This repository has been archived by the owner on Jan 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 86
/
ed25519ctx_test_vectors.h
138 lines (131 loc) · 6.98 KB
/
ed25519ctx_test_vectors.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
* Copyright (C) 2021 - This file is part of libecc project
*
* Authors:
* Arnaud EBALARD <[email protected]>
* Ryad BENADJILA <[email protected]>
*
* This software is licensed under a dual BSD and GPL v2 license.
* See LICENSE file at the root folder of the project.
*/
#ifndef __ED25519CTX_TEST_VECTORS_H__
#define __ED25519CTX_TEST_VECTORS_H__
/************************************************/
static const u8 ed25519ctx_1_test_vectors_priv_key[] = {
0x03, 0x05, 0x33, 0x4e, 0x38, 0x1a, 0xf7, 0x8f, 0x14, 0x1c, 0xb6, 0x66, 0xf6, 0x19, 0x9f, 0x57, 0xbc, 0x34, 0x95, 0x33, 0x5a, 0x25, 0x6a, 0x95, 0xbd, 0x2a, 0x55, 0xbf, 0x54, 0x66, 0x63, 0xf6,
};
static const u8 ed25519ctx_1_test_vectors_message[] = {
0xf7, 0x26, 0x93, 0x6d, 0x19, 0xc8, 0x00, 0x49, 0x4e, 0x3f, 0xda, 0xff, 0x20, 0xb2, 0x76, 0xa8,
};
static const u8 ed25519ctx_1_test_vectors_expected_sig[] = {
0x55, 0xa4, 0xcc, 0x2f, 0x70, 0xa5, 0x4e, 0x04, 0x28, 0x8c, 0x5f, 0x4c, 0xd1, 0xe4, 0x5a, 0x7b, 0xb5, 0x20, 0xb3, 0x62, 0x92, 0x91, 0x18, 0x76, 0xca, 0xda, 0x73, 0x23, 0x19, 0x8d, 0xd8, 0x7a, 0x8b, 0x36, 0x95, 0x0b, 0x95, 0x13, 0x00, 0x22, 0x90, 0x7a, 0x7f, 0xb7, 0xc4, 0xe9, 0xb2, 0xd5, 0xf6, 0xcc, 0xa6, 0x85, 0xa5, 0x87, 0xb4, 0xb2, 0x1f, 0x4b, 0x88, 0x8e, 0x4e, 0x7e, 0xdb, 0x0d,
};
static const u8 ed25519ctx_1_test_vectors_adata[] = {
0x66, 0x6f, 0x6f,
};
static const ec_test_case ed25519ctx_1_test_case = {
.name = "EDDSA25519CTX-SHA512/wei25519 1",
.ec_str_p = &wei25519_str_params,
.priv_key = ed25519ctx_1_test_vectors_priv_key,
.priv_key_len = sizeof(ed25519ctx_1_test_vectors_priv_key),
.nn_random = NULL,
.hash_type = SHA512,
.msg = (const char *)ed25519ctx_1_test_vectors_message,
.msglen = sizeof(ed25519ctx_1_test_vectors_message),
.sig_type = EDDSA25519CTX,
.exp_sig = ed25519ctx_1_test_vectors_expected_sig,
.exp_siglen = sizeof(ed25519ctx_1_test_vectors_expected_sig),
.adata = ed25519ctx_1_test_vectors_adata,
.adata_len = sizeof(ed25519ctx_1_test_vectors_adata),
};
/************************************************/
static const u8 ed25519ctx_2_test_vectors_priv_key[] = {
0x03, 0x05, 0x33, 0x4e, 0x38, 0x1a, 0xf7, 0x8f, 0x14, 0x1c, 0xb6, 0x66, 0xf6, 0x19, 0x9f, 0x57, 0xbc, 0x34, 0x95, 0x33, 0x5a, 0x25, 0x6a, 0x95, 0xbd, 0x2a, 0x55, 0xbf, 0x54, 0x66, 0x63, 0xf6,
};
static const u8 ed25519ctx_2_test_vectors_message[] = {
0xf7, 0x26, 0x93, 0x6d, 0x19, 0xc8, 0x00, 0x49, 0x4e, 0x3f, 0xda, 0xff, 0x20, 0xb2, 0x76, 0xa8,
};
static const u8 ed25519ctx_2_test_vectors_expected_sig[] = {
0xfc, 0x60, 0xd5, 0x87, 0x2f, 0xc4, 0x6b, 0x3a, 0xa6, 0x9f, 0x8b, 0x5b, 0x43, 0x51, 0xd5, 0x80, 0x8f, 0x92, 0xbc, 0xc0, 0x44, 0x60, 0x6d, 0xb0, 0x97, 0xab, 0xab, 0x6d, 0xbc, 0xb1, 0xae, 0xe3, 0x21, 0x6c, 0x48, 0xe8, 0xb3, 0xb6, 0x64, 0x31, 0xb5, 0xb1, 0x86, 0xd1, 0xd2, 0x8f, 0x8e, 0xe1, 0x5a, 0x5c, 0xa2, 0xdf, 0x66, 0x68, 0x34, 0x62, 0x91, 0xc2, 0x04, 0x3d, 0x4e, 0xb3, 0xe9, 0x0d,
};
static const u8 ed25519ctx_2_test_vectors_adata[] = {
0x62, 0x61, 0x72,
};
static const ec_test_case ed25519ctx_2_test_case = {
.name = "EDDSA25519CTX-SHA512/wei25519 2",
.ec_str_p = &wei25519_str_params,
.priv_key = ed25519ctx_2_test_vectors_priv_key,
.priv_key_len = sizeof(ed25519ctx_2_test_vectors_priv_key),
.nn_random = NULL,
.hash_type = SHA512,
.msg = (const char *)ed25519ctx_2_test_vectors_message,
.msglen = sizeof(ed25519ctx_2_test_vectors_message),
.sig_type = EDDSA25519CTX,
.exp_sig = ed25519ctx_2_test_vectors_expected_sig,
.exp_siglen = sizeof(ed25519ctx_2_test_vectors_expected_sig),
.adata = ed25519ctx_2_test_vectors_adata,
.adata_len = sizeof(ed25519ctx_2_test_vectors_adata),
};
/************************************************/
static const u8 ed25519ctx_3_test_vectors_priv_key[] = {
0x03, 0x05, 0x33, 0x4e, 0x38, 0x1a, 0xf7, 0x8f, 0x14, 0x1c, 0xb6, 0x66, 0xf6, 0x19, 0x9f, 0x57, 0xbc, 0x34, 0x95, 0x33, 0x5a, 0x25, 0x6a, 0x95, 0xbd, 0x2a, 0x55, 0xbf, 0x54, 0x66, 0x63, 0xf6,
};
static const u8 ed25519ctx_3_test_vectors_message[] = {
0x50, 0x8e, 0x9e, 0x68, 0x82, 0xb9, 0x79, 0xfe, 0xa9, 0x00, 0xf6, 0x2a, 0xdc, 0xea, 0xca, 0x35,
};
static const u8 ed25519ctx_3_test_vectors_expected_sig[] = {
0x8b, 0x70, 0xc1, 0xcc, 0x83, 0x10, 0xe1, 0xde, 0x20, 0xac, 0x53, 0xce, 0x28, 0xae, 0x6e, 0x72, 0x07, 0xf3, 0x3c, 0x32, 0x95, 0xe0, 0x3b, 0xb5, 0xc0, 0x73, 0x2a, 0x1d, 0x20, 0xdc, 0x64, 0x90, 0x89, 0x22, 0xa8, 0xb0, 0x52, 0xcf, 0x99, 0xb7, 0xc4, 0xfe, 0x10, 0x7a, 0x5a, 0xbb, 0x5b, 0x2c, 0x40, 0x85, 0xae, 0x75, 0x89, 0x0d, 0x02, 0xdf, 0x26, 0x26, 0x9d, 0x89, 0x45, 0xf8, 0x4b, 0x0b,
};
static const u8 ed25519ctx_3_test_vectors_adata[] = {
0x66, 0x6f, 0x6f,
};
static const ec_test_case ed25519ctx_3_test_case = {
.name = "EDDSA25519CTX-SHA512/wei25519 3",
.ec_str_p = &wei25519_str_params,
.priv_key = ed25519ctx_3_test_vectors_priv_key,
.priv_key_len = sizeof(ed25519ctx_3_test_vectors_priv_key),
.nn_random = NULL,
.hash_type = SHA512,
.msg = (const char *)ed25519ctx_3_test_vectors_message,
.msglen = sizeof(ed25519ctx_3_test_vectors_message),
.sig_type = EDDSA25519CTX,
.exp_sig = ed25519ctx_3_test_vectors_expected_sig,
.exp_siglen = sizeof(ed25519ctx_3_test_vectors_expected_sig),
.adata = ed25519ctx_3_test_vectors_adata,
.adata_len = sizeof(ed25519ctx_3_test_vectors_adata),
};
/************************************************/
static const u8 ed25519ctx_4_test_vectors_priv_key[] = {
0xab, 0x9c, 0x28, 0x53, 0xce, 0x29, 0x7d, 0xda, 0xb8, 0x5c, 0x99, 0x3b, 0x3a, 0xe1, 0x4b, 0xca, 0xd3, 0x9b, 0x2c, 0x68, 0x2b, 0xea, 0xbc, 0x27, 0xd6, 0xd4, 0xeb, 0x20, 0x71, 0x1d, 0x65, 0x60,
};
static const u8 ed25519ctx_4_test_vectors_message[] = {
0xf7, 0x26, 0x93, 0x6d, 0x19, 0xc8, 0x00, 0x49, 0x4e, 0x3f, 0xda, 0xff, 0x20, 0xb2, 0x76, 0xa8,
};
static const u8 ed25519ctx_4_test_vectors_expected_sig[] = {
0x21, 0x65, 0x5b, 0x5f, 0x1a, 0xa9, 0x65, 0x99, 0x6b, 0x3f, 0x97, 0xb3, 0xc8, 0x49, 0xea, 0xfb, 0xa9, 0x22, 0xa0, 0xa6, 0x29, 0x92, 0xf7, 0x3b, 0x3d, 0x1b, 0x73, 0x10, 0x6a, 0x84, 0xad, 0x85, 0xe9, 0xb8, 0x6a, 0x7b, 0x60, 0x05, 0xea, 0x86, 0x83, 0x37, 0xff, 0x2d, 0x20, 0xa7, 0xf5, 0xfb, 0xd4, 0xcd, 0x10, 0xb0, 0xbe, 0x49, 0xa6, 0x8d, 0xa2, 0xb2, 0xe0, 0xdc, 0x0a, 0xd8, 0x96, 0x0f,
};
static const u8 ed25519ctx_4_test_vectors_adata[] = {
0x66, 0x6f, 0x6f,
};
static const ec_test_case ed25519ctx_4_test_case = {
.name = "EDDSA25519CTX-SHA512/wei25519 4",
.ec_str_p = &wei25519_str_params,
.priv_key = ed25519ctx_4_test_vectors_priv_key,
.priv_key_len = sizeof(ed25519ctx_4_test_vectors_priv_key),
.nn_random = NULL,
.hash_type = SHA512,
.msg = (const char *)ed25519ctx_4_test_vectors_message,
.msglen = sizeof(ed25519ctx_4_test_vectors_message),
.sig_type = EDDSA25519CTX,
.exp_sig = ed25519ctx_4_test_vectors_expected_sig,
.exp_siglen = sizeof(ed25519ctx_4_test_vectors_expected_sig),
.adata = ed25519ctx_4_test_vectors_adata,
.adata_len = sizeof(ed25519ctx_4_test_vectors_adata),
};
/************************************************/
#define EDDSA25519CTX_SHA512_WEI25519_ALL_TESTS() \
&ed25519ctx_1_test_case,\
&ed25519ctx_2_test_case,\
&ed25519ctx_3_test_case,\
&ed25519ctx_4_test_case,
#endif /* __ED25519CTX_TEST_VECTORS_H__ */