-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_crypto_common.h
More file actions
178 lines (148 loc) · 5.79 KB
/
Copy pathtest_crypto_common.h
File metadata and controls
178 lines (148 loc) · 5.79 KB
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/** @file
* Copyright (c) 2020-2024, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
#ifndef _TEST_CRYPTO_COMMON_H_
#define _TEST_CRYPTO_COMMON_H_
#include "val_crypto.h"
#define INPUT_BYTES_DATA_LEN 16
#define ECDH_SECP_256_R1_PRV_KEY_LEN 32
#define ECDH_SECP_256_R1_PUB_KEY_LEN 65
#define ECDH_SECP_384_R1_PRV_KEY_LEN 48
#define ECDH_SECP_384_R1_PUB_KEY_LEN 97
#define FFDH2048_PRV_KEY_LEN 256
#define FFDH2048_PUB_KEY_LEN 256
#define FFDH3072_PRV_KEY_LEN 384
#define FFDH3072_PUB_KEY_LEN 384
#define FFDH4096_PRV_KEY_LEN 512
#define FFDH4096_PUB_KEY_LEN 512
#define AEAD_CIPHERTEXT_LEN_1 39
#define AEAD_CIPHERTEXT_LEN_2 40
#define AEAD_CIPHERTEXT_LEN_3 28
#define AEAD_CIPHERTEXT_LEN_4 40
#define AEAD_CIPHERTEXT_LEN_5 16
#define AEAD_CIPHERTEXT_LEN_6 40
#define INPUT_SALT_LEN 4
#define INPUT_INFO_LEN 4
#define INPUT_SEED_LEN 4
#define INPUT_LABEL_LEN 5
#define INPUT_PASSWORD_LEN 8
/* min and max finding macro */
#ifndef MIN
#define MIN(a, b) (((a) < (b))?(a):(b))
#endif
#ifndef MAX
#define MAX(a, b) (((a) > (b))?(a):(b))
#endif
extern const uint8_t key_data[];
extern const uint8_t rsa_128_key_pair[];
extern const uint8_t rsa_key_pair_public_key[];
extern const uint8_t rsa_128_key_data[];
extern const uint8_t rsa_256_key_pair[];
extern const uint8_t rsa_256_key_data[];
extern const uint8_t ec_key_data[];
extern const uint8_t ec_key_pair[];
extern const uint8_t ec_keypair_deterministic[];
extern const uint8_t md2_hash[];
extern const uint8_t md4_hash[];
extern const uint8_t md5_hash[];
extern const uint8_t ripemd_160_hash[];
extern const uint8_t sha_1_hash[];
extern const uint8_t sha_224_hash[];
extern const uint8_t sha_256_hash[];
extern const uint8_t sha_256_incorrect_hash[];
extern const uint8_t sha_384_hash[];
extern const uint8_t sha_512_hash[];
extern const uint8_t ecdh_secp_256_r1_prv_key[];
extern const uint8_t ecdh_secp_256_r1_pub_key[];
extern const uint8_t ecdh_secp_384_r1_prv_key[];
extern const uint8_t ecdh_secp_384_r1_pub_key[];
extern const uint8_t nonce[];
extern const uint8_t additional_data[];
extern const uint8_t plaintext[];
extern const uint8_t aead_ciphertext_1[AEAD_CIPHERTEXT_LEN_1];
extern const uint8_t aead_ciphertext_2[AEAD_CIPHERTEXT_LEN_2];
extern const uint8_t aead_invalid_ciphertext_2[AEAD_CIPHERTEXT_LEN_2];
extern const uint8_t aead_ciphertext_3[AEAD_CIPHERTEXT_LEN_3];
extern const uint8_t aead_ciphertext_4[AEAD_CIPHERTEXT_LEN_4];
extern const uint8_t aead_ciphertext_5[AEAD_CIPHERTEXT_LEN_5];
extern const uint8_t aead_ciphertext_6[AEAD_CIPHERTEXT_LEN_6];
extern const uint8_t hash_input;
extern const uint8_t input_bytes_data[INPUT_BYTES_DATA_LEN];
extern const uint8_t input_salt[INPUT_SALT_LEN];
extern const uint8_t input_info[INPUT_INFO_LEN];
extern const uint8_t input_seed[INPUT_SEED_LEN];
extern const uint8_t input_label[INPUT_LABEL_LEN];
extern const uint8_t input_password[INPUT_PASSWORD_LEN];
extern uint64_t input_rounds;
extern const unsigned char iv[];
extern const unsigned char ciphertext_1[];
extern const unsigned char ciphertext_2[];
extern const unsigned char ciphertext_3[];
extern const unsigned char ciphertext_4[];
extern const unsigned char ciphertext_5[];
extern const unsigned char ciphertext_6[];
extern const uint8_t salt[];
extern const unsigned char ciphertext_7[];
extern const unsigned char ciphertext_8[];
extern const unsigned char ciphertext_9[];
extern const uint8_t signature_1[];
extern const uint8_t signature_2[];
extern const uint8_t signature_2_invalid[];
extern const uint8_t signature_3[];
extern const uint8_t signature_4[];
extern const uint8_t signature_4_invalid[];
extern const uint8_t signature_5[];
extern const uint8_t signature_6[];
extern const uint8_t hmac_sha224[];
extern const uint8_t hmac_sha224_invalid[];
extern const uint8_t hmac_sha256[];
extern const uint8_t hmac_sha512[];
extern const uint8_t cmac_aes_128[];
extern uint8_t expected_output[BUFFER_SIZE];
extern void crypto_common_exit_action(void);
extern const uint8_t ccm_star_no_tag_iv[];
extern const uint8_t ccm_star_no_tag_plaintext[];
extern const uint8_t ccm_star_no_tag_ciphertext[];
extern const uint8_t ccm_star_no_tag_key_data[];
#ifdef ARCH_TEST_FFDHE2048
extern const uint8_t ffdh_key_data_2048[];
extern const uint8_t ffdh_peer_key_data_2048[];
#endif
#ifdef ARCH_TEST_FFDHE3072
extern const uint8_t ffdh_key_data_3072[];
extern const uint8_t ffdh_peer_key_data_3072[];
#endif
#ifdef ARCH_TEST_FFDHE4096
extern const uint8_t ffdh_key_data_4096[];
extern const uint8_t ffdh_peer_key_data_4096[];
#endif
#ifdef ARCH_TEST_ARIA
extern const uint8_t aria_128_key_data[];
extern const uint8_t aria_128_plain_text[];
extern const uint8_t aria_128_cipher_text[];
extern const uint8_t aead_aria_cipher_test[];
#endif
#ifdef ARCH_TEST_TWISTED_EDWARDS
extern const uint8_t eddsa_25519ph_keypair[];
extern const uint8_t eddsa_25519ph_pubkey[];
extern const uint8_t eddsa_25519ph_message[];
extern const uint8_t eddsa_25519ph_signature[];
extern const uint8_t eddsa_448_keypair[];
extern const uint8_t eddsa_448_pubkey[];
extern const uint8_t eddsa_448_message[];
extern const uint8_t eddsa_448_signature[];
#endif
#endif /* _TEST_CRYPTO_COMMON_H_ */