summaryrefslogtreecommitdiff
path: root/sha1.c
diff options
context:
space:
mode:
authorSam Leffler <sam@FreeBSD.org>2009-01-15 04:25:21 +0000
committerSam Leffler <sam@FreeBSD.org>2009-01-15 04:25:21 +0000
commit22188e6ab4f02f981de3b9f228a40b1e8f98e6a1 (patch)
treee396cb7a4849178b23486ba07b66a6dfede1d1e9 /sha1.c
parent17914a6ec9e4814998abdaec5a947b6a78709a19 (diff)
Notes
Diffstat (limited to 'sha1.c')
-rw-r--r--sha1.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sha1.c b/sha1.c
index 194db1601d1e6..e53c8452ddd8b 100644
--- a/sha1.c
+++ b/sha1.c
@@ -265,6 +265,10 @@ int tls_prf(const u8 *secret, size_t secret_len, const char *label,
L_S1 = L_S2 = (secret_len + 1) / 2;
S1 = secret;
S2 = secret + L_S1;
+ if (secret_len & 1) {
+ /* The last byte of S1 will be shared with S2 */
+ S2--;
+ }
hmac_md5_vector(S1, L_S1, 2, &MD5_addr[1], &MD5_len[1], A_MD5);
hmac_sha1_vector(S2, L_S2, 2, &SHA1_addr[1], &SHA1_len[1], A_SHA1);