diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/regress/lib/libcrypto/wycheproof/wycheproof.go | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/regress/lib/libcrypto/wycheproof/wycheproof.go b/src/regress/lib/libcrypto/wycheproof/wycheproof.go index a4360d2904..318abf9806 100644 --- a/src/regress/lib/libcrypto/wycheproof/wycheproof.go +++ b/src/regress/lib/libcrypto/wycheproof/wycheproof.go | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: wycheproof.go,v 1.82 2018/10/18 21:30:05 tb Exp $ */ | 1 | /* $OpenBSD: wycheproof.go,v 1.83 2018/10/18 21:34:06 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018 Joel Sing <jsing@openbsd.org> |
| 4 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> |
| @@ -1362,12 +1362,11 @@ func runECDHWebCryptoTest(nid int, wt *wycheproofTestECDHWebCrypto) bool { | |||
| 1362 | } | 1362 | } |
| 1363 | defer C.EC_KEY_free(privKey) | 1363 | defer C.EC_KEY_free(privKey) |
| 1364 | 1364 | ||
| 1365 | var bnD *C.BIGNUM | ||
| 1366 | d, err := base64.RawURLEncoding.DecodeString(wt.Private.D) | 1365 | d, err := base64.RawURLEncoding.DecodeString(wt.Private.D) |
| 1367 | if err != nil { | 1366 | if err != nil { |
| 1368 | log.Fatalf("Failed to base64 decode d: %v", err) | 1367 | log.Fatalf("Failed to base64 decode d: %v", err) |
| 1369 | } | 1368 | } |
| 1370 | bnD = C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&d[0])), C.int(len(d)), nil) | 1369 | bnD := C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&d[0])), C.int(len(d)), nil) |
| 1371 | if bnD == nil { | 1370 | if bnD == nil { |
| 1372 | log.Fatal("Failed to decode D") | 1371 | log.Fatal("Failed to decode D") |
| 1373 | } | 1372 | } |
| @@ -1380,23 +1379,21 @@ func runECDHWebCryptoTest(nid int, wt *wycheproofTestECDHWebCrypto) bool { | |||
| 1380 | return false | 1379 | return false |
| 1381 | } | 1380 | } |
| 1382 | 1381 | ||
| 1383 | var bnX *C.BIGNUM | ||
| 1384 | x, err := base64.RawURLEncoding.DecodeString(wt.Public.X) | 1382 | x, err := base64.RawURLEncoding.DecodeString(wt.Public.X) |
| 1385 | if err != nil { | 1383 | if err != nil { |
| 1386 | log.Fatalf("Failed to base64 decode x: %v", err) | 1384 | log.Fatalf("Failed to base64 decode x: %v", err) |
| 1387 | } | 1385 | } |
| 1388 | bnX = C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&x[0])), C.int(len(x)), nil) | 1386 | bnX := C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&x[0])), C.int(len(x)), nil) |
| 1389 | if bnX == nil { | 1387 | if bnX == nil { |
| 1390 | log.Fatal("Failed to decode X") | 1388 | log.Fatal("Failed to decode X") |
| 1391 | } | 1389 | } |
| 1392 | defer C.BN_free(bnX) | 1390 | defer C.BN_free(bnX) |
| 1393 | 1391 | ||
| 1394 | var bnY *C.BIGNUM | ||
| 1395 | y, err := base64.RawURLEncoding.DecodeString(wt.Public.Y) | 1392 | y, err := base64.RawURLEncoding.DecodeString(wt.Public.Y) |
| 1396 | if err != nil { | 1393 | if err != nil { |
| 1397 | log.Fatalf("Failed to base64 decode y: %v", err) | 1394 | log.Fatalf("Failed to base64 decode y: %v", err) |
| 1398 | } | 1395 | } |
| 1399 | bnY = C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&y[0])), C.int(len(y)), nil) | 1396 | bnY := C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&y[0])), C.int(len(y)), nil) |
| 1400 | if bnY == nil { | 1397 | if bnY == nil { |
| 1401 | log.Fatal("Failed to decode Y") | 1398 | log.Fatal("Failed to decode Y") |
| 1402 | } | 1399 | } |
| @@ -1635,8 +1632,7 @@ func runECDSAWebCryptoTestGroup(algorithm string, wtg *wycheproofTestGroupECDSAW | |||
| 1635 | if err != nil { | 1632 | if err != nil { |
| 1636 | log.Fatalf("Failed to base64 decode X: %v", err) | 1633 | log.Fatalf("Failed to base64 decode X: %v", err) |
| 1637 | } | 1634 | } |
| 1638 | var bnX *C.BIGNUM | 1635 | bnX := C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&x[0])), C.int(len(x)), nil) |
| 1639 | bnX = C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&x[0])), C.int(len(x)), nil) | ||
| 1640 | if bnX == nil { | 1636 | if bnX == nil { |
| 1641 | log.Fatal("Failed to decode X") | 1637 | log.Fatal("Failed to decode X") |
| 1642 | } | 1638 | } |
| @@ -1646,8 +1642,7 @@ func runECDSAWebCryptoTestGroup(algorithm string, wtg *wycheproofTestGroupECDSAW | |||
| 1646 | if err != nil { | 1642 | if err != nil { |
| 1647 | log.Fatalf("Failed to base64 decode Y: %v", err) | 1643 | log.Fatalf("Failed to base64 decode Y: %v", err) |
| 1648 | } | 1644 | } |
| 1649 | var bnY *C.BIGNUM | 1645 | bnY := C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&y[0])), C.int(len(y)), nil) |
| 1650 | bnY = C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&y[0])), C.int(len(y)), nil) | ||
| 1651 | if bnY == nil { | 1646 | if bnY == nil { |
| 1652 | log.Fatal("Failed to decode Y") | 1647 | log.Fatal("Failed to decode Y") |
| 1653 | } | 1648 | } |
