diff options
-rw-r--r-- | src/util/crypto/nss/nss_hmac_sha1.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/util/crypto/nss/nss_hmac_sha1.c b/src/util/crypto/nss/nss_hmac_sha1.c index 6faa09aee..7074fe766 100644 --- a/src/util/crypto/nss/nss_hmac_sha1.c +++ b/src/util/crypto/nss/nss_hmac_sha1.c @@ -63,7 +63,9 @@ int sss_hmac_sha1(const unsigned char *key, } else { /* keys shorter than blocksize are zero-padded */ memcpy(ikey, key, key_len); - memset(ikey + key_len, 0, HMAC_SHA1_BLOCKSIZE - key_len); + if (key_len != HMAC_SHA1_BLOCKSIZE) { + memset(ikey + key_len, 0, HMAC_SHA1_BLOCKSIZE - key_len); + } } /* HMAC(key, msg) = HASH(key XOR opad, HASH(key XOR ipad, msg)) */ |