8 typedef UINT32 uint32_t;
17 #define GET_UINT32_BE(n,b,i) \
19 (n) = ( (uint32_t) (b)[(i) ] << 24 ) \
20 | ( (uint32_t) (b)[(i) + 1] << 16 ) \
21 | ( (uint32_t) (b)[(i) + 2] << 8 ) \
22 | ( (uint32_t) (b)[(i) + 3] ); \
27 #define PUT_UINT32_BE(n,b,i) \
29 (b)[(i) ] = (unsigned char) ( (n) >> 24 ); \
30 (b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \
31 (b)[(i) + 2] = (unsigned char) ( (n) >> 8 ); \
32 (b)[(i) + 3] = (unsigned char) ( (n) ); \
36 int unhexify(
unsigned char *obuf,
const char *ibuf)
39 int len = strlen(ibuf) / 2;
40 assert(!(strlen(ibuf) %1));
45 if( c >=
'0' && c <=
'9' )
47 else if( c >=
'a' && c <=
'f' )
49 else if( c >=
'A' && c <=
'F' )
55 if( c2 >=
'0' && c2 <=
'9' )
57 else if( c2 >=
'a' && c2 <=
'f' )
59 else if( c2 >=
'A' && c2 <=
'F' )
64 *obuf++ = ( c << 4 ) | c2;
70 void hexify(
unsigned char *obuf,
const unsigned char *ibuf,
int len)
82 *obuf++ =
'a' + h - 10;
87 *obuf++ =
'a' + l - 10;
103 static int rnd_std_rand(
void *rng_state,
unsigned char *output,
size_t len )
107 if( rng_state != NULL )
110 for( i = 0; i < len; ++i )
121 static int rnd_zero_rand(
void *rng_state,
unsigned char *output,
size_t len )
123 if( rng_state != NULL )
126 memset( output, 0, len );
153 if( rng_state == NULL )
162 memcpy( output, info->
buf, use_len );
163 info->
buf += use_len;
167 if( len - use_len > 0 )
168 return(
rnd_std_rand( NULL, output + use_len, len - use_len ) );
197 uint32_t i, *k, sum, delta=0x9E3779B9;
198 unsigned char result[4];
200 if( rng_state == NULL )
207 size_t use_len = ( len > 4 ) ? 4 : len;
210 for( i = 0; i < 32; i++ )
212 info->
v0 += (((info->
v1 << 4) ^ (info->
v1 >> 5)) + info->
v1) ^ (sum + k[sum & 3]);
214 info->
v1 += (((info->
v0 << 4) ^ (info->
v0 >> 5)) + info->
v0) ^ (sum + k[(sum>>11) & 3]);
218 memcpy( output, result, use_len );
228 #ifdef POLARSSL_AES_C
231 FCT_SUITE_BGN(test_suite_aes)
233 #ifdef POLARSSL_CIPHER_MODE_CFB
235 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_1)
237 unsigned char key_str[100];
238 unsigned char iv_str[100];
239 unsigned char src_str[100];
240 unsigned char dst_str[100];
241 unsigned char output[100];
243 size_t iv_offset = 0;
246 memset(key_str, 0x00, 100);
247 memset(iv_str, 0x00, 100);
248 memset(src_str, 0x00, 100);
249 memset(dst_str, 0x00, 100);
250 memset(output, 0x00, 100);
252 key_len =
unhexify( key_str,
"f0000000000000000000000000000000" );
253 unhexify( iv_str,
"00000000000000000000000000000000" );
254 unhexify( src_str,
"00000000000000000000000000000000" );
258 hexify( dst_str, output, 16 );
260 fct_chk( strcmp( (
char *) dst_str,
"970014d634e2b7650777e8e84d03ccd8" ) == 0 );
265 #ifdef POLARSSL_CIPHER_MODE_CFB
267 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_2)
269 unsigned char key_str[100];
270 unsigned char iv_str[100];
271 unsigned char src_str[100];
272 unsigned char dst_str[100];
273 unsigned char output[100];
275 size_t iv_offset = 0;
278 memset(key_str, 0x00, 100);
279 memset(iv_str, 0x00, 100);
280 memset(src_str, 0x00, 100);
281 memset(dst_str, 0x00, 100);
282 memset(output, 0x00, 100);
284 key_len =
unhexify( key_str,
"f8000000000000000000000000000000" );
285 unhexify( iv_str,
"00000000000000000000000000000000" );
286 unhexify( src_str,
"00000000000000000000000000000000" );
290 hexify( dst_str, output, 16 );
292 fct_chk( strcmp( (
char *) dst_str,
"f17e79aed0db7e279e955b5f493875a7" ) == 0 );
297 #ifdef POLARSSL_CIPHER_MODE_CFB
299 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_3)
301 unsigned char key_str[100];
302 unsigned char iv_str[100];
303 unsigned char src_str[100];
304 unsigned char dst_str[100];
305 unsigned char output[100];
307 size_t iv_offset = 0;
310 memset(key_str, 0x00, 100);
311 memset(iv_str, 0x00, 100);
312 memset(src_str, 0x00, 100);
313 memset(dst_str, 0x00, 100);
314 memset(output, 0x00, 100);
316 key_len =
unhexify( key_str,
"fc000000000000000000000000000000" );
317 unhexify( iv_str,
"00000000000000000000000000000000" );
318 unhexify( src_str,
"00000000000000000000000000000000" );
322 hexify( dst_str, output, 16 );
324 fct_chk( strcmp( (
char *) dst_str,
"9ed5a75136a940d0963da379db4af26a" ) == 0 );
329 #ifdef POLARSSL_CIPHER_MODE_CFB
331 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_4)
333 unsigned char key_str[100];
334 unsigned char iv_str[100];
335 unsigned char src_str[100];
336 unsigned char dst_str[100];
337 unsigned char output[100];
339 size_t iv_offset = 0;
342 memset(key_str, 0x00, 100);
343 memset(iv_str, 0x00, 100);
344 memset(src_str, 0x00, 100);
345 memset(dst_str, 0x00, 100);
346 memset(output, 0x00, 100);
348 key_len =
unhexify( key_str,
"64cf9c7abc50b888af65f49d521944b2" );
349 unhexify( iv_str,
"00000000000000000000000000000000" );
350 unhexify( src_str,
"00000000000000000000000000000000" );
354 hexify( dst_str, output, 16 );
356 fct_chk( strcmp( (
char *) dst_str,
"f7efc89d5dba578104016ce5ad659c05" ) == 0 );
361 #ifdef POLARSSL_CIPHER_MODE_CFB
363 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_5)
365 unsigned char key_str[100];
366 unsigned char iv_str[100];
367 unsigned char src_str[100];
368 unsigned char dst_str[100];
369 unsigned char output[100];
371 size_t iv_offset = 0;
374 memset(key_str, 0x00, 100);
375 memset(iv_str, 0x00, 100);
376 memset(src_str, 0x00, 100);
377 memset(dst_str, 0x00, 100);
378 memset(output, 0x00, 100);
380 key_len =
unhexify( key_str,
"47d6742eefcc0465dc96355e851b64d9" );
381 unhexify( iv_str,
"00000000000000000000000000000000" );
382 unhexify( src_str,
"00000000000000000000000000000000" );
386 hexify( dst_str, output, 16 );
388 fct_chk( strcmp( (
char *) dst_str,
"0306194f666d183624aa230a8b264ae7" ) == 0 );
393 #ifdef POLARSSL_CIPHER_MODE_CFB
395 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_6)
397 unsigned char key_str[100];
398 unsigned char iv_str[100];
399 unsigned char src_str[100];
400 unsigned char dst_str[100];
401 unsigned char output[100];
403 size_t iv_offset = 0;
406 memset(key_str, 0x00, 100);
407 memset(iv_str, 0x00, 100);
408 memset(src_str, 0x00, 100);
409 memset(dst_str, 0x00, 100);
410 memset(output, 0x00, 100);
412 key_len =
unhexify( key_str,
"3eb39790678c56bee34bbcdeccf6cdb5" );
413 unhexify( iv_str,
"00000000000000000000000000000000" );
414 unhexify( src_str,
"00000000000000000000000000000000" );
418 hexify( dst_str, output, 16 );
420 fct_chk( strcmp( (
char *) dst_str,
"858075d536d79ccee571f7d7204b1f67" ) == 0 );
425 #ifdef POLARSSL_CIPHER_MODE_CFB
427 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_7)
429 unsigned char key_str[100];
430 unsigned char iv_str[100];
431 unsigned char src_str[100];
432 unsigned char dst_str[100];
433 unsigned char output[100];
435 size_t iv_offset = 0;
438 memset(key_str, 0x00, 100);
439 memset(iv_str, 0x00, 100);
440 memset(src_str, 0x00, 100);
441 memset(dst_str, 0x00, 100);
442 memset(output, 0x00, 100);
444 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
445 unhexify( iv_str,
"6a118a874519e64e9963798a503f1d35" );
446 unhexify( src_str,
"00000000000000000000000000000000" );
450 hexify( dst_str, output, 16 );
452 fct_chk( strcmp( (
char *) dst_str,
"dc43be40be0e53712f7e2bf5ca707209" ) == 0 );
457 #ifdef POLARSSL_CIPHER_MODE_CFB
459 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_8)
461 unsigned char key_str[100];
462 unsigned char iv_str[100];
463 unsigned char src_str[100];
464 unsigned char dst_str[100];
465 unsigned char output[100];
467 size_t iv_offset = 0;
470 memset(key_str, 0x00, 100);
471 memset(iv_str, 0x00, 100);
472 memset(src_str, 0x00, 100);
473 memset(dst_str, 0x00, 100);
474 memset(output, 0x00, 100);
476 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
477 unhexify( iv_str,
"cb9fceec81286ca3e989bd979b0cb284" );
478 unhexify( src_str,
"00000000000000000000000000000000" );
482 hexify( dst_str, output, 16 );
484 fct_chk( strcmp( (
char *) dst_str,
"92beedab1895a94faa69b632e5cc47ce" ) == 0 );
489 #ifdef POLARSSL_CIPHER_MODE_CFB
491 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_9)
493 unsigned char key_str[100];
494 unsigned char iv_str[100];
495 unsigned char src_str[100];
496 unsigned char dst_str[100];
497 unsigned char output[100];
499 size_t iv_offset = 0;
502 memset(key_str, 0x00, 100);
503 memset(iv_str, 0x00, 100);
504 memset(src_str, 0x00, 100);
505 memset(dst_str, 0x00, 100);
506 memset(output, 0x00, 100);
508 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
509 unhexify( iv_str,
"b26aeb1874e47ca8358ff22378f09144" );
510 unhexify( src_str,
"00000000000000000000000000000000" );
514 hexify( dst_str, output, 16 );
516 fct_chk( strcmp( (
char *) dst_str,
"459264f4798f6a78bacb89c15ed3d601" ) == 0 );
521 #ifdef POLARSSL_CIPHER_MODE_CFB
523 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_10)
525 unsigned char key_str[100];
526 unsigned char iv_str[100];
527 unsigned char src_str[100];
528 unsigned char dst_str[100];
529 unsigned char output[100];
531 size_t iv_offset = 0;
534 memset(key_str, 0x00, 100);
535 memset(iv_str, 0x00, 100);
536 memset(src_str, 0x00, 100);
537 memset(dst_str, 0x00, 100);
538 memset(output, 0x00, 100);
540 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
541 unhexify( iv_str,
"fffffffffffffffffffffffffffffff0" );
542 unhexify( src_str,
"00000000000000000000000000000000" );
546 hexify( dst_str, output, 16 );
548 fct_chk( strcmp( (
char *) dst_str,
"f9b0fda0c4a898f5b9e6f661c4ce4d07" ) == 0 );
553 #ifdef POLARSSL_CIPHER_MODE_CFB
555 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_11)
557 unsigned char key_str[100];
558 unsigned char iv_str[100];
559 unsigned char src_str[100];
560 unsigned char dst_str[100];
561 unsigned char output[100];
563 size_t iv_offset = 0;
566 memset(key_str, 0x00, 100);
567 memset(iv_str, 0x00, 100);
568 memset(src_str, 0x00, 100);
569 memset(dst_str, 0x00, 100);
570 memset(output, 0x00, 100);
572 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
573 unhexify( iv_str,
"fffffffffffffffffffffffffffffff8" );
574 unhexify( src_str,
"00000000000000000000000000000000" );
578 hexify( dst_str, output, 16 );
580 fct_chk( strcmp( (
char *) dst_str,
"8ade895913685c67c5269f8aae42983e" ) == 0 );
585 #ifdef POLARSSL_CIPHER_MODE_CFB
587 FCT_TEST_BGN(aes_128_cfb128_encrypt_nist_kat_12)
589 unsigned char key_str[100];
590 unsigned char iv_str[100];
591 unsigned char src_str[100];
592 unsigned char dst_str[100];
593 unsigned char output[100];
595 size_t iv_offset = 0;
598 memset(key_str, 0x00, 100);
599 memset(iv_str, 0x00, 100);
600 memset(src_str, 0x00, 100);
601 memset(dst_str, 0x00, 100);
602 memset(output, 0x00, 100);
604 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
605 unhexify( iv_str,
"fffffffffffffffffffffffffffffffc" );
606 unhexify( src_str,
"00000000000000000000000000000000" );
610 hexify( dst_str, output, 16 );
612 fct_chk( strcmp( (
char *) dst_str,
"39bde67d5c8ed8a8b1c37eb8fa9f5ac0" ) == 0 );
617 #ifdef POLARSSL_CIPHER_MODE_CFB
619 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_1)
621 unsigned char key_str[100];
622 unsigned char iv_str[100];
623 unsigned char src_str[100];
624 unsigned char dst_str[100];
625 unsigned char output[100];
627 size_t iv_offset = 0;
630 memset(key_str, 0x00, 100);
631 memset(iv_str, 0x00, 100);
632 memset(src_str, 0x00, 100);
633 memset(dst_str, 0x00, 100);
634 memset(output, 0x00, 100);
636 key_len =
unhexify( key_str,
"fffffffe000000000000000000000000" );
637 unhexify( iv_str,
"00000000000000000000000000000000" );
638 unhexify( src_str,
"1114bc2028009b923f0b01915ce5e7c4" );
642 hexify( dst_str, output, 16 );
644 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
649 #ifdef POLARSSL_CIPHER_MODE_CFB
651 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_2)
653 unsigned char key_str[100];
654 unsigned char iv_str[100];
655 unsigned char src_str[100];
656 unsigned char dst_str[100];
657 unsigned char output[100];
659 size_t iv_offset = 0;
662 memset(key_str, 0x00, 100);
663 memset(iv_str, 0x00, 100);
664 memset(src_str, 0x00, 100);
665 memset(dst_str, 0x00, 100);
666 memset(output, 0x00, 100);
668 key_len =
unhexify( key_str,
"ffffffff000000000000000000000000" );
669 unhexify( iv_str,
"00000000000000000000000000000000" );
670 unhexify( src_str,
"9c28524a16a1e1c1452971caa8d13476" );
674 hexify( dst_str, output, 16 );
676 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
681 #ifdef POLARSSL_CIPHER_MODE_CFB
683 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_3)
685 unsigned char key_str[100];
686 unsigned char iv_str[100];
687 unsigned char src_str[100];
688 unsigned char dst_str[100];
689 unsigned char output[100];
691 size_t iv_offset = 0;
694 memset(key_str, 0x00, 100);
695 memset(iv_str, 0x00, 100);
696 memset(src_str, 0x00, 100);
697 memset(dst_str, 0x00, 100);
698 memset(output, 0x00, 100);
700 key_len =
unhexify( key_str,
"ffffffff800000000000000000000000" );
701 unhexify( iv_str,
"00000000000000000000000000000000" );
702 unhexify( src_str,
"ed62e16363638360fdd6ad62112794f0" );
706 hexify( dst_str, output, 16 );
708 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
713 #ifdef POLARSSL_CIPHER_MODE_CFB
715 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_4)
717 unsigned char key_str[100];
718 unsigned char iv_str[100];
719 unsigned char src_str[100];
720 unsigned char dst_str[100];
721 unsigned char output[100];
723 size_t iv_offset = 0;
726 memset(key_str, 0x00, 100);
727 memset(iv_str, 0x00, 100);
728 memset(src_str, 0x00, 100);
729 memset(dst_str, 0x00, 100);
730 memset(output, 0x00, 100);
732 key_len =
unhexify( key_str,
"3071a2a48fe6cbd04f1a129098e308f8" );
733 unhexify( iv_str,
"00000000000000000000000000000000" );
734 unhexify( src_str,
"4b98e06d356deb07ebb824e5713f7be3" );
738 hexify( dst_str, output, 16 );
740 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
745 #ifdef POLARSSL_CIPHER_MODE_CFB
747 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_5)
749 unsigned char key_str[100];
750 unsigned char iv_str[100];
751 unsigned char src_str[100];
752 unsigned char dst_str[100];
753 unsigned char output[100];
755 size_t iv_offset = 0;
758 memset(key_str, 0x00, 100);
759 memset(iv_str, 0x00, 100);
760 memset(src_str, 0x00, 100);
761 memset(dst_str, 0x00, 100);
762 memset(output, 0x00, 100);
764 key_len =
unhexify( key_str,
"90f42ec0f68385f2ffc5dfc03a654dce" );
765 unhexify( iv_str,
"00000000000000000000000000000000" );
766 unhexify( src_str,
"7a20a53d460fc9ce0423a7a0764c6cf2" );
770 hexify( dst_str, output, 16 );
772 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
777 #ifdef POLARSSL_CIPHER_MODE_CFB
779 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_6)
781 unsigned char key_str[100];
782 unsigned char iv_str[100];
783 unsigned char src_str[100];
784 unsigned char dst_str[100];
785 unsigned char output[100];
787 size_t iv_offset = 0;
790 memset(key_str, 0x00, 100);
791 memset(iv_str, 0x00, 100);
792 memset(src_str, 0x00, 100);
793 memset(dst_str, 0x00, 100);
794 memset(output, 0x00, 100);
796 key_len =
unhexify( key_str,
"febd9a24d8b65c1c787d50a4ed3619a9" );
797 unhexify( iv_str,
"00000000000000000000000000000000" );
798 unhexify( src_str,
"f4a70d8af877f9b02b4c40df57d45b17" );
802 hexify( dst_str, output, 16 );
804 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
809 #ifdef POLARSSL_CIPHER_MODE_CFB
811 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_7)
813 unsigned char key_str[100];
814 unsigned char iv_str[100];
815 unsigned char src_str[100];
816 unsigned char dst_str[100];
817 unsigned char output[100];
819 size_t iv_offset = 0;
822 memset(key_str, 0x00, 100);
823 memset(iv_str, 0x00, 100);
824 memset(src_str, 0x00, 100);
825 memset(dst_str, 0x00, 100);
826 memset(output, 0x00, 100);
828 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
829 unhexify( iv_str,
"f34481ec3cc627bacd5dc3fb08f273e6" );
830 unhexify( src_str,
"0336763e966d92595a567cc9ce537f5e" );
834 hexify( dst_str, output, 16 );
836 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
841 #ifdef POLARSSL_CIPHER_MODE_CFB
843 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_8)
845 unsigned char key_str[100];
846 unsigned char iv_str[100];
847 unsigned char src_str[100];
848 unsigned char dst_str[100];
849 unsigned char output[100];
851 size_t iv_offset = 0;
854 memset(key_str, 0x00, 100);
855 memset(iv_str, 0x00, 100);
856 memset(src_str, 0x00, 100);
857 memset(dst_str, 0x00, 100);
858 memset(output, 0x00, 100);
860 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
861 unhexify( iv_str,
"9798c4640bad75c7c3227db910174e72" );
862 unhexify( src_str,
"a9a1631bf4996954ebc093957b234589" );
866 hexify( dst_str, output, 16 );
868 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
873 #ifdef POLARSSL_CIPHER_MODE_CFB
875 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_9)
877 unsigned char key_str[100];
878 unsigned char iv_str[100];
879 unsigned char src_str[100];
880 unsigned char dst_str[100];
881 unsigned char output[100];
883 size_t iv_offset = 0;
886 memset(key_str, 0x00, 100);
887 memset(iv_str, 0x00, 100);
888 memset(src_str, 0x00, 100);
889 memset(dst_str, 0x00, 100);
890 memset(output, 0x00, 100);
892 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
893 unhexify( iv_str,
"96ab5c2ff612d9dfaae8c31f30c42168" );
894 unhexify( src_str,
"ff4f8391a6a40ca5b25d23bedd44a597" );
898 hexify( dst_str, output, 16 );
900 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
905 #ifdef POLARSSL_CIPHER_MODE_CFB
907 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_10)
909 unsigned char key_str[100];
910 unsigned char iv_str[100];
911 unsigned char src_str[100];
912 unsigned char dst_str[100];
913 unsigned char output[100];
915 size_t iv_offset = 0;
918 memset(key_str, 0x00, 100);
919 memset(iv_str, 0x00, 100);
920 memset(src_str, 0x00, 100);
921 memset(dst_str, 0x00, 100);
922 memset(output, 0x00, 100);
924 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
925 unhexify( iv_str,
"ffffffffffffffff0000000000000000" );
926 unhexify( src_str,
"f807c3e7985fe0f5a50e2cdb25c5109e" );
930 hexify( dst_str, output, 16 );
932 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
937 #ifdef POLARSSL_CIPHER_MODE_CFB
939 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_11)
941 unsigned char key_str[100];
942 unsigned char iv_str[100];
943 unsigned char src_str[100];
944 unsigned char dst_str[100];
945 unsigned char output[100];
947 size_t iv_offset = 0;
950 memset(key_str, 0x00, 100);
951 memset(iv_str, 0x00, 100);
952 memset(src_str, 0x00, 100);
953 memset(dst_str, 0x00, 100);
954 memset(output, 0x00, 100);
956 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
957 unhexify( iv_str,
"ffffffffffffffff8000000000000000" );
958 unhexify( src_str,
"41f992a856fb278b389a62f5d274d7e9" );
962 hexify( dst_str, output, 16 );
964 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
969 #ifdef POLARSSL_CIPHER_MODE_CFB
971 FCT_TEST_BGN(aes_128_cfb128_decrypt_nist_kat_12)
973 unsigned char key_str[100];
974 unsigned char iv_str[100];
975 unsigned char src_str[100];
976 unsigned char dst_str[100];
977 unsigned char output[100];
979 size_t iv_offset = 0;
982 memset(key_str, 0x00, 100);
983 memset(iv_str, 0x00, 100);
984 memset(src_str, 0x00, 100);
985 memset(dst_str, 0x00, 100);
986 memset(output, 0x00, 100);
988 key_len =
unhexify( key_str,
"00000000000000000000000000000000" );
989 unhexify( iv_str,
"ffffffffffffffffc000000000000000" );
990 unhexify( src_str,
"10d3ed7a6fe15ab4d91acbc7d0767ab1" );
994 hexify( dst_str, output, 16 );
996 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1001 #ifdef POLARSSL_CIPHER_MODE_CFB
1003 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_1)
1005 unsigned char key_str[100];
1006 unsigned char iv_str[100];
1007 unsigned char src_str[100];
1008 unsigned char dst_str[100];
1009 unsigned char output[100];
1011 size_t iv_offset = 0;
1014 memset(key_str, 0x00, 100);
1015 memset(iv_str, 0x00, 100);
1016 memset(src_str, 0x00, 100);
1017 memset(dst_str, 0x00, 100);
1018 memset(output, 0x00, 100);
1020 key_len =
unhexify( key_str,
"fffffffffffffffffffc0000000000000000000000000000" );
1021 unhexify( iv_str,
"00000000000000000000000000000000" );
1022 unhexify( src_str,
"00000000000000000000000000000000" );
1026 hexify( dst_str, output, 16 );
1028 fct_chk( strcmp( (
char *) dst_str,
"8dfd999be5d0cfa35732c0ddc88ff5a5" ) == 0 );
1033 #ifdef POLARSSL_CIPHER_MODE_CFB
1035 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_2)
1037 unsigned char key_str[100];
1038 unsigned char iv_str[100];
1039 unsigned char src_str[100];
1040 unsigned char dst_str[100];
1041 unsigned char output[100];
1043 size_t iv_offset = 0;
1046 memset(key_str, 0x00, 100);
1047 memset(iv_str, 0x00, 100);
1048 memset(src_str, 0x00, 100);
1049 memset(dst_str, 0x00, 100);
1050 memset(output, 0x00, 100);
1052 key_len =
unhexify( key_str,
"fffffffffffffffffffe0000000000000000000000000000" );
1053 unhexify( iv_str,
"00000000000000000000000000000000" );
1054 unhexify( src_str,
"00000000000000000000000000000000" );
1058 hexify( dst_str, output, 16 );
1060 fct_chk( strcmp( (
char *) dst_str,
"02647c76a300c3173b841487eb2bae9f" ) == 0 );
1065 #ifdef POLARSSL_CIPHER_MODE_CFB
1067 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_3)
1069 unsigned char key_str[100];
1070 unsigned char iv_str[100];
1071 unsigned char src_str[100];
1072 unsigned char dst_str[100];
1073 unsigned char output[100];
1075 size_t iv_offset = 0;
1078 memset(key_str, 0x00, 100);
1079 memset(iv_str, 0x00, 100);
1080 memset(src_str, 0x00, 100);
1081 memset(dst_str, 0x00, 100);
1082 memset(output, 0x00, 100);
1084 key_len =
unhexify( key_str,
"ffffffffffffffffffff0000000000000000000000000000" );
1085 unhexify( iv_str,
"00000000000000000000000000000000" );
1086 unhexify( src_str,
"00000000000000000000000000000000" );
1090 hexify( dst_str, output, 16 );
1092 fct_chk( strcmp( (
char *) dst_str,
"172df8b02f04b53adab028b4e01acd87" ) == 0 );
1097 #ifdef POLARSSL_CIPHER_MODE_CFB
1099 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_4)
1101 unsigned char key_str[100];
1102 unsigned char iv_str[100];
1103 unsigned char src_str[100];
1104 unsigned char dst_str[100];
1105 unsigned char output[100];
1107 size_t iv_offset = 0;
1110 memset(key_str, 0x00, 100);
1111 memset(iv_str, 0x00, 100);
1112 memset(src_str, 0x00, 100);
1113 memset(dst_str, 0x00, 100);
1114 memset(output, 0x00, 100);
1116 key_len =
unhexify( key_str,
"d184c36cf0dddfec39e654195006022237871a47c33d3198" );
1117 unhexify( iv_str,
"00000000000000000000000000000000" );
1118 unhexify( src_str,
"00000000000000000000000000000000" );
1122 hexify( dst_str, output, 16 );
1124 fct_chk( strcmp( (
char *) dst_str,
"2e19fb60a3e1de0166f483c97824a978" ) == 0 );
1129 #ifdef POLARSSL_CIPHER_MODE_CFB
1131 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_5)
1133 unsigned char key_str[100];
1134 unsigned char iv_str[100];
1135 unsigned char src_str[100];
1136 unsigned char dst_str[100];
1137 unsigned char output[100];
1139 size_t iv_offset = 0;
1142 memset(key_str, 0x00, 100);
1143 memset(iv_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,
"4c6994ffa9dcdc805b60c2c0095334c42d95a8fc0ca5b080" );
1149 unhexify( iv_str,
"00000000000000000000000000000000" );
1150 unhexify( src_str,
"00000000000000000000000000000000" );
1154 hexify( dst_str, output, 16 );
1156 fct_chk( strcmp( (
char *) dst_str,
"7656709538dd5fec41e0ce6a0f8e207d" ) == 0 );
1161 #ifdef POLARSSL_CIPHER_MODE_CFB
1163 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_6)
1165 unsigned char key_str[100];
1166 unsigned char iv_str[100];
1167 unsigned char src_str[100];
1168 unsigned char dst_str[100];
1169 unsigned char output[100];
1171 size_t iv_offset = 0;
1174 memset(key_str, 0x00, 100);
1175 memset(iv_str, 0x00, 100);
1176 memset(src_str, 0x00, 100);
1177 memset(dst_str, 0x00, 100);
1178 memset(output, 0x00, 100);
1180 key_len =
unhexify( key_str,
"c88f5b00a4ef9a6840e2acaf33f00a3bdc4e25895303fa72" );
1181 unhexify( iv_str,
"00000000000000000000000000000000" );
1182 unhexify( src_str,
"00000000000000000000000000000000" );
1186 hexify( dst_str, output, 16 );
1188 fct_chk( strcmp( (
char *) dst_str,
"a67cf333b314d411d3c0ae6e1cfcd8f5" ) == 0 );
1193 #ifdef POLARSSL_CIPHER_MODE_CFB
1195 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_7)
1197 unsigned char key_str[100];
1198 unsigned char iv_str[100];
1199 unsigned char src_str[100];
1200 unsigned char dst_str[100];
1201 unsigned char output[100];
1203 size_t iv_offset = 0;
1206 memset(key_str, 0x00, 100);
1207 memset(iv_str, 0x00, 100);
1208 memset(src_str, 0x00, 100);
1209 memset(dst_str, 0x00, 100);
1210 memset(output, 0x00, 100);
1212 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1213 unhexify( iv_str,
"9c2d8842e5f48f57648205d39a239af1" );
1214 unhexify( src_str,
"00000000000000000000000000000000" );
1218 hexify( dst_str, output, 16 );
1220 fct_chk( strcmp( (
char *) dst_str,
"c9b8135ff1b5adc413dfd053b21bd96d" ) == 0 );
1225 #ifdef POLARSSL_CIPHER_MODE_CFB
1227 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_8)
1229 unsigned char key_str[100];
1230 unsigned char iv_str[100];
1231 unsigned char src_str[100];
1232 unsigned char dst_str[100];
1233 unsigned char output[100];
1235 size_t iv_offset = 0;
1238 memset(key_str, 0x00, 100);
1239 memset(iv_str, 0x00, 100);
1240 memset(src_str, 0x00, 100);
1241 memset(dst_str, 0x00, 100);
1242 memset(output, 0x00, 100);
1244 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1245 unhexify( iv_str,
"bff52510095f518ecca60af4205444bb" );
1246 unhexify( src_str,
"00000000000000000000000000000000" );
1250 hexify( dst_str, output, 16 );
1252 fct_chk( strcmp( (
char *) dst_str,
"4a3650c3371ce2eb35e389a171427440" ) == 0 );
1257 #ifdef POLARSSL_CIPHER_MODE_CFB
1259 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_9)
1261 unsigned char key_str[100];
1262 unsigned char iv_str[100];
1263 unsigned char src_str[100];
1264 unsigned char dst_str[100];
1265 unsigned char output[100];
1267 size_t iv_offset = 0;
1270 memset(key_str, 0x00, 100);
1271 memset(iv_str, 0x00, 100);
1272 memset(src_str, 0x00, 100);
1273 memset(dst_str, 0x00, 100);
1274 memset(output, 0x00, 100);
1276 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1277 unhexify( iv_str,
"51719783d3185a535bd75adc65071ce1" );
1278 unhexify( src_str,
"00000000000000000000000000000000" );
1282 hexify( dst_str, output, 16 );
1284 fct_chk( strcmp( (
char *) dst_str,
"4f354592ff7c8847d2d0870ca9481b7c" ) == 0 );
1289 #ifdef POLARSSL_CIPHER_MODE_CFB
1291 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_10)
1293 unsigned char key_str[100];
1294 unsigned char iv_str[100];
1295 unsigned char src_str[100];
1296 unsigned char dst_str[100];
1297 unsigned char output[100];
1299 size_t iv_offset = 0;
1302 memset(key_str, 0x00, 100);
1303 memset(iv_str, 0x00, 100);
1304 memset(src_str, 0x00, 100);
1305 memset(dst_str, 0x00, 100);
1306 memset(output, 0x00, 100);
1308 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1309 unhexify( iv_str,
"ffffffffffffffe00000000000000000" );
1310 unhexify( src_str,
"00000000000000000000000000000000" );
1314 hexify( dst_str, output, 16 );
1316 fct_chk( strcmp( (
char *) dst_str,
"f34e4a6324ea4a5c39a661c8fe5ada8f" ) == 0 );
1321 #ifdef POLARSSL_CIPHER_MODE_CFB
1323 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_11)
1325 unsigned char key_str[100];
1326 unsigned char iv_str[100];
1327 unsigned char src_str[100];
1328 unsigned char dst_str[100];
1329 unsigned char output[100];
1331 size_t iv_offset = 0;
1334 memset(key_str, 0x00, 100);
1335 memset(iv_str, 0x00, 100);
1336 memset(src_str, 0x00, 100);
1337 memset(dst_str, 0x00, 100);
1338 memset(output, 0x00, 100);
1340 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1341 unhexify( iv_str,
"fffffffffffffff00000000000000000" );
1342 unhexify( src_str,
"00000000000000000000000000000000" );
1346 hexify( dst_str, output, 16 );
1348 fct_chk( strcmp( (
char *) dst_str,
"0882a16f44088d42447a29ac090ec17e" ) == 0 );
1353 #ifdef POLARSSL_CIPHER_MODE_CFB
1355 FCT_TEST_BGN(aes_192_cfb128_encrypt_nist_kat_12)
1357 unsigned char key_str[100];
1358 unsigned char iv_str[100];
1359 unsigned char src_str[100];
1360 unsigned char dst_str[100];
1361 unsigned char output[100];
1363 size_t iv_offset = 0;
1366 memset(key_str, 0x00, 100);
1367 memset(iv_str, 0x00, 100);
1368 memset(src_str, 0x00, 100);
1369 memset(dst_str, 0x00, 100);
1370 memset(output, 0x00, 100);
1372 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1373 unhexify( iv_str,
"fffffffffffffff80000000000000000" );
1374 unhexify( src_str,
"00000000000000000000000000000000" );
1378 hexify( dst_str, output, 16 );
1380 fct_chk( strcmp( (
char *) dst_str,
"3a3c15bfc11a9537c130687004e136ee" ) == 0 );
1385 #ifdef POLARSSL_CIPHER_MODE_CFB
1387 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_1)
1389 unsigned char key_str[100];
1390 unsigned char iv_str[100];
1391 unsigned char src_str[100];
1392 unsigned char dst_str[100];
1393 unsigned char output[100];
1395 size_t iv_offset = 0;
1398 memset(key_str, 0x00, 100);
1399 memset(iv_str, 0x00, 100);
1400 memset(src_str, 0x00, 100);
1401 memset(dst_str, 0x00, 100);
1402 memset(output, 0x00, 100);
1404 key_len =
unhexify( key_str,
"ffffffffffffffffffffffffffffffffffffffffffe00000" );
1405 unhexify( iv_str,
"00000000000000000000000000000000" );
1406 unhexify( src_str,
"60136703374f64e860b48ce31f930716" );
1410 hexify( dst_str, output, 16 );
1412 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1417 #ifdef POLARSSL_CIPHER_MODE_CFB
1419 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_2)
1421 unsigned char key_str[100];
1422 unsigned char iv_str[100];
1423 unsigned char src_str[100];
1424 unsigned char dst_str[100];
1425 unsigned char output[100];
1427 size_t iv_offset = 0;
1430 memset(key_str, 0x00, 100);
1431 memset(iv_str, 0x00, 100);
1432 memset(src_str, 0x00, 100);
1433 memset(dst_str, 0x00, 100);
1434 memset(output, 0x00, 100);
1436 key_len =
unhexify( key_str,
"fffffffffffffffffffffffffffffffffffffffffff00000" );
1437 unhexify( iv_str,
"00000000000000000000000000000000" );
1438 unhexify( src_str,
"8d63a269b14d506ccc401ab8a9f1b591" );
1442 hexify( dst_str, output, 16 );
1444 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1449 #ifdef POLARSSL_CIPHER_MODE_CFB
1451 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_3)
1453 unsigned char key_str[100];
1454 unsigned char iv_str[100];
1455 unsigned char src_str[100];
1456 unsigned char dst_str[100];
1457 unsigned char output[100];
1459 size_t iv_offset = 0;
1462 memset(key_str, 0x00, 100);
1463 memset(iv_str, 0x00, 100);
1464 memset(src_str, 0x00, 100);
1465 memset(dst_str, 0x00, 100);
1466 memset(output, 0x00, 100);
1468 key_len =
unhexify( key_str,
"fffffffffffffffffffffffffffffffffffffffffff80000" );
1469 unhexify( iv_str,
"00000000000000000000000000000000" );
1470 unhexify( src_str,
"d317f81dc6aa454aee4bd4a5a5cff4bd" );
1474 hexify( dst_str, output, 16 );
1476 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1481 #ifdef POLARSSL_CIPHER_MODE_CFB
1483 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_4)
1485 unsigned char key_str[100];
1486 unsigned char iv_str[100];
1487 unsigned char src_str[100];
1488 unsigned char dst_str[100];
1489 unsigned char output[100];
1491 size_t iv_offset = 0;
1494 memset(key_str, 0x00, 100);
1495 memset(iv_str, 0x00, 100);
1496 memset(src_str, 0x00, 100);
1497 memset(dst_str, 0x00, 100);
1498 memset(output, 0x00, 100);
1500 key_len =
unhexify( key_str,
"98c6b8e01e379fbd14e61af6af891596583565f2a27d59e9" );
1501 unhexify( iv_str,
"00000000000000000000000000000000" );
1502 unhexify( src_str,
"19c80ec4a6deb7e5ed1033dda933498f" );
1506 hexify( dst_str, output, 16 );
1508 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1513 #ifdef POLARSSL_CIPHER_MODE_CFB
1515 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_5)
1517 unsigned char key_str[100];
1518 unsigned char iv_str[100];
1519 unsigned char src_str[100];
1520 unsigned char dst_str[100];
1521 unsigned char output[100];
1523 size_t iv_offset = 0;
1526 memset(key_str, 0x00, 100);
1527 memset(iv_str, 0x00, 100);
1528 memset(src_str, 0x00, 100);
1529 memset(dst_str, 0x00, 100);
1530 memset(output, 0x00, 100);
1532 key_len =
unhexify( key_str,
"b3ad5cea1dddc214ca969ac35f37dae1a9a9d1528f89bb35" );
1533 unhexify( iv_str,
"00000000000000000000000000000000" );
1534 unhexify( src_str,
"3cf5e1d21a17956d1dffad6a7c41c659" );
1538 hexify( dst_str, output, 16 );
1540 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1545 #ifdef POLARSSL_CIPHER_MODE_CFB
1547 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_6)
1549 unsigned char key_str[100];
1550 unsigned char iv_str[100];
1551 unsigned char src_str[100];
1552 unsigned char dst_str[100];
1553 unsigned char output[100];
1555 size_t iv_offset = 0;
1558 memset(key_str, 0x00, 100);
1559 memset(iv_str, 0x00, 100);
1560 memset(src_str, 0x00, 100);
1561 memset(dst_str, 0x00, 100);
1562 memset(output, 0x00, 100);
1564 key_len =
unhexify( key_str,
"45899367c3132849763073c435a9288a766c8b9ec2308516" );
1565 unhexify( iv_str,
"00000000000000000000000000000000" );
1566 unhexify( src_str,
"69fd12e8505f8ded2fdcb197a121b362" );
1570 hexify( dst_str, output, 16 );
1572 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1577 #ifdef POLARSSL_CIPHER_MODE_CFB
1579 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_7)
1581 unsigned char key_str[100];
1582 unsigned char iv_str[100];
1583 unsigned char src_str[100];
1584 unsigned char dst_str[100];
1585 unsigned char output[100];
1587 size_t iv_offset = 0;
1590 memset(key_str, 0x00, 100);
1591 memset(iv_str, 0x00, 100);
1592 memset(src_str, 0x00, 100);
1593 memset(dst_str, 0x00, 100);
1594 memset(output, 0x00, 100);
1596 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1597 unhexify( iv_str,
"1b077a6af4b7f98229de786d7516b639" );
1598 unhexify( src_str,
"275cfc0413d8ccb70513c3859b1d0f72" );
1602 hexify( dst_str, output, 16 );
1604 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1609 #ifdef POLARSSL_CIPHER_MODE_CFB
1611 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_8)
1613 unsigned char key_str[100];
1614 unsigned char iv_str[100];
1615 unsigned char src_str[100];
1616 unsigned char dst_str[100];
1617 unsigned char output[100];
1619 size_t iv_offset = 0;
1622 memset(key_str, 0x00, 100);
1623 memset(iv_str, 0x00, 100);
1624 memset(src_str, 0x00, 100);
1625 memset(dst_str, 0x00, 100);
1626 memset(output, 0x00, 100);
1628 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1629 unhexify( iv_str,
"9c2d8842e5f48f57648205d39a239af1" );
1630 unhexify( src_str,
"c9b8135ff1b5adc413dfd053b21bd96d" );
1634 hexify( dst_str, output, 16 );
1636 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1641 #ifdef POLARSSL_CIPHER_MODE_CFB
1643 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_9)
1645 unsigned char key_str[100];
1646 unsigned char iv_str[100];
1647 unsigned char src_str[100];
1648 unsigned char dst_str[100];
1649 unsigned char output[100];
1651 size_t iv_offset = 0;
1654 memset(key_str, 0x00, 100);
1655 memset(iv_str, 0x00, 100);
1656 memset(src_str, 0x00, 100);
1657 memset(dst_str, 0x00, 100);
1658 memset(output, 0x00, 100);
1660 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1661 unhexify( iv_str,
"bff52510095f518ecca60af4205444bb" );
1662 unhexify( src_str,
"4a3650c3371ce2eb35e389a171427440" );
1666 hexify( dst_str, output, 16 );
1668 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1673 #ifdef POLARSSL_CIPHER_MODE_CFB
1675 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_10)
1677 unsigned char key_str[100];
1678 unsigned char iv_str[100];
1679 unsigned char src_str[100];
1680 unsigned char dst_str[100];
1681 unsigned char output[100];
1683 size_t iv_offset = 0;
1686 memset(key_str, 0x00, 100);
1687 memset(iv_str, 0x00, 100);
1688 memset(src_str, 0x00, 100);
1689 memset(dst_str, 0x00, 100);
1690 memset(output, 0x00, 100);
1692 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1693 unhexify( iv_str,
"ffffffffffffffffffff000000000000" );
1694 unhexify( src_str,
"54d632d03aba0bd0f91877ebdd4d09cb" );
1698 hexify( dst_str, output, 16 );
1700 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1705 #ifdef POLARSSL_CIPHER_MODE_CFB
1707 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_11)
1709 unsigned char key_str[100];
1710 unsigned char iv_str[100];
1711 unsigned char src_str[100];
1712 unsigned char dst_str[100];
1713 unsigned char output[100];
1715 size_t iv_offset = 0;
1718 memset(key_str, 0x00, 100);
1719 memset(iv_str, 0x00, 100);
1720 memset(src_str, 0x00, 100);
1721 memset(dst_str, 0x00, 100);
1722 memset(output, 0x00, 100);
1724 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1725 unhexify( iv_str,
"ffffffffffffffffffff800000000000" );
1726 unhexify( src_str,
"d3427be7e4d27cd54f5fe37b03cf0897" );
1730 hexify( dst_str, output, 16 );
1732 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1737 #ifdef POLARSSL_CIPHER_MODE_CFB
1739 FCT_TEST_BGN(aes_192_cfb128_decrypt_nist_kat_12)
1741 unsigned char key_str[100];
1742 unsigned char iv_str[100];
1743 unsigned char src_str[100];
1744 unsigned char dst_str[100];
1745 unsigned char output[100];
1747 size_t iv_offset = 0;
1750 memset(key_str, 0x00, 100);
1751 memset(iv_str, 0x00, 100);
1752 memset(src_str, 0x00, 100);
1753 memset(dst_str, 0x00, 100);
1754 memset(output, 0x00, 100);
1756 key_len =
unhexify( key_str,
"000000000000000000000000000000000000000000000000" );
1757 unhexify( iv_str,
"ffffffffffffffffffffc00000000000" );
1758 unhexify( src_str,
"b2099795e88cc158fd75ea133d7e7fbe" );
1762 hexify( dst_str, output, 16 );
1764 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
1769 #ifdef POLARSSL_CIPHER_MODE_CFB
1771 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_1)
1773 unsigned char key_str[100];
1774 unsigned char iv_str[100];
1775 unsigned char src_str[100];
1776 unsigned char dst_str[100];
1777 unsigned char output[100];
1779 size_t iv_offset = 0;
1782 memset(key_str, 0x00, 100);
1783 memset(iv_str, 0x00, 100);
1784 memset(src_str, 0x00, 100);
1785 memset(dst_str, 0x00, 100);
1786 memset(output, 0x00, 100);
1788 key_len =
unhexify( key_str,
"ffffffe000000000000000000000000000000000000000000000000000000000" );
1789 unhexify( iv_str,
"00000000000000000000000000000000" );
1790 unhexify( src_str,
"00000000000000000000000000000000" );
1794 hexify( dst_str, output, 16 );
1796 fct_chk( strcmp( (
char *) dst_str,
"bbd1097a62433f79449fa97d4ee80dbf" ) == 0 );
1801 #ifdef POLARSSL_CIPHER_MODE_CFB
1803 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_2)
1805 unsigned char key_str[100];
1806 unsigned char iv_str[100];
1807 unsigned char src_str[100];
1808 unsigned char dst_str[100];
1809 unsigned char output[100];
1811 size_t iv_offset = 0;
1814 memset(key_str, 0x00, 100);
1815 memset(iv_str, 0x00, 100);
1816 memset(src_str, 0x00, 100);
1817 memset(dst_str, 0x00, 100);
1818 memset(output, 0x00, 100);
1820 key_len =
unhexify( key_str,
"fffffff000000000000000000000000000000000000000000000000000000000" );
1821 unhexify( iv_str,
"00000000000000000000000000000000" );
1822 unhexify( src_str,
"00000000000000000000000000000000" );
1826 hexify( dst_str, output, 16 );
1828 fct_chk( strcmp( (
char *) dst_str,
"07058e408f5b99b0e0f061a1761b5b3b" ) == 0 );
1833 #ifdef POLARSSL_CIPHER_MODE_CFB
1835 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_3)
1837 unsigned char key_str[100];
1838 unsigned char iv_str[100];
1839 unsigned char src_str[100];
1840 unsigned char dst_str[100];
1841 unsigned char output[100];
1843 size_t iv_offset = 0;
1846 memset(key_str, 0x00, 100);
1847 memset(iv_str, 0x00, 100);
1848 memset(src_str, 0x00, 100);
1849 memset(dst_str, 0x00, 100);
1850 memset(output, 0x00, 100);
1852 key_len =
unhexify( key_str,
"fffffff800000000000000000000000000000000000000000000000000000000" );
1853 unhexify( iv_str,
"00000000000000000000000000000000" );
1854 unhexify( src_str,
"00000000000000000000000000000000" );
1858 hexify( dst_str, output, 16 );
1860 fct_chk( strcmp( (
char *) dst_str,
"5fd1f13fa0f31e37fabde328f894eac2" ) == 0 );
1865 #ifdef POLARSSL_CIPHER_MODE_CFB
1867 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_4)
1869 unsigned char key_str[100];
1870 unsigned char iv_str[100];
1871 unsigned char src_str[100];
1872 unsigned char dst_str[100];
1873 unsigned char output[100];
1875 size_t iv_offset = 0;
1878 memset(key_str, 0x00, 100);
1879 memset(iv_str, 0x00, 100);
1880 memset(src_str, 0x00, 100);
1881 memset(dst_str, 0x00, 100);
1882 memset(output, 0x00, 100);
1884 key_len =
unhexify( key_str,
"13428b5e4c005e0636dd338405d173ab135dec2a25c22c5df0722d69dcc43887" );
1885 unhexify( iv_str,
"00000000000000000000000000000000" );
1886 unhexify( src_str,
"00000000000000000000000000000000" );
1890 hexify( dst_str, output, 16 );
1892 fct_chk( strcmp( (
char *) dst_str,
"649a71545378c783e368c9ade7114f6c" ) == 0 );
1897 #ifdef POLARSSL_CIPHER_MODE_CFB
1899 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_5)
1901 unsigned char key_str[100];
1902 unsigned char iv_str[100];
1903 unsigned char src_str[100];
1904 unsigned char dst_str[100];
1905 unsigned char output[100];
1907 size_t iv_offset = 0;
1910 memset(key_str, 0x00, 100);
1911 memset(iv_str, 0x00, 100);
1912 memset(src_str, 0x00, 100);
1913 memset(dst_str, 0x00, 100);
1914 memset(output, 0x00, 100);
1916 key_len =
unhexify( key_str,
"07eb03a08d291d1b07408bf3512ab40c91097ac77461aad4bb859647f74f00ee" );
1917 unhexify( iv_str,
"00000000000000000000000000000000" );
1918 unhexify( src_str,
"00000000000000000000000000000000" );
1922 hexify( dst_str, output, 16 );
1924 fct_chk( strcmp( (
char *) dst_str,
"47cb030da2ab051dfc6c4bf6910d12bb" ) == 0 );
1929 #ifdef POLARSSL_CIPHER_MODE_CFB
1931 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_6)
1933 unsigned char key_str[100];
1934 unsigned char iv_str[100];
1935 unsigned char src_str[100];
1936 unsigned char dst_str[100];
1937 unsigned char output[100];
1939 size_t iv_offset = 0;
1942 memset(key_str, 0x00, 100);
1943 memset(iv_str, 0x00, 100);
1944 memset(src_str, 0x00, 100);
1945 memset(dst_str, 0x00, 100);
1946 memset(output, 0x00, 100);
1948 key_len =
unhexify( key_str,
"90143ae20cd78c5d8ebdd6cb9dc1762427a96c78c639bccc41a61424564eafe1" );
1949 unhexify( iv_str,
"00000000000000000000000000000000" );
1950 unhexify( src_str,
"00000000000000000000000000000000" );
1954 hexify( dst_str, output, 16 );
1956 fct_chk( strcmp( (
char *) dst_str,
"798c7c005dee432b2c8ea5dfa381ecc3" ) == 0 );
1961 #ifdef POLARSSL_CIPHER_MODE_CFB
1963 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_7)
1965 unsigned char key_str[100];
1966 unsigned char iv_str[100];
1967 unsigned char src_str[100];
1968 unsigned char dst_str[100];
1969 unsigned char output[100];
1971 size_t iv_offset = 0;
1974 memset(key_str, 0x00, 100);
1975 memset(iv_str, 0x00, 100);
1976 memset(src_str, 0x00, 100);
1977 memset(dst_str, 0x00, 100);
1978 memset(output, 0x00, 100);
1980 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
1981 unhexify( iv_str,
"0b24af36193ce4665f2825d7b4749c98" );
1982 unhexify( src_str,
"00000000000000000000000000000000" );
1986 hexify( dst_str, output, 16 );
1988 fct_chk( strcmp( (
char *) dst_str,
"a9ff75bd7cf6613d3731c77c3b6d0c04" ) == 0 );
1993 #ifdef POLARSSL_CIPHER_MODE_CFB
1995 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_8)
1997 unsigned char key_str[100];
1998 unsigned char iv_str[100];
1999 unsigned char src_str[100];
2000 unsigned char dst_str[100];
2001 unsigned char output[100];
2003 size_t iv_offset = 0;
2006 memset(key_str, 0x00, 100);
2007 memset(iv_str, 0x00, 100);
2008 memset(src_str, 0x00, 100);
2009 memset(dst_str, 0x00, 100);
2010 memset(output, 0x00, 100);
2012 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
2013 unhexify( iv_str,
"761c1fe41a18acf20d241650611d90f1" );
2014 unhexify( src_str,
"00000000000000000000000000000000" );
2018 hexify( dst_str, output, 16 );
2020 fct_chk( strcmp( (
char *) dst_str,
"623a52fcea5d443e48d9181ab32c7421" ) == 0 );
2025 #ifdef POLARSSL_CIPHER_MODE_CFB
2027 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_9)
2029 unsigned char key_str[100];
2030 unsigned char iv_str[100];
2031 unsigned char src_str[100];
2032 unsigned char dst_str[100];
2033 unsigned char output[100];
2035 size_t iv_offset = 0;
2038 memset(key_str, 0x00, 100);
2039 memset(iv_str, 0x00, 100);
2040 memset(src_str, 0x00, 100);
2041 memset(dst_str, 0x00, 100);
2042 memset(output, 0x00, 100);
2044 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
2045 unhexify( iv_str,
"8a560769d605868ad80d819bdba03771" );
2046 unhexify( src_str,
"00000000000000000000000000000000" );
2050 hexify( dst_str, output, 16 );
2052 fct_chk( strcmp( (
char *) dst_str,
"38f2c7ae10612415d27ca190d27da8b4" ) == 0 );
2057 #ifdef POLARSSL_CIPHER_MODE_CFB
2059 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_10)
2061 unsigned char key_str[100];
2062 unsigned char iv_str[100];
2063 unsigned char src_str[100];
2064 unsigned char dst_str[100];
2065 unsigned char output[100];
2067 size_t iv_offset = 0;
2070 memset(key_str, 0x00, 100);
2071 memset(iv_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,
"0000000000000000000000000000000000000000000000000000000000000000" );
2077 unhexify( iv_str,
"ffffffffffffffffffffffffe0000000" );
2078 unhexify( src_str,
"00000000000000000000000000000000" );
2082 hexify( dst_str, output, 16 );
2084 fct_chk( strcmp( (
char *) dst_str,
"2be1fae5048a25582a679ca10905eb80" ) == 0 );
2089 #ifdef POLARSSL_CIPHER_MODE_CFB
2091 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_11)
2093 unsigned char key_str[100];
2094 unsigned char iv_str[100];
2095 unsigned char src_str[100];
2096 unsigned char dst_str[100];
2097 unsigned char output[100];
2099 size_t iv_offset = 0;
2102 memset(key_str, 0x00, 100);
2103 memset(iv_str, 0x00, 100);
2104 memset(src_str, 0x00, 100);
2105 memset(dst_str, 0x00, 100);
2106 memset(output, 0x00, 100);
2108 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
2109 unhexify( iv_str,
"fffffffffffffffffffffffff0000000" );
2110 unhexify( src_str,
"00000000000000000000000000000000" );
2114 hexify( dst_str, output, 16 );
2116 fct_chk( strcmp( (
char *) dst_str,
"da86f292c6f41ea34fb2068df75ecc29" ) == 0 );
2121 #ifdef POLARSSL_CIPHER_MODE_CFB
2123 FCT_TEST_BGN(aes_256_cfb128_encrypt_nist_kat_12)
2125 unsigned char key_str[100];
2126 unsigned char iv_str[100];
2127 unsigned char src_str[100];
2128 unsigned char dst_str[100];
2129 unsigned char output[100];
2131 size_t iv_offset = 0;
2134 memset(key_str, 0x00, 100);
2135 memset(iv_str, 0x00, 100);
2136 memset(src_str, 0x00, 100);
2137 memset(dst_str, 0x00, 100);
2138 memset(output, 0x00, 100);
2140 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
2141 unhexify( iv_str,
"fffffffffffffffffffffffff8000000" );
2142 unhexify( src_str,
"00000000000000000000000000000000" );
2146 hexify( dst_str, output, 16 );
2148 fct_chk( strcmp( (
char *) dst_str,
"220df19f85d69b1b562fa69a3c5beca5" ) == 0 );
2153 #ifdef POLARSSL_CIPHER_MODE_CFB
2155 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_1)
2157 unsigned char key_str[100];
2158 unsigned char iv_str[100];
2159 unsigned char src_str[100];
2160 unsigned char dst_str[100];
2161 unsigned char output[100];
2163 size_t iv_offset = 0;
2166 memset(key_str, 0x00, 100);
2167 memset(iv_str, 0x00, 100);
2168 memset(src_str, 0x00, 100);
2169 memset(dst_str, 0x00, 100);
2170 memset(output, 0x00, 100);
2172 key_len =
unhexify( key_str,
"ffffffffff800000000000000000000000000000000000000000000000000000" );
2173 unhexify( iv_str,
"00000000000000000000000000000000" );
2174 unhexify( src_str,
"be66cfea2fecd6bf0ec7b4352c99bcaa" );
2178 hexify( dst_str, output, 16 );
2180 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2185 #ifdef POLARSSL_CIPHER_MODE_CFB
2187 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_2)
2189 unsigned char key_str[100];
2190 unsigned char iv_str[100];
2191 unsigned char src_str[100];
2192 unsigned char dst_str[100];
2193 unsigned char output[100];
2195 size_t iv_offset = 0;
2198 memset(key_str, 0x00, 100);
2199 memset(iv_str, 0x00, 100);
2200 memset(src_str, 0x00, 100);
2201 memset(dst_str, 0x00, 100);
2202 memset(output, 0x00, 100);
2204 key_len =
unhexify( key_str,
"ffffffffffc00000000000000000000000000000000000000000000000000000" );
2205 unhexify( iv_str,
"00000000000000000000000000000000" );
2206 unhexify( src_str,
"df31144f87a2ef523facdcf21a427804" );
2210 hexify( dst_str, output, 16 );
2212 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2217 #ifdef POLARSSL_CIPHER_MODE_CFB
2219 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_3)
2221 unsigned char key_str[100];
2222 unsigned char iv_str[100];
2223 unsigned char src_str[100];
2224 unsigned char dst_str[100];
2225 unsigned char output[100];
2227 size_t iv_offset = 0;
2230 memset(key_str, 0x00, 100);
2231 memset(iv_str, 0x00, 100);
2232 memset(src_str, 0x00, 100);
2233 memset(dst_str, 0x00, 100);
2234 memset(output, 0x00, 100);
2236 key_len =
unhexify( key_str,
"ffffffffffe00000000000000000000000000000000000000000000000000000" );
2237 unhexify( iv_str,
"00000000000000000000000000000000" );
2238 unhexify( src_str,
"b5bb0f5629fb6aae5e1839a3c3625d63" );
2242 hexify( dst_str, output, 16 );
2244 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2249 #ifdef POLARSSL_CIPHER_MODE_CFB
2251 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_4)
2253 unsigned char key_str[100];
2254 unsigned char iv_str[100];
2255 unsigned char src_str[100];
2256 unsigned char dst_str[100];
2257 unsigned char output[100];
2259 size_t iv_offset = 0;
2262 memset(key_str, 0x00, 100);
2263 memset(iv_str, 0x00, 100);
2264 memset(src_str, 0x00, 100);
2265 memset(dst_str, 0x00, 100);
2266 memset(output, 0x00, 100);
2268 key_len =
unhexify( key_str,
"1d85a181b54cde51f0e098095b2962fdc93b51fe9b88602b3f54130bf76a5bd9" );
2269 unhexify( iv_str,
"00000000000000000000000000000000" );
2270 unhexify( src_str,
"531c2c38344578b84d50b3c917bbb6e1" );
2274 hexify( dst_str, output, 16 );
2276 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2281 #ifdef POLARSSL_CIPHER_MODE_CFB
2283 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_5)
2285 unsigned char key_str[100];
2286 unsigned char iv_str[100];
2287 unsigned char src_str[100];
2288 unsigned char dst_str[100];
2289 unsigned char output[100];
2291 size_t iv_offset = 0;
2294 memset(key_str, 0x00, 100);
2295 memset(iv_str, 0x00, 100);
2296 memset(src_str, 0x00, 100);
2297 memset(dst_str, 0x00, 100);
2298 memset(output, 0x00, 100);
2300 key_len =
unhexify( key_str,
"dc0eba1f2232a7879ded34ed8428eeb8769b056bbaf8ad77cb65c3541430b4cf" );
2301 unhexify( iv_str,
"00000000000000000000000000000000" );
2302 unhexify( src_str,
"fc6aec906323480005c58e7e1ab004ad" );
2306 hexify( dst_str, output, 16 );
2308 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2313 #ifdef POLARSSL_CIPHER_MODE_CFB
2315 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_6)
2317 unsigned char key_str[100];
2318 unsigned char iv_str[100];
2319 unsigned char src_str[100];
2320 unsigned char dst_str[100];
2321 unsigned char output[100];
2323 size_t iv_offset = 0;
2326 memset(key_str, 0x00, 100);
2327 memset(iv_str, 0x00, 100);
2328 memset(src_str, 0x00, 100);
2329 memset(dst_str, 0x00, 100);
2330 memset(output, 0x00, 100);
2332 key_len =
unhexify( key_str,
"f8be9ba615c5a952cabbca24f68f8593039624d524c816acda2c9183bd917cb9" );
2333 unhexify( iv_str,
"00000000000000000000000000000000" );
2334 unhexify( src_str,
"a3944b95ca0b52043584ef02151926a8" );
2338 hexify( dst_str, output, 16 );
2340 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2345 #ifdef POLARSSL_CIPHER_MODE_CFB
2347 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_7)
2349 unsigned char key_str[100];
2350 unsigned char iv_str[100];
2351 unsigned char src_str[100];
2352 unsigned char dst_str[100];
2353 unsigned char output[100];
2355 size_t iv_offset = 0;
2358 memset(key_str, 0x00, 100);
2359 memset(iv_str, 0x00, 100);
2360 memset(src_str, 0x00, 100);
2361 memset(dst_str, 0x00, 100);
2362 memset(output, 0x00, 100);
2364 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
2365 unhexify( iv_str,
"761c1fe41a18acf20d241650611d90f1" );
2366 unhexify( src_str,
"623a52fcea5d443e48d9181ab32c7421" );
2370 hexify( dst_str, output, 16 );
2372 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2377 #ifdef POLARSSL_CIPHER_MODE_CFB
2379 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_8)
2381 unsigned char key_str[100];
2382 unsigned char iv_str[100];
2383 unsigned char src_str[100];
2384 unsigned char dst_str[100];
2385 unsigned char output[100];
2387 size_t iv_offset = 0;
2390 memset(key_str, 0x00, 100);
2391 memset(iv_str, 0x00, 100);
2392 memset(src_str, 0x00, 100);
2393 memset(dst_str, 0x00, 100);
2394 memset(output, 0x00, 100);
2396 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
2397 unhexify( iv_str,
"8a560769d605868ad80d819bdba03771" );
2398 unhexify( src_str,
"38f2c7ae10612415d27ca190d27da8b4" );
2402 hexify( dst_str, output, 16 );
2404 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2409 #ifdef POLARSSL_CIPHER_MODE_CFB
2411 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_9)
2413 unsigned char key_str[100];
2414 unsigned char iv_str[100];
2415 unsigned char src_str[100];
2416 unsigned char dst_str[100];
2417 unsigned char output[100];
2419 size_t iv_offset = 0;
2422 memset(key_str, 0x00, 100);
2423 memset(iv_str, 0x00, 100);
2424 memset(src_str, 0x00, 100);
2425 memset(dst_str, 0x00, 100);
2426 memset(output, 0x00, 100);
2428 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
2429 unhexify( iv_str,
"91fbef2d15a97816060bee1feaa49afe" );
2430 unhexify( src_str,
"1bc704f1bce135ceb810341b216d7abe" );
2434 hexify( dst_str, output, 16 );
2436 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2441 #ifdef POLARSSL_CIPHER_MODE_CFB
2443 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_10)
2445 unsigned char key_str[100];
2446 unsigned char iv_str[100];
2447 unsigned char src_str[100];
2448 unsigned char dst_str[100];
2449 unsigned char output[100];
2451 size_t iv_offset = 0;
2454 memset(key_str, 0x00, 100);
2455 memset(iv_str, 0x00, 100);
2456 memset(src_str, 0x00, 100);
2457 memset(dst_str, 0x00, 100);
2458 memset(output, 0x00, 100);
2460 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
2461 unhexify( iv_str,
"e0000000000000000000000000000000" );
2462 unhexify( src_str,
"9b80eefb7ebe2d2b16247aa0efc72f5d" );
2466 hexify( dst_str, output, 16 );
2468 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2473 #ifdef POLARSSL_CIPHER_MODE_CFB
2475 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_11)
2477 unsigned char key_str[100];
2478 unsigned char iv_str[100];
2479 unsigned char src_str[100];
2480 unsigned char dst_str[100];
2481 unsigned char output[100];
2483 size_t iv_offset = 0;
2486 memset(key_str, 0x00, 100);
2487 memset(iv_str, 0x00, 100);
2488 memset(src_str, 0x00, 100);
2489 memset(dst_str, 0x00, 100);
2490 memset(output, 0x00, 100);
2492 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
2493 unhexify( iv_str,
"f0000000000000000000000000000000" );
2494 unhexify( src_str,
"7f2c5ece07a98d8bee13c51177395ff7" );
2498 hexify( dst_str, output, 16 );
2500 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );
2505 #ifdef POLARSSL_CIPHER_MODE_CFB
2507 FCT_TEST_BGN(aes_256_cfb128_decrypt_nist_kat_12)
2509 unsigned char key_str[100];
2510 unsigned char iv_str[100];
2511 unsigned char src_str[100];
2512 unsigned char dst_str[100];
2513 unsigned char output[100];
2515 size_t iv_offset = 0;
2518 memset(key_str, 0x00, 100);
2519 memset(iv_str, 0x00, 100);
2520 memset(src_str, 0x00, 100);
2521 memset(dst_str, 0x00, 100);
2522 memset(output, 0x00, 100);
2524 key_len =
unhexify( key_str,
"0000000000000000000000000000000000000000000000000000000000000000" );
2525 unhexify( iv_str,
"f8000000000000000000000000000000" );
2526 unhexify( src_str,
"7818d800dcf6f4be1e0e94f403d1e4c2" );
2530 hexify( dst_str, output, 16 );
2532 fct_chk( strcmp( (
char *) dst_str,
"00000000000000000000000000000000" ) == 0 );