aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/ahash.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/ahash.c')
-rw-r--r--crypto/ahash.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/crypto/ahash.c b/crypto/ahash.c
index ac0798d2824e..28a33d06c274 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -145,7 +145,6 @@ int crypto_hash_walk_first_compat(struct hash_desc *hdesc,
145static int ahash_setkey_unaligned(struct crypto_ahash *tfm, const u8 *key, 145static int ahash_setkey_unaligned(struct crypto_ahash *tfm, const u8 *key,
146 unsigned int keylen) 146 unsigned int keylen)
147{ 147{
148 struct ahash_alg *ahash = crypto_ahash_alg(tfm);
149 unsigned long alignmask = crypto_ahash_alignmask(tfm); 148 unsigned long alignmask = crypto_ahash_alignmask(tfm);
150 int ret; 149 int ret;
151 u8 *buffer, *alignbuffer; 150 u8 *buffer, *alignbuffer;
@@ -158,7 +157,7 @@ static int ahash_setkey_unaligned(struct crypto_ahash *tfm, const u8 *key,
158 157
159 alignbuffer = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1); 158 alignbuffer = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1);
160 memcpy(alignbuffer, key, keylen); 159 memcpy(alignbuffer, key, keylen);
161 ret = ahash->setkey(tfm, alignbuffer, keylen); 160 ret = tfm->setkey(tfm, alignbuffer, keylen);
162 kzfree(buffer); 161 kzfree(buffer);
163 return ret; 162 return ret;
164} 163}
@@ -166,13 +165,12 @@ static int ahash_setkey_unaligned(struct crypto_ahash *tfm, const u8 *key,
166int crypto_ahash_setkey(struct crypto_ahash *tfm, const u8 *key, 165int crypto_ahash_setkey(struct crypto_ahash *tfm, const u8 *key,
167 unsigned int keylen) 166 unsigned int keylen)
168{ 167{
169 struct ahash_alg *ahash = crypto_ahash_alg(tfm);
170 unsigned long alignmask = crypto_ahash_alignmask(tfm); 168 unsigned long alignmask = crypto_ahash_alignmask(tfm);
171 169
172 if ((unsigned long)key & alignmask) 170 if ((unsigned long)key & alignmask)
173 return ahash_setkey_unaligned(tfm, key, keylen); 171 return ahash_setkey_unaligned(tfm, key, keylen);
174 172
175 return ahash->setkey(tfm, key, keylen); 173 return tfm->setkey(tfm, key, keylen);
176} 174}
177EXPORT_SYMBOL_GPL(crypto_ahash_setkey); 175EXPORT_SYMBOL_GPL(crypto_ahash_setkey);
178 176