diff options
author | tb <> | 2020-01-27 00:37:59 +0000 |
---|---|---|
committer | tb <> | 2020-01-27 00:37:59 +0000 |
commit | c2342387700c0e916db90c21bdc5c3b14838418c (patch) | |
tree | ebb5fcfebe55bf6c43d6bc34c0ec8371fc5d4727 /src | |
parent | 1ea50969cfc23d07b5348c6a9d444203a377a0a7 (diff) | |
download | openbsd-c2342387700c0e916db90c21bdc5c3b14838418c.tar.gz openbsd-c2342387700c0e916db90c21bdc5c3b14838418c.tar.bz2 openbsd-c2342387700c0e916db90c21bdc5c3b14838418c.zip |
Some of the test vectors that were added in the upstream commit
4672ff74d68766e7785c2cac4c597effccef2c5c have a zero byte prepended.
Run the secp224k1 ECDH tests and adjust this if needed.
Diffstat (limited to 'src')
-rw-r--r-- | src/regress/lib/libcrypto/wycheproof/wycheproof.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/regress/lib/libcrypto/wycheproof/wycheproof.go b/src/regress/lib/libcrypto/wycheproof/wycheproof.go index d84e683e1b..e19d4c3eda 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.115 2019/12/14 18:39:02 tb Exp $ */ | 1 | /* $OpenBSD: wycheproof.go,v 1.116 2020/01/27 00:37:59 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, 2019 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2018, 2019 Theo Buehler <tb@openbsd.org> |
@@ -1535,6 +1535,14 @@ func runECDHTest(nid int, variant testVariant, wt *wycheproofTestECDH) bool { | |||
1535 | log.Fatalf("Failed to decode shared secret: %v", err) | 1535 | log.Fatalf("Failed to decode shared secret: %v", err) |
1536 | } | 1536 | } |
1537 | 1537 | ||
1538 | // XXX The shared fields of the secp224k1 test cases have a 0 byte preprended. | ||
1539 | if len(shared) == int(secLen) + 1 && shared[0] == 0 { | ||
1540 | fmt.Printf("INFO: Test case %d (%q) %v - prepending 0 byte\n", wt.TCID, wt.Comment, wt.Flags) | ||
1541 | // shared = shared[1:]; | ||
1542 | zero := make([]byte, 1, secLen + 1) | ||
1543 | secret = append(zero, secret...) | ||
1544 | } | ||
1545 | |||
1538 | success := true | 1546 | success := true |
1539 | if !bytes.Equal(shared, secret) { | 1547 | if !bytes.Equal(shared, secret) { |
1540 | fmt.Printf("FAIL: Test case %d (%q) %v - expected and computed shared secret do not match, want %v\n", | 1548 | fmt.Printf("FAIL: Test case %d (%q) %v - expected and computed shared secret do not match, want %v\n", |
@@ -1548,12 +1556,6 @@ func runECDHTest(nid int, variant testVariant, wt *wycheproofTestECDH) bool { | |||
1548 | } | 1556 | } |
1549 | 1557 | ||
1550 | func runECDHTestGroup(algorithm string, variant testVariant, wtg *wycheproofTestGroupECDH) bool { | 1558 | func runECDHTestGroup(algorithm string, variant testVariant, wtg *wycheproofTestGroupECDH) bool { |
1551 | // XXX | ||
1552 | if wtg.Curve == "secp224k1" { | ||
1553 | fmt.Printf("INFO: skipping %v test group %v with curve %v and %v encoding...\n", algorithm, wtg.Type, wtg.Curve, wtg.Encoding) | ||
1554 | return true | ||
1555 | } | ||
1556 | |||
1557 | fmt.Printf("Running %v test group %v with curve %v and %v encoding...\n", | 1559 | fmt.Printf("Running %v test group %v with curve %v and %v encoding...\n", |
1558 | algorithm, wtg.Type, wtg.Curve, wtg.Encoding) | 1560 | algorithm, wtg.Type, wtg.Curve, wtg.Encoding) |
1559 | 1561 | ||