diff options
author | tb <> | 2018-10-06 10:58:57 +0000 |
---|---|---|
committer | tb <> | 2018-10-06 10:58:57 +0000 |
commit | 0c606774a10ec82c8e1640fa9cb0c34ccba9f612 (patch) | |
tree | db437cc08fd150cbfc27fd1fe5a7d991d91613a3 /src | |
parent | 6e8e365c996f2ba23205d1dad7efdb9ca526ece5 (diff) | |
download | openbsd-0c606774a10ec82c8e1640fa9cb0c34ccba9f612.tar.gz openbsd-0c606774a10ec82c8e1640fa9cb0c34ccba9f612.tar.bz2 openbsd-0c606774a10ec82c8e1640fa9cb0c34ccba9f612.zip |
wrap some overlong fmt.Printfs
Diffstat (limited to 'src')
-rw-r--r-- | src/regress/lib/libcrypto/wycheproof/wycheproof.go | 159 |
1 files changed, 106 insertions, 53 deletions
diff --git a/src/regress/lib/libcrypto/wycheproof/wycheproof.go b/src/regress/lib/libcrypto/wycheproof/wycheproof.go index 6f2fc42f8e..e151b190e9 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.76 2018/10/06 10:43:47 tb Exp $ */ | 1 | /* $OpenBSD: wycheproof.go,v 1.77 2018/10/06 10:58:57 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> |
@@ -435,10 +435,12 @@ func checkAesCbcPkcs5(ctx *C.EVP_CIPHER_CTX, doEncrypt int, key []byte, keyLen i | |||
435 | ret = C.EVP_CipherUpdate(ctx, (*C.uchar)(unsafe.Pointer(&cipherOut[0])), &cipherOutLen, (*C.uchar)(unsafe.Pointer(&in[0])), C.int(inLen)) | 435 | ret = C.EVP_CipherUpdate(ctx, (*C.uchar)(unsafe.Pointer(&cipherOut[0])), &cipherOutLen, (*C.uchar)(unsafe.Pointer(&in[0])), C.int(inLen)) |
436 | if ret != 1 { | 436 | if ret != 1 { |
437 | if wt.Result == "invalid" { | 437 | if wt.Result == "invalid" { |
438 | fmt.Printf("INFO: Test case %d (%q) [%v] %v - EVP_CipherUpdate() = %d, want %v\n", wt.TCID, wt.Comment, action, wt.Flags, ret, wt.Result) | 438 | fmt.Printf("INFO: Test case %d (%q) [%v] %v - EVP_CipherUpdate() = %d, want %v\n", |
439 | wt.TCID, wt.Comment, action, wt.Flags, ret, wt.Result) | ||
439 | return true | 440 | return true |
440 | } | 441 | } |
441 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - EVP_CipherUpdate() = %d, want %v\n", wt.TCID, wt.Comment, action, wt.Flags, ret, wt.Result) | 442 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - EVP_CipherUpdate() = %d, want %v\n", |
443 | wt.TCID, wt.Comment, action, wt.Flags, ret, wt.Result) | ||
442 | return false | 444 | return false |
443 | } | 445 | } |
444 | 446 | ||
@@ -448,13 +450,15 @@ func checkAesCbcPkcs5(ctx *C.EVP_CIPHER_CTX, doEncrypt int, key []byte, keyLen i | |||
448 | if wt.Result == "invalid" { | 450 | if wt.Result == "invalid" { |
449 | return true | 451 | return true |
450 | } | 452 | } |
451 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - EVP_CipherFinal_ex() = %d, want %v\n", wt.TCID, wt.Comment, action, wt.Flags, ret, wt.Result) | 453 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - EVP_CipherFinal_ex() = %d, want %v\n", |
454 | wt.TCID, wt.Comment, action, wt.Flags, ret, wt.Result) | ||
452 | return false | 455 | return false |
453 | } | 456 | } |
454 | 457 | ||
455 | cipherOutLen += finallen | 458 | cipherOutLen += finallen |
456 | if cipherOutLen != C.int(outLen) && wt.Result != "invalid" { | 459 | if cipherOutLen != C.int(outLen) && wt.Result != "invalid" { |
457 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - open length mismatch: got %d, want %d\n", wt.TCID, wt.Comment, action, wt.Flags, cipherOutLen, outLen) | 460 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - open length mismatch: got %d, want %d\n", |
461 | wt.TCID, wt.Comment, action, wt.Flags, cipherOutLen, outLen) | ||
458 | return false | 462 | return false |
459 | } | 463 | } |
460 | 464 | ||
@@ -470,7 +474,8 @@ func checkAesCbcPkcs5(ctx *C.EVP_CIPHER_CTX, doEncrypt int, key []byte, keyLen i | |||
470 | gatherAcceptableStatistics(wt.TCID, wt.Comment, wt.Flags) | 474 | gatherAcceptableStatistics(wt.TCID, wt.Comment, wt.Flags) |
471 | } | 475 | } |
472 | } else { | 476 | } else { |
473 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - msg match: %t; want %v\n", wt.TCID, wt.Comment, action, wt.Flags, bytes.Equal(openedMsg, out), wt.Result) | 477 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - msg match: %t; want %v\n", |
478 | wt.TCID, wt.Comment, action, wt.Flags, bytes.Equal(openedMsg, out), wt.Result) | ||
474 | } | 479 | } |
475 | return success | 480 | return success |
476 | } | 481 | } |
@@ -515,7 +520,8 @@ func runAesCbcPkcs5Test(ctx *C.EVP_CIPHER_CTX, wt *wycheproofTestAesCbcPkcs5) bo | |||
515 | } | 520 | } |
516 | 521 | ||
517 | func runAesCbcPkcs5TestGroup(algorithm string, wtg *wycheproofTestGroupAesCbcPkcs5) bool { | 522 | func runAesCbcPkcs5TestGroup(algorithm string, wtg *wycheproofTestGroupAesCbcPkcs5) bool { |
518 | fmt.Printf("Running %v test group %v with IV size %d and key size %d...\n", algorithm, wtg.Type, wtg.IVSize, wtg.KeySize) | 523 | fmt.Printf("Running %v test group %v with IV size %d and key size %d...\n", |
524 | algorithm, wtg.Type, wtg.IVSize, wtg.KeySize) | ||
519 | 525 | ||
520 | var cipher *C.EVP_CIPHER | 526 | var cipher *C.EVP_CIPHER |
521 | switch wtg.KeySize { | 527 | switch wtg.KeySize { |
@@ -587,7 +593,8 @@ func checkAesAead(algorithm string, ctx *C.EVP_CIPHER_CTX, doEncrypt int, key [] | |||
587 | if wt.Comment == "Nonce is too long" || wt.Comment == "Invalid nonce size" || wt.Comment == "0 size IV is not valid" { | 593 | if wt.Comment == "Nonce is too long" || wt.Comment == "Invalid nonce size" || wt.Comment == "0 size IV is not valid" { |
588 | return true | 594 | return true |
589 | } | 595 | } |
590 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - setting IV len to %d failed. got %d, want %v\n", wt.TCID, wt.Comment, action, wt.Flags, ivLen, ret, wt.Result) | 596 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - setting IV len to %d failed. got %d, want %v\n", |
597 | wt.TCID, wt.Comment, action, wt.Flags, ivLen, ret, wt.Result) | ||
591 | return false | 598 | return false |
592 | } | 599 | } |
593 | 600 | ||
@@ -597,14 +604,16 @@ func checkAesAead(algorithm string, ctx *C.EVP_CIPHER_CTX, doEncrypt int, key [] | |||
597 | if wt.Comment == "Invalid tag size" { | 604 | if wt.Comment == "Invalid tag size" { |
598 | return true | 605 | return true |
599 | } | 606 | } |
600 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - setting tag length to %d failed. got %d, want %v\n", wt.TCID, wt.Comment, action, wt.Flags, tagLen, ret, wt.Result) | 607 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - setting tag length to %d failed. got %d, want %v\n", |
608 | wt.TCID, wt.Comment, action, wt.Flags, tagLen, ret, wt.Result) | ||
601 | return false | 609 | return false |
602 | } | 610 | } |
603 | } | 611 | } |
604 | 612 | ||
605 | ret = C.EVP_CipherInit_ex(ctx, nil, nil, (*C.uchar)(unsafe.Pointer(&key[0])), (*C.uchar)(unsafe.Pointer(&iv[0])), C.int(doEncrypt)) | 613 | ret = C.EVP_CipherInit_ex(ctx, nil, nil, (*C.uchar)(unsafe.Pointer(&key[0])), (*C.uchar)(unsafe.Pointer(&iv[0])), C.int(doEncrypt)) |
606 | if ret != 1 { | 614 | if ret != 1 { |
607 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - setting key and IV failed. got %d, want %v\n", wt.TCID, wt.Comment, action, wt.Flags, ret, wt.Result) | 615 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - setting key and IV failed. got %d, want %v\n", |
616 | wt.TCID, wt.Comment, action, wt.Flags, ret, wt.Result) | ||
608 | return false | 617 | return false |
609 | } | 618 | } |
610 | 619 | ||
@@ -612,14 +621,16 @@ func checkAesAead(algorithm string, ctx *C.EVP_CIPHER_CTX, doEncrypt int, key [] | |||
612 | if doCCM { | 621 | if doCCM { |
613 | ret = C.EVP_CipherUpdate(ctx, nil, &cipherOutLen, nil, C.int(inLen)) | 622 | ret = C.EVP_CipherUpdate(ctx, nil, &cipherOutLen, nil, C.int(inLen)) |
614 | if ret != 1 { | 623 | if ret != 1 { |
615 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - setting input length to %d failed. got %d, want %v\n", wt.TCID, wt.Comment, action, wt.Flags, inLen, ret, wt.Result) | 624 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - setting input length to %d failed. got %d, want %v\n", |
625 | wt.TCID, wt.Comment, action, wt.Flags, inLen, ret, wt.Result) | ||
616 | return false | 626 | return false |
617 | } | 627 | } |
618 | } | 628 | } |
619 | 629 | ||
620 | ret = C.EVP_CipherUpdate(ctx, nil, &cipherOutLen, (*C.uchar)(unsafe.Pointer(&aad[0])), C.int(aadLen)) | 630 | ret = C.EVP_CipherUpdate(ctx, nil, &cipherOutLen, (*C.uchar)(unsafe.Pointer(&aad[0])), C.int(aadLen)) |
621 | if ret != 1 { | 631 | if ret != 1 { |
622 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - processing AAD failed. got %d, want %v\n", wt.TCID, wt.Comment, action, wt.Flags, ret, wt.Result) | 632 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - processing AAD failed. got %d, want %v\n", |
633 | wt.TCID, wt.Comment, action, wt.Flags, ret, wt.Result) | ||
623 | return false | 634 | return false |
624 | } | 635 | } |
625 | 636 | ||
@@ -634,7 +645,8 @@ func checkAesAead(algorithm string, ctx *C.EVP_CIPHER_CTX, doEncrypt int, key [] | |||
634 | if wt.Result == "invalid" { | 645 | if wt.Result == "invalid" { |
635 | return true | 646 | return true |
636 | } | 647 | } |
637 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - EVP_CipherUpdate() = %d, want %v\n", wt.TCID, wt.Comment, action, wt.Flags, ret, wt.Result) | 648 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - EVP_CipherUpdate() = %d, want %v\n", |
649 | wt.TCID, wt.Comment, action, wt.Flags, ret, wt.Result) | ||
638 | return false | 650 | return false |
639 | } | 651 | } |
640 | 652 | ||
@@ -644,27 +656,31 @@ func checkAesAead(algorithm string, ctx *C.EVP_CIPHER_CTX, doEncrypt int, key [] | |||
644 | 656 | ||
645 | ret = C.EVP_CipherFinal_ex(ctx, (*C.uchar)(unsafe.Pointer(&dummyOut[0])), &tmpLen) | 657 | ret = C.EVP_CipherFinal_ex(ctx, (*C.uchar)(unsafe.Pointer(&dummyOut[0])), &tmpLen) |
646 | if ret != 1 { | 658 | if ret != 1 { |
647 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - EVP_CipherFinal_ex() = %d, want %v\n", wt.TCID, wt.Comment, action, wt.Flags, ret, wt.Result) | 659 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - EVP_CipherFinal_ex() = %d, want %v\n", |
660 | wt.TCID, wt.Comment, action, wt.Flags, ret, wt.Result) | ||
648 | return false | 661 | return false |
649 | } | 662 | } |
650 | cipherOutLen += tmpLen | 663 | cipherOutLen += tmpLen |
651 | } | 664 | } |
652 | 665 | ||
653 | if cipherOutLen != C.int(outLen) { | 666 | if cipherOutLen != C.int(outLen) { |
654 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - cipherOutLen %d != outLen %d. Result %v\n", wt.TCID, wt.Comment, action, wt.Flags, cipherOutLen, outLen, wt.Result) | 667 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - cipherOutLen %d != outLen %d. Result %v\n", |
668 | wt.TCID, wt.Comment, action, wt.Flags, cipherOutLen, outLen, wt.Result) | ||
655 | return false | 669 | return false |
656 | } | 670 | } |
657 | 671 | ||
658 | success := true | 672 | success := true |
659 | if !bytes.Equal(cipherOut, out) { | 673 | if !bytes.Equal(cipherOut, out) { |
660 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - expected and computed output do not match. Result: %v\n", wt.TCID, wt.Comment, action, wt.Flags, wt.Result) | 674 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - expected and computed output do not match. Result: %v\n", |
675 | wt.TCID, wt.Comment, action, wt.Flags, wt.Result) | ||
661 | success = false | 676 | success = false |
662 | } | 677 | } |
663 | if doEncrypt == 1 { | 678 | if doEncrypt == 1 { |
664 | tagOut := make([]byte, tagLen) | 679 | tagOut := make([]byte, tagLen) |
665 | ret = C.EVP_CIPHER_CTX_ctrl(ctx, ctrlGetTag, C.int(tagLen), unsafe.Pointer(&tagOut[0])) | 680 | ret = C.EVP_CIPHER_CTX_ctrl(ctx, ctrlGetTag, C.int(tagLen), unsafe.Pointer(&tagOut[0])) |
666 | if ret != 1 { | 681 | if ret != 1 { |
667 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - EVP_CIPHER_CTX_ctrl() = %d, want %v\n", wt.TCID, wt.Comment, action, wt.Flags, ret, wt.Result) | 682 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - EVP_CIPHER_CTX_ctrl() = %d, want %v\n", |
683 | wt.TCID, wt.Comment, action, wt.Flags, ret, wt.Result) | ||
668 | return false | 684 | return false |
669 | } | 685 | } |
670 | 686 | ||
@@ -675,7 +691,8 @@ func checkAesAead(algorithm string, ctx *C.EVP_CIPHER_CTX, doEncrypt int, key [] | |||
675 | // support to the length of 96 bits, to promote | 691 | // support to the length of 96 bits, to promote |
676 | // interoperability, efficiency and simplicity of design." | 692 | // interoperability, efficiency and simplicity of design." |
677 | if bytes.Equal(tagOut, tag) != (wt.Result == "valid" || wt.Result == "acceptable") { | 693 | if bytes.Equal(tagOut, tag) != (wt.Result == "valid" || wt.Result == "acceptable") { |
678 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - expected and computed tag do not match - ret: %d, Result: %v\n", wt.TCID, wt.Comment, action, wt.Flags, ret, wt.Result) | 694 | fmt.Printf("FAIL: Test case %d (%q) [%v] %v - expected and computed tag do not match - ret: %d, Result: %v\n", |
695 | wt.TCID, wt.Comment, action, wt.Flags, ret, wt.Result) | ||
679 | success = false | 696 | success = false |
680 | } | 697 | } |
681 | if acceptableAudit && bytes.Equal(tagOut, tag) && wt.Result == "acceptable" { | 698 | if acceptableAudit && bytes.Equal(tagOut, tag) && wt.Result == "acceptable" { |
@@ -761,7 +778,8 @@ func runAesAeadTest(algorithm string, ctx *C.EVP_CIPHER_CTX, aead *C.EVP_AEAD, w | |||
761 | } | 778 | } |
762 | 779 | ||
763 | func runAesAeadTestGroup(algorithm string, wtg *wycheproofTestGroupAead) bool { | 780 | func runAesAeadTestGroup(algorithm string, wtg *wycheproofTestGroupAead) bool { |
764 | fmt.Printf("Running %v test group %v with IV size %d, key size %d and tag size %d...\n", algorithm, wtg.Type, wtg.IVSize, wtg.KeySize, wtg.TagSize) | 781 | fmt.Printf("Running %v test group %v with IV size %d, key size %d and tag size %d...\n", |
782 | algorithm, wtg.Type, wtg.IVSize, wtg.KeySize, wtg.TagSize) | ||
765 | 783 | ||
766 | var cipher *C.EVP_CIPHER | 784 | var cipher *C.EVP_CIPHER |
767 | var aead *C.EVP_AEAD | 785 | var aead *C.EVP_AEAD |
@@ -849,13 +867,15 @@ func runAesCmacTest(cipher *C.EVP_CIPHER, wt *wycheproofTestAesCmac) bool { | |||
849 | 867 | ||
850 | ret := C.CMAC_Init(ctx, unsafe.Pointer(&key[0]), C.size_t(keyLen), cipher, nil) | 868 | ret := C.CMAC_Init(ctx, unsafe.Pointer(&key[0]), C.size_t(keyLen), cipher, nil) |
851 | if ret != 1 { | 869 | if ret != 1 { |
852 | fmt.Printf("FAIL: Test case %d (%q) %v - CMAC_Init() = %d, want %v\n", wt.TCID, wt.Comment, wt.Flags, ret, wt.Result) | 870 | fmt.Printf("FAIL: Test case %d (%q) %v - CMAC_Init() = %d, want %v\n", |
871 | wt.TCID, wt.Comment, wt.Flags, ret, wt.Result) | ||
853 | return false | 872 | return false |
854 | } | 873 | } |
855 | 874 | ||
856 | ret = C.CMAC_Update(ctx, unsafe.Pointer(&msg[0]), C.size_t(msgLen)) | 875 | ret = C.CMAC_Update(ctx, unsafe.Pointer(&msg[0]), C.size_t(msgLen)) |
857 | if ret != 1 { | 876 | if ret != 1 { |
858 | fmt.Printf("FAIL: Test case %d (%q) %v - CMAC_Update() = %d, want %v\n", wt.TCID, wt.Comment, wt.Flags, ret, wt.Result) | 877 | fmt.Printf("FAIL: Test case %d (%q) %v - CMAC_Update() = %d, want %v\n", |
878 | wt.TCID, wt.Comment, wt.Flags, ret, wt.Result) | ||
859 | return false | 879 | return false |
860 | } | 880 | } |
861 | 881 | ||
@@ -864,7 +884,8 @@ func runAesCmacTest(cipher *C.EVP_CIPHER, wt *wycheproofTestAesCmac) bool { | |||
864 | 884 | ||
865 | ret = C.CMAC_Final(ctx, (*C.uchar)(unsafe.Pointer(&outTag[0])), &outLen) | 885 | ret = C.CMAC_Final(ctx, (*C.uchar)(unsafe.Pointer(&outTag[0])), &outLen) |
866 | if ret != 1 { | 886 | if ret != 1 { |
867 | fmt.Printf("FAIL: Test case %d (%q) %v - CMAC_Final() = %d, want %v\n", wt.TCID, wt.Comment, wt.Flags, ret, wt.Result) | 887 | fmt.Printf("FAIL: Test case %d (%q) %v - CMAC_Final() = %d, want %v\n", |
888 | wt.TCID, wt.Comment, wt.Flags, ret, wt.Result) | ||
868 | return false | 889 | return false |
869 | } | 890 | } |
870 | 891 | ||
@@ -872,14 +893,16 @@ func runAesCmacTest(cipher *C.EVP_CIPHER, wt *wycheproofTestAesCmac) bool { | |||
872 | 893 | ||
873 | success := true | 894 | success := true |
874 | if bytes.Equal(tag, outTag) != (wt.Result == "valid") { | 895 | if bytes.Equal(tag, outTag) != (wt.Result == "valid") { |
875 | fmt.Printf("FAIL: Test case %d (%q) %v - want %v\n", wt.TCID, wt.Comment, wt.Flags, wt.Result) | 896 | fmt.Printf("FAIL: Test case %d (%q) %v - want %v\n", |
897 | wt.TCID, wt.Comment, wt.Flags, wt.Result) | ||
876 | success = false | 898 | success = false |
877 | } | 899 | } |
878 | return success | 900 | return success |
879 | } | 901 | } |
880 | 902 | ||
881 | func runAesCmacTestGroup(algorithm string, wtg *wycheproofTestGroupAesCmac) bool { | 903 | func runAesCmacTestGroup(algorithm string, wtg *wycheproofTestGroupAesCmac) bool { |
882 | fmt.Printf("Running %v test group %v with key size %d and tag size %d...\n", algorithm, wtg.Type, wtg.KeySize, wtg.TagSize) | 904 | fmt.Printf("Running %v test group %v with key size %d and tag size %d...\n", |
905 | algorithm, wtg.Type, wtg.KeySize, wtg.TagSize) | ||
883 | var cipher *C.EVP_CIPHER | 906 | var cipher *C.EVP_CIPHER |
884 | 907 | ||
885 | switch wtg.KeySize { | 908 | switch wtg.KeySize { |
@@ -916,12 +939,14 @@ func checkAeadOpen(ctx *C.EVP_AEAD_CTX, iv []byte, ivLen int, aad []byte, aadLen | |||
916 | if wt.Result == "invalid" { | 939 | if wt.Result == "invalid" { |
917 | return true | 940 | return true |
918 | } | 941 | } |
919 | fmt.Printf("FAIL: Test case %d (%q) %v - EVP_AEAD_CTX_open() = %d, want %v\n", wt.TCID, wt.Comment, wt.Flags, int(openRet), wt.Result) | 942 | fmt.Printf("FAIL: Test case %d (%q) %v - EVP_AEAD_CTX_open() = %d, want %v\n", |
943 | wt.TCID, wt.Comment, wt.Flags, int(openRet), wt.Result) | ||
920 | return false | 944 | return false |
921 | } | 945 | } |
922 | 946 | ||
923 | if openedMsgLen != C.size_t(msgLen) { | 947 | if openedMsgLen != C.size_t(msgLen) { |
924 | fmt.Printf("FAIL: Test case %d (%q) %v - open length mismatch: got %d, want %d\n", wt.TCID, wt.Comment, wt.Flags, openedMsgLen, msgLen) | 948 | fmt.Printf("FAIL: Test case %d (%q) %v - open length mismatch: got %d, want %d\n", |
949 | wt.TCID, wt.Comment, wt.Flags, openedMsgLen, msgLen) | ||
925 | return false | 950 | return false |
926 | } | 951 | } |
927 | 952 | ||
@@ -937,7 +962,8 @@ func checkAeadOpen(ctx *C.EVP_AEAD_CTX, iv []byte, ivLen int, aad []byte, aadLen | |||
937 | } | 962 | } |
938 | success = true | 963 | success = true |
939 | } else { | 964 | } else { |
940 | fmt.Printf("FAIL: Test case %d (%q) %v - msg match: %t; want %v\n", wt.TCID, wt.Comment, wt.Flags, bytes.Equal(openedMsg, msg), wt.Result) | 965 | fmt.Printf("FAIL: Test case %d (%q) %v - msg match: %t; want %v\n", |
966 | wt.TCID, wt.Comment, wt.Flags, bytes.Equal(openedMsg, msg), wt.Result) | ||
941 | } | 967 | } |
942 | return success | 968 | return success |
943 | } | 969 | } |
@@ -951,12 +977,14 @@ func checkAeadSeal(ctx *C.EVP_AEAD_CTX, iv []byte, ivLen int, aad []byte, aadLen | |||
951 | sealRet := C.EVP_AEAD_CTX_seal(ctx, (*C.uint8_t)(unsafe.Pointer(&sealed[0])), (*C.size_t)(unsafe.Pointer(&sealedLen)), C.size_t(maxOutLen), (*C.uint8_t)(unsafe.Pointer(&iv[0])), C.size_t(ivLen), (*C.uint8_t)(unsafe.Pointer(&msg[0])), C.size_t(msgLen), (*C.uint8_t)(unsafe.Pointer(&aad[0])), C.size_t(aadLen)) | 977 | sealRet := C.EVP_AEAD_CTX_seal(ctx, (*C.uint8_t)(unsafe.Pointer(&sealed[0])), (*C.size_t)(unsafe.Pointer(&sealedLen)), C.size_t(maxOutLen), (*C.uint8_t)(unsafe.Pointer(&iv[0])), C.size_t(ivLen), (*C.uint8_t)(unsafe.Pointer(&msg[0])), C.size_t(msgLen), (*C.uint8_t)(unsafe.Pointer(&aad[0])), C.size_t(aadLen)) |
952 | 978 | ||
953 | if sealRet != 1 { | 979 | if sealRet != 1 { |
954 | fmt.Printf("FAIL: Test case %d (%q) %v - EVP_AEAD_CTX_seal() = %d, want %v\n", wt.TCID, wt.Comment, wt.Flags, int(sealRet), wt.Result) | 980 | fmt.Printf("FAIL: Test case %d (%q) %v - EVP_AEAD_CTX_seal() = %d, want %v\n", |
981 | wt.TCID, wt.Comment, wt.Flags, int(sealRet), wt.Result) | ||
955 | return false | 982 | return false |
956 | } | 983 | } |
957 | 984 | ||
958 | if sealedLen != C.size_t(maxOutLen) { | 985 | if sealedLen != C.size_t(maxOutLen) { |
959 | fmt.Printf("FAIL: Test case %d (%q) %v - seal length mismatch: got %d, want %d\n", wt.TCID, wt.Comment, wt.Flags, sealedLen, maxOutLen) | 986 | fmt.Printf("FAIL: Test case %d (%q) %v - seal length mismatch: got %d, want %d\n", |
987 | wt.TCID, wt.Comment, wt.Flags, sealedLen, maxOutLen) | ||
960 | return false | 988 | return false |
961 | } | 989 | } |
962 | 990 | ||
@@ -970,7 +998,9 @@ func checkAeadSeal(ctx *C.EVP_AEAD_CTX, iv []byte, ivLen int, aad []byte, aadLen | |||
970 | } | 998 | } |
971 | success = true | 999 | success = true |
972 | } else { | 1000 | } else { |
973 | fmt.Printf("FAIL: Test case %d (%q) %v - EVP_AEAD_CTX_seal() = %d, ct match: %t, tag match: %t; want %v\n", wt.TCID, wt.Comment, wt.Flags, int(sealRet), bytes.Equal(sealedCt, ct), bytes.Equal(sealedTag, tag), wt.Result) | 1001 | fmt.Printf("FAIL: Test case %d (%q) %v - EVP_AEAD_CTX_seal() = %d, ct match: %t, tag match: %t; want %v\n", |
1002 | wt.TCID, wt.Comment, wt.Flags, int(sealRet), | ||
1003 | bytes.Equal(sealedCt, ct), bytes.Equal(sealedTag, tag), wt.Result) | ||
974 | } | 1004 | } |
975 | return success | 1005 | return success |
976 | } | 1006 | } |
@@ -1033,7 +1063,8 @@ func runChaCha20Poly1305TestGroup(algorithm string, wtg *wycheproofTestGroupAead | |||
1033 | return true | 1063 | return true |
1034 | } | 1064 | } |
1035 | 1065 | ||
1036 | fmt.Printf("Running %v test group %v with IV size %d, key size %d, tag size %d...\n", algorithm, wtg.Type, wtg.IVSize, wtg.KeySize, wtg.TagSize) | 1066 | fmt.Printf("Running %v test group %v with IV size %d, key size %d, tag size %d...\n", |
1067 | algorithm, wtg.Type, wtg.IVSize, wtg.KeySize, wtg.TagSize) | ||
1037 | 1068 | ||
1038 | success := true | 1069 | success := true |
1039 | for _, wt := range wtg.Tests { | 1070 | for _, wt := range wtg.Tests { |
@@ -1072,14 +1103,16 @@ func runDSATest(dsa *C.DSA, h hash.Hash, wt *wycheproofTestDSA) bool { | |||
1072 | 1103 | ||
1073 | success := true | 1104 | success := true |
1074 | if (ret == 1) != (wt.Result == "valid") { | 1105 | if (ret == 1) != (wt.Result == "valid") { |
1075 | fmt.Printf("FAIL: Test case %d (%q) %v - DSA_verify() = %d, want %v\n", wt.TCID, wt.Comment, wt.Flags, ret, wt.Result) | 1106 | fmt.Printf("FAIL: Test case %d (%q) %v - DSA_verify() = %d, want %v\n", |
1107 | wt.TCID, wt.Comment, wt.Flags, ret, wt.Result) | ||
1076 | success = false | 1108 | success = false |
1077 | } | 1109 | } |
1078 | return success | 1110 | return success |
1079 | } | 1111 | } |
1080 | 1112 | ||
1081 | func runDSATestGroup(algorithm string, wtg *wycheproofTestGroupDSA) bool { | 1113 | func runDSATestGroup(algorithm string, wtg *wycheproofTestGroupDSA) bool { |
1082 | fmt.Printf("Running %v test group %v, key size %d and %v...\n", algorithm, wtg.Type, wtg.Key.KeySize, wtg.SHA) | 1114 | fmt.Printf("Running %v test group %v, key size %d and %v...\n", |
1115 | algorithm, wtg.Type, wtg.Key.KeySize, wtg.SHA) | ||
1083 | 1116 | ||
1084 | dsa := C.DSA_new() | 1117 | dsa := C.DSA_new() |
1085 | if dsa == nil { | 1118 | if dsa == nil { |
@@ -1195,7 +1228,8 @@ func runECDHTest(nid int, doECpoint bool, wt *wycheproofTestECDH) bool { | |||
1195 | 1228 | ||
1196 | ret := C.EC_KEY_set_private_key(privKey, bnPriv) | 1229 | ret := C.EC_KEY_set_private_key(privKey, bnPriv) |
1197 | if ret != 1 { | 1230 | if ret != 1 { |
1198 | fmt.Printf("FAIL: Test case %d (%q) %v - EC_KEY_set_private_key() = %d, want %v\n", wt.TCID, wt.Comment, wt.Flags, ret, wt.Result) | 1231 | fmt.Printf("FAIL: Test case %d (%q) %v - EC_KEY_set_private_key() = %d, want %v\n", |
1232 | wt.TCID, wt.Comment, wt.Flags, ret, wt.Result) | ||
1199 | return false | 1233 | return false |
1200 | } | 1234 | } |
1201 | 1235 | ||
@@ -1233,7 +1267,8 @@ func runECDHTest(nid int, doECpoint bool, wt *wycheproofTestECDH) bool { | |||
1233 | if wt.Result == "invalid" || wt.Result == "acceptable" { | 1267 | if wt.Result == "invalid" || wt.Result == "acceptable" { |
1234 | return true | 1268 | return true |
1235 | } | 1269 | } |
1236 | fmt.Printf("FAIL: Test case %d (%q) %v - ASN decoding failed: want %v\n", wt.TCID, wt.Comment, wt.Flags, wt.Result) | 1270 | fmt.Printf("FAIL: Test case %d (%q) %v - ASN decoding failed: want %v\n", |
1271 | wt.TCID, wt.Comment, wt.Flags, wt.Result) | ||
1237 | return false | 1272 | return false |
1238 | } | 1273 | } |
1239 | 1274 | ||
@@ -1253,7 +1288,8 @@ func runECDHTest(nid int, doECpoint bool, wt *wycheproofTestECDH) bool { | |||
1253 | if wt.Result == "invalid" { | 1288 | if wt.Result == "invalid" { |
1254 | return true | 1289 | return true |
1255 | } | 1290 | } |
1256 | fmt.Printf("FAIL: Test case %d (%q) %v - ECDH_compute_key() = %d, want %d, result: %v\n", wt.TCID, wt.Comment, wt.Flags, ret, int(secLen), wt.Result) | 1291 | fmt.Printf("FAIL: Test case %d (%q) %v - ECDH_compute_key() = %d, want %d, result: %v\n", |
1292 | wt.TCID, wt.Comment, wt.Flags, ret, int(secLen), wt.Result) | ||
1257 | return false | 1293 | return false |
1258 | } | 1294 | } |
1259 | 1295 | ||
@@ -1264,7 +1300,8 @@ func runECDHTest(nid int, doECpoint bool, wt *wycheproofTestECDH) bool { | |||
1264 | 1300 | ||
1265 | success := true | 1301 | success := true |
1266 | if !bytes.Equal(shared, secret) { | 1302 | if !bytes.Equal(shared, secret) { |
1267 | fmt.Printf("FAIL: Test case %d (%q) %v - expected and computed shared secret do not match, want %v\n", wt.TCID, wt.Comment, wt.Flags, wt.Result) | 1303 | fmt.Printf("FAIL: Test case %d (%q) %v - expected and computed shared secret do not match, want %v\n", |
1304 | wt.TCID, wt.Comment, wt.Flags, wt.Result) | ||
1268 | success = false | 1305 | success = false |
1269 | } | 1306 | } |
1270 | if acceptableAudit && success && wt.Result == "acceptable" { | 1307 | if acceptableAudit && success && wt.Result == "acceptable" { |
@@ -1279,7 +1316,8 @@ func runECDHTestGroup(algorithm string, wtg *wycheproofTestGroupECDH) bool { | |||
1279 | doECpoint = true | 1316 | doECpoint = true |
1280 | } | 1317 | } |
1281 | 1318 | ||
1282 | fmt.Printf("Running %v test group %v with curve %v and %v encoding...\n", algorithm, wtg.Type, wtg.Curve, wtg.Encoding) | 1319 | fmt.Printf("Running %v test group %v with curve %v and %v encoding...\n", |
1320 | algorithm, wtg.Type, wtg.Curve, wtg.Encoding) | ||
1283 | 1321 | ||
1284 | nid, err := nidFromString(wtg.Curve) | 1322 | nid, err := nidFromString(wtg.Curve) |
1285 | if err != nil { | 1323 | if err != nil { |
@@ -1315,7 +1353,8 @@ func runECDHWebCryptoTest(nid int, wt *wycheproofTestECDHWebCrypto) bool { | |||
1315 | 1353 | ||
1316 | ret := C.EC_KEY_set_private_key(privKey, bnD) | 1354 | ret := C.EC_KEY_set_private_key(privKey, bnD) |
1317 | if ret != 1 { | 1355 | if ret != 1 { |
1318 | fmt.Printf("FAIL: Test case %d (%q) %v - EC_KEY_set_private_key() = %d, want %v\n", wt.TCID, wt.Comment, wt.Flags, ret, wt.Result) | 1356 | fmt.Printf("FAIL: Test case %d (%q) %v - EC_KEY_set_private_key() = %d, want %v\n", |
1357 | wt.TCID, wt.Comment, wt.Flags, ret, wt.Result) | ||
1319 | return false | 1358 | return false |
1320 | } | 1359 | } |
1321 | 1360 | ||
@@ -1352,7 +1391,8 @@ func runECDHWebCryptoTest(nid int, wt *wycheproofTestECDHWebCrypto) bool { | |||
1352 | if wt.Result == "invalid" { | 1391 | if wt.Result == "invalid" { |
1353 | return true | 1392 | return true |
1354 | } | 1393 | } |
1355 | fmt.Printf("FAIL: Test case %d (%q) %v - EC_KEY_set_public_key_affine_coordinates() = %d, want %v\n", wt.TCID, wt.Comment, wt.Flags, ret, wt.Result) | 1394 | fmt.Printf("FAIL: Test case %d (%q) %v - EC_KEY_set_public_key_affine_coordinates() = %d, want %v\n", |
1395 | wt.TCID, wt.Comment, wt.Flags, ret, wt.Result) | ||
1356 | return false | 1396 | return false |
1357 | } | 1397 | } |
1358 | pubPoint := C.EC_KEY_get0_public_key(pubKey) | 1398 | pubPoint := C.EC_KEY_get0_public_key(pubKey) |
@@ -1371,7 +1411,8 @@ func runECDHWebCryptoTest(nid int, wt *wycheproofTestECDHWebCrypto) bool { | |||
1371 | if wt.Result == "invalid" { | 1411 | if wt.Result == "invalid" { |
1372 | return true | 1412 | return true |
1373 | } | 1413 | } |
1374 | fmt.Printf("FAIL: Test case %d (%q) %v - ECDH_compute_key() = %d, want %d, result: %v\n", wt.TCID, wt.Comment, wt.Flags, ret, int(secLen), wt.Result) | 1414 | fmt.Printf("FAIL: Test case %d (%q) %v - ECDH_compute_key() = %d, want %d, result: %v\n", |
1415 | wt.TCID, wt.Comment, wt.Flags, ret, int(secLen), wt.Result) | ||
1375 | return false | 1416 | return false |
1376 | } | 1417 | } |
1377 | 1418 | ||
@@ -1382,7 +1423,8 @@ func runECDHWebCryptoTest(nid int, wt *wycheproofTestECDHWebCrypto) bool { | |||
1382 | 1423 | ||
1383 | success := true | 1424 | success := true |
1384 | if !bytes.Equal(shared, secret) { | 1425 | if !bytes.Equal(shared, secret) { |
1385 | fmt.Printf("FAIL: Test case %d (%q) %v - expected and computed shared secret do not match, want %v\n", wt.TCID, wt.Comment, wt.Flags, wt.Result) | 1426 | fmt.Printf("FAIL: Test case %d (%q) %v - expected and computed shared secret do not match, want %v\n", |
1427 | wt.TCID, wt.Comment, wt.Flags, wt.Result) | ||
1386 | success = false | 1428 | success = false |
1387 | } | 1429 | } |
1388 | if acceptableAudit && success && wt.Result == "acceptable" { | 1430 | if acceptableAudit && success && wt.Result == "acceptable" { |
@@ -1392,7 +1434,8 @@ func runECDHWebCryptoTest(nid int, wt *wycheproofTestECDHWebCrypto) bool { | |||
1392 | } | 1434 | } |
1393 | 1435 | ||
1394 | func runECDHWebCryptoTestGroup(algorithm string, wtg *wycheproofTestGroupECDHWebCrypto) bool { | 1436 | func runECDHWebCryptoTestGroup(algorithm string, wtg *wycheproofTestGroupECDHWebCrypto) bool { |
1395 | fmt.Printf("Running %v test group %v with curve %v and %v encoding...\n", algorithm, wtg.Type, wtg.Curve, wtg.Encoding) | 1437 | fmt.Printf("Running %v test group %v with curve %v and %v encoding...\n", |
1438 | algorithm, wtg.Type, wtg.Curve, wtg.Encoding) | ||
1396 | 1439 | ||
1397 | nid, err := nidFromString(wtg.Curve) | 1440 | nid, err := nidFromString(wtg.Curve) |
1398 | if err != nil { | 1441 | if err != nil { |
@@ -1451,7 +1494,8 @@ func runECDSATest(ecKey *C.EC_KEY, nid int, h hash.Hash, webcrypto bool, wt *wyc | |||
1451 | // XXX audit acceptable cases... | 1494 | // XXX audit acceptable cases... |
1452 | success := true | 1495 | success := true |
1453 | if (ret == 1) != (wt.Result == "valid") && wt.Result != "acceptable" { | 1496 | if (ret == 1) != (wt.Result == "valid") && wt.Result != "acceptable" { |
1454 | fmt.Printf("FAIL: Test case %d (%q) %v - ECDSA_verify() = %d, want %v\n", wt.TCID, wt.Comment, wt.Flags, int(ret), wt.Result) | 1497 | fmt.Printf("FAIL: Test case %d (%q) %v - ECDSA_verify() = %d, want %v\n", |
1498 | wt.TCID, wt.Comment, wt.Flags, int(ret), wt.Result) | ||
1455 | success = false | 1499 | success = false |
1456 | } | 1500 | } |
1457 | if acceptableAudit && ret == 1 && wt.Result == "acceptable" { | 1501 | if acceptableAudit && ret == 1 && wt.Result == "acceptable" { |
@@ -1461,7 +1505,8 @@ func runECDSATest(ecKey *C.EC_KEY, nid int, h hash.Hash, webcrypto bool, wt *wyc | |||
1461 | } | 1505 | } |
1462 | 1506 | ||
1463 | func runECDSATestGroup(algorithm string, wtg *wycheproofTestGroupECDSA) bool { | 1507 | func runECDSATestGroup(algorithm string, wtg *wycheproofTestGroupECDSA) bool { |
1464 | fmt.Printf("Running %v test group %v with curve %v, key size %d and %v...\n", algorithm, wtg.Type, wtg.Key.Curve, wtg.Key.KeySize, wtg.SHA) | 1508 | fmt.Printf("Running %v test group %v with curve %v, key size %d and %v...\n", |
1509 | algorithm, wtg.Type, wtg.Key.Curve, wtg.Key.KeySize, wtg.SHA) | ||
1465 | 1510 | ||
1466 | nid, err := nidFromString(wtg.Key.Curve) | 1511 | nid, err := nidFromString(wtg.Key.Curve) |
1467 | if err != nil { | 1512 | if err != nil { |
@@ -1551,7 +1596,8 @@ func encodeECDSAWebCryptoSig(wtSig string) (*C.uchar, C.int) { | |||
1551 | } | 1596 | } |
1552 | 1597 | ||
1553 | func runECDSAWebCryptoTestGroup(algorithm string, wtg *wycheproofTestGroupECDSAWebCrypto) bool { | 1598 | func runECDSAWebCryptoTestGroup(algorithm string, wtg *wycheproofTestGroupECDSAWebCrypto) bool { |
1554 | fmt.Printf("Running %v test group %v with curve %v, key size %d and %v...\n", algorithm, wtg.Type, wtg.Key.Curve, wtg.Key.KeySize, wtg.SHA) | 1599 | fmt.Printf("Running %v test group %v with curve %v, key size %d and %v...\n", |
1600 | algorithm, wtg.Type, wtg.Key.Curve, wtg.Key.KeySize, wtg.SHA) | ||
1555 | 1601 | ||
1556 | nid, err := nidFromString(wtg.JWK.Crv) | 1602 | nid, err := nidFromString(wtg.JWK.Crv) |
1557 | if err != nil { | 1603 | if err != nil { |
@@ -1640,7 +1686,8 @@ func runRSASSATest(rsa *C.RSA, h hash.Hash, sha *C.EVP_MD, mgfSha *C.EVP_MD, sLe | |||
1640 | if wt.Result == "invalid" { | 1686 | if wt.Result == "invalid" { |
1641 | return true | 1687 | return true |
1642 | } | 1688 | } |
1643 | fmt.Printf("FAIL: Test case %d (%q) %v - RSA_public_decrypt() = %d, want %v\n", wt.TCID, wt.Comment, wt.Flags, int(ret), wt.Result) | 1689 | fmt.Printf("FAIL: Test case %d (%q) %v - RSA_public_decrypt() = %d, want %v\n", |
1690 | wt.TCID, wt.Comment, wt.Flags, int(ret), wt.Result) | ||
1644 | return false | 1691 | return false |
1645 | } | 1692 | } |
1646 | 1693 | ||
@@ -1657,13 +1704,15 @@ func runRSASSATest(rsa *C.RSA, h hash.Hash, sha *C.EVP_MD, mgfSha *C.EVP_MD, sLe | |||
1657 | } else if ret == 0 && (wt.Result == "invalid" || wt.Result == "acceptable") { | 1704 | } else if ret == 0 && (wt.Result == "invalid" || wt.Result == "acceptable") { |
1658 | success = true | 1705 | success = true |
1659 | } else { | 1706 | } else { |
1660 | fmt.Printf("FAIL: Test case %d (%q) %v - RSA_verify_PKCS1_PSS_mgf1() = %d, want %v\n", wt.TCID, wt.Comment, wt.Flags, int(ret), wt.Result) | 1707 | fmt.Printf("FAIL: Test case %d (%q) %v - RSA_verify_PKCS1_PSS_mgf1() = %d, want %v\n", |
1708 | wt.TCID, wt.Comment, wt.Flags, int(ret), wt.Result) | ||
1661 | } | 1709 | } |
1662 | return success | 1710 | return success |
1663 | } | 1711 | } |
1664 | 1712 | ||
1665 | func runRSASSATestGroup(algorithm string, wtg *wycheproofTestGroupRSASSA) bool { | 1713 | func runRSASSATestGroup(algorithm string, wtg *wycheproofTestGroupRSASSA) bool { |
1666 | fmt.Printf("Running %v test group %v with key size %d and %v...\n", algorithm, wtg.Type, wtg.KeySize, wtg.SHA) | 1714 | fmt.Printf("Running %v test group %v with key size %d and %v...\n", |
1715 | algorithm, wtg.Type, wtg.KeySize, wtg.SHA) | ||
1667 | rsa := C.RSA_new() | 1716 | rsa := C.RSA_new() |
1668 | if rsa == nil { | 1717 | if rsa == nil { |
1669 | log.Fatal("RSA_new failed") | 1718 | log.Fatal("RSA_new failed") |
@@ -1735,7 +1784,8 @@ func runRSATest(rsa *C.RSA, nid int, h hash.Hash, wt *wycheproofTestRSA) bool { | |||
1735 | // XXX audit acceptable cases... | 1784 | // XXX audit acceptable cases... |
1736 | success := true | 1785 | success := true |
1737 | if (ret == 1) != (wt.Result == "valid") && wt.Result != "acceptable" { | 1786 | if (ret == 1) != (wt.Result == "valid") && wt.Result != "acceptable" { |
1738 | fmt.Printf("FAIL: Test case %d (%q) %v - RSA_verify() = %d, want %v\n", wt.TCID, wt.Comment, wt.Flags, int(ret), wt.Result) | 1787 | fmt.Printf("FAIL: Test case %d (%q) %v - RSA_verify() = %d, want %v\n", |
1788 | wt.TCID, wt.Comment, wt.Flags, int(ret), wt.Result) | ||
1739 | success = false | 1789 | success = false |
1740 | } | 1790 | } |
1741 | if acceptableAudit && ret == 1 && wt.Result == "acceptable" { | 1791 | if acceptableAudit && ret == 1 && wt.Result == "acceptable" { |
@@ -1745,7 +1795,8 @@ func runRSATest(rsa *C.RSA, nid int, h hash.Hash, wt *wycheproofTestRSA) bool { | |||
1745 | } | 1795 | } |
1746 | 1796 | ||
1747 | func runRSATestGroup(algorithm string, wtg *wycheproofTestGroupRSA) bool { | 1797 | func runRSATestGroup(algorithm string, wtg *wycheproofTestGroupRSA) bool { |
1748 | fmt.Printf("Running %v test group %v with key size %d and %v...\n", algorithm, wtg.Type, wtg.KeySize, wtg.SHA) | 1798 | fmt.Printf("Running %v test group %v with key size %d and %v...\n", |
1799 | algorithm, wtg.Type, wtg.KeySize, wtg.SHA) | ||
1749 | 1800 | ||
1750 | rsa := C.RSA_new() | 1801 | rsa := C.RSA_new() |
1751 | if rsa == nil { | 1802 | if rsa == nil { |
@@ -1809,7 +1860,8 @@ func runX25519Test(wt *wycheproofTestX25519) bool { | |||
1809 | // XXX audit acceptable cases... | 1860 | // XXX audit acceptable cases... |
1810 | success := true | 1861 | success := true |
1811 | if result != (wt.Result == "valid") && wt.Result != "acceptable" { | 1862 | if result != (wt.Result == "valid") && wt.Result != "acceptable" { |
1812 | fmt.Printf("FAIL: Test case %d (%q) %v - X25519(), want %v\n", wt.TCID, wt.Comment, wt.Flags, wt.Result) | 1863 | fmt.Printf("FAIL: Test case %d (%q) %v - X25519(), want %v\n", |
1864 | wt.TCID, wt.Comment, wt.Flags, wt.Result) | ||
1813 | success = false | 1865 | success = false |
1814 | } | 1866 | } |
1815 | if acceptableAudit && result && wt.Result == "acceptable" { | 1867 | if acceptableAudit && result && wt.Result == "acceptable" { |
@@ -1839,7 +1891,8 @@ func runTestVectors(path string, webcrypto bool) bool { | |||
1839 | if err := json.Unmarshal(b, wtv); err != nil { | 1891 | if err := json.Unmarshal(b, wtv); err != nil { |
1840 | log.Fatalf("Failed to unmarshal JSON: %v", err) | 1892 | log.Fatalf("Failed to unmarshal JSON: %v", err) |
1841 | } | 1893 | } |
1842 | fmt.Printf("Loaded Wycheproof test vectors for %v with %d tests from %q\n", wtv.Algorithm, wtv.NumberOfTests, filepath.Base(path)) | 1894 | fmt.Printf("Loaded Wycheproof test vectors for %v with %d tests from %q\n", |
1895 | wtv.Algorithm, wtv.NumberOfTests, filepath.Base(path)) | ||
1843 | 1896 | ||
1844 | var wtg interface{} | 1897 | var wtg interface{} |
1845 | switch wtv.Algorithm { | 1898 | switch wtv.Algorithm { |