summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2021-09-24 20:48:23 +0000
committertb <>2021-09-24 20:48:23 +0000
commit70b29545784d47b4f06739ce4e82f9b75b921bd5 (patch)
tree80d358fa8e862d46f42c50c2186358c4e2f0fad4
parentbb080a758b26689122e28d80215b720e5058a6ec (diff)
downloadopenbsd-70b29545784d47b4f06739ce4e82f9b75b921bd5.tar.gz
openbsd-70b29545784d47b4f06739ce4e82f9b75b921bd5.tar.bz2
openbsd-70b29545784d47b4f06739ce4e82f9b75b921bd5.zip
Simplify runAesCmacTest() by using EVP_DigestSign().
-rw-r--r--src/regress/lib/libcrypto/wycheproof/wycheproof.go19
1 files changed, 3 insertions, 16 deletions
diff --git a/src/regress/lib/libcrypto/wycheproof/wycheproof.go b/src/regress/lib/libcrypto/wycheproof/wycheproof.go
index 4e465a8410..9b22f1411e 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.121 2021/04/03 13:34:45 tb Exp $ */ 1/* $OpenBSD: wycheproof.go,v 1.122 2021/09/24 20:48:23 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>
@@ -39,12 +39,6 @@ package main
39#include <openssl/pem.h> 39#include <openssl/pem.h>
40#include <openssl/x509.h> 40#include <openssl/x509.h>
41#include <openssl/rsa.h> 41#include <openssl/rsa.h>
42
43int
44evpDigestSignUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt)
45{
46 return EVP_DigestSignUpdate(ctx, d, cnt);
47}
48*/ 42*/
49import "C" 43import "C"
50 44
@@ -1033,19 +1027,12 @@ func runAesCmacTest(cipher *C.EVP_CIPHER, wt *wycheproofTestAesCmac) bool {
1033 return false 1027 return false
1034 } 1028 }
1035 1029
1036 ret = C.evpDigestSignUpdate(mdctx, unsafe.Pointer(&msg[0]), C.size_t(msgLen))
1037 if ret != 1 {
1038 fmt.Printf("FAIL: Test case %d (%q) %v - EVP_DigestSignUpdate() = %d, want %v\n",
1039 wt.TCID, wt.Comment, wt.Flags, ret, wt.Result)
1040 return false
1041 }
1042
1043 var outLen C.size_t 1030 var outLen C.size_t
1044 outTag := make([]byte, 16) 1031 outTag := make([]byte, 16)
1045 1032
1046 ret = C.EVP_DigestSignFinal(mdctx, (*C.uchar)(unsafe.Pointer(&outTag[0])), &outLen) 1033 ret = C.EVP_DigestSign(mdctx, (*C.uchar)(unsafe.Pointer(&outTag[0])), &outLen, (*C.uchar)(unsafe.Pointer(&msg[0])), C.size_t(msgLen))
1047 if ret != 1 { 1034 if ret != 1 {
1048 fmt.Printf("FAIL: Test case %d (%q) %v - EVP_DigestSignFinal() = %d, want %v\n", 1035 fmt.Printf("FAIL: Test case %d (%q) %v - EVP_DigestSign() = %d, want %v\n",
1049 wt.TCID, wt.Comment, wt.Flags, ret, wt.Result) 1036 wt.TCID, wt.Comment, wt.Flags, ret, wt.Result)
1050 return false 1037 return false
1051 } 1038 }