9 typedef UINT32 uint32_t;
18 #define GET_ULONG_BE(n,b,i) \
20 (n) = ( (unsigned long) (b)[(i) ] << 24 ) \
21 | ( (unsigned long) (b)[(i) + 1] << 16 ) \
22 | ( (unsigned long) (b)[(i) + 2] << 8 ) \
23 | ( (unsigned long) (b)[(i) + 3] ); \
28 #define PUT_ULONG_BE(n,b,i) \
30 (b)[(i) ] = (unsigned char) ( (n) >> 24 ); \
31 (b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \
32 (b)[(i) + 2] = (unsigned char) ( (n) >> 8 ); \
33 (b)[(i) + 3] = (unsigned char) ( (n) ); \
37 int unhexify(
unsigned char *obuf,
const char *ibuf)
40 int len = strlen(ibuf) / 2;
41 assert(!(strlen(ibuf) %1));
46 if( c >=
'0' && c <=
'9' )
48 else if( c >=
'a' && c <=
'f' )
50 else if( c >=
'A' && c <=
'F' )
56 if( c2 >=
'0' && c2 <=
'9' )
58 else if( c2 >=
'a' && c2 <=
'f' )
60 else if( c2 >=
'A' && c2 <=
'F' )
65 *obuf++ = ( c << 4 ) | c2;
71 void hexify(
unsigned char *obuf,
const unsigned char *ibuf,
int len)
83 *obuf++ =
'a' + h - 10;
88 *obuf++ =
'a' + l - 10;
104 static int rnd_std_rand(
void *rng_state,
unsigned char *output,
size_t len )
108 if( rng_state != NULL )
111 for( i = 0; i < len; ++i )
122 static int rnd_zero_rand(
void *rng_state,
unsigned char *output,
size_t len )
124 if( rng_state != NULL )
127 memset( output, 0, len );
154 if( rng_state == NULL )
163 memcpy( output, info->
buf, use_len );
164 info->
buf += use_len;
168 if( len - use_len > 0 )
169 return(
rnd_std_rand( NULL, output + use_len, len - use_len ) );
198 uint32_t i, *k, sum, delta=0x9E3779B9;
199 unsigned char result[4];
201 if( rng_state == NULL )
208 size_t use_len = ( len > 4 ) ? 4 : len;
211 for( i = 0; i < 32; i++ )
213 info->
v0 += (((info->
v1 << 4) ^ (info->
v1 >> 5)) + info->
v1) ^ (sum + k[sum & 3]);
215 info->
v1 += (((info->
v0 << 4) ^ (info->
v0 >> 5)) + info->
v0) ^ (sum + k[(sum>>11) & 3]);
219 memcpy( output, result, use_len );
229 #ifdef POLARSSL_AES_C
232 FCT_SUITE_BGN(test_suite_aes)
235 FCT_TEST_BGN(aes_128_ecb_encrypt_nist_kat_1)
237 unsigned char key_str[100];
238 unsigned char src_str[100];
239 unsigned char dst_str[100];
240 unsigned char output[100];
244 memset(key_str, 0x00, 100);
245 memset(src_str, 0x00, 100);
246 memset(dst_str, 0x00, 100);
247 memset(output, 0x00, 100);
249 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
250 unhexify( src_str,
"f34481ec3cc627bacd5dc3fb08f273e6" );
256 hexify( dst_str, output, 16 );
258 fct_chk( strcmp( (
char *) dst_str,
"0336763e966d92595a567cc9ce537f5e" ) == 0 );
264 FCT_TEST_BGN(aes_128_ecb_encrypt_nist_kat_2)
266 unsigned char key_str[100];
267 unsigned char src_str[100];
268 unsigned char dst_str[100];
269 unsigned char output[100];
273 memset(key_str, 0x00, 100);
274 memset(src_str, 0x00, 100);
275 memset(dst_str, 0x00, 100);
276 memset(output, 0x00, 100);
278 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
279 unhexify( src_str,
"9798c4640bad75c7c3227db910174e72" );
285 hexify( dst_str, output, 16 );
287 fct_chk( strcmp( (
char *) dst_str,
"a9a1631bf4996954ebc093957b234589" ) == 0 );
293 FCT_TEST_BGN(aes_128_ecb_encrypt_nist_kat_3)
295 unsigned char key_str[100];
296 unsigned char src_str[100];
297 unsigned char dst_str[100];
298 unsigned char output[100];
302 memset(key_str, 0x00, 100);
303 memset(src_str, 0x00, 100);
304 memset(dst_str, 0x00, 100);
305 memset(output, 0x00, 100);
307 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
308 unhexify( src_str,
"96ab5c2ff612d9dfaae8c31f30c42168" );
314 hexify( dst_str, output, 16 );
316 fct_chk( strcmp( (
char *) dst_str,
"ff4f8391a6a40ca5b25d23bedd44a597" ) == 0 );
322 FCT_TEST_BGN(aes_128_ecb_encrypt_nist_kat_4)
324 unsigned char key_str[100];
325 unsigned char src_str[100];
326 unsigned char dst_str[100];
327 unsigned char output[100];
331 memset(key_str, 0x00, 100);
332 memset(src_str, 0x00, 100);
333 memset(dst_str, 0x00, 100);
334 memset(output, 0x00, 100);
336 key_len =
unhexify( key_str,
"e0000000000000000000000000000000" );
337 unhexify( src_str,
"00000000000000000000000000000000" );
343 hexify( dst_str, output, 16 );
345 fct_chk( strcmp( (
char *) dst_str,
"72a1da770f5d7ac4c9ef94d822affd97" ) == 0 );
351 FCT_TEST_BGN(aes_128_ecb_encrypt_nist_kat_5)
353 unsigned char key_str[100];
354 unsigned char src_str[100];
355 unsigned char dst_str[100];
356 unsigned char output[100];
360 memset(key_str, 0x00, 100);
361 memset(src_str, 0x00, 100);
362 memset(dst_str, 0x00, 100);
363 memset(output, 0x00, 100);
365 key_len =
unhexify( key_str,
"f0000000000000000000000000000000" );
366 unhexify( src_str,
"00000000000000000000000000000000" );
372 hexify( dst_str, output, 16 );
374 fct_chk( strcmp( (
char *) dst_str,
"970014d634e2b7650777e8e84d03ccd8" ) == 0 );
380 FCT_TEST_BGN(aes_128_ecb_encrypt_nist_kat_6)
382 unsigned char key_str[100];
383 unsigned char src_str[100];
384 unsigned char dst_str[100];
385 unsigned char output[100];
389 memset(key_str, 0x00, 100);
390 memset(src_str, 0x00, 100);
391 memset(dst_str, 0x00, 100);
392 memset(output, 0x00, 100);
394 key_len =
unhexify( key_str,
"f8000000000000000000000000000000" );
395 unhexify( src_str,
"00000000000000000000000000000000" );
401 hexify( dst_str, output, 16 );
403 fct_chk( strcmp( (
char *) dst_str,
"f17e79aed0db7e279e955b5f493875a7" ) == 0 );
409 FCT_TEST_BGN(aes_128_ecb_encrypt_nist_kat_7)
411 unsigned char key_str[100];
412 unsigned char src_str[100];
413 unsigned char dst_str[100];
414 unsigned char output[100];
418 memset(key_str, 0x00, 100);
419 memset(src_str, 0x00, 100);
420 memset(dst_str, 0x00, 100);
421 memset(output, 0x00, 100);
423 key_len =
unhexify( key_str,
"fffffffffffff0000000000000000000" );
424 unhexify( src_str,
"00000000000000000000000000000000" );
430 hexify( dst_str, output, 16 );
432 fct_chk( strcmp( (
char *) dst_str,
"7b90785125505fad59b13c186dd66ce3" ) == 0 );
438 FCT_TEST_BGN(aes_128_ecb_encrypt_nist_kat_8)
440 unsigned char key_str[100];
441 unsigned char src_str[100];
442 unsigned char dst_str[100];
443 unsigned char output[100];
447 memset(key_str, 0x00, 100);
448 memset(src_str, 0x00, 100);
449 memset(dst_str, 0x00, 100);
450 memset(output, 0x00, 100);
452 key_len =
unhexify( key_str,
"fffffffffffff8000000000000000000" );
453 unhexify( src_str,
"00000000000000000000000000000000" );
459 hexify( dst_str, output, 16 );
461 fct_chk( strcmp( (
char *) dst_str,
"8b527a6aebdaec9eaef8eda2cb7783e5" ) == 0 );
467 FCT_TEST_BGN(aes_128_ecb_encrypt_nist_kat_9)
469 unsigned char key_str[100];
470 unsigned char src_str[100];
471 unsigned char dst_str[100];
472 unsigned char output[100];
476 memset(key_str, 0x00, 100);
477 memset(src_str, 0x00, 100);
478 memset(dst_str, 0x00, 100);
479 memset(output, 0x00, 100);
481 key_len =
unhexify( key_str,
"fffffffffffffc000000000000000000" );
482 unhexify( src_str,
"00000000000000000000000000000000" );
488 hexify( dst_str, output, 16 );
490 fct_chk( strcmp( (
char *) dst_str,
"43fdaf53ebbc9880c228617d6a9b548b" ) == 0 );
496 FCT_TEST_BGN(aes_128_ecb_encrypt_nist_kat_10)
498 unsigned char key_str[100];
499 unsigned char src_str[100];
500 unsigned char dst_str[100];
501 unsigned char output[100];
505 memset(key_str, 0x00, 100);
506 memset(src_str, 0x00, 100);
507 memset(dst_str, 0x00, 100);
508 memset(output, 0x00, 100);
510 key_len =
unhexify( key_str,
"ffffffffffffffffffffffffffffc000" );
511 unhexify( src_str,
"00000000000000000000000000000000" );
517 hexify( dst_str, output, 16 );
519 fct_chk( strcmp( (
char *) dst_str,
"70c46bb30692be657f7eaa93ebad9897" ) == 0 );
525 FCT_TEST_BGN(aes_128_ecb_encrypt_nist_kat_11)
527 unsigned char key_str[100];
528 unsigned char src_str[100];
529 unsigned char dst_str[100];
530 unsigned char output[100];
534 memset(key_str, 0x00, 100);
535 memset(src_str, 0x00, 100);
536 memset(dst_str, 0x00, 100);
537 memset(output, 0x00, 100);
539 key_len =
unhexify( key_str,
"ffffffffffffffffffffffffffffe000" );
540 unhexify( src_str,
"00000000000000000000000000000000" );
546 hexify( dst_str, output, 16 );
548 fct_chk( strcmp( (
char *) dst_str,
"323994cfb9da285a5d9642e1759b224a" ) == 0 );
554 FCT_TEST_BGN(aes_128_ecb_encrypt_nist_kat_12)
556 unsigned char key_str[100];
557 unsigned char src_str[100];
558 unsigned char dst_str[100];
559 unsigned char output[100];
563 memset(key_str, 0x00, 100);
564 memset(src_str, 0x00, 100);
565 memset(dst_str, 0x00, 100);
566 memset(output, 0x00, 100);
568 key_len =
unhexify( key_str,
"fffffffffffffffffffffffffffff000" );
569 unhexify( src_str,
"00000000000000000000000000000000" );
575 hexify( dst_str, output, 16 );
577 fct_chk( strcmp( (
char *) dst_str,
"1dbf57877b7b17385c85d0b54851e371" ) == 0 );
583 FCT_TEST_BGN(aes_128_ecb_encrypt_nist_kat_13)
585 unsigned char key_str[100];
586 unsigned char src_str[100];
587 unsigned char dst_str[100];
588 unsigned char output[100];
592 memset(key_str, 0x00, 100);
593 memset(src_str, 0x00, 100);
594 memset(dst_str, 0x00, 100);
595 memset(output, 0x00, 100);
597 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
598 unhexify( src_str,
"ffffffffffffffc00000000000000000" );
604 hexify( dst_str, output, 16 );
606 fct_chk( strcmp( (
char *) dst_str,
"3a4d354f02bb5a5e47d39666867f246a" ) == 0 );
612 FCT_TEST_BGN(aes_128_ecb_encrypt_nist_kat_14)
614 unsigned char key_str[100];
615 unsigned char src_str[100];
616 unsigned char dst_str[100];
617 unsigned char output[100];
621 memset(key_str, 0x00, 100);
622 memset(src_str, 0x00, 100);
623 memset(dst_str, 0x00, 100);
624 memset(output, 0x00, 100);
626 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
627 unhexify( src_str,
"ffffffffffffffe00000000000000000" );
633 hexify( dst_str, output, 16 );
635 fct_chk( strcmp( (
char *) dst_str,
"d451b8d6e1e1a0ebb155fbbf6e7b7dc3" ) == 0 );
641 FCT_TEST_BGN(aes_128_ecb_encrypt_nist_kat_15)
643 unsigned char key_str[100];
644 unsigned char src_str[100];
645 unsigned char dst_str[100];
646 unsigned char output[100];
650 memset(key_str, 0x00, 100);
651 memset(src_str, 0x00, 100);
652 memset(dst_str, 0x00, 100);
653 memset(output, 0x00, 100);
655 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
656 unhexify( src_str,
"fffffffffffffff00000000000000000" );
662 hexify( dst_str, output, 16 );
664 fct_chk( strcmp( (
char *) dst_str,
"6898d4f42fa7ba6a10ac05e87b9f2080" ) == 0 );
670 FCT_TEST_BGN(aes_128_ecb_encrypt_nist_kat_16)
672 unsigned char key_str[100];
673 unsigned char src_str[100];
674 unsigned char dst_str[100];
675 unsigned char output[100];
679 memset(key_str, 0x00, 100);
680 memset(src_str, 0x00, 100);
681 memset(dst_str, 0x00, 100);
682 memset(output, 0x00, 100);
684 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
685 unhexify( src_str,
"ffffffffffffffffffffffffe0000000" );
691 hexify( dst_str, output, 16 );
693 fct_chk( strcmp( (
char *) dst_str,
"082eb8be35f442fb52668e16a591d1d6" ) == 0 );
699 FCT_TEST_BGN(aes_128_ecb_encrypt_nist_kat_17)
701 unsigned char key_str[100];
702 unsigned char src_str[100];
703 unsigned char dst_str[100];
704 unsigned char output[100];
708 memset(key_str, 0x00, 100);
709 memset(src_str, 0x00, 100);
710 memset(dst_str, 0x00, 100);
711 memset(output, 0x00, 100);
713 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
714 unhexify( src_str,
"fffffffffffffffffffffffff0000000" );
720 hexify( dst_str, output, 16 );
722 fct_chk( strcmp( (
char *) dst_str,
"e656f9ecf5fe27ec3e4a73d00c282fb3" ) == 0 );
728 FCT_TEST_BGN(aes_128_ecb_encrypt_nist_kat_18)
730 unsigned char key_str[100];
731 unsigned char src_str[100];
732 unsigned char dst_str[100];
733 unsigned char output[100];
737 memset(key_str, 0x00, 100);
738 memset(src_str, 0x00, 100);
739 memset(dst_str, 0x00, 100);
740 memset(output, 0x00, 100);
742 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
743 unhexify( src_str,
"fffffffffffffffffffffffff8000000" );
749 hexify( dst_str, output, 16 );
751 fct_chk( strcmp( (
char *) dst_str,
"2ca8209d63274cd9a29bb74bcd77683a" ) == 0 );
757 FCT_TEST_BGN(aes_128_ecb_decrypt_nist_kat_1)
759 unsigned char key_str[100];
760 unsigned char src_str[100];
761 unsigned char dst_str[100];
762 unsigned char output[100];
766 memset(key_str, 0x00, 100);
767 memset(src_str, 0x00, 100);
768 memset(dst_str, 0x00, 100);
769 memset(output, 0x00, 100);
771 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
772 unhexify( src_str,
"db4f1aa530967d6732ce4715eb0ee24b" );
778 hexify( dst_str, output, 16 );
780 fct_chk( strcmp( (
char *) dst_str,
"ff000000000000000000000000000000" ) == 0 );
786 FCT_TEST_BGN(aes_128_ecb_decrypt_nist_kat_2)
788 unsigned char key_str[100];
789 unsigned char src_str[100];
790 unsigned char dst_str[100];
791 unsigned char output[100];
795 memset(key_str, 0x00, 100);
796 memset(src_str, 0x00, 100);
797 memset(dst_str, 0x00, 100);
798 memset(output, 0x00, 100);
800 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
801 unhexify( src_str,
"a81738252621dd180a34f3455b4baa2f" );
807 hexify( dst_str, output, 16 );
809 fct_chk( strcmp( (
char *) dst_str,
"ff800000000000000000000000000000" ) == 0 );
815 FCT_TEST_BGN(aes_128_ecb_decrypt_nist_kat_3)
817 unsigned char key_str[100];
818 unsigned char src_str[100];
819 unsigned char dst_str[100];
820 unsigned char output[100];
824 memset(key_str, 0x00, 100);
825 memset(src_str, 0x00, 100);
826 memset(dst_str, 0x00, 100);
827 memset(output, 0x00, 100);
829 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
830 unhexify( src_str,
"77e2b508db7fd89234caf7939ee5621a" );
836 hexify( dst_str, output, 16 );
838 fct_chk( strcmp( (
char *) dst_str,
"ffc00000000000000000000000000000" ) == 0 );
844 FCT_TEST_BGN(aes_128_ecb_decrypt_nist_kat_4)
846 unsigned char key_str[100];
847 unsigned char src_str[100];
848 unsigned char dst_str[100];
849 unsigned char output[100];
853 memset(key_str, 0x00, 100);
854 memset(src_str, 0x00, 100);
855 memset(dst_str, 0x00, 100);
856 memset(output, 0x00, 100);
858 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
859 unhexify( src_str,
"dc43be40be0e53712f7e2bf5ca707209" );
865 hexify( dst_str, output, 16 );
867 fct_chk( strcmp( (
char *) dst_str,
"6a118a874519e64e9963798a503f1d35" ) == 0 );
873 FCT_TEST_BGN(aes_128_ecb_decrypt_nist_kat_5)
875 unsigned char key_str[100];
876 unsigned char src_str[100];
877 unsigned char dst_str[100];
878 unsigned char output[100];
882 memset(key_str, 0x00, 100);
883 memset(src_str, 0x00, 100);
884 memset(dst_str, 0x00, 100);
885 memset(output, 0x00, 100);
887 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
888 unhexify( src_str,
"92beedab1895a94faa69b632e5cc47ce" );
894 hexify( dst_str, output, 16 );
896 fct_chk( strcmp( (
char *) dst_str,
"cb9fceec81286ca3e989bd979b0cb284" ) == 0 );
902 FCT_TEST_BGN(aes_128_ecb_decrypt_nist_kat_6)
904 unsigned char key_str[100];
905 unsigned char src_str[100];
906 unsigned char dst_str[100];
907 unsigned char output[100];
911 memset(key_str, 0x00, 100);
912 memset(src_str, 0x00, 100);
913 memset(dst_str, 0x00, 100);
914 memset(output, 0x00, 100);
916 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
917 unhexify( src_str,
"459264f4798f6a78bacb89c15ed3d601" );
923 hexify( dst_str, output, 16 );
925 fct_chk( strcmp( (
char *) dst_str,
"b26aeb1874e47ca8358ff22378f09144" ) == 0 );
931 FCT_TEST_BGN(aes_128_ecb_decrypt_nist_kat_7)
933 unsigned char key_str[100];
934 unsigned char src_str[100];
935 unsigned char dst_str[100];
936 unsigned char output[100];
940 memset(key_str, 0x00, 100);
941 memset(src_str, 0x00, 100);
942 memset(dst_str, 0x00, 100);
943 memset(output, 0x00, 100);
945 key_len =
unhexify( key_str,
"b69418a85332240dc82492353956ae0c" );
946 unhexify( src_str,
"a303d940ded8f0baff6f75414cac5243" );
952 hexify( dst_str, output, 16 );
954 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
960 FCT_TEST_BGN(aes_128_ecb_decrypt_nist_kat_8)
962 unsigned char key_str[100];
963 unsigned char src_str[100];
964 unsigned char dst_str[100];
965 unsigned char output[100];
969 memset(key_str, 0x00, 100);
970 memset(src_str, 0x00, 100);
971 memset(dst_str, 0x00, 100);
972 memset(output, 0x00, 100);
974 key_len =
unhexify( key_str,
"71b5c08a1993e1362e4d0ce9b22b78d5" );
975 unhexify( src_str,
"c2dabd117f8a3ecabfbb11d12194d9d0" );
981 hexify( dst_str, output, 16 );
983 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
989 FCT_TEST_BGN(aes_128_ecb_decrypt_nist_kat_9)
991 unsigned char key_str[100];
992 unsigned char src_str[100];
993 unsigned char dst_str[100];
994 unsigned char output[100];
998 memset(key_str, 0x00, 100);
999 memset(src_str, 0x00, 100);
1000 memset(dst_str, 0x00, 100);
1001 memset(output, 0x00, 100);
1003 key_len =
unhexify( key_str,
"e234cdca2606b81f29408d5f6da21206" );
1004 unhexify( src_str,
"fff60a4740086b3b9c56195b98d91a7b" );
1010 hexify( dst_str, output, 16 );
1012 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1018 FCT_TEST_BGN(aes_128_ecb_decrypt_nist_kat_10)
1020 unsigned char key_str[100];
1021 unsigned char src_str[100];
1022 unsigned char dst_str[100];
1023 unsigned char output[100];
1027 memset(key_str, 0x00, 100);
1028 memset(src_str, 0x00, 100);
1029 memset(dst_str, 0x00, 100);
1030 memset(output, 0x00, 100);
1032 key_len =
unhexify( key_str,
"ffffffffffffffff0000000000000000" );
1033 unhexify( src_str,
"84be19e053635f09f2665e7bae85b42d" );
1039 hexify( dst_str, output, 16 );
1041 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1047 FCT_TEST_BGN(aes_128_ecb_decrypt_nist_kat_11)
1049 unsigned char key_str[100];
1050 unsigned char src_str[100];
1051 unsigned char dst_str[100];
1052 unsigned char output[100];
1056 memset(key_str, 0x00, 100);
1057 memset(src_str, 0x00, 100);
1058 memset(dst_str, 0x00, 100);
1059 memset(output, 0x00, 100);
1061 key_len =
unhexify( key_str,
"ffffffffffffffff8000000000000000" );
1062 unhexify( src_str,
"32cd652842926aea4aa6137bb2be2b5e" );
1068 hexify( dst_str, output, 16 );
1070 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1076 FCT_TEST_BGN(aes_192_ecb_encrypt_nist_kat_1)
1078 unsigned char key_str[100];
1079 unsigned char src_str[100];
1080 unsigned char dst_str[100];
1081 unsigned char output[100];
1085 memset(key_str, 0x00, 100);
1086 memset(src_str, 0x00, 100);
1087 memset(dst_str, 0x00, 100);
1088 memset(output, 0x00, 100);
1090 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1091 unhexify( src_str,
"fffffffffffffffffffff80000000000" );
1097 hexify( dst_str, output, 16 );
1099 fct_chk( strcmp( (
char *) dst_str,
"156f07767a85a4312321f63968338a01" ) == 0 );
1105 FCT_TEST_BGN(aes_192_ecb_encrypt_nist_kat_2)
1107 unsigned char key_str[100];
1108 unsigned char src_str[100];
1109 unsigned char dst_str[100];
1110 unsigned char output[100];
1114 memset(key_str, 0x00, 100);
1115 memset(src_str, 0x00, 100);
1116 memset(dst_str, 0x00, 100);
1117 memset(output, 0x00, 100);
1119 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1120 unhexify( src_str,
"fffffffffffffffffffffc0000000000" );
1126 hexify( dst_str, output, 16 );
1128 fct_chk( strcmp( (
char *) dst_str,
"15eec9ebf42b9ca76897d2cd6c5a12e2" ) == 0 );
1134 FCT_TEST_BGN(aes_192_ecb_encrypt_nist_kat_3)
1136 unsigned char key_str[100];
1137 unsigned char src_str[100];
1138 unsigned char dst_str[100];
1139 unsigned char output[100];
1143 memset(key_str, 0x00, 100);
1144 memset(src_str, 0x00, 100);
1145 memset(dst_str, 0x00, 100);
1146 memset(output, 0x00, 100);
1148 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1149 unhexify( src_str,
"fffffffffffffffffffffe0000000000" );
1155 hexify( dst_str, output, 16 );
1157 fct_chk( strcmp( (
char *) dst_str,
"db0d3a6fdcc13f915e2b302ceeb70fd8" ) == 0 );
1163 FCT_TEST_BGN(aes_192_ecb_encrypt_nist_kat_4)
1165 unsigned char key_str[100];
1166 unsigned char src_str[100];
1167 unsigned char dst_str[100];
1168 unsigned char output[100];
1172 memset(key_str, 0x00, 100);
1173 memset(src_str, 0x00, 100);
1174 memset(dst_str, 0x00, 100);
1175 memset(output, 0x00, 100);
1177 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1178 unhexify( src_str,
"51719783d3185a535bd75adc65071ce1" );
1184 hexify( dst_str, output, 16 );
1186 fct_chk( strcmp( (
char *) dst_str,
"4f354592ff7c8847d2d0870ca9481b7c" ) == 0 );
1192 FCT_TEST_BGN(aes_192_ecb_encrypt_nist_kat_5)
1194 unsigned char key_str[100];
1195 unsigned char src_str[100];
1196 unsigned char dst_str[100];
1197 unsigned char output[100];
1201 memset(key_str, 0x00, 100);
1202 memset(src_str, 0x00, 100);
1203 memset(dst_str, 0x00, 100);
1204 memset(output, 0x00, 100);
1206 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1207 unhexify( src_str,
"26aa49dcfe7629a8901a69a9914e6dfd" );
1213 hexify( dst_str, output, 16 );
1215 fct_chk( strcmp( (
char *) dst_str,
"d5e08bf9a182e857cf40b3a36ee248cc" ) == 0 );
1221 FCT_TEST_BGN(aes_192_ecb_encrypt_nist_kat_6)
1223 unsigned char key_str[100];
1224 unsigned char src_str[100];
1225 unsigned char dst_str[100];
1226 unsigned char output[100];
1230 memset(key_str, 0x00, 100);
1231 memset(src_str, 0x00, 100);
1232 memset(dst_str, 0x00, 100);
1233 memset(output, 0x00, 100);
1235 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1236 unhexify( src_str,
"941a4773058224e1ef66d10e0a6ee782" );
1242 hexify( dst_str, output, 16 );
1244 fct_chk( strcmp( (
char *) dst_str,
"067cd9d3749207791841562507fa9626" ) == 0 );
1250 FCT_TEST_BGN(aes_192_ecb_encrypt_nist_kat_7)
1252 unsigned char key_str[100];
1253 unsigned char src_str[100];
1254 unsigned char dst_str[100];
1255 unsigned char output[100];
1259 memset(key_str, 0x00, 100);
1260 memset(src_str, 0x00, 100);
1261 memset(dst_str, 0x00, 100);
1262 memset(output, 0x00, 100);
1264 key_len =
unhexify( key_str,
"d2926527e0aa9f37b45e2ec2ade5853ef807576104c7ace3" );
1265 unhexify( src_str,
"00000000000000000000000000000000" );
1271 hexify( dst_str, output, 16 );
1273 fct_chk( strcmp( (
char *) dst_str,
"dd619e1cf204446112e0af2b9afa8f8c" ) == 0 );
1279 FCT_TEST_BGN(aes_192_ecb_encrypt_nist_kat_8)
1281 unsigned char key_str[100];
1282 unsigned char src_str[100];
1283 unsigned char dst_str[100];
1284 unsigned char output[100];
1288 memset(key_str, 0x00, 100);
1289 memset(src_str, 0x00, 100);
1290 memset(dst_str, 0x00, 100);
1291 memset(output, 0x00, 100);
1293 key_len =
unhexify( key_str,
"982215f4e173dfa0fcffe5d3da41c4812c7bcc8ed3540f93" );
1294 unhexify( src_str,
"00000000000000000000000000000000" );
1300 hexify( dst_str, output, 16 );
1302 fct_chk( strcmp( (
char *) dst_str,
"d4f0aae13c8fe9339fbf9e69ed0ad74d" ) == 0 );
1308 FCT_TEST_BGN(aes_192_ecb_encrypt_nist_kat_9)
1310 unsigned char key_str[100];
1311 unsigned char src_str[100];
1312 unsigned char dst_str[100];
1313 unsigned char output[100];
1317 memset(key_str, 0x00, 100);
1318 memset(src_str, 0x00, 100);
1319 memset(dst_str, 0x00, 100);
1320 memset(output, 0x00, 100);
1322 key_len =
unhexify( key_str,
"98c6b8e01e379fbd14e61af6af891596583565f2a27d59e9" );
1323 unhexify( src_str,
"00000000000000000000000000000000" );
1329 hexify( dst_str, output, 16 );
1331 fct_chk( strcmp( (
char *) dst_str,
"19c80ec4a6deb7e5ed1033dda933498f" ) == 0 );
1337 FCT_TEST_BGN(aes_192_ecb_encrypt_nist_kat_10)
1339 unsigned char key_str[100];
1340 unsigned char src_str[100];
1341 unsigned char dst_str[100];
1342 unsigned char output[100];
1346 memset(key_str, 0x00, 100);
1347 memset(src_str, 0x00, 100);
1348 memset(dst_str, 0x00, 100);
1349 memset(output, 0x00, 100);
1351 key_len =
unhexify( key_str,
"fffffffffffffffffffffffffff800000000000000000000" );
1352 unhexify( src_str,
"00000000000000000000000000000000" );
1358 hexify( dst_str, output, 16 );
1360 fct_chk( strcmp( (
char *) dst_str,
"8dd274bd0f1b58ae345d9e7233f9b8f3" ) == 0 );
1366 FCT_TEST_BGN(aes_192_ecb_encrypt_nist_kat_11)
1368 unsigned char key_str[100];
1369 unsigned char src_str[100];
1370 unsigned char dst_str[100];
1371 unsigned char output[100];
1375 memset(key_str, 0x00, 100);
1376 memset(src_str, 0x00, 100);
1377 memset(dst_str, 0x00, 100);
1378 memset(output, 0x00, 100);
1380 key_len =
unhexify( key_str,
"fffffffffffffffffffffffffffc00000000000000000000" );
1381 unhexify( src_str,
"00000000000000000000000000000000" );
1387 hexify( dst_str, output, 16 );
1389 fct_chk( strcmp( (
char *) dst_str,
"9d6bdc8f4ce5feb0f3bed2e4b9a9bb0b" ) == 0 );
1395 FCT_TEST_BGN(aes_192_ecb_encrypt_nist_kat_12)
1397 unsigned char key_str[100];
1398 unsigned char src_str[100];
1399 unsigned char dst_str[100];
1400 unsigned char output[100];
1404 memset(key_str, 0x00, 100);
1405 memset(src_str, 0x00, 100);
1406 memset(dst_str, 0x00, 100);
1407 memset(output, 0x00, 100);
1409 key_len =
unhexify( key_str,
"fffffffffffffffffffffffffffe00000000000000000000" );
1410 unhexify( src_str,
"00000000000000000000000000000000" );
1416 hexify( dst_str, output, 16 );
1418 fct_chk( strcmp( (
char *) dst_str,
"fd5548bcf3f42565f7efa94562528d46" ) == 0 );
1424 FCT_TEST_BGN(aes_192_ecb_decrypt_nist_kat_1)
1426 unsigned char key_str[100];
1427 unsigned char src_str[100];
1428 unsigned char dst_str[100];
1429 unsigned char output[100];
1433 memset(key_str, 0x00, 100);
1434 memset(src_str, 0x00, 100);
1435 memset(dst_str, 0x00, 100);
1436 memset(output, 0x00, 100);
1438 key_len =
unhexify( key_str,
"fffffffffffffffffffffffffffffffff000000000000000" );
1439 unhexify( src_str,
"bb2852c891c5947d2ed44032c421b85f" );
1445 hexify( dst_str, output, 16 );
1447 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1453 FCT_TEST_BGN(aes_192_ecb_decrypt_nist_kat_2)
1455 unsigned char key_str[100];
1456 unsigned char src_str[100];
1457 unsigned char dst_str[100];
1458 unsigned char output[100];
1462 memset(key_str, 0x00, 100);
1463 memset(src_str, 0x00, 100);
1464 memset(dst_str, 0x00, 100);
1465 memset(output, 0x00, 100);
1467 key_len =
unhexify( key_str,
"fffffffffffffffffffffffffffffffff800000000000000" );
1468 unhexify( src_str,
"1b9f5fbd5e8a4264c0a85b80409afa5e" );
1474 hexify( dst_str, output, 16 );
1476 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1482 FCT_TEST_BGN(aes_192_ecb_decrypt_nist_kat_3)
1484 unsigned char key_str[100];
1485 unsigned char src_str[100];
1486 unsigned char dst_str[100];
1487 unsigned char output[100];
1491 memset(key_str, 0x00, 100);
1492 memset(src_str, 0x00, 100);
1493 memset(dst_str, 0x00, 100);
1494 memset(output, 0x00, 100);
1496 key_len =
unhexify( key_str,
"fffffffffffffffffffffffffffffffffc00000000000000" );
1497 unhexify( src_str,
"30dab809f85a917fe924733f424ac589" );
1503 hexify( dst_str, output, 16 );
1505 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1511 FCT_TEST_BGN(aes_192_ecb_decrypt_nist_kat_4)
1513 unsigned char key_str[100];
1514 unsigned char src_str[100];
1515 unsigned char dst_str[100];
1516 unsigned char output[100];
1520 memset(key_str, 0x00, 100);
1521 memset(src_str, 0x00, 100);
1522 memset(dst_str, 0x00, 100);
1523 memset(output, 0x00, 100);
1525 key_len =
unhexify( key_str,
"61257134a518a0d57d9d244d45f6498cbc32f2bafc522d79" );
1526 unhexify( src_str,
"cfe4d74002696ccf7d87b14a2f9cafc9" );
1532 hexify( dst_str, output, 16 );
1534 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1540 FCT_TEST_BGN(aes_192_ecb_decrypt_nist_kat_5)
1542 unsigned char key_str[100];
1543 unsigned char src_str[100];
1544 unsigned char dst_str[100];
1545 unsigned char output[100];
1549 memset(key_str, 0x00, 100);
1550 memset(src_str, 0x00, 100);
1551 memset(dst_str, 0x00, 100);
1552 memset(output, 0x00, 100);
1554 key_len =
unhexify( key_str,
"b0ab0a6a818baef2d11fa33eac947284fb7d748cfb75e570" );
1555 unhexify( src_str,
"d2eafd86f63b109b91f5dbb3a3fb7e13" );
1561 hexify( dst_str, output, 16 );
1563 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1569 FCT_TEST_BGN(aes_192_ecb_decrypt_nist_kat_6)
1571 unsigned char key_str[100];
1572 unsigned char src_str[100];
1573 unsigned char dst_str[100];
1574 unsigned char output[100];
1578 memset(key_str, 0x00, 100);
1579 memset(src_str, 0x00, 100);
1580 memset(dst_str, 0x00, 100);
1581 memset(output, 0x00, 100);
1583 key_len =
unhexify( key_str,
"ee053aa011c8b428cdcc3636313c54d6a03cac01c71579d6" );
1584 unhexify( src_str,
"9b9fdd1c5975655f539998b306a324af" );
1590 hexify( dst_str, output, 16 );
1592 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1598 FCT_TEST_BGN(aes_192_ecb_decrypt_nist_kat_7)
1600 unsigned char key_str[100];
1601 unsigned char src_str[100];
1602 unsigned char dst_str[100];
1603 unsigned char output[100];
1607 memset(key_str, 0x00, 100);
1608 memset(src_str, 0x00, 100);
1609 memset(dst_str, 0x00, 100);
1610 memset(output, 0x00, 100);
1612 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1613 unhexify( src_str,
"275cfc0413d8ccb70513c3859b1d0f72" );
1619 hexify( dst_str, output, 16 );
1621 fct_chk( strcmp( (
char *) dst_str,
"1b077a6af4b7f98229de786d7516b639" ) == 0 );
1627 FCT_TEST_BGN(aes_192_ecb_decrypt_nist_kat_8)
1629 unsigned char key_str[100];
1630 unsigned char src_str[100];
1631 unsigned char dst_str[100];
1632 unsigned char output[100];
1636 memset(key_str, 0x00, 100);
1637 memset(src_str, 0x00, 100);
1638 memset(dst_str, 0x00, 100);
1639 memset(output, 0x00, 100);
1641 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1642 unhexify( src_str,
"c9b8135ff1b5adc413dfd053b21bd96d" );
1648 hexify( dst_str, output, 16 );
1650 fct_chk( strcmp( (
char *) dst_str,
"9c2d8842e5f48f57648205d39a239af1" ) == 0 );
1656 FCT_TEST_BGN(aes_192_ecb_decrypt_nist_kat_9)
1658 unsigned char key_str[100];
1659 unsigned char src_str[100];
1660 unsigned char dst_str[100];
1661 unsigned char output[100];
1665 memset(key_str, 0x00, 100);
1666 memset(src_str, 0x00, 100);
1667 memset(dst_str, 0x00, 100);
1668 memset(output, 0x00, 100);
1670 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1671 unhexify( src_str,
"4a3650c3371ce2eb35e389a171427440" );
1677 hexify( dst_str, output, 16 );
1679 fct_chk( strcmp( (
char *) dst_str,
"bff52510095f518ecca60af4205444bb" ) == 0 );
1685 FCT_TEST_BGN(aes_192_ecb_decrypt_nist_kat_10)
1687 unsigned char key_str[100];
1688 unsigned char src_str[100];
1689 unsigned char dst_str[100];
1690 unsigned char output[100];
1694 memset(key_str, 0x00, 100);
1695 memset(src_str, 0x00, 100);
1696 memset(dst_str, 0x00, 100);
1697 memset(output, 0x00, 100);
1699 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1700 unhexify( src_str,
"b2099795e88cc158fd75ea133d7e7fbe" );
1706 hexify( dst_str, output, 16 );
1708 fct_chk( strcmp( (
char *) dst_str,
"ffffffffffffffffffffc00000000000" ) == 0 );
1714 FCT_TEST_BGN(aes_192_ecb_decrypt_nist_kat_11)
1716 unsigned char key_str[100];
1717 unsigned char src_str[100];
1718 unsigned char dst_str[100];
1719 unsigned char output[100];
1723 memset(key_str, 0x00, 100);
1724 memset(src_str, 0x00, 100);
1725 memset(dst_str, 0x00, 100);
1726 memset(output, 0x00, 100);
1728 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1729 unhexify( src_str,
"a6cae46fb6fadfe7a2c302a34242817b" );
1735 hexify( dst_str, output, 16 );
1737 fct_chk( strcmp( (
char *) dst_str,
"ffffffffffffffffffffe00000000000" ) == 0 );
1743 FCT_TEST_BGN(aes_192_ecb_decrypt_nist_kat_12)
1745 unsigned char key_str[100];
1746 unsigned char src_str[100];
1747 unsigned char dst_str[100];
1748 unsigned char output[100];
1752 memset(key_str, 0x00, 100);
1753 memset(src_str, 0x00, 100);
1754 memset(dst_str, 0x00, 100);
1755 memset(output, 0x00, 100);
1757 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1758 unhexify( src_str,
"026a7024d6a902e0b3ffccbaa910cc3f" );
1764 hexify( dst_str, output, 16 );
1766 fct_chk( strcmp( (
char *) dst_str,
"fffffffffffffffffffff00000000000" ) == 0 );
1772 FCT_TEST_BGN(aes_256_ecb_encrypt_nist_kat_1)
1774 unsigned char key_str[100];
1775 unsigned char src_str[100];
1776 unsigned char dst_str[100];
1777 unsigned char output[100];
1781 memset(key_str, 0x00, 100);
1782 memset(src_str, 0x00, 100);
1783 memset(dst_str, 0x00, 100);
1784 memset(output, 0x00, 100);
1786 key_len =
unhexify( key_str,
"c1cc358b449909a19436cfbb3f852ef8bcb5ed12ac7058325f56e6099aab1a1c" );
1787 unhexify( src_str,
"00000000000000000000000000000000" );
1793 hexify( dst_str, output, 16 );
1795 fct_chk( strcmp( (
char *) dst_str,
"352065272169abf9856843927d0674fd" ) == 0 );
1801 FCT_TEST_BGN(aes_256_ecb_encrypt_nist_kat_2)
1803 unsigned char key_str[100];
1804 unsigned char src_str[100];
1805 unsigned char dst_str[100];
1806 unsigned char output[100];
1810 memset(key_str, 0x00, 100);
1811 memset(src_str, 0x00, 100);
1812 memset(dst_str, 0x00, 100);
1813 memset(output, 0x00, 100);
1815 key_len =
unhexify( key_str,
"984ca75f4ee8d706f46c2d98c0bf4a45f5b00d791c2dfeb191b5ed8e420fd627" );
1816 unhexify( src_str,
"00000000000000000000000000000000" );
1822 hexify( dst_str, output, 16 );
1824 fct_chk( strcmp( (
char *) dst_str,
"4307456a9e67813b452e15fa8fffe398" ) == 0 );
1830 FCT_TEST_BGN(aes_256_ecb_encrypt_nist_kat_3)
1832 unsigned char key_str[100];
1833 unsigned char src_str[100];
1834 unsigned char dst_str[100];
1835 unsigned char output[100];
1839 memset(key_str, 0x00, 100);
1840 memset(src_str, 0x00, 100);
1841 memset(dst_str, 0x00, 100);
1842 memset(output, 0x00, 100);
1844 key_len =
unhexify( key_str,
"b43d08a447ac8609baadae4ff12918b9f68fc1653f1269222f123981ded7a92f" );
1845 unhexify( src_str,
"00000000000000000000000000000000" );
1851 hexify( dst_str, output, 16 );
1853 fct_chk( strcmp( (
char *) dst_str,
"4663446607354989477a5c6f0f007ef4" ) == 0 );
1859 FCT_TEST_BGN(aes_256_ecb_encrypt_nist_kat_4)
1861 unsigned char key_str[100];
1862 unsigned char src_str[100];
1863 unsigned char dst_str[100];
1864 unsigned char output[100];
1868 memset(key_str, 0x00, 100);
1869 memset(src_str, 0x00, 100);
1870 memset(dst_str, 0x00, 100);
1871 memset(output, 0x00, 100);
1873 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
1874 unhexify( src_str,
"0b24af36193ce4665f2825d7b4749c98" );
1880 hexify( dst_str, output, 16 );
1882 fct_chk( strcmp( (
char *) dst_str,
"a9ff75bd7cf6613d3731c77c3b6d0c04" ) == 0 );
1888 FCT_TEST_BGN(aes_256_ecb_encrypt_nist_kat_5)
1890 unsigned char key_str[100];
1891 unsigned char src_str[100];
1892 unsigned char dst_str[100];
1893 unsigned char output[100];
1897 memset(key_str, 0x00, 100);
1898 memset(src_str, 0x00, 100);
1899 memset(dst_str, 0x00, 100);
1900 memset(output, 0x00, 100);
1902 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
1903 unhexify( src_str,
"761c1fe41a18acf20d241650611d90f1" );
1909 hexify( dst_str, output, 16 );
1911 fct_chk( strcmp( (
char *) dst_str,
"623a52fcea5d443e48d9181ab32c7421" ) == 0 );
1917 FCT_TEST_BGN(aes_256_ecb_encrypt_nist_kat_6)
1919 unsigned char key_str[100];
1920 unsigned char src_str[100];
1921 unsigned char dst_str[100];
1922 unsigned char output[100];
1926 memset(key_str, 0x00, 100);
1927 memset(src_str, 0x00, 100);
1928 memset(dst_str, 0x00, 100);
1929 memset(output, 0x00, 100);
1931 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
1932 unhexify( src_str,
"8a560769d605868ad80d819bdba03771" );
1938 hexify( dst_str, output, 16 );
1940 fct_chk( strcmp( (
char *) dst_str,
"38f2c7ae10612415d27ca190d27da8b4" ) == 0 );
1946 FCT_TEST_BGN(aes_256_ecb_encrypt_nist_kat_7)
1948 unsigned char key_str[100];
1949 unsigned char src_str[100];
1950 unsigned char dst_str[100];
1951 unsigned char output[100];
1955 memset(key_str, 0x00, 100);
1956 memset(src_str, 0x00, 100);
1957 memset(dst_str, 0x00, 100);
1958 memset(output, 0x00, 100);
1960 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
1961 unhexify( src_str,
"ffffff80000000000000000000000000" );
1967 hexify( dst_str, output, 16 );
1969 fct_chk( strcmp( (
char *) dst_str,
"36aff0ef7bf3280772cf4cac80a0d2b2" ) == 0 );
1975 FCT_TEST_BGN(aes_256_ecb_encrypt_nist_kat_8)
1977 unsigned char key_str[100];
1978 unsigned char src_str[100];
1979 unsigned char dst_str[100];
1980 unsigned char output[100];
1984 memset(key_str, 0x00, 100);
1985 memset(src_str, 0x00, 100);
1986 memset(dst_str, 0x00, 100);
1987 memset(output, 0x00, 100);
1989 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
1990 unhexify( src_str,
"ffffffc0000000000000000000000000" );
1996 hexify( dst_str, output, 16 );
1998 fct_chk( strcmp( (
char *) dst_str,
"1f8eedea0f62a1406d58cfc3ecea72cf" ) == 0 );
2004 FCT_TEST_BGN(aes_256_ecb_encrypt_nist_kat_9)
2006 unsigned char key_str[100];
2007 unsigned char src_str[100];
2008 unsigned char dst_str[100];
2009 unsigned char output[100];
2013 memset(key_str, 0x00, 100);
2014 memset(src_str, 0x00, 100);
2015 memset(dst_str, 0x00, 100);
2016 memset(output, 0x00, 100);
2018 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
2019 unhexify( src_str,
"ffffffe0000000000000000000000000" );
2025 hexify( dst_str, output, 16 );
2027 fct_chk( strcmp( (
char *) dst_str,
"abf4154a3375a1d3e6b1d454438f95a6" ) == 0 );
2033 FCT_TEST_BGN(aes_256_ecb_encrypt_nist_kat_10)
2035 unsigned char key_str[100];
2036 unsigned char src_str[100];
2037 unsigned char dst_str[100];
2038 unsigned char output[100];
2042 memset(key_str, 0x00, 100);
2043 memset(src_str, 0x00, 100);
2044 memset(dst_str, 0x00, 100);
2045 memset(output, 0x00, 100);
2047 key_len =
unhexify( key_str,
"ffffffffffffffffffffffffffffffffffff8000000000000000000000000000" );
2048 unhexify( src_str,
"00000000000000000000000000000000" );
2054 hexify( dst_str, output, 16 );
2056 fct_chk( strcmp( (
char *) dst_str,
"45d089c36d5c5a4efc689e3b0de10dd5" ) == 0 );
2062 FCT_TEST_BGN(aes_256_ecb_encrypt_nist_kat_11)
2064 unsigned char key_str[100];
2065 unsigned char src_str[100];
2066 unsigned char dst_str[100];
2067 unsigned char output[100];
2071 memset(key_str, 0x00, 100);
2072 memset(src_str, 0x00, 100);
2073 memset(dst_str, 0x00, 100);
2074 memset(output, 0x00, 100);
2076 key_len =
unhexify( key_str,
"ffffffffffffffffffffffffffffffffffffc000000000000000000000000000" );
2077 unhexify( src_str,
"00000000000000000000000000000000" );
2083 hexify( dst_str, output, 16 );
2085 fct_chk( strcmp( (
char *) dst_str,
"b4da5df4becb5462e03a0ed00d295629" ) == 0 );
2091 FCT_TEST_BGN(aes_256_ecb_encrypt_nist_kat_12)
2093 unsigned char key_str[100];
2094 unsigned char src_str[100];
2095 unsigned char dst_str[100];
2096 unsigned char output[100];
2100 memset(key_str, 0x00, 100);
2101 memset(src_str, 0x00, 100);
2102 memset(dst_str, 0x00, 100);
2103 memset(output, 0x00, 100);
2105 key_len =
unhexify( key_str,
"ffffffffffffffffffffffffffffffffffffe000000000000000000000000000" );
2106 unhexify( src_str,
"00000000000000000000000000000000" );
2112 hexify( dst_str, output, 16 );
2114 fct_chk( strcmp( (
char *) dst_str,
"dcf4e129136c1a4b7a0f38935cc34b2b" ) == 0 );
2120 FCT_TEST_BGN(aes_256_ecb_decrypt_nist_kat_1)
2122 unsigned char key_str[100];
2123 unsigned char src_str[100];
2124 unsigned char dst_str[100];
2125 unsigned char output[100];
2129 memset(key_str, 0x00, 100);
2130 memset(src_str, 0x00, 100);
2131 memset(dst_str, 0x00, 100);
2132 memset(output, 0x00, 100);
2134 key_len =
unhexify( key_str,
"fffffffffffffffffffffffffffffffffffffffffffffff00000000000000000" );
2135 unhexify( src_str,
"edf61ae362e882ddc0167474a7a77f3a" );
2141 hexify( dst_str, output, 16 );
2143 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2149 FCT_TEST_BGN(aes_256_ecb_decrypt_nist_kat_2)
2151 unsigned char key_str[100];
2152 unsigned char src_str[100];
2153 unsigned char dst_str[100];
2154 unsigned char output[100];
2158 memset(key_str, 0x00, 100);
2159 memset(src_str, 0x00, 100);
2160 memset(dst_str, 0x00, 100);
2161 memset(output, 0x00, 100);
2163 key_len =
unhexify( key_str,
"fffffffffffffffffffffffffffffffffffffffffffffff80000000000000000" );
2164 unhexify( src_str,
"6168b00ba7859e0970ecfd757efecf7c" );
2170 hexify( dst_str, output, 16 );
2172 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2178 FCT_TEST_BGN(aes_256_ecb_decrypt_nist_kat_3)
2180 unsigned char key_str[100];
2181 unsigned char src_str[100];
2182 unsigned char dst_str[100];
2183 unsigned char output[100];
2187 memset(key_str, 0x00, 100);
2188 memset(src_str, 0x00, 100);
2189 memset(dst_str, 0x00, 100);
2190 memset(output, 0x00, 100);
2192 key_len =
unhexify( key_str,
"fffffffffffffffffffffffffffffffffffffffffffffffc0000000000000000" );
2193 unhexify( src_str,
"d1415447866230d28bb1ea18a4cdfd02" );
2199 hexify( dst_str, output, 16 );
2201 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2207 FCT_TEST_BGN(aes_256_ecb_decrypt_nist_kat_4)
2209 unsigned char key_str[100];
2210 unsigned char src_str[100];
2211 unsigned char dst_str[100];
2212 unsigned char output[100];
2216 memset(key_str, 0x00, 100);
2217 memset(src_str, 0x00, 100);
2218 memset(dst_str, 0x00, 100);
2219 memset(output, 0x00, 100);
2221 key_len =
unhexify( key_str,
"f8be9ba615c5a952cabbca24f68f8593039624d524c816acda2c9183bd917cb9" );
2222 unhexify( src_str,
"a3944b95ca0b52043584ef02151926a8" );
2228 hexify( dst_str, output, 16 );
2230 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2236 FCT_TEST_BGN(aes_256_ecb_decrypt_nist_kat_5)
2238 unsigned char key_str[100];
2239 unsigned char src_str[100];
2240 unsigned char dst_str[100];
2241 unsigned char output[100];
2245 memset(key_str, 0x00, 100);
2246 memset(src_str, 0x00, 100);
2247 memset(dst_str, 0x00, 100);
2248 memset(output, 0x00, 100);
2250 key_len =
unhexify( key_str,
"797f8b3d176dac5b7e34a2d539c4ef367a16f8635f6264737591c5c07bf57a3e" );
2251 unhexify( src_str,
"a74289fe73a4c123ca189ea1e1b49ad5" );
2257 hexify( dst_str, output, 16 );
2259 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2265 FCT_TEST_BGN(aes_256_ecb_decrypt_nist_kat_6)
2267 unsigned char key_str[100];
2268 unsigned char src_str[100];
2269 unsigned char dst_str[100];
2270 unsigned char output[100];
2274 memset(key_str, 0x00, 100);
2275 memset(src_str, 0x00, 100);
2276 memset(dst_str, 0x00, 100);
2277 memset(output, 0x00, 100);
2279 key_len =
unhexify( key_str,
"6838d40caf927749c13f0329d331f448e202c73ef52c5f73a37ca635d4c47707" );
2280 unhexify( src_str,
"b91d4ea4488644b56cf0812fa7fcf5fc" );
2286 hexify( dst_str, output, 16 );
2288 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2294 FCT_TEST_BGN(aes_256_ecb_decrypt_nist_kat_7)
2296 unsigned char key_str[100];
2297 unsigned char src_str[100];
2298 unsigned char dst_str[100];
2299 unsigned char output[100];
2303 memset(key_str, 0x00, 100);
2304 memset(src_str, 0x00, 100);
2305 memset(dst_str, 0x00, 100);
2306 memset(output, 0x00, 100);
2308 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
2309 unhexify( src_str,
"623a52fcea5d443e48d9181ab32c7421" );
2315 hexify( dst_str, output, 16 );
2317 fct_chk( strcmp( (
char *) dst_str,
"761c1fe41a18acf20d241650611d90f1" ) == 0 );
2323 FCT_TEST_BGN(aes_256_ecb_decrypt_nist_kat_8)
2325 unsigned char key_str[100];
2326 unsigned char src_str[100];
2327 unsigned char dst_str[100];
2328 unsigned char output[100];
2332 memset(key_str, 0x00, 100);
2333 memset(src_str, 0x00, 100);
2334 memset(dst_str, 0x00, 100);
2335 memset(output, 0x00, 100);
2337 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
2338 unhexify( src_str,
"38f2c7ae10612415d27ca190d27da8b4" );
2344 hexify( dst_str, output, 16 );
2346 fct_chk( strcmp( (
char *) dst_str,
"8a560769d605868ad80d819bdba03771" ) == 0 );
2352 FCT_TEST_BGN(aes_256_ecb_decrypt_nist_kat_9)
2354 unsigned char key_str[100];
2355 unsigned char src_str[100];
2356 unsigned char dst_str[100];
2357 unsigned char output[100];
2361 memset(key_str, 0x00, 100);
2362 memset(src_str, 0x00, 100);
2363 memset(dst_str, 0x00, 100);
2364 memset(output, 0x00, 100);
2366 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
2367 unhexify( src_str,
"1bc704f1bce135ceb810341b216d7abe" );
2373 hexify( dst_str, output, 16 );
2375 fct_chk( strcmp( (
char *) dst_str,
"91fbef2d15a97816060bee1feaa49afe" ) == 0 );
2381 FCT_TEST_BGN(aes_256_ecb_decrypt_nist_kat_10)
2383 unsigned char key_str[100];
2384 unsigned char src_str[100];
2385 unsigned char dst_str[100];
2386 unsigned char output[100];
2390 memset(key_str, 0x00, 100);
2391 memset(src_str, 0x00, 100);
2392 memset(dst_str, 0x00, 100);
2393 memset(output, 0x00, 100);
2395 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
2396 unhexify( src_str,
"ddc6bf790c15760d8d9aeb6f9a75fd4e" );
2402 hexify( dst_str, output, 16 );
2404 fct_chk( strcmp( (
char *) dst_str,
"80000000000000000000000000000000" ) == 0 );
2410 FCT_TEST_BGN(aes_256_ecb_decrypt_nist_kat_11)
2412 unsigned char key_str[100];
2413 unsigned char src_str[100];
2414 unsigned char dst_str[100];
2415 unsigned char output[100];
2419 memset(key_str, 0x00, 100);
2420 memset(src_str, 0x00, 100);
2421 memset(dst_str, 0x00, 100);
2422 memset(output, 0x00, 100);
2424 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
2425 unhexify( src_str,
"0a6bdc6d4c1e6280301fd8e97ddbe601" );
2431 hexify( dst_str, output, 16 );
2433 fct_chk( strcmp( (
char *) dst_str,
"c0000000000000000000000000000000" ) == 0 );
2439 FCT_TEST_BGN(aes_256_ecb_decrypt_nist_kat_12)
2441 unsigned char key_str[100];
2442 unsigned char src_str[100];
2443 unsigned char dst_str[100];
2444 unsigned char output[100];
2448 memset(key_str, 0x00, 100);
2449 memset(src_str, 0x00, 100);
2450 memset(dst_str, 0x00, 100);
2451 memset(output, 0x00, 100);
2453 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
2454 unhexify( src_str,
"9b80eefb7ebe2d2b16247aa0efc72f5d" );
2460 hexify( dst_str, output, 16 );
2462 fct_chk( strcmp( (
char *) dst_str,
"e0000000000000000000000000000000" ) == 0 );
2468 FCT_TEST_BGN(aes_128_cbc_encrypt_nist_kat_1)
2470 unsigned char key_str[100];
2471 unsigned char iv_str[100];
2472 unsigned char src_str[100];
2473 unsigned char dst_str[100];
2474 unsigned char output[100];
2476 int key_len, data_len;
2478 memset(key_str, 0x00, 100);
2479 memset(iv_str, 0x00, 100);
2480 memset(src_str, 0x00, 100);
2481 memset(dst_str, 0x00, 100);
2482 memset(output, 0x00, 100);
2484 key_len =
unhexify( key_str,
"fffffffffffff8000000000000000000" );
2485 unhexify( iv_str,
"00000000000000000000000000000000" );
2486 data_len =
unhexify( src_str,
"00000000000000000000000000000000" );
2492 hexify( dst_str, output, data_len );
2494 fct_chk( strcmp( (
char *) dst_str,
"8b527a6aebdaec9eaef8eda2cb7783e5" ) == 0 );
2500 FCT_TEST_BGN(aes_128_cbc_encrypt_nist_kat_2)
2502 unsigned char key_str[100];
2503 unsigned char iv_str[100];
2504 unsigned char src_str[100];
2505 unsigned char dst_str[100];
2506 unsigned char output[100];
2508 int key_len, data_len;
2510 memset(key_str, 0x00, 100);
2511 memset(iv_str, 0x00, 100);
2512 memset(src_str, 0x00, 100);
2513 memset(dst_str, 0x00, 100);
2514 memset(output, 0x00, 100);
2516 key_len =
unhexify( key_str,
"fffffffffffffc000000000000000000" );
2517 unhexify( iv_str,
"00000000000000000000000000000000" );
2518 data_len =
unhexify( src_str,
"00000000000000000000000000000000" );
2524 hexify( dst_str, output, data_len );
2526 fct_chk( strcmp( (
char *) dst_str,
"43fdaf53ebbc9880c228617d6a9b548b" ) == 0 );
2532 FCT_TEST_BGN(aes_128_cbc_encrypt_nist_kat_3)
2534 unsigned char key_str[100];
2535 unsigned char iv_str[100];
2536 unsigned char src_str[100];
2537 unsigned char dst_str[100];
2538 unsigned char output[100];
2540 int key_len, data_len;
2542 memset(key_str, 0x00, 100);
2543 memset(iv_str, 0x00, 100);
2544 memset(src_str, 0x00, 100);
2545 memset(dst_str, 0x00, 100);
2546 memset(output, 0x00, 100);
2548 key_len =
unhexify( key_str,
"fffffffffffffe000000000000000000" );
2549 unhexify( iv_str,
"00000000000000000000000000000000" );
2550 data_len =
unhexify( src_str,
"00000000000000000000000000000000" );
2556 hexify( dst_str, output, data_len );
2558 fct_chk( strcmp( (
char *) dst_str,
"53786104b9744b98f052c46f1c850d0b" ) == 0 );
2564 FCT_TEST_BGN(aes_128_cbc_encrypt_nist_kat_4)
2566 unsigned char key_str[100];
2567 unsigned char iv_str[100];
2568 unsigned char src_str[100];
2569 unsigned char dst_str[100];
2570 unsigned char output[100];
2572 int key_len, data_len;
2574 memset(key_str, 0x00, 100);
2575 memset(iv_str, 0x00, 100);
2576 memset(src_str, 0x00, 100);
2577 memset(dst_str, 0x00, 100);
2578 memset(output, 0x00, 100);
2580 key_len =
unhexify( key_str,
"e37b1c6aa2846f6fdb413f238b089f23" );
2581 unhexify( iv_str,
"00000000000000000000000000000000" );
2582 data_len =
unhexify( src_str,
"00000000000000000000000000000000" );
2588 hexify( dst_str, output, data_len );
2590 fct_chk( strcmp( (
char *) dst_str,
"43c9f7e62f5d288bb27aa40ef8fe1ea8" ) == 0 );
2596 FCT_TEST_BGN(aes_128_cbc_encrypt_nist_kat_5)
2598 unsigned char key_str[100];
2599 unsigned char iv_str[100];
2600 unsigned char src_str[100];
2601 unsigned char dst_str[100];
2602 unsigned char output[100];
2604 int key_len, data_len;
2606 memset(key_str, 0x00, 100);
2607 memset(iv_str, 0x00, 100);
2608 memset(src_str, 0x00, 100);
2609 memset(dst_str, 0x00, 100);
2610 memset(output, 0x00, 100);
2612 key_len =
unhexify( key_str,
"6c002b682483e0cabcc731c253be5674" );
2613 unhexify( iv_str,
"00000000000000000000000000000000" );
2614 data_len =
unhexify( src_str,
"00000000000000000000000000000000" );
2620 hexify( dst_str, output, data_len );
2622 fct_chk( strcmp( (
char *) dst_str,
"3580d19cff44f1014a7c966a69059de5" ) == 0 );
2628 FCT_TEST_BGN(aes_128_cbc_encrypt_nist_kat_6)
2630 unsigned char key_str[100];
2631 unsigned char iv_str[100];
2632 unsigned char src_str[100];
2633 unsigned char dst_str[100];
2634 unsigned char output[100];
2636 int key_len, data_len;
2638 memset(key_str, 0x00, 100);
2639 memset(iv_str, 0x00, 100);
2640 memset(src_str, 0x00, 100);
2641 memset(dst_str, 0x00, 100);
2642 memset(output, 0x00, 100);
2644 key_len =
unhexify( key_str,
"143ae8ed6555aba96110ab58893a8ae1" );
2645 unhexify( iv_str,
"00000000000000000000000000000000" );
2646 data_len =
unhexify( src_str,
"00000000000000000000000000000000" );
2652 hexify( dst_str, output, data_len );
2654 fct_chk( strcmp( (
char *) dst_str,
"806da864dd29d48deafbe764f8202aef" ) == 0 );
2660 FCT_TEST_BGN(aes_128_cbc_encrypt_nist_kat_7)
2662 unsigned char key_str[100];
2663 unsigned char iv_str[100];
2664 unsigned char src_str[100];
2665 unsigned char dst_str[100];
2666 unsigned char output[100];
2668 int key_len, data_len;
2670 memset(key_str, 0x00, 100);
2671 memset(iv_str, 0x00, 100);
2672 memset(src_str, 0x00, 100);
2673 memset(dst_str, 0x00, 100);
2674 memset(output, 0x00, 100);
2676 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
2677 unhexify( iv_str,
"00000000000000000000000000000000" );
2678 data_len =
unhexify( src_str,
"6a118a874519e64e9963798a503f1d35" );
2684 hexify( dst_str, output, data_len );
2686 fct_chk( strcmp( (
char *) dst_str,
"dc43be40be0e53712f7e2bf5ca707209" ) == 0 );
2692 FCT_TEST_BGN(aes_128_cbc_encrypt_nist_kat_8)
2694 unsigned char key_str[100];
2695 unsigned char iv_str[100];
2696 unsigned char src_str[100];
2697 unsigned char dst_str[100];
2698 unsigned char output[100];
2700 int key_len, data_len;
2702 memset(key_str, 0x00, 100);
2703 memset(iv_str, 0x00, 100);
2704 memset(src_str, 0x00, 100);
2705 memset(dst_str, 0x00, 100);
2706 memset(output, 0x00, 100);
2708 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
2709 unhexify( iv_str,
"00000000000000000000000000000000" );
2710 data_len =
unhexify( src_str,
"cb9fceec81286ca3e989bd979b0cb284" );
2716 hexify( dst_str, output, data_len );
2718 fct_chk( strcmp( (
char *) dst_str,
"92beedab1895a94faa69b632e5cc47ce" ) == 0 );
2724 FCT_TEST_BGN(aes_128_cbc_encrypt_nist_kat_9)
2726 unsigned char key_str[100];
2727 unsigned char iv_str[100];
2728 unsigned char src_str[100];
2729 unsigned char dst_str[100];
2730 unsigned char output[100];
2732 int key_len, data_len;
2734 memset(key_str, 0x00, 100);
2735 memset(iv_str, 0x00, 100);
2736 memset(src_str, 0x00, 100);
2737 memset(dst_str, 0x00, 100);
2738 memset(output, 0x00, 100);
2740 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
2741 unhexify( iv_str,
"00000000000000000000000000000000" );
2742 data_len =
unhexify( src_str,
"b26aeb1874e47ca8358ff22378f09144" );
2748 hexify( dst_str, output, data_len );
2750 fct_chk( strcmp( (
char *) dst_str,
"459264f4798f6a78bacb89c15ed3d601" ) == 0 );
2756 FCT_TEST_BGN(aes_128_cbc_encrypt_nist_kat_10)
2758 unsigned char key_str[100];
2759 unsigned char iv_str[100];
2760 unsigned char src_str[100];
2761 unsigned char dst_str[100];
2762 unsigned char output[100];
2764 int key_len, data_len;
2766 memset(key_str, 0x00, 100);
2767 memset(iv_str, 0x00, 100);
2768 memset(src_str, 0x00, 100);
2769 memset(dst_str, 0x00, 100);
2770 memset(output, 0x00, 100);
2772 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
2773 unhexify( iv_str,
"00000000000000000000000000000000" );
2774 data_len =
unhexify( src_str,
"ffffffffffffffffffffffc000000000" );
2780 hexify( dst_str, output, data_len );
2782 fct_chk( strcmp( (
char *) dst_str,
"90684a2ac55fe1ec2b8ebd5622520b73" ) == 0 );
2788 FCT_TEST_BGN(aes_128_cbc_encrypt_nist_kat_11)
2790 unsigned char key_str[100];
2791 unsigned char iv_str[100];
2792 unsigned char src_str[100];
2793 unsigned char dst_str[100];
2794 unsigned char output[100];
2796 int key_len, data_len;
2798 memset(key_str, 0x00, 100);
2799 memset(iv_str, 0x00, 100);
2800 memset(src_str, 0x00, 100);
2801 memset(dst_str, 0x00, 100);
2802 memset(output, 0x00, 100);
2804 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
2805 unhexify( iv_str,
"00000000000000000000000000000000" );
2806 data_len =
unhexify( src_str,
"ffffffffffffffffffffffe000000000" );
2812 hexify( dst_str, output, data_len );
2814 fct_chk( strcmp( (
char *) dst_str,
"7472f9a7988607ca79707795991035e6" ) == 0 );
2820 FCT_TEST_BGN(aes_128_cbc_encrypt_nist_kat_12)
2822 unsigned char key_str[100];
2823 unsigned char iv_str[100];
2824 unsigned char src_str[100];
2825 unsigned char dst_str[100];
2826 unsigned char output[100];
2828 int key_len, data_len;
2830 memset(key_str, 0x00, 100);
2831 memset(iv_str, 0x00, 100);
2832 memset(src_str, 0x00, 100);
2833 memset(dst_str, 0x00, 100);
2834 memset(output, 0x00, 100);
2836 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
2837 unhexify( iv_str,
"00000000000000000000000000000000" );
2838 data_len =
unhexify( src_str,
"fffffffffffffffffffffff000000000" );
2844 hexify( dst_str, output, data_len );
2846 fct_chk( strcmp( (
char *) dst_str,
"56aff089878bf3352f8df172a3ae47d8" ) == 0 );
2852 FCT_TEST_BGN(aes_128_cbc_decrypt_nist_kat_1)
2854 unsigned char key_str[100];
2855 unsigned char iv_str[100];
2856 unsigned char src_str[100];
2857 unsigned char dst_str[100];
2858 unsigned char output[100];
2860 int key_len, data_len;
2862 memset(key_str, 0x00, 100);
2863 memset(iv_str, 0x00, 100);
2864 memset(src_str, 0x00, 100);
2865 memset(dst_str, 0x00, 100);
2866 memset(output, 0x00, 100);
2868 key_len =
unhexify( key_str,
"ffffffffe00000000000000000000000" );
2869 unhexify( iv_str,
"00000000000000000000000000000000" );
2870 data_len =
unhexify( src_str,
"23f710842b9bb9c32f26648c786807ca" );
2876 hexify( dst_str, output, data_len );
2878 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2884 FCT_TEST_BGN(aes_128_cbc_decrypt_nist_kat_2)
2886 unsigned char key_str[100];
2887 unsigned char iv_str[100];
2888 unsigned char src_str[100];
2889 unsigned char dst_str[100];
2890 unsigned char output[100];
2892 int key_len, data_len;
2894 memset(key_str, 0x00, 100);
2895 memset(iv_str, 0x00, 100);
2896 memset(src_str, 0x00, 100);
2897 memset(dst_str, 0x00, 100);
2898 memset(output, 0x00, 100);
2900 key_len =
unhexify( key_str,
"fffffffff00000000000000000000000" );
2901 unhexify( iv_str,
"00000000000000000000000000000000" );
2902 data_len =
unhexify( src_str,
"44a98bf11e163f632c47ec6a49683a89" );
2908 hexify( dst_str, output, data_len );
2910 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2916 FCT_TEST_BGN(aes_128_cbc_decrypt_nist_kat_3)
2918 unsigned char key_str[100];
2919 unsigned char iv_str[100];
2920 unsigned char src_str[100];
2921 unsigned char dst_str[100];
2922 unsigned char output[100];
2924 int key_len, data_len;
2926 memset(key_str, 0x00, 100);
2927 memset(iv_str, 0x00, 100);
2928 memset(src_str, 0x00, 100);
2929 memset(dst_str, 0x00, 100);
2930 memset(output, 0x00, 100);
2932 key_len =
unhexify( key_str,
"fffffffff80000000000000000000000" );
2933 unhexify( iv_str,
"00000000000000000000000000000000" );
2934 data_len =
unhexify( src_str,
"0f18aff94274696d9b61848bd50ac5e5" );
2940 hexify( dst_str, output, data_len );
2942 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2948 FCT_TEST_BGN(aes_128_cbc_decrypt_nist_kat_4)
2950 unsigned char key_str[100];
2951 unsigned char iv_str[100];
2952 unsigned char src_str[100];
2953 unsigned char dst_str[100];
2954 unsigned char output[100];
2956 int key_len, data_len;
2958 memset(key_str, 0x00, 100);
2959 memset(iv_str, 0x00, 100);
2960 memset(src_str, 0x00, 100);
2961 memset(dst_str, 0x00, 100);
2962 memset(output, 0x00, 100);
2964 key_len =
unhexify( key_str,
"e234cdca2606b81f29408d5f6da21206" );
2965 unhexify( iv_str,
"00000000000000000000000000000000" );
2966 data_len =
unhexify( src_str,
"fff60a4740086b3b9c56195b98d91a7b" );
2972 hexify( dst_str, output, data_len );
2974 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2980 FCT_TEST_BGN(aes_128_cbc_decrypt_nist_kat_5)
2982 unsigned char key_str[100];
2983 unsigned char iv_str[100];
2984 unsigned char src_str[100];
2985 unsigned char dst_str[100];
2986 unsigned char output[100];
2988 int key_len, data_len;
2990 memset(key_str, 0x00, 100);
2991 memset(iv_str, 0x00, 100);
2992 memset(src_str, 0x00, 100);
2993 memset(dst_str, 0x00, 100);
2994 memset(output, 0x00, 100);
2996 key_len =
unhexify( key_str,
"13237c49074a3da078dc1d828bb78c6f" );
2997 unhexify( iv_str,
"00000000000000000000000000000000" );
2998 data_len =
unhexify( src_str,
"8146a08e2357f0caa30ca8c94d1a0544" );
3004 hexify( dst_str, output, data_len );
3006 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
3012 FCT_TEST_BGN(aes_128_cbc_decrypt_nist_kat_6)
3014 unsigned char key_str[100];
3015 unsigned char iv_str[100];
3016 unsigned char src_str[100];
3017 unsigned char dst_str[100];
3018 unsigned char output[100];
3020 int key_len, data_len;
3022 memset(key_str, 0x00, 100);
3023 memset(iv_str, 0x00, 100);
3024 memset(src_str, 0x00, 100);
3025 memset(dst_str, 0x00, 100);
3026 memset(output, 0x00, 100);
3028 key_len =
unhexify( key_str,
"3071a2a48fe6cbd04f1a129098e308f8" );
3029 unhexify( iv_str,
"00000000000000000000000000000000" );
3030 data_len =
unhexify( src_str,
"4b98e06d356deb07ebb824e5713f7be3" );
3036 hexify( dst_str, output, data_len );
3038 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
3044 FCT_TEST_BGN(aes_128_cbc_decrypt_nist_kat_7)
3046 unsigned char key_str[100];
3047 unsigned char iv_str[100];
3048 unsigned char src_str[100];
3049 unsigned char dst_str[100];
3050 unsigned char output[100];
3052 int key_len, data_len;
3054 memset(key_str, 0x00, 100);
3055 memset(iv_str, 0x00, 100);
3056 memset(src_str, 0x00, 100);
3057 memset(dst_str, 0x00, 100);
3058 memset(output, 0x00, 100);
3060 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
3061 unhexify( iv_str,
"00000000000000000000000000000000" );
3062 data_len =
unhexify( src_str,
"0336763e966d92595a567cc9ce537f5e" );
3068 hexify( dst_str, output, data_len );
3070 fct_chk( strcmp( (
char *) dst_str,
"f34481ec3cc627bacd5dc3fb08f273e6" ) == 0 );
3076 FCT_TEST_BGN(aes_128_cbc_decrypt_nist_kat_8)
3078 unsigned char key_str[100];
3079 unsigned char iv_str[100];
3080 unsigned char src_str[100];
3081 unsigned char dst_str[100];
3082 unsigned char output[100];
3084 int key_len, data_len;
3086 memset(key_str, 0x00, 100);
3087 memset(iv_str, 0x00, 100);
3088 memset(src_str, 0x00, 100);
3089 memset(dst_str, 0x00, 100);
3090 memset(output, 0x00, 100);
3092 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
3093 unhexify( iv_str,
"00000000000000000000000000000000" );
3094 data_len =
unhexify( src_str,
"a9a1631bf4996954ebc093957b234589" );
3100 hexify( dst_str, output, data_len );
3102 fct_chk( strcmp( (
char *) dst_str,
"9798c4640bad75c7c3227db910174e72" ) == 0 );
3108 FCT_TEST_BGN(aes_128_cbc_decrypt_nist_kat_9)
3110 unsigned char key_str[100];
3111 unsigned char iv_str[100];
3112 unsigned char src_str[100];
3113 unsigned char dst_str[100];
3114 unsigned char output[100];
3116 int key_len, data_len;
3118 memset(key_str, 0x00, 100);
3119 memset(iv_str, 0x00, 100);
3120 memset(src_str, 0x00, 100);
3121 memset(dst_str, 0x00, 100);
3122 memset(output, 0x00, 100);
3124 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
3125 unhexify( iv_str,
"00000000000000000000000000000000" );
3126 data_len =
unhexify( src_str,
"ff4f8391a6a40ca5b25d23bedd44a597" );
3132 hexify( dst_str, output, data_len );
3134 fct_chk( strcmp( (
char *) dst_str,
"96ab5c2ff612d9dfaae8c31f30c42168" ) == 0 );
3140 FCT_TEST_BGN(aes_128_cbc_decrypt_nist_kat_10)
3142 unsigned char key_str[100];
3143 unsigned char iv_str[100];
3144 unsigned char src_str[100];
3145 unsigned char dst_str[100];
3146 unsigned char output[100];
3148 int key_len, data_len;
3150 memset(key_str, 0x00, 100);
3151 memset(iv_str, 0x00, 100);
3152 memset(src_str, 0x00, 100);
3153 memset(dst_str, 0x00, 100);
3154 memset(output, 0x00, 100);
3156 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
3157 unhexify( iv_str,
"00000000000000000000000000000000" );
3158 data_len =
unhexify( src_str,
"f9b0fda0c4a898f5b9e6f661c4ce4d07" );
3164 hexify( dst_str, output, data_len );
3166 fct_chk( strcmp( (
char *) dst_str,
"fffffffffffffffffffffffffffffff0" ) == 0 );
3172 FCT_TEST_BGN(aes_128_cbc_decrypt_nist_kat_11)
3174 unsigned char key_str[100];
3175 unsigned char iv_str[100];
3176 unsigned char src_str[100];
3177 unsigned char dst_str[100];
3178 unsigned char output[100];
3180 int key_len, data_len;
3182 memset(key_str, 0x00, 100);
3183 memset(iv_str, 0x00, 100);
3184 memset(src_str, 0x00, 100);
3185 memset(dst_str, 0x00, 100);
3186 memset(output, 0x00, 100);
3188 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
3189 unhexify( iv_str,
"00000000000000000000000000000000" );
3190 data_len =
unhexify( src_str,
"8ade895913685c67c5269f8aae42983e" );
3196 hexify( dst_str, output, data_len );
3198 fct_chk( strcmp( (
char *) dst_str,
"fffffffffffffffffffffffffffffff8" ) == 0 );
3204 FCT_TEST_BGN(aes_128_cbc_decrypt_nist_kat_12)
3206 unsigned char key_str[100];
3207 unsigned char iv_str[100];
3208 unsigned char src_str[100];
3209 unsigned char dst_str[100];
3210 unsigned char output[100];
3212 int key_len, data_len;
3214 memset(key_str, 0x00, 100);
3215 memset(iv_str, 0x00, 100);
3216 memset(src_str, 0x00, 100);
3217 memset(dst_str, 0x00, 100);
3218 memset(output, 0x00, 100);
3220 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
3221 unhexify( iv_str,
"00000000000000000000000000000000" );
3222 data_len =
unhexify( src_str,
"39bde67d5c8ed8a8b1c37eb8fa9f5ac0" );
3228 hexify( dst_str, output, data_len );
3230 fct_chk( strcmp( (
char *) dst_str,
"fffffffffffffffffffffffffffffffc" ) == 0 );
3236 FCT_TEST_BGN(aes_192_cbc_encrypt_nist_kat_1)
3238 unsigned char key_str[100];
3239 unsigned char iv_str[100];
3240 unsigned char src_str[100];
3241 unsigned char dst_str[100];
3242 unsigned char output[100];
3244 int key_len, data_len;
3246 memset(key_str, 0x00, 100);
3247 memset(iv_str, 0x00, 100);
3248 memset(src_str, 0x00, 100);
3249 memset(dst_str, 0x00, 100);
3250 memset(output, 0x00, 100);
3252 key_len =
unhexify( key_str,
"fffffffffffffffffffffffffffffffffffffffffffffe00" );
3253 unhexify( iv_str,
"00000000000000000000000000000000" );
3254 data_len =
unhexify( src_str,
"00000000000000000000000000000000" );
3260 hexify( dst_str, output, data_len );
3262 fct_chk( strcmp( (
char *) dst_str,
"ddb505e6cc1384cbaec1df90b80beb20" ) == 0 );
3268 FCT_TEST_BGN(aes_192_cbc_encrypt_nist_kat_2)
3270 unsigned char key_str[100];
3271 unsigned char iv_str[100];
3272 unsigned char src_str[100];
3273 unsigned char dst_str[100];
3274 unsigned char output[100];
3276 int key_len, data_len;
3278 memset(key_str, 0x00, 100);
3279 memset(iv_str, 0x00, 100);
3280 memset(src_str, 0x00, 100);
3281 memset(dst_str, 0x00, 100);
3282 memset(output, 0x00, 100);
3284 key_len =
unhexify( key_str,
"ffffffffffffffffffffffffffffffffffffffffffffff00" );
3285 unhexify( iv_str,
"00000000000000000000000000000000" );
3286 data_len =
unhexify( src_str,
"00000000000000000000000000000000" );
3292 hexify( dst_str, output, data_len );
3294 fct_chk( strcmp( (
char *) dst_str,
"5674a3bed27bf4bd3622f9f5fe208306" ) == 0 );
3300 FCT_TEST_BGN(aes_192_cbc_encrypt_nist_kat_3)
3302 unsigned char key_str[100];
3303 unsigned char iv_str[100];
3304 unsigned char src_str[100];
3305 unsigned char dst_str[100];
3306 unsigned char output[100];
3308 int key_len, data_len;
3310 memset(key_str, 0x00, 100);
3311 memset(iv_str, 0x00, 100);
3312 memset(src_str, 0x00, 100);
3313 memset(dst_str, 0x00, 100);
3314 memset(output, 0x00, 100);
3316 key_len =
unhexify( key_str,
"ffffffffffffffffffffffffffffffffffffffffffffff80" );
3317 unhexify( iv_str,
"00000000000000000000000000000000" );
3318 data_len =
unhexify( src_str,
"00000000000000000000000000000000" );
3324 hexify( dst_str, output, data_len );
3326 fct_chk( strcmp( (
char *) dst_str,
"b687f26a89cfbfbb8e5eeac54055315e" ) == 0 );
3332 FCT_TEST_BGN(aes_192_cbc_encrypt_nist_kat_4)
3334 unsigned char key_str[100];
3335 unsigned char iv_str[100];
3336 unsigned char src_str[100];
3337 unsigned char dst_str[100];
3338 unsigned char output[100];
3340 int key_len, data_len;
3342 memset(key_str, 0x00, 100);
3343 memset(iv_str, 0x00, 100);
3344 memset(src_str, 0x00, 100);
3345 memset(dst_str, 0x00, 100);
3346 memset(output, 0x00, 100);
3348 key_len =
unhexify( key_str,
"25a39dbfd8034f71a81f9ceb55026e4037f8f6aa30ab44ce" );
3349 unhexify( iv_str,
"00000000000000000000000000000000" );
3350 data_len =
unhexify( src_str,
"00000000000000000000000000000000" );
3356 hexify( dst_str, output, data_len );
3358 fct_chk( strcmp( (
char *) dst_str,
"3608c344868e94555d23a120f8a5502d" ) == 0 );
3364 FCT_TEST_BGN(aes_192_cbc_encrypt_nist_kat_5)
3366 unsigned char key_str[100];
3367 unsigned char iv_str[100];
3368 unsigned char src_str[100];
3369 unsigned char dst_str[100];
3370 unsigned char output[100];
3372 int key_len, data_len;
3374 memset(key_str, 0x00, 100);
3375 memset(iv_str, 0x00, 100);
3376 memset(src_str, 0x00, 100);
3377 memset(dst_str, 0x00, 100);
3378 memset(output, 0x00, 100);
3380 key_len =
unhexify( key_str,
"e08c15411774ec4a908b64eadc6ac4199c7cd453f3aaef53" );
3381 unhexify( iv_str,
"00000000000000000000000000000000" );
3382 data_len =
unhexify( src_str,
"00000000000000000000000000000000" );
3388 hexify( dst_str, output, data_len );
3390 fct_chk( strcmp( (
char *) dst_str,
"77da2021935b840b7f5dcc39132da9e5" ) == 0 );
3396 FCT_TEST_BGN(aes_192_cbc_encrypt_nist_kat_6)
3398 unsigned char key_str[100];
3399 unsigned char iv_str[100];
3400 unsigned char src_str[100];
3401 unsigned char dst_str[100];
3402 unsigned char output[100];
3404 int key_len, data_len;
3406 memset(key_str, 0x00, 100);
3407 memset(iv_str, 0x00, 100);
3408 memset(src_str, 0x00, 100);
3409 memset(dst_str, 0x00, 100);
3410 memset(output, 0x00, 100);
3412 key_len =
unhexify( key_str,
"3b375a1ff7e8d44409696e6326ec9dec86138e2ae010b980" );
3413 unhexify( iv_str,
"00000000000000000000000000000000" );
3414 data_len =
unhexify( src_str,
"00000000000000000000000000000000" );
3420 hexify( dst_str, output, data_len );
3422 fct_chk( strcmp( (
char *) dst_str,
"3b7c24f825e3bf9873c9f14d39a0e6f4" ) == 0 );
3428 FCT_TEST_BGN(aes_192_cbc_encrypt_nist_kat_7)
3430 unsigned char key_str[100];
3431 unsigned char iv_str[100];
3432 unsigned char src_str[100];
3433 unsigned char dst_str[100];
3434 unsigned char output[100];
3436 int key_len, data_len;
3438 memset(key_str, 0x00, 100);
3439 memset(iv_str, 0x00, 100);
3440 memset(src_str, 0x00, 100);
3441 memset(dst_str, 0x00, 100);
3442 memset(output, 0x00, 100);
3444 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
3445 unhexify( iv_str,
"00000000000000000000000000000000" );
3446 data_len =
unhexify( src_str,
"51719783d3185a535bd75adc65071ce1" );
3452 hexify( dst_str, output, data_len );
3454 fct_chk( strcmp( (
char *) dst_str,
"4f354592ff7c8847d2d0870ca9481b7c" ) == 0 );
3460 FCT_TEST_BGN(aes_192_cbc_encrypt_nist_kat_8)
3462 unsigned char key_str[100];
3463 unsigned char iv_str[100];
3464 unsigned char src_str[100];
3465 unsigned char dst_str[100];
3466 unsigned char output[100];
3468 int key_len, data_len;
3470 memset(key_str, 0x00, 100);
3471 memset(iv_str, 0x00, 100);
3472 memset(src_str, 0x00, 100);
3473 memset(dst_str, 0x00, 100);
3474 memset(output, 0x00, 100);
3476 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
3477 unhexify( iv_str,
"00000000000000000000000000000000" );
3478 data_len =
unhexify( src_str,
"26aa49dcfe7629a8901a69a9914e6dfd" );
3484 hexify( dst_str, output, data_len );
3486 fct_chk( strcmp( (
char *) dst_str,
"d5e08bf9a182e857cf40b3a36ee248cc" ) == 0 );
3492 FCT_TEST_BGN(aes_192_cbc_encrypt_nist_kat_9)
3494 unsigned char key_str[100];
3495 unsigned char iv_str[100];
3496 unsigned char src_str[100];
3497 unsigned char dst_str[100];
3498 unsigned char output[100];
3500 int key_len, data_len;
3502 memset(key_str, 0x00, 100);
3503 memset(iv_str, 0x00, 100);
3504 memset(src_str, 0x00, 100);
3505 memset(dst_str, 0x00, 100);
3506 memset(output, 0x00, 100);
3508 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
3509 unhexify( iv_str,
"00000000000000000000000000000000" );
3510 data_len =
unhexify( src_str,
"941a4773058224e1ef66d10e0a6ee782" );
3516 hexify( dst_str, output, data_len );
3518 fct_chk( strcmp( (
char *) dst_str,
"067cd9d3749207791841562507fa9626" ) == 0 );
3524 FCT_TEST_BGN(aes_192_cbc_encrypt_nist_kat_10)
3526 unsigned char key_str[100];
3527 unsigned char iv_str[100];
3528 unsigned char src_str[100];
3529 unsigned char dst_str[100];
3530 unsigned char output[100];
3532 int key_len, data_len;
3534 memset(key_str, 0x00, 100);
3535 memset(iv_str, 0x00, 100);
3536 memset(src_str, 0x00, 100);
3537 memset(dst_str, 0x00, 100);
3538 memset(output, 0x00, 100);
3540 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
3541 unhexify( iv_str,
"00000000000000000000000000000000" );
3542 data_len =
unhexify( src_str,
"ffc00000000000000000000000000000" );
3548 hexify( dst_str, output, data_len );
3550 fct_chk( strcmp( (
char *) dst_str,
"030d7e5b64f380a7e4ea5387b5cd7f49" ) == 0 );
3556 FCT_TEST_BGN(aes_192_cbc_encrypt_nist_kat_11)
3558 unsigned char key_str[100];
3559 unsigned char iv_str[100];
3560 unsigned char src_str[100];
3561 unsigned char dst_str[100];
3562 unsigned char output[100];
3564 int key_len, data_len;
3566 memset(key_str, 0x00, 100);
3567 memset(iv_str, 0x00, 100);
3568 memset(src_str, 0x00, 100);
3569 memset(dst_str, 0x00, 100);
3570 memset(output, 0x00, 100);
3572 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
3573 unhexify( iv_str,
"00000000000000000000000000000000" );
3574 data_len =
unhexify( src_str,
"ffe00000000000000000000000000000" );
3580 hexify( dst_str, output, data_len );
3582 fct_chk( strcmp( (
char *) dst_str,
"0dc9a2610037009b698f11bb7e86c83e" ) == 0 );
3588 FCT_TEST_BGN(aes_192_cbc_encrypt_nist_kat_12)
3590 unsigned char key_str[100];
3591 unsigned char iv_str[100];
3592 unsigned char src_str[100];
3593 unsigned char dst_str[100];
3594 unsigned char output[100];
3596 int key_len, data_len;
3598 memset(key_str, 0x00, 100);
3599 memset(iv_str, 0x00, 100);
3600 memset(src_str, 0x00, 100);
3601 memset(dst_str, 0x00, 100);
3602 memset(output, 0x00, 100);
3604 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
3605 unhexify( iv_str,
"00000000000000000000000000000000" );
3606 data_len =
unhexify( src_str,
"fff00000000000000000000000000000" );
3612 hexify( dst_str, output, data_len );
3614 fct_chk( strcmp( (
char *) dst_str,
"0046612c766d1840c226364f1fa7ed72" ) == 0 );
3620 FCT_TEST_BGN(aes_192_cbc_decrypt_nist_kat_1)
3622 unsigned char key_str[100];
3623 unsigned char iv_str[100];
3624 unsigned char src_str[100];
3625 unsigned char dst_str[100];
3626 unsigned char output[100];
3628 int key_len, data_len;
3630 memset(key_str, 0x00, 100);
3631 memset(iv_str, 0x00, 100);
3632 memset(src_str, 0x00, 100);
3633 memset(dst_str, 0x00, 100);
3634 memset(output, 0x00, 100);
3636 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
3637 unhexify( iv_str,
"00000000000000000000000000000000" );
3638 data_len =
unhexify( src_str,
"902d88d13eae52089abd6143cfe394e9" );
3644 hexify( dst_str, output, data_len );
3646 fct_chk( strcmp( (
char *) dst_str,
"ffffffffe00000000000000000000000" ) == 0 );
3652 FCT_TEST_BGN(aes_192_cbc_decrypt_nist_kat_2)
3654 unsigned char key_str[100];
3655 unsigned char iv_str[100];
3656 unsigned char src_str[100];
3657 unsigned char dst_str[100];
3658 unsigned char output[100];
3660 int key_len, data_len;
3662 memset(key_str, 0x00, 100);
3663 memset(iv_str, 0x00, 100);
3664 memset(src_str, 0x00, 100);
3665 memset(dst_str, 0x00, 100);
3666 memset(output, 0x00, 100);
3668 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
3669 unhexify( iv_str,
"00000000000000000000000000000000" );
3670 data_len =
unhexify( src_str,
"d49bceb3b823fedd602c305345734bd2" );
3676 hexify( dst_str, output, data_len );
3678 fct_chk( strcmp( (
char *) dst_str,
"fffffffff00000000000000000000000" ) == 0 );
3684 FCT_TEST_BGN(aes_192_cbc_decrypt_nist_kat_3)
3686 unsigned char key_str[100];
3687 unsigned char iv_str[100];
3688 unsigned char src_str[100];
3689 unsigned char dst_str[100];
3690 unsigned char output[100];
3692 int key_len, data_len;
3694 memset(key_str, 0x00, 100);
3695 memset(iv_str, 0x00, 100);
3696 memset(src_str, 0x00, 100);
3697 memset(dst_str, 0x00, 100);
3698 memset(output, 0x00, 100);
3700 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
3701 unhexify( iv_str,
"00000000000000000000000000000000" );
3702 data_len =
unhexify( src_str,
"707b1dbb0ffa40ef7d95def421233fae" );
3708 hexify( dst_str, output, data_len );
3710 fct_chk( strcmp( (
char *) dst_str,
"fffffffff80000000000000000000000" ) == 0 );
3716 FCT_TEST_BGN(aes_192_cbc_decrypt_nist_kat_4)
3718 unsigned char key_str[100];
3719 unsigned char iv_str[100];
3720 unsigned char src_str[100];
3721 unsigned char dst_str[100];
3722 unsigned char output[100];
3724 int key_len, data_len;
3726 memset(key_str, 0x00, 100);
3727 memset(iv_str, 0x00, 100);
3728 memset(src_str, 0x00, 100);
3729 memset(dst_str, 0x00, 100);
3730 memset(output, 0x00, 100);
3732 key_len =
unhexify( key_str,
"fffffffffffffffffffc0000000000000000000000000000" );
3733 unhexify( iv_str,
"00000000000000000000000000000000" );
3734 data_len =
unhexify( src_str,
"8dfd999be5d0cfa35732c0ddc88ff5a5" );
3740 hexify( dst_str, output, data_len );
3742 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
3748 FCT_TEST_BGN(aes_192_cbc_decrypt_nist_kat_5)
3750 unsigned char key_str[100];
3751 unsigned char iv_str[100];
3752 unsigned char src_str[100];
3753 unsigned char dst_str[100];
3754 unsigned char output[100];
3756 int key_len, data_len;
3758 memset(key_str, 0x00, 100);
3759 memset(iv_str, 0x00, 100);
3760 memset(src_str, 0x00, 100);
3761 memset(dst_str, 0x00, 100);
3762 memset(output, 0x00, 100);
3764 key_len =
unhexify( key_str,
"fffffffffffffffffffe0000000000000000000000000000" );
3765 unhexify( iv_str,
"00000000000000000000000000000000" );
3766 data_len =
unhexify( src_str,
"02647c76a300c3173b841487eb2bae9f" );
3772 hexify( dst_str, output, data_len );
3774 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
3780 FCT_TEST_BGN(aes_192_cbc_decrypt_nist_kat_6)
3782 unsigned char key_str[100];
3783 unsigned char iv_str[100];
3784 unsigned char src_str[100];
3785 unsigned char dst_str[100];
3786 unsigned char output[100];
3788 int key_len, data_len;
3790 memset(key_str, 0x00, 100);
3791 memset(iv_str, 0x00, 100);
3792 memset(src_str, 0x00, 100);
3793 memset(dst_str, 0x00, 100);
3794 memset(output, 0x00, 100);
3796 key_len =
unhexify( key_str,
"ffffffffffffffffffff0000000000000000000000000000" );
3797 unhexify( iv_str,
"00000000000000000000000000000000" );
3798 data_len =
unhexify( src_str,
"172df8b02f04b53adab028b4e01acd87" );
3804 hexify( dst_str, output, data_len );
3806 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
3812 FCT_TEST_BGN(aes_192_cbc_decrypt_nist_kat_7)
3814 unsigned char key_str[100];
3815 unsigned char iv_str[100];
3816 unsigned char src_str[100];
3817 unsigned char dst_str[100];
3818 unsigned char output[100];
3820 int key_len, data_len;
3822 memset(key_str, 0x00, 100);
3823 memset(iv_str, 0x00, 100);
3824 memset(src_str, 0x00, 100);
3825 memset(dst_str, 0x00, 100);
3826 memset(output, 0x00, 100);
3828 key_len =
unhexify( key_str,
"b3ad5cea1dddc214ca969ac35f37dae1a9a9d1528f89bb35" );
3829 unhexify( iv_str,
"00000000000000000000000000000000" );
3830 data_len =
unhexify( src_str,
"3cf5e1d21a17956d1dffad6a7c41c659" );
3836 hexify( dst_str, output, data_len );
3838 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
3844 FCT_TEST_BGN(aes_192_cbc_decrypt_nist_kat_8)
3846 unsigned char key_str[100];
3847 unsigned char iv_str[100];
3848 unsigned char src_str[100];
3849 unsigned char dst_str[100];
3850 unsigned char output[100];
3852 int key_len, data_len;
3854 memset(key_str, 0x00, 100);
3855 memset(iv_str, 0x00, 100);
3856 memset(src_str, 0x00, 100);
3857 memset(dst_str, 0x00, 100);
3858 memset(output, 0x00, 100);
3860 key_len =
unhexify( key_str,
"45899367c3132849763073c435a9288a766c8b9ec2308516" );
3861 unhexify( iv_str,
"00000000000000000000000000000000" );
3862 data_len =
unhexify( src_str,
"69fd12e8505f8ded2fdcb197a121b362" );
3868 hexify( dst_str, output, data_len );
3870 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
3876 FCT_TEST_BGN(aes_192_cbc_decrypt_nist_kat_9)
3878 unsigned char key_str[100];
3879 unsigned char iv_str[100];
3880 unsigned char src_str[100];
3881 unsigned char dst_str[100];
3882 unsigned char output[100];
3884 int key_len, data_len;
3886 memset(key_str, 0x00, 100);
3887 memset(iv_str, 0x00, 100);
3888 memset(src_str, 0x00, 100);
3889 memset(dst_str, 0x00, 100);
3890 memset(output, 0x00, 100);
3892 key_len =
unhexify( key_str,
"ec250e04c3903f602647b85a401a1ae7ca2f02f67fa4253e" );
3893 unhexify( iv_str,
"00000000000000000000000000000000" );
3894 data_len =
unhexify( src_str,
"8aa584e2cc4d17417a97cb9a28ba29c8" );
3900 hexify( dst_str, output, data_len );
3902 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
3908 FCT_TEST_BGN(aes_192_cbc_decrypt_nist_kat_10)
3910 unsigned char key_str[100];
3911 unsigned char iv_str[100];
3912 unsigned char src_str[100];
3913 unsigned char dst_str[100];
3914 unsigned char output[100];
3916 int key_len, data_len;
3918 memset(key_str, 0x00, 100);
3919 memset(iv_str, 0x00, 100);
3920 memset(src_str, 0x00, 100);
3921 memset(dst_str, 0x00, 100);
3922 memset(output, 0x00, 100);
3924 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
3925 unhexify( iv_str,
"00000000000000000000000000000000" );
3926 data_len =
unhexify( src_str,
"c9b8135ff1b5adc413dfd053b21bd96d" );
3932 hexify( dst_str, output, data_len );
3934 fct_chk( strcmp( (
char *) dst_str,
"9c2d8842e5f48f57648205d39a239af1" ) == 0 );
3940 FCT_TEST_BGN(aes_192_cbc_decrypt_nist_kat_11)
3942 unsigned char key_str[100];
3943 unsigned char iv_str[100];
3944 unsigned char src_str[100];
3945 unsigned char dst_str[100];
3946 unsigned char output[100];
3948 int key_len, data_len;
3950 memset(key_str, 0x00, 100);
3951 memset(iv_str, 0x00, 100);
3952 memset(src_str, 0x00, 100);
3953 memset(dst_str, 0x00, 100);
3954 memset(output, 0x00, 100);
3956 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
3957 unhexify( iv_str,
"00000000000000000000000000000000" );
3958 data_len =
unhexify( src_str,
"4a3650c3371ce2eb35e389a171427440" );
3964 hexify( dst_str, output, data_len );
3966 fct_chk( strcmp( (
char *) dst_str,
"bff52510095f518ecca60af4205444bb" ) == 0 );
3972 FCT_TEST_BGN(aes_192_cbc_decrypt_nist_kat_12)
3974 unsigned char key_str[100];
3975 unsigned char iv_str[100];
3976 unsigned char src_str[100];
3977 unsigned char dst_str[100];
3978 unsigned char output[100];
3980 int key_len, data_len;
3982 memset(key_str, 0x00, 100);
3983 memset(iv_str, 0x00, 100);
3984 memset(src_str, 0x00, 100);
3985 memset(dst_str, 0x00, 100);
3986 memset(output, 0x00, 100);
3988 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
3989 unhexify( iv_str,
"00000000000000000000000000000000" );
3990 data_len =
unhexify( src_str,
"4f354592ff7c8847d2d0870ca9481b7c" );
3996 hexify( dst_str, output, data_len );
3998 fct_chk( strcmp( (
char *) dst_str,
"51719783d3185a535bd75adc65071ce1" ) == 0 );
4004 FCT_TEST_BGN(aes_256_cbc_encrypt_nist_kat_1)
4006 unsigned char key_str[100];
4007 unsigned char iv_str[100];
4008 unsigned char src_str[100];
4009 unsigned char dst_str[100];
4010 unsigned char output[100];
4012 int key_len, data_len;
4014 memset(key_str, 0x00, 100);
4015 memset(iv_str, 0x00, 100);
4016 memset(src_str, 0x00, 100);
4017 memset(dst_str, 0x00, 100);
4018 memset(output, 0x00, 100);
4020 key_len =
unhexify( key_str,
"8000000000000000000000000000000000000000000000000000000000000000" );
4021 unhexify( iv_str,
"00000000000000000000000000000000" );
4022 data_len =
unhexify( src_str,
"00000000000000000000000000000000" );
4028 hexify( dst_str, output, data_len );
4030 fct_chk( strcmp( (
char *) dst_str,
"e35a6dcb19b201a01ebcfa8aa22b5759" ) == 0 );
4036 FCT_TEST_BGN(aes_256_cbc_encrypt_nist_kat_2)
4038 unsigned char key_str[100];
4039 unsigned char iv_str[100];
4040 unsigned char src_str[100];
4041 unsigned char dst_str[100];
4042 unsigned char output[100];
4044 int key_len, data_len;
4046 memset(key_str, 0x00, 100);
4047 memset(iv_str, 0x00, 100);
4048 memset(src_str, 0x00, 100);
4049 memset(dst_str, 0x00, 100);
4050 memset(output, 0x00, 100);
4052 key_len =
unhexify( key_str,
"c000000000000000000000000000000000000000000000000000000000000000" );
4053 unhexify( iv_str,
"00000000000000000000000000000000" );
4054 data_len =
unhexify( src_str,
"00000000000000000000000000000000" );
4060 hexify( dst_str, output, data_len );
4062 fct_chk( strcmp( (
char *) dst_str,
"b29169cdcf2d83e838125a12ee6aa400" ) == 0 );
4068 FCT_TEST_BGN(aes_256_cbc_encrypt_nist_kat_3)
4070 unsigned char key_str[100];
4071 unsigned char iv_str[100];
4072 unsigned char src_str[100];
4073 unsigned char dst_str[100];
4074 unsigned char output[100];
4076 int key_len, data_len;
4078 memset(key_str, 0x00, 100);
4079 memset(iv_str, 0x00, 100);
4080 memset(src_str, 0x00, 100);
4081 memset(dst_str, 0x00, 100);
4082 memset(output, 0x00, 100);
4084 key_len =
unhexify( key_str,
"e000000000000000000000000000000000000000000000000000000000000000" );
4085 unhexify( iv_str,
"00000000000000000000000000000000" );
4086 data_len =
unhexify( src_str,
"00000000000000000000000000000000" );
4092 hexify( dst_str, output, data_len );
4094 fct_chk( strcmp( (
char *) dst_str,
"d8f3a72fc3cdf74dfaf6c3e6b97b2fa6" ) == 0 );
4100 FCT_TEST_BGN(aes_256_cbc_encrypt_nist_kat_4)
4102 unsigned char key_str[100];
4103 unsigned char iv_str[100];
4104 unsigned char src_str[100];
4105 unsigned char dst_str[100];
4106 unsigned char output[100];
4108 int key_len, data_len;
4110 memset(key_str, 0x00, 100);
4111 memset(iv_str, 0x00, 100);
4112 memset(src_str, 0x00, 100);
4113 memset(dst_str, 0x00, 100);
4114 memset(output, 0x00, 100);
4116 key_len =
unhexify( key_str,
"dc0eba1f2232a7879ded34ed8428eeb8769b056bbaf8ad77cb65c3541430b4cf" );
4117 unhexify( iv_str,
"00000000000000000000000000000000" );
4118 data_len =
unhexify( src_str,
"00000000000000000000000000000000" );
4124 hexify( dst_str, output, data_len );
4126 fct_chk( strcmp( (
char *) dst_str,
"fc6aec906323480005c58e7e1ab004ad" ) == 0 );
4132 FCT_TEST_BGN(aes_256_cbc_encrypt_nist_kat_5)
4134 unsigned char key_str[100];
4135 unsigned char iv_str[100];
4136 unsigned char src_str[100];
4137 unsigned char dst_str[100];
4138 unsigned char output[100];
4140 int key_len, data_len;
4142 memset(key_str, 0x00, 100);
4143 memset(iv_str, 0x00, 100);
4144 memset(src_str, 0x00, 100);
4145 memset(dst_str, 0x00, 100);
4146 memset(output, 0x00, 100);
4148 key_len =
unhexify( key_str,
"f8be9ba615c5a952cabbca24f68f8593039624d524c816acda2c9183bd917cb9" );
4149 unhexify( iv_str,
"00000000000000000000000000000000" );
4150 data_len =
unhexify( src_str,
"00000000000000000000000000000000" );
4156 hexify( dst_str, output, data_len );
4158 fct_chk( strcmp( (
char *) dst_str,
"a3944b95ca0b52043584ef02151926a8" ) == 0 );
4164 FCT_TEST_BGN(aes_256_cbc_encrypt_nist_kat_6)
4166 unsigned char key_str[100];
4167 unsigned char iv_str[100];
4168 unsigned char src_str[100];
4169 unsigned char dst_str[100];
4170 unsigned char output[100];
4172 int key_len, data_len;
4174 memset(key_str, 0x00, 100);
4175 memset(iv_str, 0x00, 100);
4176 memset(src_str, 0x00, 100);
4177 memset(dst_str, 0x00, 100);
4178 memset(output, 0x00, 100);
4180 key_len =
unhexify( key_str,
"797f8b3d176dac5b7e34a2d539c4ef367a16f8635f6264737591c5c07bf57a3e" );
4181 unhexify( iv_str,
"00000000000000000000000000000000" );
4182 data_len =
unhexify( src_str,
"00000000000000000000000000000000" );
4188 hexify( dst_str, output, data_len );
4190 fct_chk( strcmp( (
char *) dst_str,
"a74289fe73a4c123ca189ea1e1b49ad5" ) == 0 );
4196 FCT_TEST_BGN(aes_256_cbc_encrypt_nist_kat_7)
4198 unsigned char key_str[100];
4199 unsigned char iv_str[100];
4200 unsigned char src_str[100];
4201 unsigned char dst_str[100];
4202 unsigned char output[100];
4204 int key_len, data_len;
4206 memset(key_str, 0x00, 100);
4207 memset(iv_str, 0x00, 100);
4208 memset(src_str, 0x00, 100);
4209 memset(dst_str, 0x00, 100);
4210 memset(output, 0x00, 100);
4212 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
4213 unhexify( iv_str,
"00000000000000000000000000000000" );
4214 data_len =
unhexify( src_str,
"761c1fe41a18acf20d241650611d90f1" );
4220 hexify( dst_str, output, data_len );
4222 fct_chk( strcmp( (
char *) dst_str,
"623a52fcea5d443e48d9181ab32c7421" ) == 0 );
4228 FCT_TEST_BGN(aes_256_cbc_encrypt_nist_kat_8)
4230 unsigned char key_str[100];
4231 unsigned char iv_str[100];
4232 unsigned char src_str[100];
4233 unsigned char dst_str[100];
4234 unsigned char output[100];
4236 int key_len, data_len;
4238 memset(key_str, 0x00, 100);
4239 memset(iv_str, 0x00, 100);
4240 memset(src_str, 0x00, 100);
4241 memset(dst_str, 0x00, 100);
4242 memset(output, 0x00, 100);
4244 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
4245 unhexify( iv_str,
"00000000000000000000000000000000" );
4246 data_len =
unhexify( src_str,
"8a560769d605868ad80d819bdba03771" );
4252 hexify( dst_str, output, data_len );
4254 fct_chk( strcmp( (
char *) dst_str,
"38f2c7ae10612415d27ca190d27da8b4" ) == 0 );
4260 FCT_TEST_BGN(aes_256_cbc_encrypt_nist_kat_9)
4262 unsigned char key_str[100];
4263 unsigned char iv_str[100];
4264 unsigned char src_str[100];
4265 unsigned char dst_str[100];
4266 unsigned char output[100];
4268 int key_len, data_len;
4270 memset(key_str, 0x00, 100);
4271 memset(iv_str, 0x00, 100);
4272 memset(src_str, 0x00, 100);
4273 memset(dst_str, 0x00, 100);
4274 memset(output, 0x00, 100);
4276 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
4277 unhexify( iv_str,
"00000000000000000000000000000000" );
4278 data_len =
unhexify( src_str,
"91fbef2d15a97816060bee1feaa49afe" );
4284 hexify( dst_str, output, data_len );
4286 fct_chk( strcmp( (
char *) dst_str,
"1bc704f1bce135ceb810341b216d7abe" ) == 0 );
4292 FCT_TEST_BGN(aes_256_cbc_encrypt_nist_kat_10)
4294 unsigned char key_str[100];
4295 unsigned char iv_str[100];
4296 unsigned char src_str[100];
4297 unsigned char dst_str[100];
4298 unsigned char output[100];
4300 int key_len, data_len;
4302 memset(key_str, 0x00, 100);
4303 memset(iv_str, 0x00, 100);
4304 memset(src_str, 0x00, 100);
4305 memset(dst_str, 0x00, 100);
4306 memset(output, 0x00, 100);
4308 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
4309 unhexify( iv_str,
"00000000000000000000000000000000" );
4310 data_len =
unhexify( src_str,
"ffffffffffffff800000000000000000" );
4316 hexify( dst_str, output, data_len );
4318 fct_chk( strcmp( (
char *) dst_str,
"0d9ac756eb297695eed4d382eb126d26" ) == 0 );
4324 FCT_TEST_BGN(aes_256_cbc_encrypt_nist_kat_11)
4326 unsigned char key_str[100];
4327 unsigned char iv_str[100];
4328 unsigned char src_str[100];
4329 unsigned char dst_str[100];
4330 unsigned char output[100];
4332 int key_len, data_len;
4334 memset(key_str, 0x00, 100);
4335 memset(iv_str, 0x00, 100);
4336 memset(src_str, 0x00, 100);
4337 memset(dst_str, 0x00, 100);
4338 memset(output, 0x00, 100);
4340 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
4341 unhexify( iv_str,
"00000000000000000000000000000000" );
4342 data_len =
unhexify( src_str,
"ffffffffffffffc00000000000000000" );
4348 hexify( dst_str, output, data_len );
4350 fct_chk( strcmp( (
char *) dst_str,
"56ede9dda3f6f141bff1757fa689c3e1" ) == 0 );
4356 FCT_TEST_BGN(aes_256_cbc_encrypt_nist_kat_12)
4358 unsigned char key_str[100];
4359 unsigned char iv_str[100];
4360 unsigned char src_str[100];
4361 unsigned char dst_str[100];
4362 unsigned char output[100];
4364 int key_len, data_len;
4366 memset(key_str, 0x00, 100);
4367 memset(iv_str, 0x00, 100);
4368 memset(src_str, 0x00, 100);
4369 memset(dst_str, 0x00, 100);
4370 memset(output, 0x00, 100);
4372 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
4373 unhexify( iv_str,
"00000000000000000000000000000000" );
4374 data_len =
unhexify( src_str,
"ffffffffffffffe00000000000000000" );
4380 hexify( dst_str, output, data_len );
4382 fct_chk( strcmp( (
char *) dst_str,
"768f520efe0f23e61d3ec8ad9ce91774" ) == 0 );
4388 FCT_TEST_BGN(aes_256_cbc_decrypt_nist_kat_1)
4390 unsigned char key_str[100];
4391 unsigned char iv_str[100];
4392 unsigned char src_str[100];
4393 unsigned char dst_str[100];
4394 unsigned char output[100];
4396 int key_len, data_len;
4398 memset(key_str, 0x00, 100);
4399 memset(iv_str, 0x00, 100);
4400 memset(src_str, 0x00, 100);
4401 memset(dst_str, 0x00, 100);
4402 memset(output, 0x00, 100);
4404 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
4405 unhexify( iv_str,
"00000000000000000000000000000000" );
4406 data_len =
unhexify( src_str,
"49af6b372135acef10132e548f217b17" );
4412 hexify( dst_str, output, data_len );
4414 fct_chk( strcmp( (
char *) dst_str,
"ff000000000000000000000000000000" ) == 0 );
4420 FCT_TEST_BGN(aes_256_cbc_decrypt_nist_kat_2)
4422 unsigned char key_str[100];
4423 unsigned char iv_str[100];
4424 unsigned char src_str[100];
4425 unsigned char dst_str[100];
4426 unsigned char output[100];
4428 int key_len, data_len;
4430 memset(key_str, 0x00, 100);
4431 memset(iv_str, 0x00, 100);
4432 memset(src_str, 0x00, 100);
4433 memset(dst_str, 0x00, 100);
4434 memset(output, 0x00, 100);
4436 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
4437 unhexify( iv_str,
"00000000000000000000000000000000" );
4438 data_len =
unhexify( src_str,
"8bcd40f94ebb63b9f7909676e667f1e7" );
4444 hexify( dst_str, output, data_len );
4446 fct_chk( strcmp( (
char *) dst_str,
"ff800000000000000000000000000000" ) == 0 );
4452 FCT_TEST_BGN(aes_256_cbc_decrypt_nist_kat_3)
4454 unsigned char key_str[100];
4455 unsigned char iv_str[100];
4456 unsigned char src_str[100];
4457 unsigned char dst_str[100];
4458 unsigned char output[100];
4460 int key_len, data_len;
4462 memset(key_str, 0x00, 100);
4463 memset(iv_str, 0x00, 100);
4464 memset(src_str, 0x00, 100);
4465 memset(dst_str, 0x00, 100);
4466 memset(output, 0x00, 100);
4468 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
4469 unhexify( iv_str,
"00000000000000000000000000000000" );
4470 data_len =
unhexify( src_str,
"fe1cffb83f45dcfb38b29be438dbd3ab" );
4476 hexify( dst_str, output, data_len );
4478 fct_chk( strcmp( (
char *) dst_str,
"ffc00000000000000000000000000000" ) == 0 );
4484 FCT_TEST_BGN(aes_256_cbc_decrypt_nist_kat_4)
4486 unsigned char key_str[100];
4487 unsigned char iv_str[100];
4488 unsigned char src_str[100];
4489 unsigned char dst_str[100];
4490 unsigned char output[100];
4492 int key_len, data_len;
4494 memset(key_str, 0x00, 100);
4495 memset(iv_str, 0x00, 100);
4496 memset(src_str, 0x00, 100);
4497 memset(dst_str, 0x00, 100);
4498 memset(output, 0x00, 100);
4500 key_len =
unhexify( key_str,
"fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00" );
4501 unhexify( iv_str,
"00000000000000000000000000000000" );
4502 data_len =
unhexify( src_str,
"cca7c3086f5f9511b31233da7cab9160" );
4508 hexify( dst_str, output, data_len );
4510 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
4516 FCT_TEST_BGN(aes_256_cbc_decrypt_nist_kat_5)
4518 unsigned char key_str[100];
4519 unsigned char iv_str[100];
4520 unsigned char src_str[100];
4521 unsigned char dst_str[100];
4522 unsigned char output[100];
4524 int key_len, data_len;
4526 memset(key_str, 0x00, 100);
4527 memset(iv_str, 0x00, 100);
4528 memset(src_str, 0x00, 100);
4529 memset(dst_str, 0x00, 100);
4530 memset(output, 0x00, 100);
4532 key_len =
unhexify( key_str,
"fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00" );
4533 unhexify( iv_str,
"00000000000000000000000000000000" );
4534 data_len =
unhexify( src_str,
"5b40ff4ec9be536ba23035fa4f06064c" );
4540 hexify( dst_str, output, data_len );
4542 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
4548 FCT_TEST_BGN(aes_256_cbc_decrypt_nist_kat_6)
4550 unsigned char key_str[100];
4551 unsigned char iv_str[100];
4552 unsigned char src_str[100];
4553 unsigned char dst_str[100];
4554 unsigned char output[100];
4556 int key_len, data_len;
4558 memset(key_str, 0x00, 100);
4559 memset(iv_str, 0x00, 100);
4560 memset(src_str, 0x00, 100);
4561 memset(dst_str, 0x00, 100);
4562 memset(output, 0x00, 100);
4564 key_len =
unhexify( key_str,
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00" );
4565 unhexify( iv_str,
"00000000000000000000000000000000" );
4566 data_len =
unhexify( src_str,
"60eb5af8416b257149372194e8b88749" );
4572 hexify( dst_str, output, data_len );
4574 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
4580 FCT_TEST_BGN(aes_256_cbc_decrypt_nist_kat_7)
4582 unsigned char key_str[100];
4583 unsigned char iv_str[100];
4584 unsigned char src_str[100];
4585 unsigned char dst_str[100];
4586 unsigned char output[100];
4588 int key_len, data_len;
4590 memset(key_str, 0x00, 100);
4591 memset(iv_str, 0x00, 100);
4592 memset(src_str, 0x00, 100);
4593 memset(dst_str, 0x00, 100);
4594 memset(output, 0x00, 100);
4596 key_len =
unhexify( key_str,
"90143ae20cd78c5d8ebdd6cb9dc1762427a96c78c639bccc41a61424564eafe1" );
4597 unhexify( iv_str,
"00000000000000000000000000000000" );
4598 data_len =
unhexify( src_str,
"798c7c005dee432b2c8ea5dfa381ecc3" );
4604 hexify( dst_str, output, data_len );
4606 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
4612 FCT_TEST_BGN(aes_256_cbc_decrypt_nist_kat_8)
4614 unsigned char key_str[100];
4615 unsigned char iv_str[100];
4616 unsigned char src_str[100];
4617 unsigned char dst_str[100];
4618 unsigned char output[100];
4620 int key_len, data_len;
4622 memset(key_str, 0x00, 100);
4623 memset(iv_str, 0x00, 100);
4624 memset(src_str, 0x00, 100);
4625 memset(dst_str, 0x00, 100);
4626 memset(output, 0x00, 100);
4628 key_len =
unhexify( key_str,
"b7a5794d52737475d53d5a377200849be0260a67a2b22ced8bbef12882270d07" );
4629 unhexify( iv_str,
"00000000000000000000000000000000" );
4630 data_len =
unhexify( src_str,
"637c31dc2591a07636f646b72daabbe7" );
4636 hexify( dst_str, output, data_len );
4638 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
4644 FCT_TEST_BGN(aes_256_cbc_decrypt_nist_kat_9)
4646 unsigned char key_str[100];
4647 unsigned char iv_str[100];
4648 unsigned char src_str[100];
4649 unsigned char dst_str[100];
4650 unsigned char output[100];
4652 int key_len, data_len;
4654 memset(key_str, 0x00, 100);
4655 memset(iv_str, 0x00, 100);
4656 memset(src_str, 0x00, 100);
4657 memset(dst_str, 0x00, 100);
4658 memset(output, 0x00, 100);
4660 key_len =
unhexify( key_str,
"fca02f3d5011cfc5c1e23165d413a049d4526a991827424d896fe3435e0bf68e" );
4661 unhexify( iv_str,
"00000000000000000000000000000000" );
4662 data_len =
unhexify( src_str,
"179a49c712154bbffbe6e7a84a18e220" );
4668 hexify( dst_str, output, data_len );
4670 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
4676 FCT_TEST_BGN(aes_256_cbc_decrypt_nist_kat_10)
4678 unsigned char key_str[100];
4679 unsigned char iv_str[100];
4680 unsigned char src_str[100];
4681 unsigned char dst_str[100];
4682 unsigned char output[100];
4684 int key_len, data_len;
4686 memset(key_str, 0x00, 100);
4687 memset(iv_str, 0x00, 100);
4688 memset(src_str, 0x00, 100);
4689 memset(dst_str, 0x00, 100);
4690 memset(output, 0x00, 100);
4692 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
4693 unhexify( iv_str,
"00000000000000000000000000000000" );
4694 data_len =
unhexify( src_str,
"5c9d844ed46f9885085e5d6a4f94c7d7" );
4700 hexify( dst_str, output, data_len );
4702 fct_chk( strcmp( (
char *) dst_str,
"014730f80ac625fe84f026c60bfd547d" ) == 0 );
4708 FCT_TEST_BGN(aes_256_cbc_decrypt_nist_kat_11)
4710 unsigned char key_str[100];
4711 unsigned char iv_str[100];
4712 unsigned char src_str[100];
4713 unsigned char dst_str[100];
4714 unsigned char output[100];
4716 int key_len, data_len;
4718 memset(key_str, 0x00, 100);
4719 memset(iv_str, 0x00, 100);
4720 memset(src_str, 0x00, 100);
4721 memset(dst_str, 0x00, 100);
4722 memset(output, 0x00, 100);
4724 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
4725 unhexify( iv_str,
"00000000000000000000000000000000" );
4726 data_len =
unhexify( src_str,
"a9ff75bd7cf6613d3731c77c3b6d0c04" );
4732 hexify( dst_str, output, data_len );
4734 fct_chk( strcmp( (
char *) dst_str,
"0b24af36193ce4665f2825d7b4749c98" ) == 0 );
4740 FCT_TEST_BGN(aes_256_cbc_decrypt_nist_kat_12)
4742 unsigned char key_str[100];
4743 unsigned char iv_str[100];
4744 unsigned char src_str[100];
4745 unsigned char dst_str[100];
4746 unsigned char output[100];
4748 int key_len, data_len;
4750 memset(key_str, 0x00, 100);
4751 memset(iv_str, 0x00, 100);
4752 memset(src_str, 0x00, 100);
4753 memset(dst_str, 0x00, 100);
4754 memset(output, 0x00, 100);
4756 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
4757 unhexify( iv_str,
"00000000000000000000000000000000" );
4758 data_len =
unhexify( src_str,
"623a52fcea5d443e48d9181ab32c7421" );
4764 hexify( dst_str, output, data_len );
4766 fct_chk( strcmp( (
char *) dst_str,
"761c1fe41a18acf20d241650611d90f1" ) == 0 );
4771 #ifdef POLARSSL_CIPHER_MODE_CFB
4773 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_1)
4775 unsigned char key_str[100];
4776 unsigned char iv_str[100];
4777 unsigned char src_str[100];
4778 unsigned char dst_str[100];
4779 unsigned char output[100];
4781 size_t iv_offset = 0;
4784 memset(key_str, 0x00, 100);
4785 memset(iv_str, 0x00, 100);
4786 memset(src_str, 0x00, 100);
4787 memset(dst_str, 0x00, 100);
4788 memset(output, 0x00, 100);
4790 key_len =
unhexify( key_str,
"f0000000000000000000000000000000" );
4791 unhexify( iv_str,
"00000000000000000000000000000000" );
4792 unhexify( src_str,
"00000000000000000000000000000000" );
4796 hexify( dst_str, output, 16 );
4798 fct_chk( strcmp( (
char *) dst_str,
"970014d634e2b7650777e8e84d03ccd8" ) == 0 );
4803 #ifdef POLARSSL_CIPHER_MODE_CFB
4805 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_2)
4807 unsigned char key_str[100];
4808 unsigned char iv_str[100];
4809 unsigned char src_str[100];
4810 unsigned char dst_str[100];
4811 unsigned char output[100];
4813 size_t iv_offset = 0;
4816 memset(key_str, 0x00, 100);
4817 memset(iv_str, 0x00, 100);
4818 memset(src_str, 0x00, 100);
4819 memset(dst_str, 0x00, 100);
4820 memset(output, 0x00, 100);
4822 key_len =
unhexify( key_str,
"f8000000000000000000000000000000" );
4823 unhexify( iv_str,
"00000000000000000000000000000000" );
4824 unhexify( src_str,
"00000000000000000000000000000000" );
4828 hexify( dst_str, output, 16 );
4830 fct_chk( strcmp( (
char *) dst_str,
"f17e79aed0db7e279e955b5f493875a7" ) == 0 );
4835 #ifdef POLARSSL_CIPHER_MODE_CFB
4837 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_3)
4839 unsigned char key_str[100];
4840 unsigned char iv_str[100];
4841 unsigned char src_str[100];
4842 unsigned char dst_str[100];
4843 unsigned char output[100];
4845 size_t iv_offset = 0;
4848 memset(key_str, 0x00, 100);
4849 memset(iv_str, 0x00, 100);
4850 memset(src_str, 0x00, 100);
4851 memset(dst_str, 0x00, 100);
4852 memset(output, 0x00, 100);
4854 key_len =
unhexify( key_str,
"fc000000000000000000000000000000" );
4855 unhexify( iv_str,
"00000000000000000000000000000000" );
4856 unhexify( src_str,
"00000000000000000000000000000000" );
4860 hexify( dst_str, output, 16 );
4862 fct_chk( strcmp( (
char *) dst_str,
"9ed5a75136a940d0963da379db4af26a" ) == 0 );
4867 #ifdef POLARSSL_CIPHER_MODE_CFB
4869 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_4)
4871 unsigned char key_str[100];
4872 unsigned char iv_str[100];
4873 unsigned char src_str[100];
4874 unsigned char dst_str[100];
4875 unsigned char output[100];
4877 size_t iv_offset = 0;
4880 memset(key_str, 0x00, 100);
4881 memset(iv_str, 0x00, 100);
4882 memset(src_str, 0x00, 100);
4883 memset(dst_str, 0x00, 100);
4884 memset(output, 0x00, 100);
4886 key_len =
unhexify( key_str,
"64cf9c7abc50b888af65f49d521944b2" );
4887 unhexify( iv_str,
"00000000000000000000000000000000" );
4888 unhexify( src_str,
"00000000000000000000000000000000" );
4892 hexify( dst_str, output, 16 );
4894 fct_chk( strcmp( (
char *) dst_str,
"f7efc89d5dba578104016ce5ad659c05" ) == 0 );
4899 #ifdef POLARSSL_CIPHER_MODE_CFB
4901 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_5)
4903 unsigned char key_str[100];
4904 unsigned char iv_str[100];
4905 unsigned char src_str[100];
4906 unsigned char dst_str[100];
4907 unsigned char output[100];
4909 size_t iv_offset = 0;
4912 memset(key_str, 0x00, 100);
4913 memset(iv_str, 0x00, 100);
4914 memset(src_str, 0x00, 100);
4915 memset(dst_str, 0x00, 100);
4916 memset(output, 0x00, 100);
4918 key_len =
unhexify( key_str,
"47d6742eefcc0465dc96355e851b64d9" );
4919 unhexify( iv_str,
"00000000000000000000000000000000" );
4920 unhexify( src_str,
"00000000000000000000000000000000" );
4924 hexify( dst_str, output, 16 );
4926 fct_chk( strcmp( (
char *) dst_str,
"0306194f666d183624aa230a8b264ae7" ) == 0 );
4931 #ifdef POLARSSL_CIPHER_MODE_CFB
4933 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_6)
4935 unsigned char key_str[100];
4936 unsigned char iv_str[100];
4937 unsigned char src_str[100];
4938 unsigned char dst_str[100];
4939 unsigned char output[100];
4941 size_t iv_offset = 0;
4944 memset(key_str, 0x00, 100);
4945 memset(iv_str, 0x00, 100);
4946 memset(src_str, 0x00, 100);
4947 memset(dst_str, 0x00, 100);
4948 memset(output, 0x00, 100);
4950 key_len =
unhexify( key_str,
"3eb39790678c56bee34bbcdeccf6cdb5" );
4951 unhexify( iv_str,
"00000000000000000000000000000000" );
4952 unhexify( src_str,
"00000000000000000000000000000000" );
4956 hexify( dst_str, output, 16 );
4958 fct_chk( strcmp( (
char *) dst_str,
"858075d536d79ccee571f7d7204b1f67" ) == 0 );
4963 #ifdef POLARSSL_CIPHER_MODE_CFB
4965 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_7)
4967 unsigned char key_str[100];
4968 unsigned char iv_str[100];
4969 unsigned char src_str[100];
4970 unsigned char dst_str[100];
4971 unsigned char output[100];
4973 size_t iv_offset = 0;
4976 memset(key_str, 0x00, 100);
4977 memset(iv_str, 0x00, 100);
4978 memset(src_str, 0x00, 100);
4979 memset(dst_str, 0x00, 100);
4980 memset(output, 0x00, 100);
4982 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
4983 unhexify( iv_str,
"6a118a874519e64e9963798a503f1d35" );
4984 unhexify( src_str,
"00000000000000000000000000000000" );
4988 hexify( dst_str, output, 16 );
4990 fct_chk( strcmp( (
char *) dst_str,
"dc43be40be0e53712f7e2bf5ca707209" ) == 0 );
4995 #ifdef POLARSSL_CIPHER_MODE_CFB
4997 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_8)
4999 unsigned char key_str[100];
5000 unsigned char iv_str[100];
5001 unsigned char src_str[100];
5002 unsigned char dst_str[100];
5003 unsigned char output[100];
5005 size_t iv_offset = 0;
5008 memset(key_str, 0x00, 100);
5009 memset(iv_str, 0x00, 100);
5010 memset(src_str, 0x00, 100);
5011 memset(dst_str, 0x00, 100);
5012 memset(output, 0x00, 100);
5014 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
5015 unhexify( iv_str,
"cb9fceec81286ca3e989bd979b0cb284" );
5016 unhexify( src_str,
"00000000000000000000000000000000" );
5020 hexify( dst_str, output, 16 );
5022 fct_chk( strcmp( (
char *) dst_str,
"92beedab1895a94faa69b632e5cc47ce" ) == 0 );
5027 #ifdef POLARSSL_CIPHER_MODE_CFB
5029 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_9)
5031 unsigned char key_str[100];
5032 unsigned char iv_str[100];
5033 unsigned char src_str[100];
5034 unsigned char dst_str[100];
5035 unsigned char output[100];
5037 size_t iv_offset = 0;
5040 memset(key_str, 0x00, 100);
5041 memset(iv_str, 0x00, 100);
5042 memset(src_str, 0x00, 100);
5043 memset(dst_str, 0x00, 100);
5044 memset(output, 0x00, 100);
5046 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
5047 unhexify( iv_str,
"b26aeb1874e47ca8358ff22378f09144" );
5048 unhexify( src_str,
"00000000000000000000000000000000" );
5052 hexify( dst_str, output, 16 );
5054 fct_chk( strcmp( (
char *) dst_str,
"459264f4798f6a78bacb89c15ed3d601" ) == 0 );
5059 #ifdef POLARSSL_CIPHER_MODE_CFB
5061 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_10)
5063 unsigned char key_str[100];
5064 unsigned char iv_str[100];
5065 unsigned char src_str[100];
5066 unsigned char dst_str[100];
5067 unsigned char output[100];
5069 size_t iv_offset = 0;
5072 memset(key_str, 0x00, 100);
5073 memset(iv_str, 0x00, 100);
5074 memset(src_str, 0x00, 100);
5075 memset(dst_str, 0x00, 100);
5076 memset(output, 0x00, 100);
5078 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
5079 unhexify( iv_str,
"fffffffffffffffffffffffffffffff0" );
5080 unhexify( src_str,
"00000000000000000000000000000000" );
5084 hexify( dst_str, output, 16 );
5086 fct_chk( strcmp( (
char *) dst_str,
"f9b0fda0c4a898f5b9e6f661c4ce4d07" ) == 0 );
5091 #ifdef POLARSSL_CIPHER_MODE_CFB
5093 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_11)
5095 unsigned char key_str[100];
5096 unsigned char iv_str[100];
5097 unsigned char src_str[100];
5098 unsigned char dst_str[100];
5099 unsigned char output[100];
5101 size_t iv_offset = 0;
5104 memset(key_str, 0x00, 100);
5105 memset(iv_str, 0x00, 100);
5106 memset(src_str, 0x00, 100);
5107 memset(dst_str, 0x00, 100);
5108 memset(output, 0x00, 100);
5110 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
5111 unhexify( iv_str,
"fffffffffffffffffffffffffffffff8" );
5112 unhexify( src_str,
"00000000000000000000000000000000" );
5116 hexify( dst_str, output, 16 );
5118 fct_chk( strcmp( (
char *) dst_str,
"8ade895913685c67c5269f8aae42983e" ) == 0 );
5123 #ifdef POLARSSL_CIPHER_MODE_CFB
5125 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_12)
5127 unsigned char key_str[100];
5128 unsigned char iv_str[100];
5129 unsigned char src_str[100];
5130 unsigned char dst_str[100];
5131 unsigned char output[100];
5133 size_t iv_offset = 0;
5136 memset(key_str, 0x00, 100);
5137 memset(iv_str, 0x00, 100);
5138 memset(src_str, 0x00, 100);
5139 memset(dst_str, 0x00, 100);
5140 memset(output, 0x00, 100);
5142 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
5143 unhexify( iv_str,
"fffffffffffffffffffffffffffffffc" );
5144 unhexify( src_str,
"00000000000000000000000000000000" );
5148 hexify( dst_str, output, 16 );
5150 fct_chk( strcmp( (
char *) dst_str,
"39bde67d5c8ed8a8b1c37eb8fa9f5ac0" ) == 0 );
5155 #ifdef POLARSSL_CIPHER_MODE_CFB
5157 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_1)
5159 unsigned char key_str[100];
5160 unsigned char iv_str[100];
5161 unsigned char src_str[100];
5162 unsigned char dst_str[100];
5163 unsigned char output[100];
5165 size_t iv_offset = 0;
5168 memset(key_str, 0x00, 100);
5169 memset(iv_str, 0x00, 100);
5170 memset(src_str, 0x00, 100);
5171 memset(dst_str, 0x00, 100);
5172 memset(output, 0x00, 100);
5174 key_len =
unhexify( key_str,
"fffffffe000000000000000000000000" );
5175 unhexify( iv_str,
"00000000000000000000000000000000" );
5176 unhexify( src_str,
"1114bc2028009b923f0b01915ce5e7c4" );
5180 hexify( dst_str, output, 16 );
5182 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
5187 #ifdef POLARSSL_CIPHER_MODE_CFB
5189 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_2)
5191 unsigned char key_str[100];
5192 unsigned char iv_str[100];
5193 unsigned char src_str[100];
5194 unsigned char dst_str[100];
5195 unsigned char output[100];
5197 size_t iv_offset = 0;
5200 memset(key_str, 0x00, 100);
5201 memset(iv_str, 0x00, 100);
5202 memset(src_str, 0x00, 100);
5203 memset(dst_str, 0x00, 100);
5204 memset(output, 0x00, 100);
5206 key_len =
unhexify( key_str,
"ffffffff000000000000000000000000" );
5207 unhexify( iv_str,
"00000000000000000000000000000000" );
5208 unhexify( src_str,
"9c28524a16a1e1c1452971caa8d13476" );
5212 hexify( dst_str, output, 16 );
5214 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
5219 #ifdef POLARSSL_CIPHER_MODE_CFB
5221 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_3)
5223 unsigned char key_str[100];
5224 unsigned char iv_str[100];
5225 unsigned char src_str[100];
5226 unsigned char dst_str[100];
5227 unsigned char output[100];
5229 size_t iv_offset = 0;
5232 memset(key_str, 0x00, 100);
5233 memset(iv_str, 0x00, 100);
5234 memset(src_str, 0x00, 100);
5235 memset(dst_str, 0x00, 100);
5236 memset(output, 0x00, 100);
5238 key_len =
unhexify( key_str,
"ffffffff800000000000000000000000" );
5239 unhexify( iv_str,
"00000000000000000000000000000000" );
5240 unhexify( src_str,
"ed62e16363638360fdd6ad62112794f0" );
5244 hexify( dst_str, output, 16 );
5246 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
5251 #ifdef POLARSSL_CIPHER_MODE_CFB
5253 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_4)
5255 unsigned char key_str[100];
5256 unsigned char iv_str[100];
5257 unsigned char src_str[100];
5258 unsigned char dst_str[100];
5259 unsigned char output[100];
5261 size_t iv_offset = 0;
5264 memset(key_str, 0x00, 100);
5265 memset(iv_str, 0x00, 100);
5266 memset(src_str, 0x00, 100);
5267 memset(dst_str, 0x00, 100);
5268 memset(output, 0x00, 100);
5270 key_len =
unhexify( key_str,
"3071a2a48fe6cbd04f1a129098e308f8" );
5271 unhexify( iv_str,
"00000000000000000000000000000000" );
5272 unhexify( src_str,
"4b98e06d356deb07ebb824e5713f7be3" );
5276 hexify( dst_str, output, 16 );
5278 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
5283 #ifdef POLARSSL_CIPHER_MODE_CFB
5285 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_5)
5287 unsigned char key_str[100];
5288 unsigned char iv_str[100];
5289 unsigned char src_str[100];
5290 unsigned char dst_str[100];
5291 unsigned char output[100];
5293 size_t iv_offset = 0;
5296 memset(key_str, 0x00, 100);
5297 memset(iv_str, 0x00, 100);
5298 memset(src_str, 0x00, 100);
5299 memset(dst_str, 0x00, 100);
5300 memset(output, 0x00, 100);
5302 key_len =
unhexify( key_str,
"90f42ec0f68385f2ffc5dfc03a654dce" );
5303 unhexify( iv_str,
"00000000000000000000000000000000" );
5304 unhexify( src_str,
"7a20a53d460fc9ce0423a7a0764c6cf2" );
5308 hexify( dst_str, output, 16 );
5310 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
5315 #ifdef POLARSSL_CIPHER_MODE_CFB
5317 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_6)
5319 unsigned char key_str[100];
5320 unsigned char iv_str[100];
5321 unsigned char src_str[100];
5322 unsigned char dst_str[100];
5323 unsigned char output[100];
5325 size_t iv_offset = 0;
5328 memset(key_str, 0x00, 100);
5329 memset(iv_str, 0x00, 100);
5330 memset(src_str, 0x00, 100);
5331 memset(dst_str, 0x00, 100);
5332 memset(output, 0x00, 100);
5334 key_len =
unhexify( key_str,
"febd9a24d8b65c1c787d50a4ed3619a9" );
5335 unhexify( iv_str,
"00000000000000000000000000000000" );
5336 unhexify( src_str,
"f4a70d8af877f9b02b4c40df57d45b17" );
5340 hexify( dst_str, output, 16 );
5342 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
5347 #ifdef POLARSSL_CIPHER_MODE_CFB
5349 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_7)
5351 unsigned char key_str[100];
5352 unsigned char iv_str[100];
5353 unsigned char src_str[100];
5354 unsigned char dst_str[100];
5355 unsigned char output[100];
5357 size_t iv_offset = 0;
5360 memset(key_str, 0x00, 100);
5361 memset(iv_str, 0x00, 100);
5362 memset(src_str, 0x00, 100);
5363 memset(dst_str, 0x00, 100);
5364 memset(output, 0x00, 100);
5366 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
5367 unhexify( iv_str,
"f34481ec3cc627bacd5dc3fb08f273e6" );
5368 unhexify( src_str,
"0336763e966d92595a567cc9ce537f5e" );
5372 hexify( dst_str, output, 16 );
5374 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
5379 #ifdef POLARSSL_CIPHER_MODE_CFB
5381 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_8)
5383 unsigned char key_str[100];
5384 unsigned char iv_str[100];
5385 unsigned char src_str[100];
5386 unsigned char dst_str[100];
5387 unsigned char output[100];
5389 size_t iv_offset = 0;
5392 memset(key_str, 0x00, 100);
5393 memset(iv_str, 0x00, 100);
5394 memset(src_str, 0x00, 100);
5395 memset(dst_str, 0x00, 100);
5396 memset(output, 0x00, 100);
5398 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
5399 unhexify( iv_str,
"9798c4640bad75c7c3227db910174e72" );
5400 unhexify( src_str,
"a9a1631bf4996954ebc093957b234589" );
5404 hexify( dst_str, output, 16 );
5406 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
5411 #ifdef POLARSSL_CIPHER_MODE_CFB
5413 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_9)
5415 unsigned char key_str[100];
5416 unsigned char iv_str[100];
5417 unsigned char src_str[100];
5418 unsigned char dst_str[100];
5419 unsigned char output[100];
5421 size_t iv_offset = 0;
5424 memset(key_str, 0x00, 100);
5425 memset(iv_str, 0x00, 100);
5426 memset(src_str, 0x00, 100);
5427 memset(dst_str, 0x00, 100);
5428 memset(output, 0x00, 100);
5430 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
5431 unhexify( iv_str,
"96ab5c2ff612d9dfaae8c31f30c42168" );
5432 unhexify( src_str,
"ff4f8391a6a40ca5b25d23bedd44a597" );
5436 hexify( dst_str, output, 16 );
5438 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
5443 #ifdef POLARSSL_CIPHER_MODE_CFB
5445 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_10)
5447 unsigned char key_str[100];
5448 unsigned char iv_str[100];
5449 unsigned char src_str[100];
5450 unsigned char dst_str[100];
5451 unsigned char output[100];
5453 size_t iv_offset = 0;
5456 memset(key_str, 0x00, 100);
5457 memset(iv_str, 0x00, 100);
5458 memset(src_str, 0x00, 100);
5459 memset(dst_str, 0x00, 100);
5460 memset(output, 0x00, 100);
5462 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
5463 unhexify( iv_str,
"ffffffffffffffff0000000000000000" );
5464 unhexify( src_str,
"f807c3e7985fe0f5a50e2cdb25c5109e" );
5468 hexify( dst_str, output, 16 );
5470 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
5475 #ifdef POLARSSL_CIPHER_MODE_CFB
5477 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_11)
5479 unsigned char key_str[100];
5480 unsigned char iv_str[100];
5481 unsigned char src_str[100];
5482 unsigned char dst_str[100];
5483 unsigned char output[100];
5485 size_t iv_offset = 0;
5488 memset(key_str, 0x00, 100);
5489 memset(iv_str, 0x00, 100);
5490 memset(src_str, 0x00, 100);
5491 memset(dst_str, 0x00, 100);
5492 memset(output, 0x00, 100);
5494 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
5495 unhexify( iv_str,
"ffffffffffffffff8000000000000000" );
5496 unhexify( src_str,
"41f992a856fb278b389a62f5d274d7e9" );
5500 hexify( dst_str, output, 16 );
5502 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
5507 #ifdef POLARSSL_CIPHER_MODE_CFB
5509 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_12)
5511 unsigned char key_str[100];
5512 unsigned char iv_str[100];
5513 unsigned char src_str[100];
5514 unsigned char dst_str[100];
5515 unsigned char output[100];
5517 size_t iv_offset = 0;
5520 memset(key_str, 0x00, 100);
5521 memset(iv_str, 0x00, 100);
5522 memset(src_str, 0x00, 100);
5523 memset(dst_str, 0x00, 100);
5524 memset(output, 0x00, 100);
5526 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
5527 unhexify( iv_str,
"ffffffffffffffffc000000000000000" );
5528 unhexify( src_str,
"10d3ed7a6fe15ab4d91acbc7d0767ab1" );
5532 hexify( dst_str, output, 16 );
5534 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
5539 #ifdef POLARSSL_CIPHER_MODE_CFB
5541 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_1)
5543 unsigned char key_str[100];
5544 unsigned char iv_str[100];
5545 unsigned char src_str[100];
5546 unsigned char dst_str[100];
5547 unsigned char output[100];
5549 size_t iv_offset = 0;
5552 memset(key_str, 0x00, 100);
5553 memset(iv_str, 0x00, 100);
5554 memset(src_str, 0x00, 100);
5555 memset(dst_str, 0x00, 100);
5556 memset(output, 0x00, 100);
5558 key_len =
unhexify( key_str,
"fffffffffffffffffffc0000000000000000000000000000" );
5559 unhexify( iv_str,
"00000000000000000000000000000000" );
5560 unhexify( src_str,
"00000000000000000000000000000000" );
5564 hexify( dst_str, output, 16 );
5566 fct_chk( strcmp( (
char *) dst_str,
"8dfd999be5d0cfa35732c0ddc88ff5a5" ) == 0 );
5571 #ifdef POLARSSL_CIPHER_MODE_CFB
5573 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_2)
5575 unsigned char key_str[100];
5576 unsigned char iv_str[100];
5577 unsigned char src_str[100];
5578 unsigned char dst_str[100];
5579 unsigned char output[100];
5581 size_t iv_offset = 0;
5584 memset(key_str, 0x00, 100);
5585 memset(iv_str, 0x00, 100);
5586 memset(src_str, 0x00, 100);
5587 memset(dst_str, 0x00, 100);
5588 memset(output, 0x00, 100);
5590 key_len =
unhexify( key_str,
"fffffffffffffffffffe0000000000000000000000000000" );
5591 unhexify( iv_str,
"00000000000000000000000000000000" );
5592 unhexify( src_str,
"00000000000000000000000000000000" );
5596 hexify( dst_str, output, 16 );
5598 fct_chk( strcmp( (
char *) dst_str,
"02647c76a300c3173b841487eb2bae9f" ) == 0 );
5603 #ifdef POLARSSL_CIPHER_MODE_CFB
5605 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_3)
5607 unsigned char key_str[100];
5608 unsigned char iv_str[100];
5609 unsigned char src_str[100];
5610 unsigned char dst_str[100];
5611 unsigned char output[100];
5613 size_t iv_offset = 0;
5616 memset(key_str, 0x00, 100);
5617 memset(iv_str, 0x00, 100);
5618 memset(src_str, 0x00, 100);
5619 memset(dst_str, 0x00, 100);
5620 memset(output, 0x00, 100);
5622 key_len =
unhexify( key_str,
"ffffffffffffffffffff0000000000000000000000000000" );
5623 unhexify( iv_str,
"00000000000000000000000000000000" );
5624 unhexify( src_str,
"00000000000000000000000000000000" );
5628 hexify( dst_str, output, 16 );
5630 fct_chk( strcmp( (
char *) dst_str,
"172df8b02f04b53adab028b4e01acd87" ) == 0 );
5635 #ifdef POLARSSL_CIPHER_MODE_CFB
5637 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_4)
5639 unsigned char key_str[100];
5640 unsigned char iv_str[100];
5641 unsigned char src_str[100];
5642 unsigned char dst_str[100];
5643 unsigned char output[100];
5645 size_t iv_offset = 0;
5648 memset(key_str, 0x00, 100);
5649 memset(iv_str, 0x00, 100);
5650 memset(src_str, 0x00, 100);
5651 memset(dst_str, 0x00, 100);
5652 memset(output, 0x00, 100);
5654 key_len =
unhexify( key_str,
"d184c36cf0dddfec39e654195006022237871a47c33d3198" );
5655 unhexify( iv_str,
"00000000000000000000000000000000" );
5656 unhexify( src_str,
"00000000000000000000000000000000" );
5660 hexify( dst_str, output, 16 );
5662 fct_chk( strcmp( (
char *) dst_str,
"2e19fb60a3e1de0166f483c97824a978" ) == 0 );
5667 #ifdef POLARSSL_CIPHER_MODE_CFB
5669 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_5)
5671 unsigned char key_str[100];
5672 unsigned char iv_str[100];
5673 unsigned char src_str[100];
5674 unsigned char dst_str[100];
5675 unsigned char output[100];
5677 size_t iv_offset = 0;
5680 memset(key_str, 0x00, 100);
5681 memset(iv_str, 0x00, 100);
5682 memset(src_str, 0x00, 100);
5683 memset(dst_str, 0x00, 100);
5684 memset(output, 0x00, 100);
5686 key_len =
unhexify( key_str,
"4c6994ffa9dcdc805b60c2c0095334c42d95a8fc0ca5b080" );
5687 unhexify( iv_str,
"00000000000000000000000000000000" );
5688 unhexify( src_str,
"00000000000000000000000000000000" );
5692 hexify( dst_str, output, 16 );
5694 fct_chk( strcmp( (
char *) dst_str,
"7656709538dd5fec41e0ce6a0f8e207d" ) == 0 );
5699 #ifdef POLARSSL_CIPHER_MODE_CFB
5701 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_6)
5703 unsigned char key_str[100];
5704 unsigned char iv_str[100];
5705 unsigned char src_str[100];
5706 unsigned char dst_str[100];
5707 unsigned char output[100];
5709 size_t iv_offset = 0;
5712 memset(key_str, 0x00, 100);
5713 memset(iv_str, 0x00, 100);
5714 memset(src_str, 0x00, 100);
5715 memset(dst_str, 0x00, 100);
5716 memset(output, 0x00, 100);
5718 key_len =
unhexify( key_str,
"c88f5b00a4ef9a6840e2acaf33f00a3bdc4e25895303fa72" );
5719 unhexify( iv_str,
"00000000000000000000000000000000" );
5720 unhexify( src_str,
"00000000000000000000000000000000" );
5724 hexify( dst_str, output, 16 );
5726 fct_chk( strcmp( (
char *) dst_str,
"a67cf333b314d411d3c0ae6e1cfcd8f5" ) == 0 );
5731 #ifdef POLARSSL_CIPHER_MODE_CFB
5733 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_7)
5735 unsigned char key_str[100];
5736 unsigned char iv_str[100];
5737 unsigned char src_str[100];
5738 unsigned char dst_str[100];
5739 unsigned char output[100];
5741 size_t iv_offset = 0;
5744 memset(key_str, 0x00, 100);
5745 memset(iv_str, 0x00, 100);
5746 memset(src_str, 0x00, 100);
5747 memset(dst_str, 0x00, 100);
5748 memset(output, 0x00, 100);
5750 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
5751 unhexify( iv_str,
"9c2d8842e5f48f57648205d39a239af1" );
5752 unhexify( src_str,
"00000000000000000000000000000000" );
5756 hexify( dst_str, output, 16 );
5758 fct_chk( strcmp( (
char *) dst_str,
"c9b8135ff1b5adc413dfd053b21bd96d" ) == 0 );
5763 #ifdef POLARSSL_CIPHER_MODE_CFB
5765 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_8)
5767 unsigned char key_str[100];
5768 unsigned char iv_str[100];
5769 unsigned char src_str[100];
5770 unsigned char dst_str[100];
5771 unsigned char output[100];
5773 size_t iv_offset = 0;
5776 memset(key_str, 0x00, 100);
5777 memset(iv_str, 0x00, 100);
5778 memset(src_str, 0x00, 100);
5779 memset(dst_str, 0x00, 100);
5780 memset(output, 0x00, 100);
5782 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
5783 unhexify( iv_str,
"bff52510095f518ecca60af4205444bb" );
5784 unhexify( src_str,
"00000000000000000000000000000000" );
5788 hexify( dst_str, output, 16 );
5790 fct_chk( strcmp( (
char *) dst_str,
"4a3650c3371ce2eb35e389a171427440" ) == 0 );
5795 #ifdef POLARSSL_CIPHER_MODE_CFB
5797 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_9)
5799 unsigned char key_str[100];
5800 unsigned char iv_str[100];
5801 unsigned char src_str[100];
5802 unsigned char dst_str[100];
5803 unsigned char output[100];
5805 size_t iv_offset = 0;
5808 memset(key_str, 0x00, 100);
5809 memset(iv_str, 0x00, 100);
5810 memset(src_str, 0x00, 100);
5811 memset(dst_str, 0x00, 100);
5812 memset(output, 0x00, 100);
5814 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
5815 unhexify( iv_str,
"51719783d3185a535bd75adc65071ce1" );
5816 unhexify( src_str,
"00000000000000000000000000000000" );
5820 hexify( dst_str, output, 16 );
5822 fct_chk( strcmp( (
char *) dst_str,
"4f354592ff7c8847d2d0870ca9481b7c" ) == 0 );
5827 #ifdef POLARSSL_CIPHER_MODE_CFB
5829 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_10)
5831 unsigned char key_str[100];
5832 unsigned char iv_str[100];
5833 unsigned char src_str[100];
5834 unsigned char dst_str[100];
5835 unsigned char output[100];
5837 size_t iv_offset = 0;
5840 memset(key_str, 0x00, 100);
5841 memset(iv_str, 0x00, 100);
5842 memset(src_str, 0x00, 100);
5843 memset(dst_str, 0x00, 100);
5844 memset(output, 0x00, 100);
5846 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
5847 unhexify( iv_str,
"ffffffffffffffe00000000000000000" );
5848 unhexify( src_str,
"00000000000000000000000000000000" );
5852 hexify( dst_str, output, 16 );
5854 fct_chk( strcmp( (
char *) dst_str,
"f34e4a6324ea4a5c39a661c8fe5ada8f" ) == 0 );
5859 #ifdef POLARSSL_CIPHER_MODE_CFB
5861 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_11)
5863 unsigned char key_str[100];
5864 unsigned char iv_str[100];
5865 unsigned char src_str[100];
5866 unsigned char dst_str[100];
5867 unsigned char output[100];
5869 size_t iv_offset = 0;
5872 memset(key_str, 0x00, 100);
5873 memset(iv_str, 0x00, 100);
5874 memset(src_str, 0x00, 100);
5875 memset(dst_str, 0x00, 100);
5876 memset(output, 0x00, 100);
5878 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
5879 unhexify( iv_str,
"fffffffffffffff00000000000000000" );
5880 unhexify( src_str,
"00000000000000000000000000000000" );
5884 hexify( dst_str, output, 16 );
5886 fct_chk( strcmp( (
char *) dst_str,
"0882a16f44088d42447a29ac090ec17e" ) == 0 );
5891 #ifdef POLARSSL_CIPHER_MODE_CFB
5893 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_12)
5895 unsigned char key_str[100];
5896 unsigned char iv_str[100];
5897 unsigned char src_str[100];
5898 unsigned char dst_str[100];
5899 unsigned char output[100];
5901 size_t iv_offset = 0;
5904 memset(key_str, 0x00, 100);
5905 memset(iv_str, 0x00, 100);
5906 memset(src_str, 0x00, 100);
5907 memset(dst_str, 0x00, 100);
5908 memset(output, 0x00, 100);
5910 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
5911 unhexify( iv_str,
"fffffffffffffff80000000000000000" );
5912 unhexify( src_str,
"00000000000000000000000000000000" );
5916 hexify( dst_str, output, 16 );
5918 fct_chk( strcmp( (
char *) dst_str,
"3a3c15bfc11a9537c130687004e136ee" ) == 0 );
5923 #ifdef POLARSSL_CIPHER_MODE_CFB
5925 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_1)
5927 unsigned char key_str[100];
5928 unsigned char iv_str[100];
5929 unsigned char src_str[100];
5930 unsigned char dst_str[100];
5931 unsigned char output[100];
5933 size_t iv_offset = 0;
5936 memset(key_str, 0x00, 100);
5937 memset(iv_str, 0x00, 100);
5938 memset(src_str, 0x00, 100);
5939 memset(dst_str, 0x00, 100);
5940 memset(output, 0x00, 100);
5942 key_len =
unhexify( key_str,
"ffffffffffffffffffffffffffffffffffffffffffe00000" );
5943 unhexify( iv_str,
"00000000000000000000000000000000" );
5944 unhexify( src_str,
"60136703374f64e860b48ce31f930716" );
5948 hexify( dst_str, output, 16 );
5950 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
5955 #ifdef POLARSSL_CIPHER_MODE_CFB
5957 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_2)
5959 unsigned char key_str[100];
5960 unsigned char iv_str[100];
5961 unsigned char src_str[100];
5962 unsigned char dst_str[100];
5963 unsigned char output[100];
5965 size_t iv_offset = 0;
5968 memset(key_str, 0x00, 100);
5969 memset(iv_str, 0x00, 100);
5970 memset(src_str, 0x00, 100);
5971 memset(dst_str, 0x00, 100);
5972 memset(output, 0x00, 100);
5974 key_len =
unhexify( key_str,
"fffffffffffffffffffffffffffffffffffffffffff00000" );
5975 unhexify( iv_str,
"00000000000000000000000000000000" );
5976 unhexify( src_str,
"8d63a269b14d506ccc401ab8a9f1b591" );
5980 hexify( dst_str, output, 16 );
5982 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
5987 #ifdef POLARSSL_CIPHER_MODE_CFB
5989 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_3)
5991 unsigned char key_str[100];
5992 unsigned char iv_str[100];
5993 unsigned char src_str[100];
5994 unsigned char dst_str[100];
5995 unsigned char output[100];
5997 size_t iv_offset = 0;
6000 memset(key_str, 0x00, 100);
6001 memset(iv_str, 0x00, 100);
6002 memset(src_str, 0x00, 100);
6003 memset(dst_str, 0x00, 100);
6004 memset(output, 0x00, 100);
6006 key_len =
unhexify( key_str,
"fffffffffffffffffffffffffffffffffffffffffff80000" );
6007 unhexify( iv_str,
"00000000000000000000000000000000" );
6008 unhexify( src_str,
"d317f81dc6aa454aee4bd4a5a5cff4bd" );
6012 hexify( dst_str, output, 16 );
6014 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6019 #ifdef POLARSSL_CIPHER_MODE_CFB
6021 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_4)
6023 unsigned char key_str[100];
6024 unsigned char iv_str[100];
6025 unsigned char src_str[100];
6026 unsigned char dst_str[100];
6027 unsigned char output[100];
6029 size_t iv_offset = 0;
6032 memset(key_str, 0x00, 100);
6033 memset(iv_str, 0x00, 100);
6034 memset(src_str, 0x00, 100);
6035 memset(dst_str, 0x00, 100);
6036 memset(output, 0x00, 100);
6038 key_len =
unhexify( key_str,
"98c6b8e01e379fbd14e61af6af891596583565f2a27d59e9" );
6039 unhexify( iv_str,
"00000000000000000000000000000000" );
6040 unhexify( src_str,
"19c80ec4a6deb7e5ed1033dda933498f" );
6044 hexify( dst_str, output, 16 );
6046 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6051 #ifdef POLARSSL_CIPHER_MODE_CFB
6053 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_5)
6055 unsigned char key_str[100];
6056 unsigned char iv_str[100];
6057 unsigned char src_str[100];
6058 unsigned char dst_str[100];
6059 unsigned char output[100];
6061 size_t iv_offset = 0;
6064 memset(key_str, 0x00, 100);
6065 memset(iv_str, 0x00, 100);
6066 memset(src_str, 0x00, 100);
6067 memset(dst_str, 0x00, 100);
6068 memset(output, 0x00, 100);
6070 key_len =
unhexify( key_str,
"b3ad5cea1dddc214ca969ac35f37dae1a9a9d1528f89bb35" );
6071 unhexify( iv_str,
"00000000000000000000000000000000" );
6072 unhexify( src_str,
"3cf5e1d21a17956d1dffad6a7c41c659" );
6076 hexify( dst_str, output, 16 );
6078 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6083 #ifdef POLARSSL_CIPHER_MODE_CFB
6085 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_6)
6087 unsigned char key_str[100];
6088 unsigned char iv_str[100];
6089 unsigned char src_str[100];
6090 unsigned char dst_str[100];
6091 unsigned char output[100];
6093 size_t iv_offset = 0;
6096 memset(key_str, 0x00, 100);
6097 memset(iv_str, 0x00, 100);
6098 memset(src_str, 0x00, 100);
6099 memset(dst_str, 0x00, 100);
6100 memset(output, 0x00, 100);
6102 key_len =
unhexify( key_str,
"45899367c3132849763073c435a9288a766c8b9ec2308516" );
6103 unhexify( iv_str,
"00000000000000000000000000000000" );
6104 unhexify( src_str,
"69fd12e8505f8ded2fdcb197a121b362" );
6108 hexify( dst_str, output, 16 );
6110 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6115 #ifdef POLARSSL_CIPHER_MODE_CFB
6117 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_7)
6119 unsigned char key_str[100];
6120 unsigned char iv_str[100];
6121 unsigned char src_str[100];
6122 unsigned char dst_str[100];
6123 unsigned char output[100];
6125 size_t iv_offset = 0;
6128 memset(key_str, 0x00, 100);
6129 memset(iv_str, 0x00, 100);
6130 memset(src_str, 0x00, 100);
6131 memset(dst_str, 0x00, 100);
6132 memset(output, 0x00, 100);
6134 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
6135 unhexify( iv_str,
"1b077a6af4b7f98229de786d7516b639" );
6136 unhexify( src_str,
"275cfc0413d8ccb70513c3859b1d0f72" );
6140 hexify( dst_str, output, 16 );
6142 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6147 #ifdef POLARSSL_CIPHER_MODE_CFB
6149 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_8)
6151 unsigned char key_str[100];
6152 unsigned char iv_str[100];
6153 unsigned char src_str[100];
6154 unsigned char dst_str[100];
6155 unsigned char output[100];
6157 size_t iv_offset = 0;
6160 memset(key_str, 0x00, 100);
6161 memset(iv_str, 0x00, 100);
6162 memset(src_str, 0x00, 100);
6163 memset(dst_str, 0x00, 100);
6164 memset(output, 0x00, 100);
6166 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
6167 unhexify( iv_str,
"9c2d8842e5f48f57648205d39a239af1" );
6168 unhexify( src_str,
"c9b8135ff1b5adc413dfd053b21bd96d" );
6172 hexify( dst_str, output, 16 );
6174 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6179 #ifdef POLARSSL_CIPHER_MODE_CFB
6181 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_9)
6183 unsigned char key_str[100];
6184 unsigned char iv_str[100];
6185 unsigned char src_str[100];
6186 unsigned char dst_str[100];
6187 unsigned char output[100];
6189 size_t iv_offset = 0;
6192 memset(key_str, 0x00, 100);
6193 memset(iv_str, 0x00, 100);
6194 memset(src_str, 0x00, 100);
6195 memset(dst_str, 0x00, 100);
6196 memset(output, 0x00, 100);
6198 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
6199 unhexify( iv_str,
"bff52510095f518ecca60af4205444bb" );
6200 unhexify( src_str,
"4a3650c3371ce2eb35e389a171427440" );
6204 hexify( dst_str, output, 16 );
6206 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6211 #ifdef POLARSSL_CIPHER_MODE_CFB
6213 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_10)
6215 unsigned char key_str[100];
6216 unsigned char iv_str[100];
6217 unsigned char src_str[100];
6218 unsigned char dst_str[100];
6219 unsigned char output[100];
6221 size_t iv_offset = 0;
6224 memset(key_str, 0x00, 100);
6225 memset(iv_str, 0x00, 100);
6226 memset(src_str, 0x00, 100);
6227 memset(dst_str, 0x00, 100);
6228 memset(output, 0x00, 100);
6230 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
6231 unhexify( iv_str,
"ffffffffffffffffffff000000000000" );
6232 unhexify( src_str,
"54d632d03aba0bd0f91877ebdd4d09cb" );
6236 hexify( dst_str, output, 16 );
6238 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6243 #ifdef POLARSSL_CIPHER_MODE_CFB
6245 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_11)
6247 unsigned char key_str[100];
6248 unsigned char iv_str[100];
6249 unsigned char src_str[100];
6250 unsigned char dst_str[100];
6251 unsigned char output[100];
6253 size_t iv_offset = 0;
6256 memset(key_str, 0x00, 100);
6257 memset(iv_str, 0x00, 100);
6258 memset(src_str, 0x00, 100);
6259 memset(dst_str, 0x00, 100);
6260 memset(output, 0x00, 100);
6262 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
6263 unhexify( iv_str,
"ffffffffffffffffffff800000000000" );
6264 unhexify( src_str,
"d3427be7e4d27cd54f5fe37b03cf0897" );
6268 hexify( dst_str, output, 16 );
6270 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6275 #ifdef POLARSSL_CIPHER_MODE_CFB
6277 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_12)
6279 unsigned char key_str[100];
6280 unsigned char iv_str[100];
6281 unsigned char src_str[100];
6282 unsigned char dst_str[100];
6283 unsigned char output[100];
6285 size_t iv_offset = 0;
6288 memset(key_str, 0x00, 100);
6289 memset(iv_str, 0x00, 100);
6290 memset(src_str, 0x00, 100);
6291 memset(dst_str, 0x00, 100);
6292 memset(output, 0x00, 100);
6294 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
6295 unhexify( iv_str,
"ffffffffffffffffffffc00000000000" );
6296 unhexify( src_str,
"b2099795e88cc158fd75ea133d7e7fbe" );
6300 hexify( dst_str, output, 16 );
6302 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6307 #ifdef POLARSSL_CIPHER_MODE_CFB
6309 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_1)
6311 unsigned char key_str[100];
6312 unsigned char iv_str[100];
6313 unsigned char src_str[100];
6314 unsigned char dst_str[100];
6315 unsigned char output[100];
6317 size_t iv_offset = 0;
6320 memset(key_str, 0x00, 100);
6321 memset(iv_str, 0x00, 100);
6322 memset(src_str, 0x00, 100);
6323 memset(dst_str, 0x00, 100);
6324 memset(output, 0x00, 100);
6326 key_len =
unhexify( key_str,
"ffffffe000000000000000000000000000000000000000000000000000000000" );
6327 unhexify( iv_str,
"00000000000000000000000000000000" );
6328 unhexify( src_str,
"00000000000000000000000000000000" );
6332 hexify( dst_str, output, 16 );
6334 fct_chk( strcmp( (
char *) dst_str,
"bbd1097a62433f79449fa97d4ee80dbf" ) == 0 );
6339 #ifdef POLARSSL_CIPHER_MODE_CFB
6341 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_2)
6343 unsigned char key_str[100];
6344 unsigned char iv_str[100];
6345 unsigned char src_str[100];
6346 unsigned char dst_str[100];
6347 unsigned char output[100];
6349 size_t iv_offset = 0;
6352 memset(key_str, 0x00, 100);
6353 memset(iv_str, 0x00, 100);
6354 memset(src_str, 0x00, 100);
6355 memset(dst_str, 0x00, 100);
6356 memset(output, 0x00, 100);
6358 key_len =
unhexify( key_str,
"fffffff000000000000000000000000000000000000000000000000000000000" );
6359 unhexify( iv_str,
"00000000000000000000000000000000" );
6360 unhexify( src_str,
"00000000000000000000000000000000" );
6364 hexify( dst_str, output, 16 );
6366 fct_chk( strcmp( (
char *) dst_str,
"07058e408f5b99b0e0f061a1761b5b3b" ) == 0 );
6371 #ifdef POLARSSL_CIPHER_MODE_CFB
6373 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_3)
6375 unsigned char key_str[100];
6376 unsigned char iv_str[100];
6377 unsigned char src_str[100];
6378 unsigned char dst_str[100];
6379 unsigned char output[100];
6381 size_t iv_offset = 0;
6384 memset(key_str, 0x00, 100);
6385 memset(iv_str, 0x00, 100);
6386 memset(src_str, 0x00, 100);
6387 memset(dst_str, 0x00, 100);
6388 memset(output, 0x00, 100);
6390 key_len =
unhexify( key_str,
"fffffff800000000000000000000000000000000000000000000000000000000" );
6391 unhexify( iv_str,
"00000000000000000000000000000000" );
6392 unhexify( src_str,
"00000000000000000000000000000000" );
6396 hexify( dst_str, output, 16 );
6398 fct_chk( strcmp( (
char *) dst_str,
"5fd1f13fa0f31e37fabde328f894eac2" ) == 0 );
6403 #ifdef POLARSSL_CIPHER_MODE_CFB
6405 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_4)
6407 unsigned char key_str[100];
6408 unsigned char iv_str[100];
6409 unsigned char src_str[100];
6410 unsigned char dst_str[100];
6411 unsigned char output[100];
6413 size_t iv_offset = 0;
6416 memset(key_str, 0x00, 100);
6417 memset(iv_str, 0x00, 100);
6418 memset(src_str, 0x00, 100);
6419 memset(dst_str, 0x00, 100);
6420 memset(output, 0x00, 100);
6422 key_len =
unhexify( key_str,
"13428b5e4c005e0636dd338405d173ab135dec2a25c22c5df0722d69dcc43887" );
6423 unhexify( iv_str,
"00000000000000000000000000000000" );
6424 unhexify( src_str,
"00000000000000000000000000000000" );
6428 hexify( dst_str, output, 16 );
6430 fct_chk( strcmp( (
char *) dst_str,
"649a71545378c783e368c9ade7114f6c" ) == 0 );
6435 #ifdef POLARSSL_CIPHER_MODE_CFB
6437 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_5)
6439 unsigned char key_str[100];
6440 unsigned char iv_str[100];
6441 unsigned char src_str[100];
6442 unsigned char dst_str[100];
6443 unsigned char output[100];
6445 size_t iv_offset = 0;
6448 memset(key_str, 0x00, 100);
6449 memset(iv_str, 0x00, 100);
6450 memset(src_str, 0x00, 100);
6451 memset(dst_str, 0x00, 100);
6452 memset(output, 0x00, 100);
6454 key_len =
unhexify( key_str,
"07eb03a08d291d1b07408bf3512ab40c91097ac77461aad4bb859647f74f00ee" );
6455 unhexify( iv_str,
"00000000000000000000000000000000" );
6456 unhexify( src_str,
"00000000000000000000000000000000" );
6460 hexify( dst_str, output, 16 );
6462 fct_chk( strcmp( (
char *) dst_str,
"47cb030da2ab051dfc6c4bf6910d12bb" ) == 0 );
6467 #ifdef POLARSSL_CIPHER_MODE_CFB
6469 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_6)
6471 unsigned char key_str[100];
6472 unsigned char iv_str[100];
6473 unsigned char src_str[100];
6474 unsigned char dst_str[100];
6475 unsigned char output[100];
6477 size_t iv_offset = 0;
6480 memset(key_str, 0x00, 100);
6481 memset(iv_str, 0x00, 100);
6482 memset(src_str, 0x00, 100);
6483 memset(dst_str, 0x00, 100);
6484 memset(output, 0x00, 100);
6486 key_len =
unhexify( key_str,
"90143ae20cd78c5d8ebdd6cb9dc1762427a96c78c639bccc41a61424564eafe1" );
6487 unhexify( iv_str,
"00000000000000000000000000000000" );
6488 unhexify( src_str,
"00000000000000000000000000000000" );
6492 hexify( dst_str, output, 16 );
6494 fct_chk( strcmp( (
char *) dst_str,
"798c7c005dee432b2c8ea5dfa381ecc3" ) == 0 );
6499 #ifdef POLARSSL_CIPHER_MODE_CFB
6501 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_7)
6503 unsigned char key_str[100];
6504 unsigned char iv_str[100];
6505 unsigned char src_str[100];
6506 unsigned char dst_str[100];
6507 unsigned char output[100];
6509 size_t iv_offset = 0;
6512 memset(key_str, 0x00, 100);
6513 memset(iv_str, 0x00, 100);
6514 memset(src_str, 0x00, 100);
6515 memset(dst_str, 0x00, 100);
6516 memset(output, 0x00, 100);
6518 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
6519 unhexify( iv_str,
"0b24af36193ce4665f2825d7b4749c98" );
6520 unhexify( src_str,
"00000000000000000000000000000000" );
6524 hexify( dst_str, output, 16 );
6526 fct_chk( strcmp( (
char *) dst_str,
"a9ff75bd7cf6613d3731c77c3b6d0c04" ) == 0 );
6531 #ifdef POLARSSL_CIPHER_MODE_CFB
6533 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_8)
6535 unsigned char key_str[100];
6536 unsigned char iv_str[100];
6537 unsigned char src_str[100];
6538 unsigned char dst_str[100];
6539 unsigned char output[100];
6541 size_t iv_offset = 0;
6544 memset(key_str, 0x00, 100);
6545 memset(iv_str, 0x00, 100);
6546 memset(src_str, 0x00, 100);
6547 memset(dst_str, 0x00, 100);
6548 memset(output, 0x00, 100);
6550 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
6551 unhexify( iv_str,
"761c1fe41a18acf20d241650611d90f1" );
6552 unhexify( src_str,
"00000000000000000000000000000000" );
6556 hexify( dst_str, output, 16 );
6558 fct_chk( strcmp( (
char *) dst_str,
"623a52fcea5d443e48d9181ab32c7421" ) == 0 );
6563 #ifdef POLARSSL_CIPHER_MODE_CFB
6565 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_9)
6567 unsigned char key_str[100];
6568 unsigned char iv_str[100];
6569 unsigned char src_str[100];
6570 unsigned char dst_str[100];
6571 unsigned char output[100];
6573 size_t iv_offset = 0;
6576 memset(key_str, 0x00, 100);
6577 memset(iv_str, 0x00, 100);
6578 memset(src_str, 0x00, 100);
6579 memset(dst_str, 0x00, 100);
6580 memset(output, 0x00, 100);
6582 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
6583 unhexify( iv_str,
"8a560769d605868ad80d819bdba03771" );
6584 unhexify( src_str,
"00000000000000000000000000000000" );
6588 hexify( dst_str, output, 16 );
6590 fct_chk( strcmp( (
char *) dst_str,
"38f2c7ae10612415d27ca190d27da8b4" ) == 0 );
6595 #ifdef POLARSSL_CIPHER_MODE_CFB
6597 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_10)
6599 unsigned char key_str[100];
6600 unsigned char iv_str[100];
6601 unsigned char src_str[100];
6602 unsigned char dst_str[100];
6603 unsigned char output[100];
6605 size_t iv_offset = 0;
6608 memset(key_str, 0x00, 100);
6609 memset(iv_str, 0x00, 100);
6610 memset(src_str, 0x00, 100);
6611 memset(dst_str, 0x00, 100);
6612 memset(output, 0x00, 100);
6614 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
6615 unhexify( iv_str,
"ffffffffffffffffffffffffe0000000" );
6616 unhexify( src_str,
"00000000000000000000000000000000" );
6620 hexify( dst_str, output, 16 );
6622 fct_chk( strcmp( (
char *) dst_str,
"2be1fae5048a25582a679ca10905eb80" ) == 0 );
6627 #ifdef POLARSSL_CIPHER_MODE_CFB
6629 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_11)
6631 unsigned char key_str[100];
6632 unsigned char iv_str[100];
6633 unsigned char src_str[100];
6634 unsigned char dst_str[100];
6635 unsigned char output[100];
6637 size_t iv_offset = 0;
6640 memset(key_str, 0x00, 100);
6641 memset(iv_str, 0x00, 100);
6642 memset(src_str, 0x00, 100);
6643 memset(dst_str, 0x00, 100);
6644 memset(output, 0x00, 100);
6646 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
6647 unhexify( iv_str,
"fffffffffffffffffffffffff0000000" );
6648 unhexify( src_str,
"00000000000000000000000000000000" );
6652 hexify( dst_str, output, 16 );
6654 fct_chk( strcmp( (
char *) dst_str,
"da86f292c6f41ea34fb2068df75ecc29" ) == 0 );
6659 #ifdef POLARSSL_CIPHER_MODE_CFB
6661 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_12)
6663 unsigned char key_str[100];
6664 unsigned char iv_str[100];
6665 unsigned char src_str[100];
6666 unsigned char dst_str[100];
6667 unsigned char output[100];
6669 size_t iv_offset = 0;
6672 memset(key_str, 0x00, 100);
6673 memset(iv_str, 0x00, 100);
6674 memset(src_str, 0x00, 100);
6675 memset(dst_str, 0x00, 100);
6676 memset(output, 0x00, 100);
6678 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
6679 unhexify( iv_str,
"fffffffffffffffffffffffff8000000" );
6680 unhexify( src_str,
"00000000000000000000000000000000" );
6684 hexify( dst_str, output, 16 );
6686 fct_chk( strcmp( (
char *) dst_str,
"220df19f85d69b1b562fa69a3c5beca5" ) == 0 );
6691 #ifdef POLARSSL_CIPHER_MODE_CFB
6693 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_1)
6695 unsigned char key_str[100];
6696 unsigned char iv_str[100];
6697 unsigned char src_str[100];
6698 unsigned char dst_str[100];
6699 unsigned char output[100];
6701 size_t iv_offset = 0;
6704 memset(key_str, 0x00, 100);
6705 memset(iv_str, 0x00, 100);
6706 memset(src_str, 0x00, 100);
6707 memset(dst_str, 0x00, 100);
6708 memset(output, 0x00, 100);
6710 key_len =
unhexify( key_str,
"ffffffffff800000000000000000000000000000000000000000000000000000" );
6711 unhexify( iv_str,
"00000000000000000000000000000000" );
6712 unhexify( src_str,
"be66cfea2fecd6bf0ec7b4352c99bcaa" );
6716 hexify( dst_str, output, 16 );
6718 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6723 #ifdef POLARSSL_CIPHER_MODE_CFB
6725 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_2)
6727 unsigned char key_str[100];
6728 unsigned char iv_str[100];
6729 unsigned char src_str[100];
6730 unsigned char dst_str[100];
6731 unsigned char output[100];
6733 size_t iv_offset = 0;
6736 memset(key_str, 0x00, 100);
6737 memset(iv_str, 0x00, 100);
6738 memset(src_str, 0x00, 100);
6739 memset(dst_str, 0x00, 100);
6740 memset(output, 0x00, 100);
6742 key_len =
unhexify( key_str,
"ffffffffffc00000000000000000000000000000000000000000000000000000" );
6743 unhexify( iv_str,
"00000000000000000000000000000000" );
6744 unhexify( src_str,
"df31144f87a2ef523facdcf21a427804" );
6748 hexify( dst_str, output, 16 );
6750 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6755 #ifdef POLARSSL_CIPHER_MODE_CFB
6757 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_3)
6759 unsigned char key_str[100];
6760 unsigned char iv_str[100];
6761 unsigned char src_str[100];
6762 unsigned char dst_str[100];
6763 unsigned char output[100];
6765 size_t iv_offset = 0;
6768 memset(key_str, 0x00, 100);
6769 memset(iv_str, 0x00, 100);
6770 memset(src_str, 0x00, 100);
6771 memset(dst_str, 0x00, 100);
6772 memset(output, 0x00, 100);
6774 key_len =
unhexify( key_str,
"ffffffffffe00000000000000000000000000000000000000000000000000000" );
6775 unhexify( iv_str,
"00000000000000000000000000000000" );
6776 unhexify( src_str,
"b5bb0f5629fb6aae5e1839a3c3625d63" );
6780 hexify( dst_str, output, 16 );
6782 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6787 #ifdef POLARSSL_CIPHER_MODE_CFB
6789 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_4)
6791 unsigned char key_str[100];
6792 unsigned char iv_str[100];
6793 unsigned char src_str[100];
6794 unsigned char dst_str[100];
6795 unsigned char output[100];
6797 size_t iv_offset = 0;
6800 memset(key_str, 0x00, 100);
6801 memset(iv_str, 0x00, 100);
6802 memset(src_str, 0x00, 100);
6803 memset(dst_str, 0x00, 100);
6804 memset(output, 0x00, 100);
6806 key_len =
unhexify( key_str,
"1d85a181b54cde51f0e098095b2962fdc93b51fe9b88602b3f54130bf76a5bd9" );
6807 unhexify( iv_str,
"00000000000000000000000000000000" );
6808 unhexify( src_str,
"531c2c38344578b84d50b3c917bbb6e1" );
6812 hexify( dst_str, output, 16 );
6814 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6819 #ifdef POLARSSL_CIPHER_MODE_CFB
6821 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_5)
6823 unsigned char key_str[100];
6824 unsigned char iv_str[100];
6825 unsigned char src_str[100];
6826 unsigned char dst_str[100];
6827 unsigned char output[100];
6829 size_t iv_offset = 0;
6832 memset(key_str, 0x00, 100);
6833 memset(iv_str, 0x00, 100);
6834 memset(src_str, 0x00, 100);
6835 memset(dst_str, 0x00, 100);
6836 memset(output, 0x00, 100);
6838 key_len =
unhexify( key_str,
"dc0eba1f2232a7879ded34ed8428eeb8769b056bbaf8ad77cb65c3541430b4cf" );
6839 unhexify( iv_str,
"00000000000000000000000000000000" );
6840 unhexify( src_str,
"fc6aec906323480005c58e7e1ab004ad" );
6844 hexify( dst_str, output, 16 );
6846 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6851 #ifdef POLARSSL_CIPHER_MODE_CFB
6853 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_6)
6855 unsigned char key_str[100];
6856 unsigned char iv_str[100];
6857 unsigned char src_str[100];
6858 unsigned char dst_str[100];
6859 unsigned char output[100];
6861 size_t iv_offset = 0;
6864 memset(key_str, 0x00, 100);
6865 memset(iv_str, 0x00, 100);
6866 memset(src_str, 0x00, 100);
6867 memset(dst_str, 0x00, 100);
6868 memset(output, 0x00, 100);
6870 key_len =
unhexify( key_str,
"f8be9ba615c5a952cabbca24f68f8593039624d524c816acda2c9183bd917cb9" );
6871 unhexify( iv_str,
"00000000000000000000000000000000" );
6872 unhexify( src_str,
"a3944b95ca0b52043584ef02151926a8" );
6876 hexify( dst_str, output, 16 );
6878 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6883 #ifdef POLARSSL_CIPHER_MODE_CFB
6885 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_7)
6887 unsigned char key_str[100];
6888 unsigned char iv_str[100];
6889 unsigned char src_str[100];
6890 unsigned char dst_str[100];
6891 unsigned char output[100];
6893 size_t iv_offset = 0;
6896 memset(key_str, 0x00, 100);
6897 memset(iv_str, 0x00, 100);
6898 memset(src_str, 0x00, 100);
6899 memset(dst_str, 0x00, 100);
6900 memset(output, 0x00, 100);
6902 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
6903 unhexify( iv_str,
"761c1fe41a18acf20d241650611d90f1" );
6904 unhexify( src_str,
"623a52fcea5d443e48d9181ab32c7421" );
6908 hexify( dst_str, output, 16 );
6910 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6915 #ifdef POLARSSL_CIPHER_MODE_CFB
6917 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_8)
6919 unsigned char key_str[100];
6920 unsigned char iv_str[100];
6921 unsigned char src_str[100];
6922 unsigned char dst_str[100];
6923 unsigned char output[100];
6925 size_t iv_offset = 0;
6928 memset(key_str, 0x00, 100);
6929 memset(iv_str, 0x00, 100);
6930 memset(src_str, 0x00, 100);
6931 memset(dst_str, 0x00, 100);
6932 memset(output, 0x00, 100);
6934 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
6935 unhexify( iv_str,
"8a560769d605868ad80d819bdba03771" );
6936 unhexify( src_str,
"38f2c7ae10612415d27ca190d27da8b4" );
6940 hexify( dst_str, output, 16 );
6942 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6947 #ifdef POLARSSL_CIPHER_MODE_CFB
6949 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_9)
6951 unsigned char key_str[100];
6952 unsigned char iv_str[100];
6953 unsigned char src_str[100];
6954 unsigned char dst_str[100];
6955 unsigned char output[100];
6957 size_t iv_offset = 0;
6960 memset(key_str, 0x00, 100);
6961 memset(iv_str, 0x00, 100);
6962 memset(src_str, 0x00, 100);
6963 memset(dst_str, 0x00, 100);
6964 memset(output, 0x00, 100);
6966 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
6967 unhexify( iv_str,
"91fbef2d15a97816060bee1feaa49afe" );
6968 unhexify( src_str,
"1bc704f1bce135ceb810341b216d7abe" );
6972 hexify( dst_str, output, 16 );
6974 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
6979 #ifdef POLARSSL_CIPHER_MODE_CFB
6981 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_10)
6983 unsigned char key_str[100];
6984 unsigned char iv_str[100];
6985 unsigned char src_str[100];
6986 unsigned char dst_str[100];
6987 unsigned char output[100];
6989 size_t iv_offset = 0;
6992 memset(key_str, 0x00, 100);
6993 memset(iv_str, 0x00, 100);
6994 memset(src_str, 0x00, 100);
6995 memset(dst_str, 0x00, 100);
6996 memset(output, 0x00, 100);
6998 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
6999 unhexify( iv_str,
"e0000000000000000000000000000000" );
7000 unhexify( src_str,
"9b80eefb7ebe2d2b16247aa0efc72f5d" );
7004 hexify( dst_str, output, 16 );
7006 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
7011 #ifdef POLARSSL_CIPHER_MODE_CFB
7013 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_11)
7015 unsigned char key_str[100];
7016 unsigned char iv_str[100];
7017 unsigned char src_str[100];
7018 unsigned char dst_str[100];
7019 unsigned char output[100];
7021 size_t iv_offset = 0;
7024 memset(key_str, 0x00, 100);
7025 memset(iv_str, 0x00, 100);
7026 memset(src_str, 0x00, 100);
7027 memset(dst_str, 0x00, 100);
7028 memset(output, 0x00, 100);
7030 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
7031 unhexify( iv_str,
"f0000000000000000000000000000000" );
7032 unhexify( src_str,
"7f2c5ece07a98d8bee13c51177395ff7" );
7036 hexify( dst_str, output, 16 );
7038 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
7043 #ifdef POLARSSL_CIPHER_MODE_CFB
7045 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_12)
7047 unsigned char key_str[100];
7048 unsigned char iv_str[100];
7049 unsigned char src_str[100];
7050 unsigned char dst_str[100];
7051 unsigned char output[100];
7053 size_t iv_offset = 0;
7056 memset(key_str, 0x00, 100);
7057 memset(iv_str, 0x00, 100);
7058 memset(src_str, 0x00, 100);
7059 memset(dst_str, 0x00, 100);
7060 memset(output, 0x00, 100);
7062 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
7063 unhexify( iv_str,
"f8000000000000000000000000000000" );
7064 unhexify( src_str,
"7818d800dcf6f4be1e0e94f403d1e4c2" );
7068 hexify( dst_str, output, 16 );
7070 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
7076 FCT_TEST_BGN(aes_ecb_encrypt_invalid_keylength)
7078 unsigned char key_str[100];
7079 unsigned char src_str[100];
7080 unsigned char dst_str[100];
7081 unsigned char output[100];
7085 memset(key_str, 0x00, 100);
7086 memset(src_str, 0x00, 100);
7087 memset(dst_str, 0x00, 100);
7088 memset(output, 0x00, 100);
7090 key_len =
unhexify( key_str,
"000000000000000000000000000000" );
7091 unhexify( src_str,
"f34481ec3cc627bacd5dc3fb08f273e6" );
7097 hexify( dst_str, output, 16 );
7099 fct_chk( strcmp( (
char *) dst_str,
"0336763e966d92595a567cc9ce537f5e" ) == 0 );
7105 FCT_TEST_BGN(aes_ecb_decrypt_invalid_keylength)
7107 unsigned char key_str[100];
7108 unsigned char src_str[100];
7109 unsigned char dst_str[100];
7110 unsigned char output[100];
7114 memset(key_str, 0x00, 100);
7115 memset(src_str, 0x00, 100);
7116 memset(dst_str, 0x00, 100);
7117 memset(output, 0x00, 100);
7119 key_len =
unhexify( key_str,
"000000000000000000000000000000" );
7120 unhexify( src_str,
"f34481ec3cc627bacd5dc3fb08f273e6" );
7126 hexify( dst_str, output, 16 );
7128 fct_chk( strcmp( (
char *) dst_str,
"0336763e966d92595a567cc9ce537f5e" ) == 0 );
7134 FCT_TEST_BGN(aes_256_cbc_encrypt_invalid_input_length)
7136 unsigned char key_str[100];
7137 unsigned char iv_str[100];
7138 unsigned char src_str[100];
7139 unsigned char dst_str[100];
7140 unsigned char output[100];
7142 int key_len, data_len;
7144 memset(key_str, 0x00, 100);
7145 memset(iv_str, 0x00, 100);
7146 memset(src_str, 0x00, 100);
7147 memset(dst_str, 0x00, 100);
7148 memset(output, 0x00, 100);
7150 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
7151 unhexify( iv_str,
"00000000000000000000000000000000" );
7152 data_len =
unhexify( src_str,
"ffffffffffffffe000000000000000" );
7158 hexify( dst_str, output, data_len );
7160 fct_chk( strcmp( (
char *) dst_str,
"" ) == 0 );
7166 FCT_TEST_BGN(aes_256_cbc_decrypt_invalid_input_length)
7168 unsigned char key_str[100];
7169 unsigned char iv_str[100];
7170 unsigned char src_str[100];
7171 unsigned char dst_str[100];
7172 unsigned char output[100];
7174 int key_len, data_len;
7176 memset(key_str, 0x00, 100);
7177 memset(iv_str, 0x00, 100);
7178 memset(src_str, 0x00, 100);
7179 memset(dst_str, 0x00, 100);
7180 memset(output, 0x00, 100);
7182 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
7183 unhexify( iv_str,
"00000000000000000000000000000000" );
7184 data_len =
unhexify( src_str,
"623a52fcea5d443e48d9181ab32c74" );
7190 hexify( dst_str, output, data_len );
7192 fct_chk( strcmp( (
char *) dst_str,
"" ) == 0 );
7197 #ifdef POLARSSL_SELF_TEST
7199 FCT_TEST_BGN(aes_selftest)