summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2022-11-17 21:19:44 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2022-11-17 21:19:44 +0000
commit3469c7da29e7cb4a77a559993edc23412473559a (patch)
tree790171dda2cb251e9c47dc2342a6749acfd8663d /regress
parent5fd16ebf12a49a2db9ee78b42610c7ef46486194 (diff)
Use a fixed-size array for the message and simplify a few other curly
things.
Diffstat (limited to 'regress')
-rw-r--r--regress/lib/libcrypto/curve25519/ed25519test.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/regress/lib/libcrypto/curve25519/ed25519test.c b/regress/lib/libcrypto/curve25519/ed25519test.c
index 9053ef0a831..42399978373 100644
--- a/regress/lib/libcrypto/curve25519/ed25519test.c
+++ b/regress/lib/libcrypto/curve25519/ed25519test.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ed25519test.c,v 1.4 2022/11/17 19:06:35 tb Exp $ */
+/* $OpenBSD: ed25519test.c,v 1.5 2022/11/17 21:19:43 tb Exp $ */
/*
* Copyright (c) 2019, 2022 Theo Buehler <tb@openbsd.org>
*
@@ -26,8 +26,8 @@ struct testvector {
const uint8_t sec_key[ED25519_PRIVATE_KEY_LENGTH];
const uint8_t pub_key[ED25519_PUBLIC_KEY_LENGTH];
const uint8_t signature[ED25519_SIGNATURE_LENGTH];
+ const uint8_t message[1024];
size_t message_len;
- const uint8_t *message;
};
/*
@@ -48,8 +48,9 @@ struct testvector testvectors[] = {
0x0e, 0xe1, 0x72, 0xf3, 0xda, 0xa6, 0x23, 0x25,
0xaf, 0x02, 0x1a, 0x68, 0xf7, 0x07, 0x51, 0x1a,
},
+ .message = {
+ },
.message_len = 0,
- .message = (uint8_t []){ },
.signature = {
0xe5, 0x56, 0x43, 0x00, 0xc3, 0x60, 0xac, 0x72,
0x90, 0x86, 0xe2, 0xcc, 0x80, 0x6e, 0x82, 0x8a,
@@ -74,8 +75,10 @@ struct testvector testvectors[] = {
0x9c, 0x98, 0x2c, 0xcf, 0x2e, 0xc4, 0x96, 0x8c,
0xc0, 0xcd, 0x55, 0xf1, 0x2a, 0xf4, 0x66, 0x0c,
},
+ .message = {
+ 0x72,
+ },
.message_len = 1,
- .message = (uint8_t []){ 0x72 },
.signature = {
0x92, 0xa0, 0x09, 0xa9, 0xf0, 0xd4, 0xca, 0xb8,
0x72, 0x0e, 0x82, 0x0b, 0x5f, 0x64, 0x25, 0x40,
@@ -100,8 +103,10 @@ struct testvector testvectors[] = {
0x08, 0x16, 0xed, 0x13, 0xba, 0x33, 0x03, 0xac,
0x5d, 0xeb, 0x91, 0x15, 0x48, 0x90, 0x80, 0x25,
},
+ .message = {
+ 0xaf, 0x82,
+ },
.message_len = 2,
- .message = (uint8_t []){ 0xaf, 0x82, },
.signature = {
0x62, 0x91, 0xd6, 0x57, 0xde, 0xec, 0x24, 0x02,
0x48, 0x27, 0xe6, 0x9c, 0x3a, 0xbe, 0x01, 0xa3,
@@ -126,8 +131,7 @@ struct testvector testvectors[] = {
0xce, 0xff, 0xbf, 0x2b, 0x24, 0x28, 0xc9, 0xc5,
0x1f, 0xef, 0x7c, 0x59, 0x7f, 0x1d, 0x42, 0x6e,
},
- .message_len = 1023,
- .message = (uint8_t []){
+ .message = {
0x08, 0xb8, 0xb2, 0xb7, 0x33, 0x42, 0x42, 0x43,
0x76, 0x0f, 0xe4, 0x26, 0xa4, 0xb5, 0x49, 0x08,
0x63, 0x21, 0x10, 0xa6, 0x6c, 0x2f, 0x65, 0x91,
@@ -257,6 +261,7 @@ struct testvector testvectors[] = {
0xc6, 0x0c, 0x90, 0x5c, 0x15, 0xfc, 0x91, 0x08,
0x40, 0xb9, 0x4c, 0x00, 0xa0, 0xb9, 0xd0,
},
+ .message_len = 1023,
.signature = {
0x0a, 0xab, 0x4c, 0x90, 0x05, 0x01, 0xb3, 0xe2,
0x4d, 0x7c, 0xdf, 0x46, 0x63, 0x32, 0x6a, 0x3a,
@@ -281,8 +286,7 @@ struct testvector testvectors[] = {
0xc3, 0x54, 0x67, 0xef, 0x2e, 0xfd, 0x4d, 0x64,
0xeb, 0xf8, 0x19, 0x68, 0x34, 0x67, 0xe2, 0xbf,
},
- .message_len = 64,
- .message = (uint8_t []){
+ .message = {
0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba,
0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2,
@@ -292,6 +296,7 @@ struct testvector testvectors[] = {
0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e,
0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f,
},
+ .message_len = 64,
.signature = {
0xdc, 0x2a, 0x44, 0x59, 0xe7, 0x36, 0x96, 0x33,
0xa5, 0x2b, 0x1b, 0xf2, 0x77, 0x83, 0x9a, 0x00,
@@ -307,10 +312,7 @@ struct testvector testvectors[] = {
const size_t num_testvectors = sizeof(testvectors) / sizeof(testvectors[0]);
-int test_ED25519_verify(void);
-int test_ED25519_sign(void);
-
-int
+static int
test_ED25519_verify(void)
{
size_t i;
@@ -329,7 +331,7 @@ test_ED25519_verify(void)
return failed;
}
-int
+static int
test_ED25519_sign(void)
{
size_t i;