summaryrefslogtreecommitdiffstats
path: root/crypto/hmac.c
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe.montjoie@gmail.com>2017-05-19 08:53:23 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2017-05-23 12:52:05 +0800
commit03d7db5654aefb78bf2ded62e2187833fda2a6cc (patch)
tree56ad7f884c9471940518e5e69bf92c2ae316397e /crypto/hmac.c
parent9417cd1c517a89ccfb5cc3d3f2a0e50fc64f3445 (diff)
downloadlinux-stable-03d7db5654aefb78bf2ded62e2187833fda2a6cc.tar.gz
linux-stable-03d7db5654aefb78bf2ded62e2187833fda2a6cc.tar.bz2
linux-stable-03d7db5654aefb78bf2ded62e2187833fda2a6cc.zip
crypto: hmac - add hmac IPAD/OPAD constant
Many HMAC users directly use directly 0x36/0x5c values. It's better with crypto to use a name instead of directly some crypto constant. This patch simply add HMAC_IPAD_VALUE/HMAC_OPAD_VALUE defines in a new include file "crypto/hmac.h" and use them in crypto/hmac.c Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/hmac.c')
-rw-r--r--crypto/hmac.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/hmac.c b/crypto/hmac.c
index 72e38c098bb3..92871dc2a63e 100644
--- a/crypto/hmac.c
+++ b/crypto/hmac.c
@@ -16,6 +16,7 @@
*
*/
+#include <crypto/hmac.h>
#include <crypto/internal/hash.h>
#include <crypto/scatterwalk.h>
#include <linux/err.h>
@@ -74,8 +75,8 @@ static int hmac_setkey(struct crypto_shash *parent,
memcpy(opad, ipad, bs);
for (i = 0; i < bs; i++) {
- ipad[i] ^= 0x36;
- opad[i] ^= 0x5c;
+ ipad[i] ^= HMAC_IPAD_VALUE;
+ opad[i] ^= HMAC_OPAD_VALUE;
}
return crypto_shash_init(shash) ?: