summaryrefslogtreecommitdiff
path: root/src/regress/lib/libcrypto/aead
diff options
context:
space:
mode:
authorjsing <>2014-05-15 14:14:56 +0000
committerjsing <>2014-05-15 14:14:56 +0000
commitb115738274236129c97a787d577da5cbff4c828e (patch)
treed1545fae6b44d7a9d7d6aa80a89b700911a313f3 /src/regress/lib/libcrypto/aead
parent331e9a2412038c63b968d43c57141df1425f9d43 (diff)
downloadopenbsd-b115738274236129c97a787d577da5cbff4c828e.tar.gz
openbsd-b115738274236129c97a787d577da5cbff4c828e.tar.bz2
openbsd-b115738274236129c97a787d577da5cbff4c828e.zip
KNF.
Diffstat (limited to 'src/regress/lib/libcrypto/aead')
-rw-r--r--src/regress/lib/libcrypto/aead/aeadtest.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/regress/lib/libcrypto/aead/aeadtest.c b/src/regress/lib/libcrypto/aead/aeadtest.c
index e74b9fca97..4d96ed6de4 100644
--- a/src/regress/lib/libcrypto/aead/aeadtest.c
+++ b/src/regress/lib/libcrypto/aead/aeadtest.c
@@ -99,7 +99,8 @@ static const char NAMES[NUM_TYPES][6] = {
99}; 99};
100 100
101static unsigned char 101static unsigned char
102hex_digit(char h) { 102hex_digit(char h)
103{
103 if (h >= '0' && h <= '9') 104 if (h >= '0' && h <= '9')
104 return h - '0'; 105 return h - '0';
105 else if (h >= 'a' && h <= 'f') 106 else if (h >= 'a' && h <= 'f')
@@ -144,7 +145,7 @@ run_test_case(const EVP_AEAD* aead, unsigned char bufs[NUM_TYPES][BUF_MAX],
144 EVP_AEAD_CTX ctx; 145 EVP_AEAD_CTX ctx;
145 ssize_t n; 146 ssize_t n;
146 size_t un; 147 size_t un;
147 unsigned char out[BUF_MAX+EVP_AEAD_MAX_TAG_LENGTH], out2[BUF_MAX]; 148 unsigned char out[BUF_MAX + EVP_AEAD_MAX_TAG_LENGTH], out2[BUF_MAX];
148 149
149 if (!EVP_AEAD_CTX_init(&ctx, aead, bufs[KEY], lengths[KEY], 150 if (!EVP_AEAD_CTX_init(&ctx, aead, bufs[KEY], lengths[KEY],
150 lengths[TAG], NULL)) { 151 lengths[TAG], NULL)) {
@@ -164,8 +165,8 @@ run_test_case(const EVP_AEAD* aead, unsigned char bufs[NUM_TYPES][BUF_MAX],
164 165
165 if (un != lengths[CT] + lengths[TAG]) { 166 if (un != lengths[CT] + lengths[TAG]) {
166 fprintf(stderr, "Bad output length on line %u: %u vs %u\n", 167 fprintf(stderr, "Bad output length on line %u: %u vs %u\n",
167 line_no, (unsigned) un, 168 line_no, (unsigned) un,
168 (unsigned)(lengths[CT] + lengths[TAG])); 169 (unsigned)(lengths[CT] + lengths[TAG]));
169 return 0; 170 return 0;
170 } 171 }
171 172
@@ -188,7 +189,7 @@ run_test_case(const EVP_AEAD* aead, unsigned char bufs[NUM_TYPES][BUF_MAX],
188 189
189 if ((size_t)n != lengths[IN]) { 190 if ((size_t)n != lengths[IN]) {
190 fprintf(stderr, "Bad decrypt on line %u: %u\n", line_no, 191 fprintf(stderr, "Bad decrypt on line %u: %u\n", line_no,
191 (unsigned) n); 192 (unsigned) n);
192 return 0; 193 return 0;
193 } 194 }
194 195
@@ -263,7 +264,7 @@ main(int argc, char **argv)
263 fprintf(stderr, "Aborting...\n"); 264 fprintf(stderr, "Aborting...\n");
264 return 4; 265 return 4;
265 } 266 }
266 267
267 if (!run_test_case(aead, bufs, lengths, line_no)) 268 if (!run_test_case(aead, bufs, lengths, line_no))
268 return 4; 269 return 4;
269 270