summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtchang%redhat.com <devnull@localhost>2005-11-05 01:00:14 +0000
committerwtchang%redhat.com <devnull@localhost>2005-11-05 01:00:14 +0000
commit3e15ee268b1d9fdc1f9da10acad5b1aabd38c7ac (patch)
tree1124b072773743eddb39bdc3cd1c6a6bb63e87a1
parent0984f37d7e1e3ddbda95c0ee78de66eed6f54752 (diff)
downloadnss-hg-3e15ee268b1d9fdc1f9da10acad5b1aabd38c7ac.tar.gz
Replaced the magic constant 20 by SHA1_LENGTH. Use sizeof(buffer) to
be more robust. r=nelsonb
-rw-r--r--security/nss/lib/freebl/tlsprfalg.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/security/nss/lib/freebl/tlsprfalg.c b/security/nss/lib/freebl/tlsprfalg.c
index eb6741e8f..05f3f0d76 100644
--- a/security/nss/lib/freebl/tlsprfalg.c
+++ b/security/nss/lib/freebl/tlsprfalg.c
@@ -41,7 +41,7 @@
#include "alghmac.h"
#include "blapi.h"
-#define PHASH_STATE_MAX_LEN 20
+#define PHASH_STATE_MAX_LEN SHA1_LENGTH
/* TLS P_hash function */
static SECStatus
@@ -76,7 +76,7 @@ sftk_P_hash(HASH_HashType hashType, const SECItem *secret, const char *label,
HMAC_Begin(cx);
HMAC_Update(cx, (unsigned char *)label, label_len);
HMAC_Update(cx, seed->data, seed->len);
- status = HMAC_Finish(cx, state, &state_len, PHASH_STATE_MAX_LEN);
+ status = HMAC_Finish(cx, state, &state_len, sizeof(state));
if (status != SECSuccess)
goto loser;
@@ -88,14 +88,14 @@ sftk_P_hash(HASH_HashType hashType, const SECItem *secret, const char *label,
if (label_len)
HMAC_Update(cx, (unsigned char *)label, label_len);
HMAC_Update(cx, seed->data, seed->len);
- status = HMAC_Finish(cx, outbuf, &outbuf_len, PHASH_STATE_MAX_LEN);
+ status = HMAC_Finish(cx, outbuf, &outbuf_len, sizeof(outbuf));
if (status != SECSuccess)
goto loser;
/* Update the state = A(i) = HMAC_hash(secret, A(i-1)) */
HMAC_Begin(cx);
HMAC_Update(cx, state, state_len);
- status = HMAC_Finish(cx, state, &state_len, PHASH_STATE_MAX_LEN);
+ status = HMAC_Finish(cx, state, &state_len, sizeof(state));
if (status != SECSuccess)
goto loser;