aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/xcbc.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/xcbc.c')
-rw-r--r--crypto/xcbc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/xcbc.c b/crypto/xcbc.c
index 86727403e5ab..2feb0f239c38 100644
--- a/crypto/xcbc.c
+++ b/crypto/xcbc.c
@@ -124,6 +124,11 @@ static int crypto_xcbc_digest_update2(struct hash_desc *pdesc,
124 unsigned int offset = sg[i].offset; 124 unsigned int offset = sg[i].offset;
125 unsigned int slen = sg[i].length; 125 unsigned int slen = sg[i].length;
126 126
127 if (unlikely(slen > nbytes))
128 slen = nbytes;
129
130 nbytes -= slen;
131
127 while (slen > 0) { 132 while (slen > 0) {
128 unsigned int len = min(slen, ((unsigned int)(PAGE_SIZE)) - offset); 133 unsigned int len = min(slen, ((unsigned int)(PAGE_SIZE)) - offset);
129 char *p = crypto_kmap(pg, 0) + offset; 134 char *p = crypto_kmap(pg, 0) + offset;
@@ -177,7 +182,6 @@ static int crypto_xcbc_digest_update2(struct hash_desc *pdesc,
177 offset = 0; 182 offset = 0;
178 pg++; 183 pg++;
179 } 184 }
180 nbytes-=sg[i].length;
181 i++; 185 i++;
182 } while (nbytes>0); 186 } while (nbytes>0);
183 187