summaryrefslogtreecommitdiff
path: root/regress/lib/libcrypto/wycheproof
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2018-10-18 21:34:07 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2018-10-18 21:34:07 +0000
commitcc7b29b227737693584762ed833011dc465a3236 (patch)
tree26a7abd04a68dd2c7cef2a6869f2f28e0d6052dc /regress/lib/libcrypto/wycheproof
parentf2dea48228d27cc557b4684ff126a70cc2e070a1 (diff)
simplify BN_bin2bn() calls; no need to pre-declare the variable.
Diffstat (limited to 'regress/lib/libcrypto/wycheproof')
-rw-r--r--regress/lib/libcrypto/wycheproof/wycheproof.go17
1 files changed, 6 insertions, 11 deletions
diff --git a/regress/lib/libcrypto/wycheproof/wycheproof.go b/regress/lib/libcrypto/wycheproof/wycheproof.go
index a4360d2904d..318abf98061 100644
--- a/regress/lib/libcrypto/wycheproof/wycheproof.go
+++ b/regress/lib/libcrypto/wycheproof/wycheproof.go
@@ -1,4 +1,4 @@
-/* $OpenBSD: wycheproof.go,v 1.82 2018/10/18 21:30:05 tb Exp $ */
+/* $OpenBSD: wycheproof.go,v 1.83 2018/10/18 21:34:06 tb Exp $ */
/*
* Copyright (c) 2018 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
@@ -1362,12 +1362,11 @@ func runECDHWebCryptoTest(nid int, wt *wycheproofTestECDHWebCrypto) bool {
}
defer C.EC_KEY_free(privKey)
- var bnD *C.BIGNUM
d, err := base64.RawURLEncoding.DecodeString(wt.Private.D)
if err != nil {
log.Fatalf("Failed to base64 decode d: %v", err)
}
- bnD = C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&d[0])), C.int(len(d)), nil)
+ bnD := C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&d[0])), C.int(len(d)), nil)
if bnD == nil {
log.Fatal("Failed to decode D")
}
@@ -1380,23 +1379,21 @@ func runECDHWebCryptoTest(nid int, wt *wycheproofTestECDHWebCrypto) bool {
return false
}
- var bnX *C.BIGNUM
x, err := base64.RawURLEncoding.DecodeString(wt.Public.X)
if err != nil {
log.Fatalf("Failed to base64 decode x: %v", err)
}
- bnX = C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&x[0])), C.int(len(x)), nil)
+ bnX := C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&x[0])), C.int(len(x)), nil)
if bnX == nil {
log.Fatal("Failed to decode X")
}
defer C.BN_free(bnX)
- var bnY *C.BIGNUM
y, err := base64.RawURLEncoding.DecodeString(wt.Public.Y)
if err != nil {
log.Fatalf("Failed to base64 decode y: %v", err)
}
- bnY = C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&y[0])), C.int(len(y)), nil)
+ bnY := C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&y[0])), C.int(len(y)), nil)
if bnY == nil {
log.Fatal("Failed to decode Y")
}
@@ -1635,8 +1632,7 @@ func runECDSAWebCryptoTestGroup(algorithm string, wtg *wycheproofTestGroupECDSAW
if err != nil {
log.Fatalf("Failed to base64 decode X: %v", err)
}
- var bnX *C.BIGNUM
- bnX = C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&x[0])), C.int(len(x)), nil)
+ bnX := C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&x[0])), C.int(len(x)), nil)
if bnX == nil {
log.Fatal("Failed to decode X")
}
@@ -1646,8 +1642,7 @@ func runECDSAWebCryptoTestGroup(algorithm string, wtg *wycheproofTestGroupECDSAW
if err != nil {
log.Fatalf("Failed to base64 decode Y: %v", err)
}
- var bnY *C.BIGNUM
- bnY = C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&y[0])), C.int(len(y)), nil)
+ bnY := C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&y[0])), C.int(len(y)), nil)
if bnY == nil {
log.Fatal("Failed to decode Y")
}