diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/regress/lib/libcrypto/wycheproof/wycheproof.go | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/regress/lib/libcrypto/wycheproof/wycheproof.go b/src/regress/lib/libcrypto/wycheproof/wycheproof.go index ddb6e57098..ac7d3e964b 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.41 2018/09/02 17:12:01 tb Exp $ */ | 1 | /* $OpenBSD: wycheproof.go,v 1.42 2018/09/02 17:24:02 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> |
@@ -1134,20 +1134,8 @@ func runECDHTest(nid int, doECpoint bool, wt *wycheproofTestECDH) bool { | |||
1134 | return false | 1134 | return false |
1135 | } | 1135 | } |
1136 | 1136 | ||
1137 | pubGroup := C.EC_KEY_get0_group(pubKey) | ||
1138 | privGroup := C.EC_KEY_get0_group(privKey) | 1137 | privGroup := C.EC_KEY_get0_group(privKey) |
1139 | 1138 | ||
1140 | ret = C.EC_GROUP_cmp(pubGroup, privGroup, nil) | ||
1141 | if ret != 0 { | ||
1142 | fmt.Printf("INFO: Test case %d (%q) - EC_GROUP_cmp() = %d, want %v\n", wt.TCID, wt.Comment, ret, wt.Result) | ||
1143 | } | ||
1144 | |||
1145 | pubPoint := C.EC_KEY_get0_public_key(pubKey) | ||
1146 | ret = C.EC_POINT_is_on_curve(privGroup, pubPoint, nil) | ||
1147 | if ret != 1 { | ||
1148 | fmt.Printf("INFO: Test case %d (%q) - EC_POINT_is_on_curve failed: got %d want %v\n", wt.TCID, wt.Comment, ret, wt.Result) | ||
1149 | } | ||
1150 | |||
1151 | secLen := (C.EC_GROUP_get_degree(privGroup) + 7) / 8 | 1139 | secLen := (C.EC_GROUP_get_degree(privGroup) + 7) / 8 |
1152 | 1140 | ||
1153 | secret := make([]byte, secLen) | 1141 | secret := make([]byte, secLen) |
@@ -1155,6 +1143,8 @@ func runECDHTest(nid int, doECpoint bool, wt *wycheproofTestECDH) bool { | |||
1155 | secret = append(secret, 0) | 1143 | secret = append(secret, 0) |
1156 | } | 1144 | } |
1157 | 1145 | ||
1146 | pubPoint := C.EC_KEY_get0_public_key(pubKey) | ||
1147 | |||
1158 | ret = C.ECDH_compute_key(unsafe.Pointer(&secret[0]), C.ulong(secLen), pubPoint, privKey, nil) | 1148 | ret = C.ECDH_compute_key(unsafe.Pointer(&secret[0]), C.ulong(secLen), pubPoint, privKey, nil) |
1159 | if ret != C.int(secLen) { | 1149 | if ret != C.int(secLen) { |
1160 | if wt.Result == "invalid" { | 1150 | if wt.Result == "invalid" { |