diff options
author | Russ Cox <rsc@golang.org> | 2017-08-28 14:26:31 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2017-09-22 20:07:55 +0000 |
commit | 20cf4713643e1bb4a56cc018ad946cc8cc586bdb (patch) | |
tree | 4ce5315d4101d804ee88d1f8fcc6636e059cea49 | |
parent | f2ab41b02d4aa71fe472c56b21f7004071bd42ab (diff) | |
download | go-20cf4713643e1bb4a56cc018ad946cc8cc586bdb.tar.gz go-20cf4713643e1bb4a56cc018ad946cc8cc586bdb.zip |
[dev.boringcrypto.go1.8] crypto/internal/boring: fix NewHMAC with empty key
Test is in a separate CL for easier cherry-picking to master branch.
Change-Id: Ia4a9032892d2896332010fe18a3216f8c4a58d1c
Reviewed-on: https://go-review.googlesource.com/59770
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-on: https://go-review.googlesource.com/65477
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
-rw-r--r-- | src/crypto/internal/boring/hmac.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/crypto/internal/boring/hmac.go b/src/crypto/internal/boring/hmac.go index a547438222..3757da6805 100644 --- a/src/crypto/internal/boring/hmac.go +++ b/src/crypto/internal/boring/hmac.go @@ -100,7 +100,7 @@ func (h *boringHMAC) Reset() { } C._goboringcrypto_HMAC_CTX_init(&h.ctx) - if C._goboringcrypto_HMAC_Init(&h.ctx, unsafe.Pointer(&h.key[0]), C.int(len(h.key)), h.md) == 0 { + if C._goboringcrypto_HMAC_Init(&h.ctx, unsafe.Pointer(base(h.key)), C.int(len(h.key)), h.md) == 0 { panic("boringcrypto: HMAC_Init failed") } if int(C._goboringcrypto_HMAC_size(&h.ctx)) != h.size { |