56
56
#define MAX_UNALINED (16)
57
57
#endif
58
58
59
- static cbc_key_size const Ksize [] = { CBC_128_BITS , CBC_192_BITS , CBC_256_BITS };
59
+ static isal_cbc_key_size const Ksize [] = { ISAL_CBC_128_BITS , ISAL_CBC_192_BITS ,
60
+ ISAL_CBC_256_BITS };
60
61
61
62
typedef void (* aes_cbc_generic )(uint8_t * in , uint8_t * IV , uint8_t * keys , uint8_t * out ,
62
63
uint64_t len_bytes );
63
64
64
65
int
65
66
OpenSslEnc (uint8_t k_len , uint8_t * key , uint8_t * in , uint8_t * iv , uint8_t * out , uint64_t len_bytes )
66
67
{
67
- if (CBC_128_BITS == k_len ) {
68
+ if (ISAL_CBC_128_BITS == k_len ) {
68
69
#ifdef CBC_VECTORS_EXTRA_VERBOSE
69
70
printf (" OpenSSL128 " );
70
71
#endif
71
72
openssl_aes_128_cbc_enc (key , (uint8_t * ) iv , len_bytes , in , out );
72
- } else if (CBC_192_BITS == k_len ) {
73
+ } else if (ISAL_CBC_192_BITS == k_len ) {
73
74
#ifdef CBC_VECTORS_EXTRA_VERBOSE
74
75
printf (" OpenSSL192 " );
75
76
#endif
76
77
openssl_aes_192_cbc_enc (key , (uint8_t * ) iv , len_bytes , in , out );
77
- } else if (CBC_256_BITS == k_len ) {
78
+ } else if (ISAL_CBC_256_BITS == k_len ) {
78
79
#ifdef CBC_VECTORS_EXTRA_VERBOSE
79
80
printf (" OpenSSL256 " );
80
81
fflush (0 );
@@ -90,17 +91,17 @@ OpenSslEnc(uint8_t k_len, uint8_t *key, uint8_t *in, uint8_t *iv, uint8_t *out,
90
91
int
91
92
OpenSslDec (uint8_t k_len , uint8_t * key , uint8_t * in , uint8_t * iv , uint8_t * out , uint64_t len_bytes )
92
93
{
93
- if (CBC_128_BITS == k_len ) {
94
+ if (ISAL_CBC_128_BITS == k_len ) {
94
95
#ifdef CBC_VECTORS_EXTRA_VERBOSE
95
96
printf (" OpenSSL128 " );
96
97
#endif
97
98
openssl_aes_128_cbc_dec (key , (uint8_t * ) iv , len_bytes , in , out );
98
- } else if (CBC_192_BITS == k_len ) {
99
+ } else if (ISAL_CBC_192_BITS == k_len ) {
99
100
#ifdef CBC_VECTORS_EXTRA_VERBOSE
100
101
printf (" OpenSSL192 " );
101
102
#endif
102
103
openssl_aes_192_cbc_dec (key , (uint8_t * ) iv , len_bytes , in , out );
103
- } else if (CBC_256_BITS == k_len ) {
104
+ } else if (ISAL_CBC_256_BITS == k_len ) {
104
105
#ifdef CBC_VECTORS_EXTRA_VERBOSE
105
106
printf (" OpenSSL256 " );
106
107
#endif
@@ -165,21 +166,21 @@ check_vector(struct cbc_vector *vector)
165
166
printf ("." );
166
167
#endif
167
168
168
- if (CBC_128_BITS == vector -> K_LEN ) {
169
+ if (ISAL_CBC_128_BITS == vector -> K_LEN ) {
169
170
enc = (aes_cbc_generic ) & isal_aes_cbc_enc_128 ;
170
171
dec = (aes_cbc_generic ) & isal_aes_cbc_dec_128 ;
171
172
isal_aes_keyexp_128 (vector -> K , vector -> KEYS -> enc_keys , vector -> KEYS -> dec_keys );
172
173
#ifdef CBC_VECTORS_EXTRA_VERBOSE
173
174
printf (" CBC128 " );
174
175
#endif
175
- } else if (CBC_192_BITS == vector -> K_LEN ) {
176
+ } else if (ISAL_CBC_192_BITS == vector -> K_LEN ) {
176
177
enc = (aes_cbc_generic ) & isal_aes_cbc_enc_192 ;
177
178
dec = (aes_cbc_generic ) & isal_aes_cbc_dec_192 ;
178
179
isal_aes_keyexp_192 (vector -> K , vector -> KEYS -> enc_keys , vector -> KEYS -> dec_keys );
179
180
#ifdef CBC_VECTORS_EXTRA_VERBOSE
180
181
printf (" CBC192 " );
181
182
#endif
182
- } else if (CBC_256_BITS == vector -> K_LEN ) {
183
+ } else if (ISAL_CBC_256_BITS == vector -> K_LEN ) {
183
184
enc = (aes_cbc_generic ) & isal_aes_cbc_enc_256 ;
184
185
dec = (aes_cbc_generic ) & isal_aes_cbc_dec_256 ;
185
186
isal_aes_keyexp_256 (vector -> K , vector -> KEYS -> enc_keys , vector -> KEYS -> dec_keys );
@@ -259,7 +260,7 @@ test_std_combinations(void)
259
260
#ifdef CBC_VECTORS_VERBOSE
260
261
printf ("\n" );
261
262
#endif
262
- ret = posix_memalign ((void * * ) & iv , 16 , (CBC_IV_DATA_LEN ));
263
+ ret = posix_memalign ((void * * ) & iv , 16 , (ISAL_CBC_IV_DATA_LEN ));
263
264
if ((0 != ret ) || (NULL == iv ))
264
265
return 1 ;
265
266
@@ -273,7 +274,7 @@ test_std_combinations(void)
273
274
}
274
275
// IV data must be aligned to 16 byte boundary so move data in aligned buffer and
275
276
// change out the pointer
276
- memcpy (iv , vect .IV , CBC_IV_DATA_LEN );
277
+ memcpy (iv , vect .IV , ISAL_CBC_IV_DATA_LEN );
277
278
vect .IV = iv ;
278
279
vect .C = NULL ;
279
280
vect .C = malloc (vect .P_LEN );
@@ -317,7 +318,7 @@ test_random_combinations(void)
317
318
fflush (0 );
318
319
#endif
319
320
test .IV = NULL ;
320
- ret = posix_memalign ((void * * ) & test .IV , 16 , (CBC_IV_DATA_LEN ));
321
+ ret = posix_memalign ((void * * ) & test .IV , 16 , (ISAL_CBC_IV_DATA_LEN ));
321
322
if ((0 != ret ) || (NULL == test .IV ))
322
323
return 1 ;
323
324
test .KEYS = NULL ;
@@ -362,7 +363,7 @@ test_random_combinations(void)
362
363
363
364
mk_rand_data (test .P , test .P_LEN );
364
365
mk_rand_data (test .K , test .K_LEN );
365
- mk_rand_data (test .IV , CBC_IV_DATA_LEN );
366
+ mk_rand_data (test .IV , ISAL_CBC_IV_DATA_LEN );
366
367
367
368
#ifdef CBC_VECTORS_EXTRA_VERBOSE
368
369
printf (" Offset:0x%x " , offset );
@@ -428,18 +429,19 @@ test_efence_combinations(void)
428
429
test .P = P + PAGE_LEN - test .P_LEN - offset ;
429
430
test .C = C + PAGE_LEN - test .P_LEN - offset ;
430
431
test .K = K + PAGE_LEN - test .K_LEN - offset ;
431
- test .IV = IV + PAGE_LEN - CBC_IV_DATA_LEN - offset ;
432
+ test .IV = IV + PAGE_LEN - ISAL_CBC_IV_DATA_LEN - offset ;
432
433
test .IV =
433
434
test .IV - ((uint64_t ) test .IV & 0xff ); // align to 16 byte boundary
434
- test .KEYS = (struct cbc_key_data * ) (key_data + PAGE_LEN -
435
- sizeof (* test .KEYS ) - offset );
436
- test .KEYS = (struct cbc_key_data * ) ((uint8_t * ) test .KEYS -
437
- ((uint64_t ) test .KEYS &
438
- 0xff )); // align to 16 byte boundary
435
+ test .KEYS = (struct isal_cbc_key_data * ) (key_data + PAGE_LEN -
436
+ sizeof (* test .KEYS ) - offset );
437
+ test .KEYS =
438
+ (struct isal_cbc_key_data * ) ((uint8_t * ) test .KEYS -
439
+ ((uint64_t ) test .KEYS &
440
+ 0xff )); // align to 16 byte boundary
439
441
440
442
mk_rand_data (test .P , test .P_LEN );
441
443
mk_rand_data (test .K , test .K_LEN );
442
- mk_rand_data (test .IV , CBC_IV_DATA_LEN );
444
+ mk_rand_data (test .IV , ISAL_CBC_IV_DATA_LEN );
443
445
#ifdef CBC_VECTORS_EXTRA_VERBOSE
444
446
printf (" Offset:0x%x " , offset );
445
447
#endif
0 commit comments