aboutsummaryrefslogtreecommitdiffstats
diff options
authorDavid Howells <dhowells@redhat.com>2025-04-28 09:30:45 +0100
committerDavid Howells <dhowells@redhat.com>2025-04-28 12:59:16 +0100
commit0990eec4b2c645be4641b153b5b48a0d01be4756 (patch)
tree88788de922334a3613ac8d8fb21b1eb29548e5e4
parent51eddbf70d74edd61f3f034506e314f0aeb98c80 (diff)
downloadlinux-fs-netfs-fixes.tar.gz
crypto/krb5, rxrpc: Fix change to use SG miter to use offsetnetfs-fixes
The recent patch to make the rfc3961 simplified code use sg_miter rather than manually walking the scatterlist to hash the contents of a buffer described by that scatterlist failed to take the starting offset into account. This is indicated by the selftests reporting: krb5: Running aes128-cts-hmac-sha256-128 mic krb5: !!! TESTFAIL crypto/krb5/selftest.c:446 krb5: MIC mismatch Fix this by calling sg_miter_skip() before doing the loop. This doesn't affect anything in linus/master, but does affect AF_RXRPC's RxGK implementation in net-next - and only if doing packet signing rather than full encryption. Fixes: da6f9bf40ac2 ("crypto: krb5 - Use SG miter instead of doing it by hand") Reported-by: Marc Dionne <marc.dionne@auristor.com> Signed-off-by: David Howells <dhowells@redhat.com> cc: Herbert Xu <herbert@gondor.apana.org.au> cc: "David S. Miller" <davem@davemloft.net> cc: Chuck Lever <chuck.lever@oracle.com> cc: Marc Dionne <marc.dionne@auristor.com> cc: Eric Dumazet <edumazet@google.com> cc: Jakub Kicinski <kuba@kernel.org> cc: Paolo Abeni <pabeni@redhat.com> cc: Simon Horman <horms@kernel.org> cc: linux-afs@lists.infradead.org cc: linux-nfs@vger.kernel.org cc: linux-crypto@vger.kernel.org cc: netdev@vger.kernel.org
-rw-r--r--crypto/krb5/rfc3961_simplified.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/crypto/krb5/rfc3961_simplified.c b/crypto/krb5/rfc3961_simplified.c
index 79180d28baa9fb..e49cbdec7c404d 100644
--- a/crypto/krb5/rfc3961_simplified.c
+++ b/crypto/krb5/rfc3961_simplified.c
@@ -89,6 +89,7 @@ int crypto_shash_update_sg(struct shash_desc *desc, struct scatterlist *sg,
sg_miter_start(&miter, sg, sg_nents(sg),
SG_MITER_FROM_SG | SG_MITER_LOCAL);
+ sg_miter_skip(&miter, offset);
for (i = 0; i < len; i += n) {
sg_miter_next(&miter);
n = min(miter.length, len - i);