diff options
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/krb5/rfc3961_simplified.c | 1 | ||||
-rw-r--r-- | crypto/shash.c | 9 |
2 files changed, 6 insertions, 4 deletions
diff --git a/crypto/krb5/rfc3961_simplified.c b/crypto/krb5/rfc3961_simplified.c index 79180d28baa9..e49cbdec7c40 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); diff --git a/crypto/shash.c b/crypto/shash.c index 37537d7995c7..4721f5f134f4 100644 --- a/crypto/shash.c +++ b/crypto/shash.c @@ -257,12 +257,13 @@ static int __crypto_shash_import(struct shash_desc *desc, const void *in, if (crypto_shash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) return -ENOKEY; - plen = crypto_shash_blocksize(tfm) + 1; - descsize = crypto_shash_descsize(tfm); ss = crypto_shash_statesize(tfm); - buf[descsize - 1] = 0; - if (crypto_shash_block_only(tfm)) + if (crypto_shash_block_only(tfm)) { + plen = crypto_shash_blocksize(tfm) + 1; ss -= plen; + descsize = crypto_shash_descsize(tfm); + buf[descsize - 1] = 0; + } if (!import) { memcpy(buf, in, ss); return 0; |