3 #ifdef POLARSSL_CIPHER_C
7 #if defined(POLARSSL_GCM_C)
13 #if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C)
19 typedef UINT32 uint32_t;
32 #define GET_UINT32_BE(n,b,i) \
34 (n) = ( (uint32_t) (b)[(i) ] << 24 ) \
35 | ( (uint32_t) (b)[(i) + 1] << 16 ) \
36 | ( (uint32_t) (b)[(i) + 2] << 8 ) \
37 | ( (uint32_t) (b)[(i) + 3] ); \
42 #define PUT_UINT32_BE(n,b,i) \
44 (b)[(i) ] = (unsigned char) ( (n) >> 24 ); \
45 (b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \
46 (b)[(i) + 2] = (unsigned char) ( (n) >> 8 ); \
47 (b)[(i) + 3] = (unsigned char) ( (n) ); \
51 static int unhexify(
unsigned char *obuf,
const char *ibuf)
54 int len = strlen(ibuf) / 2;
55 assert(!(strlen(ibuf) %1));
60 if( c >=
'0' && c <=
'9' )
62 else if( c >=
'a' && c <=
'f' )
64 else if( c >=
'A' && c <=
'F' )
70 if( c2 >=
'0' && c2 <=
'9' )
72 else if( c2 >=
'a' && c2 <=
'f' )
74 else if( c2 >=
'A' && c2 <=
'F' )
79 *obuf++ = ( c << 4 ) | c2;
85 static void hexify(
unsigned char *obuf,
const unsigned char *ibuf,
int len)
97 *obuf++ =
'a' + h - 10;
102 *obuf++ =
'a' + l - 10;
118 static int rnd_std_rand(
void *rng_state,
unsigned char *output,
size_t len )
122 if( rng_state != NULL )
125 for( i = 0; i < len; ++i )
136 static int rnd_zero_rand(
void *rng_state,
unsigned char *output,
size_t len )
138 if( rng_state != NULL )
141 memset( output, 0, len );
168 if( rng_state == NULL )
177 memcpy( output, info->
buf, use_len );
178 info->
buf += use_len;
182 if( len - use_len > 0 )
183 return(
rnd_std_rand( NULL, output + use_len, len - use_len ) );
212 uint32_t i, *k, sum, delta=0x9E3779B9;
213 unsigned char result[4];
215 if( rng_state == NULL )
222 size_t use_len = ( len > 4 ) ? 4 : len;
225 for( i = 0; i < 32; i++ )
227 info->
v0 += (((info->
v1 << 4) ^ (info->
v1 >> 5)) + info->
v1) ^ (sum + k[sum & 3]);
229 info->
v1 += (((info->
v0 << 4) ^ (info->
v0 >> 5)) + info->
v0) ^ (sum + k[(sum>>11) & 3]);
233 memcpy( output, result, use_len );
249 static int not_rnd(
void *in,
unsigned char *out,
size_t len )
252 const char *ibuf = in;
254 assert( len == strlen(ibuf) / 2 );
255 assert(!(strlen(ibuf) %1));
257 obuf = out + (len - 1);
261 if( c >=
'0' && c <=
'9' )
263 else if( c >=
'a' && c <=
'f' )
265 else if( c >=
'A' && c <=
'F' )
271 if( c2 >=
'0' && c2 <=
'9' )
273 else if( c2 >=
'a' && c2 <=
'f' )
275 else if( c2 >=
'A' && c2 <=
'F' )
280 *obuf-- = ( c << 4 ) | c2;
292 #ifdef POLARSSL_CIPHER_C
294 #define TEST_SUITE_ACTIVE
303 printf(
"FAILED\n" );
304 printf(
" %s\n", test );
309 #define TEST_ASSERT( TEST ) \
310 do { test_assert( (TEST) ? 1 : 0, #TEST ); \
311 if( test_errors) return; \
316 if( (*str)[0] !=
'"' ||
317 (*str)[strlen( *str ) - 1] !=
'"' )
319 printf(
"Expected string (with \"\") for parameter and got: %s\n", *str );
324 (*str)[strlen( *str ) - 1] =
'\0';
336 for( i = 0; i < strlen( str ); i++ )
338 if( i == 0 && str[i] ==
'-' )
344 if( ( ( minus && i == 2 ) || ( !minus && i == 1 ) ) &&
345 str[i - 1] ==
'0' && str[i] ==
'x' )
351 if( str[i] <
'0' || str[i] >
'9' )
361 *value = strtol( str, NULL, 16 );
363 *value = strtol( str, NULL, 10 );
368 if( strcmp( str,
"POLARSSL_PADDING_ZEROS_AND_LEN" ) == 0 )
373 if( strcmp( str,
"POLARSSL_CIPHER_CAMELLIA_192_CBC" ) == 0 )
378 if( strcmp( str,
"-1" ) == 0 )
383 if( strcmp( str,
"POLARSSL_CIPHER_CAMELLIA_128_CTR" ) == 0 )
388 if( strcmp( str,
"POLARSSL_CIPHER_CAMELLIA_128_CBC" ) == 0 )
393 if( strcmp( str,
"POLARSSL_ERR_CIPHER_FULL_BLOCK_EXPECTED" ) == 0 )
398 if( strcmp( str,
"POLARSSL_PADDING_ONE_AND_ZEROS" ) == 0 )
403 if( strcmp( str,
"POLARSSL_CIPHER_CAMELLIA_256_CBC" ) == 0 )
408 if( strcmp( str,
"POLARSSL_PADDING_ZEROS" ) == 0 )
413 if( strcmp( str,
"POLARSSL_PADDING_NONE" ) == 0 )
418 if( strcmp( str,
"POLARSSL_CIPHER_CAMELLIA_128_CFB128" ) == 0 )
425 printf(
"Expected integer for parameter and got: %s\n", str );
429 void test_suite_enc_dec_buf(
int cipher_id,
char *cipher_string,
int key_len,
430 int length_val,
int pad_mode )
432 size_t length = length_val, outlen, total_len, i;
433 unsigned char key[32];
434 unsigned char iv[16];
435 unsigned char ad[13];
436 unsigned char tag[16];
437 unsigned char inbuf[64];
438 unsigned char encbuf[64];
439 unsigned char decbuf[64];
448 memset( &ctx_dec, 0,
sizeof( ctx_dec ) );
449 memset( &ctx_enc, 0,
sizeof( ctx_enc ) );
451 memset( key, 0x2a,
sizeof( key ) );
465 #if defined(POLARSSL_CIPHER_MODE_WITH_PADDING)
478 for( i = 0; i < 3; i++ )
480 memset( iv , 0x00 + i,
sizeof( iv ) );
481 memset( ad, 0x10 + i,
sizeof( ad ) );
482 memset( inbuf, 0x20 + i,
sizeof( inbuf ) );
484 memset( encbuf, 0,
sizeof( encbuf ) );
485 memset( decbuf, 0,
sizeof( decbuf ) );
486 memset( tag, 0,
sizeof( tag ) );
494 #if defined(POLARSSL_CIPHER_MODE_AEAD)
505 total_len < length &&
511 #if defined(POLARSSL_CIPHER_MODE_AEAD)
517 total_len > length &&
526 total_len < length &&
532 #if defined(POLARSSL_CIPHER_MODE_AEAD)
548 void test_suite_enc_fail(
int cipher_id,
int pad_mode,
int key_len,
549 int length_val,
int ret )
551 size_t length = length_val;
552 unsigned char key[32];
553 unsigned char iv[16];
558 unsigned char inbuf[64];
559 unsigned char encbuf[64];
563 memset( key, 0, 32 );
564 memset( iv , 0, 16 );
566 memset( &ctx, 0,
sizeof( ctx ) );
568 memset( inbuf, 5, 64 );
569 memset( encbuf, 0, 64 );
578 #if defined(POLARSSL_CIPHER_MODE_WITH_PADDING)
585 #if defined(POLARSSL_CIPHER_MODE_AEAD)
597 void test_suite_dec_empty_buf()
599 unsigned char key[32];
600 unsigned char iv[16];
605 unsigned char encbuf[64];
606 unsigned char decbuf[64];
610 memset( key, 0, 32 );
611 memset( iv , 0, 16 );
613 memset( &ctx_dec, 0,
sizeof( ctx_dec ) );
615 memset( encbuf, 0, 64 );
616 memset( decbuf, 0, 64 );
630 #if defined(POLARSSL_CIPHER_MODE_AEAD)
638 &ctx_dec, decbuf + outlen, &outlen ) );
644 void test_suite_enc_dec_buf_multipart(
int cipher_id,
int key_len,
int first_length_val,
645 int second_length_val )
647 size_t first_length = first_length_val;
648 size_t second_length = second_length_val;
649 size_t length = first_length + second_length;
650 unsigned char key[32];
651 unsigned char iv[16];
657 unsigned char inbuf[64];
658 unsigned char encbuf[64];
659 unsigned char decbuf[64];
662 size_t totaloutlen = 0;
664 memset( key, 0, 32 );
665 memset( iv , 0, 16 );
667 memset( &ctx_dec, 0,
sizeof( ctx_dec ) );
668 memset( &ctx_enc, 0,
sizeof( ctx_enc ) );
670 memset( inbuf, 5, 64 );
671 memset( encbuf, 0, 64 );
672 memset( decbuf, 0, 64 );
690 #if defined(POLARSSL_CIPHER_MODE_AEAD)
697 totaloutlen = outlen;
699 totaloutlen += outlen;
702 totaloutlen < length &&
706 totaloutlen += outlen;
709 totaloutlen > length &&
714 totaloutlen = outlen;
718 totaloutlen < length &&
722 totaloutlen += outlen;
732 void test_suite_decrypt_test_vec(
int cipher_id,
int pad_mode,
733 char *hex_key,
char *hex_iv,
734 char *hex_cipher,
char *hex_clear,
735 char *hex_ad,
char *hex_tag,
736 int finish_result,
int tag_result )
738 unsigned char key[50];
739 unsigned char iv[50];
740 unsigned char cipher[200];
741 unsigned char clear[200];
742 unsigned char ad[200];
743 unsigned char tag[20];
744 size_t key_len, iv_len, cipher_len, clear_len;
745 #if defined(POLARSSL_CIPHER_MODE_AEAD)
746 size_t ad_len, tag_len;
749 unsigned char output[200];
750 size_t outlen, total_len;
752 memset( key, 0x00,
sizeof( key ) );
753 memset( iv, 0x00,
sizeof( iv ) );
754 memset( cipher, 0x00,
sizeof( cipher ) );
755 memset( clear, 0x00,
sizeof( clear ) );
756 memset( ad, 0x00,
sizeof( ad ) );
757 memset( tag, 0x00,
sizeof( tag ) );
758 memset( output, 0x00,
sizeof( output ) );
762 cipher_len =
unhexify( cipher, hex_cipher );
763 clear_len =
unhexify( clear, hex_clear );
764 #if defined(POLARSSL_CIPHER_MODE_AEAD)
776 #if defined(POLARSSL_CIPHER_MODE_WITH_PADDING)
784 #if defined(POLARSSL_CIPHER_MODE_AEAD)
795 #if defined(POLARSSL_CIPHER_MODE_AEAD)
800 if( 0 == finish_result && 0 == tag_result )
803 TEST_ASSERT( 0 == memcmp( output, clear, clear_len ) );
809 void test_suite_test_vec_ecb(
int cipher_id,
int operation,
char *hex_key,
810 char *hex_input,
char *hex_result,
813 unsigned char key[50];
814 unsigned char input[16];
815 unsigned char result[16];
818 unsigned char output[32];
821 memset( key, 0x00,
sizeof( key ) );
822 memset( input, 0x00,
sizeof( input ) );
823 memset( result, 0x00,
sizeof( result ) );
824 memset( output, 0x00,
sizeof( output ) );
847 if( 0 == finish_result )
854 #ifdef POLARSSL_CIPHER_MODE_WITH_PADDING
855 void test_suite_set_padding(
int cipher_id,
int pad_mode,
int ret )
870 #ifdef POLARSSL_CIPHER_MODE_CBC
871 void test_suite_check_padding(
int pad_mode,
char *input_str,
int ret,
int dlen_check )
875 unsigned char input[16];
879 memset( &ctx, 0,
sizeof( ctx ) );
885 ilen =
unhexify( input, input_str );
893 #ifdef POLARSSL_SELF_TEST
894 void test_suite_cipher_selftest()
909 if( strcmp( str,
"POLARSSL_CIPHER_MODE_CTR" ) == 0 )
911 #if defined(POLARSSL_CIPHER_MODE_CTR)
917 if( strcmp( str,
"POLARSSL_CIPHER_MODE_CFB" ) == 0 )
919 #if defined(POLARSSL_CIPHER_MODE_CFB)
925 if( strcmp( str,
"POLARSSL_CIPHER_PADDING_PKCS7" ) == 0 )
927 #if defined(POLARSSL_CIPHER_PADDING_PKCS7)
933 if( strcmp( str,
"POLARSSL_CIPHER_MODE_CBC" ) == 0 )
935 #if defined(POLARSSL_CIPHER_MODE_CBC)
941 if( strcmp( str,
"POLARSSL_CAMELLIA_C" ) == 0 )
943 #if defined(POLARSSL_CAMELLIA_C)
960 #if defined(TEST_SUITE_ACTIVE)
961 if( strcmp( params[0],
"enc_dec_buf" ) == 0 )
965 char *param2 = params[2];
972 fprintf( stderr,
"\nIncorrect argument count (%d != %d)\n", cnt, 6 );
976 if(
verify_int( params[1], ¶m1 ) != 0 )
return( 2 );
978 if(
verify_int( params[3], ¶m3 ) != 0 )
return( 2 );
979 if(
verify_int( params[4], ¶m4 ) != 0 )
return( 2 );
980 if(
verify_int( params[5], ¶m5 ) != 0 )
return( 2 );
982 test_suite_enc_dec_buf( param1, param2, param3, param4, param5 );
988 if( strcmp( params[0],
"enc_fail" ) == 0 )
999 fprintf( stderr,
"\nIncorrect argument count (%d != %d)\n", cnt, 6 );
1003 if(
verify_int( params[1], ¶m1 ) != 0 )
return( 2 );
1004 if(
verify_int( params[2], ¶m2 ) != 0 )
return( 2 );
1005 if(
verify_int( params[3], ¶m3 ) != 0 )
return( 2 );
1006 if(
verify_int( params[4], ¶m4 ) != 0 )
return( 2 );
1007 if(
verify_int( params[5], ¶m5 ) != 0 )
return( 2 );
1009 test_suite_enc_fail( param1, param2, param3, param4, param5 );
1015 if( strcmp( params[0],
"dec_empty_buf" ) == 0 )
1021 fprintf( stderr,
"\nIncorrect argument count (%d != %d)\n", cnt, 1 );
1026 test_suite_dec_empty_buf( );
1032 if( strcmp( params[0],
"enc_dec_buf_multipart" ) == 0 )
1042 fprintf( stderr,
"\nIncorrect argument count (%d != %d)\n", cnt, 5 );
1046 if(
verify_int( params[1], ¶m1 ) != 0 )
return( 2 );
1047 if(
verify_int( params[2], ¶m2 ) != 0 )
return( 2 );
1048 if(
verify_int( params[3], ¶m3 ) != 0 )
return( 2 );
1049 if(
verify_int( params[4], ¶m4 ) != 0 )
return( 2 );
1051 test_suite_enc_dec_buf_multipart( param1, param2, param3, param4 );
1057 if( strcmp( params[0],
"decrypt_test_vec" ) == 0 )
1062 char *param3 = params[3];
1063 char *param4 = params[4];
1064 char *param5 = params[5];
1065 char *param6 = params[6];
1066 char *param7 = params[7];
1067 char *param8 = params[8];
1073 fprintf( stderr,
"\nIncorrect argument count (%d != %d)\n", cnt, 11 );
1077 if(
verify_int( params[1], ¶m1 ) != 0 )
return( 2 );
1078 if(
verify_int( params[2], ¶m2 ) != 0 )
return( 2 );
1085 if(
verify_int( params[9], ¶m9 ) != 0 )
return( 2 );
1086 if(
verify_int( params[10], ¶m10 ) != 0 )
return( 2 );
1088 test_suite_decrypt_test_vec( param1, param2, param3, param4, param5, param6, param7, param8, param9, param10 );
1094 if( strcmp( params[0],
"test_vec_ecb" ) == 0 )
1099 char *param3 = params[3];
1100 char *param4 = params[4];
1101 char *param5 = params[5];
1106 fprintf( stderr,
"\nIncorrect argument count (%d != %d)\n", cnt, 7 );
1110 if(
verify_int( params[1], ¶m1 ) != 0 )
return( 2 );
1111 if(
verify_int( params[2], ¶m2 ) != 0 )
return( 2 );
1115 if(
verify_int( params[6], ¶m6 ) != 0 )
return( 2 );
1117 test_suite_test_vec_ecb( param1, param2, param3, param4, param5, param6 );
1123 if( strcmp( params[0],
"set_padding" ) == 0 )
1125 #ifdef POLARSSL_CIPHER_MODE_WITH_PADDING
1133 fprintf( stderr,
"\nIncorrect argument count (%d != %d)\n", cnt, 4 );
1137 if(
verify_int( params[1], ¶m1 ) != 0 )
return( 2 );
1138 if(
verify_int( params[2], ¶m2 ) != 0 )
return( 2 );
1139 if(
verify_int( params[3], ¶m3 ) != 0 )
return( 2 );
1141 test_suite_set_padding( param1, param2, param3 );
1148 if( strcmp( params[0],
"check_padding" ) == 0 )
1150 #ifdef POLARSSL_CIPHER_MODE_CBC
1153 char *param2 = params[2];
1159 fprintf( stderr,
"\nIncorrect argument count (%d != %d)\n", cnt, 5 );
1163 if(
verify_int( params[1], ¶m1 ) != 0 )
return( 2 );
1165 if(
verify_int( params[3], ¶m3 ) != 0 )
return( 2 );
1166 if(
verify_int( params[4], ¶m4 ) != 0 )
return( 2 );
1168 test_suite_check_padding( param1, param2, param3, param4 );
1175 if( strcmp( params[0],
"cipher_selftest" ) == 0 )
1177 #ifdef POLARSSL_SELF_TEST
1182 fprintf( stderr,
"\nIncorrect argument count (%d != %d)\n", cnt, 1 );
1187 test_suite_cipher_selftest( );
1196 fprintf( stdout,
"FAILED\nSkipping unknown test function '%s'\n", params[0] );
1210 ret = fgets( buf, len, f );
1214 if( strlen( buf ) && buf[strlen(buf) - 1] ==
'\n' )
1215 buf[strlen(buf) - 1] =
'\0';
1216 if( strlen( buf ) && buf[strlen(buf) - 1] ==
'\r' )
1217 buf[strlen(buf) - 1] =
'\0';
1228 params[cnt++] = cur;
1230 while( *p !=
'\0' && p < buf + len )
1240 if( p + 1 < buf + len )
1243 params[cnt++] = cur;
1252 for( i = 0; i < cnt; i++ )
1259 if( *p ==
'\\' && *(p + 1) ==
'n' )
1264 else if( *p ==
'\\' && *(p + 1) ==
':' )
1269 else if( *p ==
'\\' && *(p + 1) ==
'?' )
1285 int ret, i, cnt, total_errors = 0, total_tests = 0, total_skipped = 0;
1286 const char *filename =
"/home/iurt/rpmbuild/BUILD/polarssl-1.3.1/tests/suites/test_suite_cipher.camellia.data";
1291 #if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C)
1292 unsigned char alloc_buf[1000000];
1293 memory_buffer_alloc_init( alloc_buf,
sizeof(alloc_buf) );
1296 file = fopen( filename,
"r" );
1299 fprintf( stderr,
"Failed to open\n" );
1303 while( !feof( file ) )
1307 if( ( ret =
get_line( file, buf,
sizeof(buf) ) ) != 0 )
1309 fprintf( stdout,
"%s%.66s",
test_errors ?
"\n" :
"", buf );
1310 fprintf( stdout,
" " );
1311 for( i = strlen( buf ) + 1; i < 67; i++ )
1312 fprintf( stdout,
"." );
1313 fprintf( stdout,
" " );
1318 if( ( ret =
get_line( file, buf,
sizeof(buf) ) ) != 0 )
1322 if( strcmp( params[0],
"depends_on" ) == 0 )
1324 for( i = 1; i < cnt; i++ )
1328 if( ( ret =
get_line( file, buf,
sizeof(buf) ) ) != 0 )
1339 if( skip == 1 || ret == 3 )
1342 fprintf( stdout,
"----\n" );
1347 fprintf( stdout,
"PASS\n" );
1352 fprintf( stderr,
"FAILED: FATAL PARSE ERROR\n" );
1359 if( ( ret =
get_line( file, buf,
sizeof(buf) ) ) != 0 )
1361 if( strlen(buf) != 0 )
1363 fprintf( stderr,
"Should be empty %d\n", (
int) strlen(buf) );
1369 fprintf( stdout,
"\n----------------------------------------------------------------------------\n\n");
1370 if( total_errors == 0 )
1371 fprintf( stdout,
"PASSED" );
1373 fprintf( stdout,
"FAILED" );
1375 fprintf( stdout,
" (%d / %d tests (%d skipped))\n",
1376 total_tests - total_errors, total_tests, total_skipped );
1378 #if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C)
1379 #if defined(POLARSSL_MEMORY_DEBUG)
1380 memory_buffer_alloc_status();
1382 memory_buffer_alloc_free();
1385 return( total_errors != 0 );
int cipher_finish(cipher_context_t *ctx, unsigned char *output, size_t *olen)
Generic cipher finalisation function.
static int not_rnd(void *in, unsigned char *out, size_t len)
This function returns a buffer given as a hex string.
Info structure for the pseudo random function.
int cipher_write_tag(cipher_context_t *ctx, unsigned char *tag, size_t tag_len)
Write tag for AEAD ciphers.
zero padding (not reversible!)
const cipher_info_t * cipher_info_from_type(const cipher_type_t cipher_type)
Returns the cipher information structure associated with the given cipher type.
static unsigned int cipher_get_block_size(const cipher_context_t *ctx)
Returns the block size of the given cipher.
const cipher_info_t * cipher_info_from_string(const char *cipher_name)
Returns the cipher information structure associated with the given cipher name.
static int rnd_pseudo_rand(void *rng_state, unsigned char *output, size_t len)
This function returns random based on a pseudo random function.
int(* get_padding)(unsigned char *input, size_t ilen, size_t *data_len)
Configuration options (set of defines)
static int test_assert(int correct, char *test)
int main(int argc, char *argv[])
const cipher_info_t * cipher_info
Information about the associated cipher.
#define TEST_ASSERT(TEST)
int cipher_free_ctx(cipher_context_t *ctx)
Free the cipher-specific context of ctx.
int cipher_update_ad(cipher_context_t *ctx, const unsigned char *ad, size_t ad_len)
Add additional data (for AEAD ciphers).
int cipher_set_iv(cipher_context_t *ctx, const unsigned char *iv, size_t iv_len)
Set the initialization vector (IV) or nonce.
int cipher_update(cipher_context_t *ctx, const unsigned char *input, size_t ilen, unsigned char *output, size_t *olen)
Generic cipher update function.
static int unhexify(unsigned char *obuf, const char *ibuf)
#define POLARSSL_ERR_CIPHER_FULL_BLOCK_EXPECTED
Decryption of block requires a full block.
static int rnd_std_rand(void *rng_state, unsigned char *output, size_t len)
This function just returns data from rand().
int parse_arguments(char *buf, size_t len, char *params[50])
#define PUT_UINT32_BE(n, b, i)
int cipher_reset(cipher_context_t *ctx)
Finish preparation of the given context.
int cipher_set_padding_mode(cipher_context_t *ctx, cipher_padding_t mode)
Set padding mode, for cipher modes that use padding.
cipher_mode_t mode
Cipher mode (e.g.
int cipher_init_ctx(cipher_context_t *ctx, const cipher_info_t *cipher_info)
Initialises and fills the cipher context structure with the appropriate values.
int cipher_setkey(cipher_context_t *ctx, const unsigned char *key, int key_length, const operation_t operation)
Set the key to use with the given context.
int verify_string(char **str)
static int rnd_zero_rand(void *rng_state, unsigned char *output, size_t len)
This function only returns zeros.
static void hexify(unsigned char *obuf, const unsigned char *ibuf, int len)
int dispatch_test(int cnt, char *params[50])
static int rnd_buffer_rand(void *rng_state, unsigned char *output, size_t len)
This function returns random based on a buffer it receives.
never pad (full blocks only)
Galois/Counter mode for 128-bit block ciphers.
int verify_int(char *str, int *value)
int cipher_self_test(int verbose)
Checkup routine.
int cipher_check_tag(cipher_context_t *ctx, const unsigned char *tag, size_t tag_len)
Check tag for AEAD ciphers.
int get_line(FILE *f, char *buf, size_t len)