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_BLOWFISH_C
231 FCT_SUITE_BGN(test_suite_blowfish)
234 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_1)
236 unsigned char key_str[100];
237 unsigned char src_str[100];
238 unsigned char dst_str[100];
239 unsigned char output[100];
243 memset(key_str, 0x00, 100);
244 memset(src_str, 0x00, 100);
245 memset(dst_str, 0x00, 100);
246 memset(output, 0x00, 100);
248 key_len =
unhexify( key_str,
"0000000000000000" );
249 unhexify( src_str,
"0000000000000000" );
255 hexify( dst_str, output, 8 );
257 fct_chk( strcmp( (
char *) dst_str,
"4ef997456198dd78" ) == 0 );
263 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_2)
265 unsigned char key_str[100];
266 unsigned char src_str[100];
267 unsigned char dst_str[100];
268 unsigned char output[100];
272 memset(key_str, 0x00, 100);
273 memset(src_str, 0x00, 100);
274 memset(dst_str, 0x00, 100);
275 memset(output, 0x00, 100);
277 key_len =
unhexify( key_str,
"ffffffffffffffff" );
278 unhexify( src_str,
"ffffffffffffffff" );
284 hexify( dst_str, output, 8 );
286 fct_chk( strcmp( (
char *) dst_str,
"51866fd5b85ecb8a" ) == 0 );
292 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_3)
294 unsigned char key_str[100];
295 unsigned char src_str[100];
296 unsigned char dst_str[100];
297 unsigned char output[100];
301 memset(key_str, 0x00, 100);
302 memset(src_str, 0x00, 100);
303 memset(dst_str, 0x00, 100);
304 memset(output, 0x00, 100);
306 key_len =
unhexify( key_str,
"3000000000000000" );
307 unhexify( src_str,
"1000000000000001" );
313 hexify( dst_str, output, 8 );
315 fct_chk( strcmp( (
char *) dst_str,
"7d856f9a613063f2" ) == 0 );
321 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_4)
323 unsigned char key_str[100];
324 unsigned char src_str[100];
325 unsigned char dst_str[100];
326 unsigned char output[100];
330 memset(key_str, 0x00, 100);
331 memset(src_str, 0x00, 100);
332 memset(dst_str, 0x00, 100);
333 memset(output, 0x00, 100);
335 key_len =
unhexify( key_str,
"1111111111111111" );
336 unhexify( src_str,
"1111111111111111" );
342 hexify( dst_str, output, 8 );
344 fct_chk( strcmp( (
char *) dst_str,
"2466dd878b963c9d" ) == 0 );
350 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_5)
352 unsigned char key_str[100];
353 unsigned char src_str[100];
354 unsigned char dst_str[100];
355 unsigned char output[100];
359 memset(key_str, 0x00, 100);
360 memset(src_str, 0x00, 100);
361 memset(dst_str, 0x00, 100);
362 memset(output, 0x00, 100);
364 key_len =
unhexify( key_str,
"0123456789abcdef" );
365 unhexify( src_str,
"1111111111111111" );
371 hexify( dst_str, output, 8 );
373 fct_chk( strcmp( (
char *) dst_str,
"61f9c3802281b096" ) == 0 );
379 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_6)
381 unsigned char key_str[100];
382 unsigned char src_str[100];
383 unsigned char dst_str[100];
384 unsigned char output[100];
388 memset(key_str, 0x00, 100);
389 memset(src_str, 0x00, 100);
390 memset(dst_str, 0x00, 100);
391 memset(output, 0x00, 100);
393 key_len =
unhexify( key_str,
"1111111111111111" );
394 unhexify( src_str,
"0123456789abcdef" );
400 hexify( dst_str, output, 8 );
402 fct_chk( strcmp( (
char *) dst_str,
"7d0cc630afda1ec7" ) == 0 );
408 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_7)
410 unsigned char key_str[100];
411 unsigned char src_str[100];
412 unsigned char dst_str[100];
413 unsigned char output[100];
417 memset(key_str, 0x00, 100);
418 memset(src_str, 0x00, 100);
419 memset(dst_str, 0x00, 100);
420 memset(output, 0x00, 100);
422 key_len =
unhexify( key_str,
"0000000000000000" );
423 unhexify( src_str,
"0000000000000000" );
429 hexify( dst_str, output, 8 );
431 fct_chk( strcmp( (
char *) dst_str,
"4ef997456198dd78" ) == 0 );
437 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_8)
439 unsigned char key_str[100];
440 unsigned char src_str[100];
441 unsigned char dst_str[100];
442 unsigned char output[100];
446 memset(key_str, 0x00, 100);
447 memset(src_str, 0x00, 100);
448 memset(dst_str, 0x00, 100);
449 memset(output, 0x00, 100);
451 key_len =
unhexify( key_str,
"fedcba9876543210" );
452 unhexify( src_str,
"0123456789abcdef" );
458 hexify( dst_str, output, 8 );
460 fct_chk( strcmp( (
char *) dst_str,
"0aceab0fc6a0a28d" ) == 0 );
466 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_9)
468 unsigned char key_str[100];
469 unsigned char src_str[100];
470 unsigned char dst_str[100];
471 unsigned char output[100];
475 memset(key_str, 0x00, 100);
476 memset(src_str, 0x00, 100);
477 memset(dst_str, 0x00, 100);
478 memset(output, 0x00, 100);
480 key_len =
unhexify( key_str,
"7ca110454a1a6e57" );
481 unhexify( src_str,
"01a1d6d039776742" );
487 hexify( dst_str, output, 8 );
489 fct_chk( strcmp( (
char *) dst_str,
"59c68245eb05282b" ) == 0 );
495 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_10)
497 unsigned char key_str[100];
498 unsigned char src_str[100];
499 unsigned char dst_str[100];
500 unsigned char output[100];
504 memset(key_str, 0x00, 100);
505 memset(src_str, 0x00, 100);
506 memset(dst_str, 0x00, 100);
507 memset(output, 0x00, 100);
509 key_len =
unhexify( key_str,
"0131d9619dc1376e" );
510 unhexify( src_str,
"5cd54ca83def57da" );
516 hexify( dst_str, output, 8 );
518 fct_chk( strcmp( (
char *) dst_str,
"b1b8cc0b250f09a0" ) == 0 );
524 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_11)
526 unsigned char key_str[100];
527 unsigned char src_str[100];
528 unsigned char dst_str[100];
529 unsigned char output[100];
533 memset(key_str, 0x00, 100);
534 memset(src_str, 0x00, 100);
535 memset(dst_str, 0x00, 100);
536 memset(output, 0x00, 100);
538 key_len =
unhexify( key_str,
"07a1133e4a0b2686" );
539 unhexify( src_str,
"0248d43806f67172" );
545 hexify( dst_str, output, 8 );
547 fct_chk( strcmp( (
char *) dst_str,
"1730e5778bea1da4" ) == 0 );
553 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_12)
555 unsigned char key_str[100];
556 unsigned char src_str[100];
557 unsigned char dst_str[100];
558 unsigned char output[100];
562 memset(key_str, 0x00, 100);
563 memset(src_str, 0x00, 100);
564 memset(dst_str, 0x00, 100);
565 memset(output, 0x00, 100);
567 key_len =
unhexify( key_str,
"3849674c2602319e" );
568 unhexify( src_str,
"51454b582ddf440a" );
574 hexify( dst_str, output, 8 );
576 fct_chk( strcmp( (
char *) dst_str,
"a25e7856cf2651eb" ) == 0 );
582 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_13)
584 unsigned char key_str[100];
585 unsigned char src_str[100];
586 unsigned char dst_str[100];
587 unsigned char output[100];
591 memset(key_str, 0x00, 100);
592 memset(src_str, 0x00, 100);
593 memset(dst_str, 0x00, 100);
594 memset(output, 0x00, 100);
596 key_len =
unhexify( key_str,
"04b915ba43feb5b6" );
597 unhexify( src_str,
"42fd443059577fa2" );
603 hexify( dst_str, output, 8 );
605 fct_chk( strcmp( (
char *) dst_str,
"353882b109ce8f1a" ) == 0 );
611 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_14)
613 unsigned char key_str[100];
614 unsigned char src_str[100];
615 unsigned char dst_str[100];
616 unsigned char output[100];
620 memset(key_str, 0x00, 100);
621 memset(src_str, 0x00, 100);
622 memset(dst_str, 0x00, 100);
623 memset(output, 0x00, 100);
625 key_len =
unhexify( key_str,
"0113b970fd34f2ce" );
626 unhexify( src_str,
"059b5e0851cf143a" );
632 hexify( dst_str, output, 8 );
634 fct_chk( strcmp( (
char *) dst_str,
"48f4d0884c379918" ) == 0 );
640 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_15)
642 unsigned char key_str[100];
643 unsigned char src_str[100];
644 unsigned char dst_str[100];
645 unsigned char output[100];
649 memset(key_str, 0x00, 100);
650 memset(src_str, 0x00, 100);
651 memset(dst_str, 0x00, 100);
652 memset(output, 0x00, 100);
654 key_len =
unhexify( key_str,
"0170f175468fb5e6" );
655 unhexify( src_str,
"0756d8e0774761d2" );
661 hexify( dst_str, output, 8 );
663 fct_chk( strcmp( (
char *) dst_str,
"432193b78951fc98" ) == 0 );
669 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_16)
671 unsigned char key_str[100];
672 unsigned char src_str[100];
673 unsigned char dst_str[100];
674 unsigned char output[100];
678 memset(key_str, 0x00, 100);
679 memset(src_str, 0x00, 100);
680 memset(dst_str, 0x00, 100);
681 memset(output, 0x00, 100);
683 key_len =
unhexify( key_str,
"43297fad38e373fe" );
684 unhexify( src_str,
"762514b829bf486a" );
690 hexify( dst_str, output, 8 );
692 fct_chk( strcmp( (
char *) dst_str,
"13f04154d69d1ae5" ) == 0 );
698 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_17)
700 unsigned char key_str[100];
701 unsigned char src_str[100];
702 unsigned char dst_str[100];
703 unsigned char output[100];
707 memset(key_str, 0x00, 100);
708 memset(src_str, 0x00, 100);
709 memset(dst_str, 0x00, 100);
710 memset(output, 0x00, 100);
712 key_len =
unhexify( key_str,
"07a7137045da2a16" );
713 unhexify( src_str,
"3bdd119049372802" );
719 hexify( dst_str, output, 8 );
721 fct_chk( strcmp( (
char *) dst_str,
"2eedda93ffd39c79" ) == 0 );
727 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_18)
729 unsigned char key_str[100];
730 unsigned char src_str[100];
731 unsigned char dst_str[100];
732 unsigned char output[100];
736 memset(key_str, 0x00, 100);
737 memset(src_str, 0x00, 100);
738 memset(dst_str, 0x00, 100);
739 memset(output, 0x00, 100);
741 key_len =
unhexify( key_str,
"04689104c2fd3b2f" );
742 unhexify( src_str,
"26955f6835af609a" );
748 hexify( dst_str, output, 8 );
750 fct_chk( strcmp( (
char *) dst_str,
"d887e0393c2da6e3" ) == 0 );
756 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_19)
758 unsigned char key_str[100];
759 unsigned char src_str[100];
760 unsigned char dst_str[100];
761 unsigned char output[100];
765 memset(key_str, 0x00, 100);
766 memset(src_str, 0x00, 100);
767 memset(dst_str, 0x00, 100);
768 memset(output, 0x00, 100);
770 key_len =
unhexify( key_str,
"37d06bb516cb7546" );
771 unhexify( src_str,
"164d5e404f275232" );
777 hexify( dst_str, output, 8 );
779 fct_chk( strcmp( (
char *) dst_str,
"5f99d04f5b163969" ) == 0 );
785 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_20)
787 unsigned char key_str[100];
788 unsigned char src_str[100];
789 unsigned char dst_str[100];
790 unsigned char output[100];
794 memset(key_str, 0x00, 100);
795 memset(src_str, 0x00, 100);
796 memset(dst_str, 0x00, 100);
797 memset(output, 0x00, 100);
799 key_len =
unhexify( key_str,
"1f08260d1ac2465e" );
800 unhexify( src_str,
"6b056e18759f5cca" );
806 hexify( dst_str, output, 8 );
808 fct_chk( strcmp( (
char *) dst_str,
"4a057a3b24d3977b" ) == 0 );
814 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_21)
816 unsigned char key_str[100];
817 unsigned char src_str[100];
818 unsigned char dst_str[100];
819 unsigned char output[100];
823 memset(key_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,
"584023641aba6176" );
829 unhexify( src_str,
"004bd6ef09176062" );
835 hexify( dst_str, output, 8 );
837 fct_chk( strcmp( (
char *) dst_str,
"452031c1e4fada8e" ) == 0 );
843 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_22)
845 unsigned char key_str[100];
846 unsigned char src_str[100];
847 unsigned char dst_str[100];
848 unsigned char output[100];
852 memset(key_str, 0x00, 100);
853 memset(src_str, 0x00, 100);
854 memset(dst_str, 0x00, 100);
855 memset(output, 0x00, 100);
857 key_len =
unhexify( key_str,
"025816164629b007" );
858 unhexify( src_str,
"480d39006ee762f2" );
864 hexify( dst_str, output, 8 );
866 fct_chk( strcmp( (
char *) dst_str,
"7555ae39f59b87bd" ) == 0 );
872 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_23)
874 unsigned char key_str[100];
875 unsigned char src_str[100];
876 unsigned char dst_str[100];
877 unsigned char output[100];
881 memset(key_str, 0x00, 100);
882 memset(src_str, 0x00, 100);
883 memset(dst_str, 0x00, 100);
884 memset(output, 0x00, 100);
886 key_len =
unhexify( key_str,
"49793ebc79b3258f" );
887 unhexify( src_str,
"437540c8698f3cfa" );
893 hexify( dst_str, output, 8 );
895 fct_chk( strcmp( (
char *) dst_str,
"53c55f9cb49fc019" ) == 0 );
901 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_24)
903 unsigned char key_str[100];
904 unsigned char src_str[100];
905 unsigned char dst_str[100];
906 unsigned char output[100];
910 memset(key_str, 0x00, 100);
911 memset(src_str, 0x00, 100);
912 memset(dst_str, 0x00, 100);
913 memset(output, 0x00, 100);
915 key_len =
unhexify( key_str,
"4fb05e1515ab73a7" );
916 unhexify( src_str,
"072d43a077075292" );
922 hexify( dst_str, output, 8 );
924 fct_chk( strcmp( (
char *) dst_str,
"7a8e7bfa937e89a3" ) == 0 );
930 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_25)
932 unsigned char key_str[100];
933 unsigned char src_str[100];
934 unsigned char dst_str[100];
935 unsigned char output[100];
939 memset(key_str, 0x00, 100);
940 memset(src_str, 0x00, 100);
941 memset(dst_str, 0x00, 100);
942 memset(output, 0x00, 100);
944 key_len =
unhexify( key_str,
"49e95d6d4ca229bf" );
945 unhexify( src_str,
"02fe55778117f12a" );
951 hexify( dst_str, output, 8 );
953 fct_chk( strcmp( (
char *) dst_str,
"cf9c5d7a4986adb5" ) == 0 );
959 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_26)
961 unsigned char key_str[100];
962 unsigned char src_str[100];
963 unsigned char dst_str[100];
964 unsigned char output[100];
968 memset(key_str, 0x00, 100);
969 memset(src_str, 0x00, 100);
970 memset(dst_str, 0x00, 100);
971 memset(output, 0x00, 100);
973 key_len =
unhexify( key_str,
"018310dc409b26d6" );
974 unhexify( src_str,
"1d9d5c5018f728c2" );
980 hexify( dst_str, output, 8 );
982 fct_chk( strcmp( (
char *) dst_str,
"d1abb290658bc778" ) == 0 );
988 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_27)
990 unsigned char key_str[100];
991 unsigned char src_str[100];
992 unsigned char dst_str[100];
993 unsigned char output[100];
997 memset(key_str, 0x00, 100);
998 memset(src_str, 0x00, 100);
999 memset(dst_str, 0x00, 100);
1000 memset(output, 0x00, 100);
1002 key_len =
unhexify( key_str,
"1c587f1c13924fef" );
1003 unhexify( src_str,
"305532286d6f295a" );
1009 hexify( dst_str, output, 8 );
1011 fct_chk( strcmp( (
char *) dst_str,
"55cb3774d13ef201" ) == 0 );
1017 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_28)
1019 unsigned char key_str[100];
1020 unsigned char src_str[100];
1021 unsigned char dst_str[100];
1022 unsigned char output[100];
1026 memset(key_str, 0x00, 100);
1027 memset(src_str, 0x00, 100);
1028 memset(dst_str, 0x00, 100);
1029 memset(output, 0x00, 100);
1031 key_len =
unhexify( key_str,
"0101010101010101" );
1032 unhexify( src_str,
"0123456789abcdef" );
1038 hexify( dst_str, output, 8 );
1040 fct_chk( strcmp( (
char *) dst_str,
"fa34ec4847b268b2" ) == 0 );
1046 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_29)
1048 unsigned char key_str[100];
1049 unsigned char src_str[100];
1050 unsigned char dst_str[100];
1051 unsigned char output[100];
1055 memset(key_str, 0x00, 100);
1056 memset(src_str, 0x00, 100);
1057 memset(dst_str, 0x00, 100);
1058 memset(output, 0x00, 100);
1060 key_len =
unhexify( key_str,
"1f1f1f1f0e0e0e0e" );
1061 unhexify( src_str,
"0123456789abcdef" );
1067 hexify( dst_str, output, 8 );
1069 fct_chk( strcmp( (
char *) dst_str,
"a790795108ea3cae" ) == 0 );
1075 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_30)
1077 unsigned char key_str[100];
1078 unsigned char src_str[100];
1079 unsigned char dst_str[100];
1080 unsigned char output[100];
1084 memset(key_str, 0x00, 100);
1085 memset(src_str, 0x00, 100);
1086 memset(dst_str, 0x00, 100);
1087 memset(output, 0x00, 100);
1089 key_len =
unhexify( key_str,
"e0fee0fef1fef1fe" );
1090 unhexify( src_str,
"0123456789abcdef" );
1096 hexify( dst_str, output, 8 );
1098 fct_chk( strcmp( (
char *) dst_str,
"c39e072d9fac631d" ) == 0 );
1104 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_31)
1106 unsigned char key_str[100];
1107 unsigned char src_str[100];
1108 unsigned char dst_str[100];
1109 unsigned char output[100];
1113 memset(key_str, 0x00, 100);
1114 memset(src_str, 0x00, 100);
1115 memset(dst_str, 0x00, 100);
1116 memset(output, 0x00, 100);
1118 key_len =
unhexify( key_str,
"0000000000000000" );
1119 unhexify( src_str,
"ffffffffffffffff" );
1125 hexify( dst_str, output, 8 );
1127 fct_chk( strcmp( (
char *) dst_str,
"014933e0cdaff6e4" ) == 0 );
1133 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_32)
1135 unsigned char key_str[100];
1136 unsigned char src_str[100];
1137 unsigned char dst_str[100];
1138 unsigned char output[100];
1142 memset(key_str, 0x00, 100);
1143 memset(src_str, 0x00, 100);
1144 memset(dst_str, 0x00, 100);
1145 memset(output, 0x00, 100);
1147 key_len =
unhexify( key_str,
"ffffffffffffffff" );
1148 unhexify( src_str,
"0000000000000000" );
1154 hexify( dst_str, output, 8 );
1156 fct_chk( strcmp( (
char *) dst_str,
"f21e9a77b71c49bc" ) == 0 );
1162 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_33)
1164 unsigned char key_str[100];
1165 unsigned char src_str[100];
1166 unsigned char dst_str[100];
1167 unsigned char output[100];
1171 memset(key_str, 0x00, 100);
1172 memset(src_str, 0x00, 100);
1173 memset(dst_str, 0x00, 100);
1174 memset(output, 0x00, 100);
1176 key_len =
unhexify( key_str,
"0123456789abcdef" );
1177 unhexify( src_str,
"0000000000000000" );
1183 hexify( dst_str, output, 8 );
1185 fct_chk( strcmp( (
char *) dst_str,
"245946885754369a" ) == 0 );
1191 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_34)
1193 unsigned char key_str[100];
1194 unsigned char src_str[100];
1195 unsigned char dst_str[100];
1196 unsigned char output[100];
1200 memset(key_str, 0x00, 100);
1201 memset(src_str, 0x00, 100);
1202 memset(dst_str, 0x00, 100);
1203 memset(output, 0x00, 100);
1205 key_len =
unhexify( key_str,
"fedcba9876543210" );
1206 unhexify( src_str,
"ffffffffffffffff" );
1212 hexify( dst_str, output, 8 );
1214 fct_chk( strcmp( (
char *) dst_str,
"6b5c5a9c5d9e0a5a" ) == 0 );
1220 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_1)
1222 unsigned char key_str[100];
1223 unsigned char src_str[100];
1224 unsigned char dst_str[100];
1225 unsigned char output[100];
1229 memset(key_str, 0x00, 100);
1230 memset(src_str, 0x00, 100);
1231 memset(dst_str, 0x00, 100);
1232 memset(output, 0x00, 100);
1234 key_len =
unhexify( key_str,
"0000000000000000" );
1235 unhexify( src_str,
"4ef997456198dd78" );
1241 hexify( dst_str, output, 8 );
1243 fct_chk( strcmp( (
char *) dst_str,
"0000000000000000" ) == 0 );
1249 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_2)
1251 unsigned char key_str[100];
1252 unsigned char src_str[100];
1253 unsigned char dst_str[100];
1254 unsigned char output[100];
1258 memset(key_str, 0x00, 100);
1259 memset(src_str, 0x00, 100);
1260 memset(dst_str, 0x00, 100);
1261 memset(output, 0x00, 100);
1263 key_len =
unhexify( key_str,
"ffffffffffffffff" );
1264 unhexify( src_str,
"51866fd5b85ecb8a" );
1270 hexify( dst_str, output, 8 );
1272 fct_chk( strcmp( (
char *) dst_str,
"ffffffffffffffff" ) == 0 );
1278 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_3)
1280 unsigned char key_str[100];
1281 unsigned char src_str[100];
1282 unsigned char dst_str[100];
1283 unsigned char output[100];
1287 memset(key_str, 0x00, 100);
1288 memset(src_str, 0x00, 100);
1289 memset(dst_str, 0x00, 100);
1290 memset(output, 0x00, 100);
1292 key_len =
unhexify( key_str,
"3000000000000000" );
1293 unhexify( src_str,
"7d856f9a613063f2" );
1299 hexify( dst_str, output, 8 );
1301 fct_chk( strcmp( (
char *) dst_str,
"1000000000000001" ) == 0 );
1307 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_4)
1309 unsigned char key_str[100];
1310 unsigned char src_str[100];
1311 unsigned char dst_str[100];
1312 unsigned char output[100];
1316 memset(key_str, 0x00, 100);
1317 memset(src_str, 0x00, 100);
1318 memset(dst_str, 0x00, 100);
1319 memset(output, 0x00, 100);
1321 key_len =
unhexify( key_str,
"1111111111111111" );
1322 unhexify( src_str,
"2466dd878b963c9d" );
1328 hexify( dst_str, output, 8 );
1330 fct_chk( strcmp( (
char *) dst_str,
"1111111111111111" ) == 0 );
1336 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_5)
1338 unsigned char key_str[100];
1339 unsigned char src_str[100];
1340 unsigned char dst_str[100];
1341 unsigned char output[100];
1345 memset(key_str, 0x00, 100);
1346 memset(src_str, 0x00, 100);
1347 memset(dst_str, 0x00, 100);
1348 memset(output, 0x00, 100);
1350 key_len =
unhexify( key_str,
"0123456789abcdef" );
1351 unhexify( src_str,
"61f9c3802281b096" );
1357 hexify( dst_str, output, 8 );
1359 fct_chk( strcmp( (
char *) dst_str,
"1111111111111111" ) == 0 );
1365 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_6)
1367 unsigned char key_str[100];
1368 unsigned char src_str[100];
1369 unsigned char dst_str[100];
1370 unsigned char output[100];
1374 memset(key_str, 0x00, 100);
1375 memset(src_str, 0x00, 100);
1376 memset(dst_str, 0x00, 100);
1377 memset(output, 0x00, 100);
1379 key_len =
unhexify( key_str,
"1111111111111111" );
1380 unhexify( src_str,
"7d0cc630afda1ec7" );
1386 hexify( dst_str, output, 8 );
1388 fct_chk( strcmp( (
char *) dst_str,
"0123456789abcdef" ) == 0 );
1394 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_7)
1396 unsigned char key_str[100];
1397 unsigned char src_str[100];
1398 unsigned char dst_str[100];
1399 unsigned char output[100];
1403 memset(key_str, 0x00, 100);
1404 memset(src_str, 0x00, 100);
1405 memset(dst_str, 0x00, 100);
1406 memset(output, 0x00, 100);
1408 key_len =
unhexify( key_str,
"0000000000000000" );
1409 unhexify( src_str,
"4ef997456198dd78" );
1415 hexify( dst_str, output, 8 );
1417 fct_chk( strcmp( (
char *) dst_str,
"0000000000000000" ) == 0 );
1423 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_8)
1425 unsigned char key_str[100];
1426 unsigned char src_str[100];
1427 unsigned char dst_str[100];
1428 unsigned char output[100];
1432 memset(key_str, 0x00, 100);
1433 memset(src_str, 0x00, 100);
1434 memset(dst_str, 0x00, 100);
1435 memset(output, 0x00, 100);
1437 key_len =
unhexify( key_str,
"fedcba9876543210" );
1438 unhexify( src_str,
"0aceab0fc6a0a28d" );
1444 hexify( dst_str, output, 8 );
1446 fct_chk( strcmp( (
char *) dst_str,
"0123456789abcdef" ) == 0 );
1452 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_9)
1454 unsigned char key_str[100];
1455 unsigned char src_str[100];
1456 unsigned char dst_str[100];
1457 unsigned char output[100];
1461 memset(key_str, 0x00, 100);
1462 memset(src_str, 0x00, 100);
1463 memset(dst_str, 0x00, 100);
1464 memset(output, 0x00, 100);
1466 key_len =
unhexify( key_str,
"7ca110454a1a6e57" );
1467 unhexify( src_str,
"59c68245eb05282b" );
1473 hexify( dst_str, output, 8 );
1475 fct_chk( strcmp( (
char *) dst_str,
"01a1d6d039776742" ) == 0 );
1481 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_10)
1483 unsigned char key_str[100];
1484 unsigned char src_str[100];
1485 unsigned char dst_str[100];
1486 unsigned char output[100];
1490 memset(key_str, 0x00, 100);
1491 memset(src_str, 0x00, 100);
1492 memset(dst_str, 0x00, 100);
1493 memset(output, 0x00, 100);
1495 key_len =
unhexify( key_str,
"0131d9619dc1376e" );
1496 unhexify( src_str,
"b1b8cc0b250f09a0" );
1502 hexify( dst_str, output, 8 );
1504 fct_chk( strcmp( (
char *) dst_str,
"5cd54ca83def57da" ) == 0 );
1510 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_11)
1512 unsigned char key_str[100];
1513 unsigned char src_str[100];
1514 unsigned char dst_str[100];
1515 unsigned char output[100];
1519 memset(key_str, 0x00, 100);
1520 memset(src_str, 0x00, 100);
1521 memset(dst_str, 0x00, 100);
1522 memset(output, 0x00, 100);
1524 key_len =
unhexify( key_str,
"07a1133e4a0b2686" );
1525 unhexify( src_str,
"1730e5778bea1da4" );
1531 hexify( dst_str, output, 8 );
1533 fct_chk( strcmp( (
char *) dst_str,
"0248d43806f67172" ) == 0 );
1539 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_12)
1541 unsigned char key_str[100];
1542 unsigned char src_str[100];
1543 unsigned char dst_str[100];
1544 unsigned char output[100];
1548 memset(key_str, 0x00, 100);
1549 memset(src_str, 0x00, 100);
1550 memset(dst_str, 0x00, 100);
1551 memset(output, 0x00, 100);
1553 key_len =
unhexify( key_str,
"3849674c2602319e" );
1554 unhexify( src_str,
"a25e7856cf2651eb" );
1560 hexify( dst_str, output, 8 );
1562 fct_chk( strcmp( (
char *) dst_str,
"51454b582ddf440a" ) == 0 );
1568 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_13)
1570 unsigned char key_str[100];
1571 unsigned char src_str[100];
1572 unsigned char dst_str[100];
1573 unsigned char output[100];
1577 memset(key_str, 0x00, 100);
1578 memset(src_str, 0x00, 100);
1579 memset(dst_str, 0x00, 100);
1580 memset(output, 0x00, 100);
1582 key_len =
unhexify( key_str,
"04b915ba43feb5b6" );
1583 unhexify( src_str,
"353882b109ce8f1a" );
1589 hexify( dst_str, output, 8 );
1591 fct_chk( strcmp( (
char *) dst_str,
"42fd443059577fa2" ) == 0 );
1597 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_14)
1599 unsigned char key_str[100];
1600 unsigned char src_str[100];
1601 unsigned char dst_str[100];
1602 unsigned char output[100];
1606 memset(key_str, 0x00, 100);
1607 memset(src_str, 0x00, 100);
1608 memset(dst_str, 0x00, 100);
1609 memset(output, 0x00, 100);
1611 key_len =
unhexify( key_str,
"0113b970fd34f2ce" );
1612 unhexify( src_str,
"48f4d0884c379918" );
1618 hexify( dst_str, output, 8 );
1620 fct_chk( strcmp( (
char *) dst_str,
"059b5e0851cf143a" ) == 0 );
1626 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_15)
1628 unsigned char key_str[100];
1629 unsigned char src_str[100];
1630 unsigned char dst_str[100];
1631 unsigned char output[100];
1635 memset(key_str, 0x00, 100);
1636 memset(src_str, 0x00, 100);
1637 memset(dst_str, 0x00, 100);
1638 memset(output, 0x00, 100);
1640 key_len =
unhexify( key_str,
"0170f175468fb5e6" );
1641 unhexify( src_str,
"0756d8e0774761d2" );
1647 hexify( dst_str, output, 8 );
1649 fct_chk( strcmp( (
char *) dst_str,
"432193b78951fc98" ) == 0 );
1655 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_16)
1657 unsigned char key_str[100];
1658 unsigned char src_str[100];
1659 unsigned char dst_str[100];
1660 unsigned char output[100];
1664 memset(key_str, 0x00, 100);
1665 memset(src_str, 0x00, 100);
1666 memset(dst_str, 0x00, 100);
1667 memset(output, 0x00, 100);
1669 key_len =
unhexify( key_str,
"43297fad38e373fe" );
1670 unhexify( src_str,
"13f04154d69d1ae5" );
1676 hexify( dst_str, output, 8 );
1678 fct_chk( strcmp( (
char *) dst_str,
"762514b829bf486a" ) == 0 );
1684 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_17)
1686 unsigned char key_str[100];
1687 unsigned char src_str[100];
1688 unsigned char dst_str[100];
1689 unsigned char output[100];
1693 memset(key_str, 0x00, 100);
1694 memset(src_str, 0x00, 100);
1695 memset(dst_str, 0x00, 100);
1696 memset(output, 0x00, 100);
1698 key_len =
unhexify( key_str,
"07a7137045da2a16" );
1699 unhexify( src_str,
"2eedda93ffd39c79" );
1705 hexify( dst_str, output, 8 );
1707 fct_chk( strcmp( (
char *) dst_str,
"3bdd119049372802" ) == 0 );
1713 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_18)
1715 unsigned char key_str[100];
1716 unsigned char src_str[100];
1717 unsigned char dst_str[100];
1718 unsigned char output[100];
1722 memset(key_str, 0x00, 100);
1723 memset(src_str, 0x00, 100);
1724 memset(dst_str, 0x00, 100);
1725 memset(output, 0x00, 100);
1727 key_len =
unhexify( key_str,
"04689104c2fd3b2f" );
1728 unhexify( src_str,
"d887e0393c2da6e3" );
1734 hexify( dst_str, output, 8 );
1736 fct_chk( strcmp( (
char *) dst_str,
"26955f6835af609a" ) == 0 );
1742 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_19)
1744 unsigned char key_str[100];
1745 unsigned char src_str[100];
1746 unsigned char dst_str[100];
1747 unsigned char output[100];
1751 memset(key_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,
"37d06bb516cb7546" );
1757 unhexify( src_str,
"5f99d04f5b163969" );
1763 hexify( dst_str, output, 8 );
1765 fct_chk( strcmp( (
char *) dst_str,
"164d5e404f275232" ) == 0 );
1771 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_20)
1773 unsigned char key_str[100];
1774 unsigned char src_str[100];
1775 unsigned char dst_str[100];
1776 unsigned char output[100];
1780 memset(key_str, 0x00, 100);
1781 memset(src_str, 0x00, 100);
1782 memset(dst_str, 0x00, 100);
1783 memset(output, 0x00, 100);
1785 key_len =
unhexify( key_str,
"1f08260d1ac2465e" );
1786 unhexify( src_str,
"4a057a3b24d3977b" );
1792 hexify( dst_str, output, 8 );
1794 fct_chk( strcmp( (
char *) dst_str,
"6b056e18759f5cca" ) == 0 );
1800 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_21)
1802 unsigned char key_str[100];
1803 unsigned char src_str[100];
1804 unsigned char dst_str[100];
1805 unsigned char output[100];
1809 memset(key_str, 0x00, 100);
1810 memset(src_str, 0x00, 100);
1811 memset(dst_str, 0x00, 100);
1812 memset(output, 0x00, 100);
1814 key_len =
unhexify( key_str,
"584023641aba6176" );
1815 unhexify( src_str,
"452031c1e4fada8e" );
1821 hexify( dst_str, output, 8 );
1823 fct_chk( strcmp( (
char *) dst_str,
"004bd6ef09176062" ) == 0 );
1829 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_22)
1831 unsigned char key_str[100];
1832 unsigned char src_str[100];
1833 unsigned char dst_str[100];
1834 unsigned char output[100];
1838 memset(key_str, 0x00, 100);
1839 memset(src_str, 0x00, 100);
1840 memset(dst_str, 0x00, 100);
1841 memset(output, 0x00, 100);
1843 key_len =
unhexify( key_str,
"025816164629b007" );
1844 unhexify( src_str,
"7555ae39f59b87bd" );
1850 hexify( dst_str, output, 8 );
1852 fct_chk( strcmp( (
char *) dst_str,
"480d39006ee762f2" ) == 0 );
1858 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_23)
1860 unsigned char key_str[100];
1861 unsigned char src_str[100];
1862 unsigned char dst_str[100];
1863 unsigned char output[100];
1867 memset(key_str, 0x00, 100);
1868 memset(src_str, 0x00, 100);
1869 memset(dst_str, 0x00, 100);
1870 memset(output, 0x00, 100);
1872 key_len =
unhexify( key_str,
"49793ebc79b3258f" );
1873 unhexify( src_str,
"53c55f9cb49fc019" );
1879 hexify( dst_str, output, 8 );
1881 fct_chk( strcmp( (
char *) dst_str,
"437540c8698f3cfa" ) == 0 );
1887 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_24)
1889 unsigned char key_str[100];
1890 unsigned char src_str[100];
1891 unsigned char dst_str[100];
1892 unsigned char output[100];
1896 memset(key_str, 0x00, 100);
1897 memset(src_str, 0x00, 100);
1898 memset(dst_str, 0x00, 100);
1899 memset(output, 0x00, 100);
1901 key_len =
unhexify( key_str,
"4fb05e1515ab73a7" );
1902 unhexify( src_str,
"7a8e7bfa937e89a3" );
1908 hexify( dst_str, output, 8 );
1910 fct_chk( strcmp( (
char *) dst_str,
"072d43a077075292" ) == 0 );
1916 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_25)
1918 unsigned char key_str[100];
1919 unsigned char src_str[100];
1920 unsigned char dst_str[100];
1921 unsigned char output[100];
1925 memset(key_str, 0x00, 100);
1926 memset(src_str, 0x00, 100);
1927 memset(dst_str, 0x00, 100);
1928 memset(output, 0x00, 100);
1930 key_len =
unhexify( key_str,
"49e95d6d4ca229bf" );
1931 unhexify( src_str,
"cf9c5d7a4986adb5" );
1937 hexify( dst_str, output, 8 );
1939 fct_chk( strcmp( (
char *) dst_str,
"02fe55778117f12a" ) == 0 );
1945 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_26)
1947 unsigned char key_str[100];
1948 unsigned char src_str[100];
1949 unsigned char dst_str[100];
1950 unsigned char output[100];
1954 memset(key_str, 0x00, 100);
1955 memset(src_str, 0x00, 100);
1956 memset(dst_str, 0x00, 100);
1957 memset(output, 0x00, 100);
1959 key_len =
unhexify( key_str,
"018310dc409b26d6" );
1960 unhexify( src_str,
"d1abb290658bc778" );
1966 hexify( dst_str, output, 8 );
1968 fct_chk( strcmp( (
char *) dst_str,
"1d9d5c5018f728c2" ) == 0 );
1974 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_27)
1976 unsigned char key_str[100];
1977 unsigned char src_str[100];
1978 unsigned char dst_str[100];
1979 unsigned char output[100];
1983 memset(key_str, 0x00, 100);
1984 memset(src_str, 0x00, 100);
1985 memset(dst_str, 0x00, 100);
1986 memset(output, 0x00, 100);
1988 key_len =
unhexify( key_str,
"1c587f1c13924fef" );
1989 unhexify( src_str,
"55cb3774d13ef201" );
1995 hexify( dst_str, output, 8 );
1997 fct_chk( strcmp( (
char *) dst_str,
"305532286d6f295a" ) == 0 );
2003 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_28)
2005 unsigned char key_str[100];
2006 unsigned char src_str[100];
2007 unsigned char dst_str[100];
2008 unsigned char output[100];
2012 memset(key_str, 0x00, 100);
2013 memset(src_str, 0x00, 100);
2014 memset(dst_str, 0x00, 100);
2015 memset(output, 0x00, 100);
2017 key_len =
unhexify( key_str,
"0101010101010101" );
2018 unhexify( src_str,
"fa34ec4847b268b2" );
2024 hexify( dst_str, output, 8 );
2026 fct_chk( strcmp( (
char *) dst_str,
"0123456789abcdef" ) == 0 );
2032 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_29)
2034 unsigned char key_str[100];
2035 unsigned char src_str[100];
2036 unsigned char dst_str[100];
2037 unsigned char output[100];
2041 memset(key_str, 0x00, 100);
2042 memset(src_str, 0x00, 100);
2043 memset(dst_str, 0x00, 100);
2044 memset(output, 0x00, 100);
2046 key_len =
unhexify( key_str,
"1f1f1f1f0e0e0e0e" );
2047 unhexify( src_str,
"a790795108ea3cae" );
2053 hexify( dst_str, output, 8 );
2055 fct_chk( strcmp( (
char *) dst_str,
"0123456789abcdef" ) == 0 );
2061 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_30)
2063 unsigned char key_str[100];
2064 unsigned char src_str[100];
2065 unsigned char dst_str[100];
2066 unsigned char output[100];
2070 memset(key_str, 0x00, 100);
2071 memset(src_str, 0x00, 100);
2072 memset(dst_str, 0x00, 100);
2073 memset(output, 0x00, 100);
2075 key_len =
unhexify( key_str,
"e0fee0fef1fef1fe" );
2076 unhexify( src_str,
"c39e072d9fac631d" );
2082 hexify( dst_str, output, 8 );
2084 fct_chk( strcmp( (
char *) dst_str,
"0123456789abcdef" ) == 0 );
2090 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_31)
2092 unsigned char key_str[100];
2093 unsigned char src_str[100];
2094 unsigned char dst_str[100];
2095 unsigned char output[100];
2099 memset(key_str, 0x00, 100);
2100 memset(src_str, 0x00, 100);
2101 memset(dst_str, 0x00, 100);
2102 memset(output, 0x00, 100);
2104 key_len =
unhexify( key_str,
"0000000000000000" );
2105 unhexify( src_str,
"014933e0cdaff6e4" );
2111 hexify( dst_str, output, 8 );
2113 fct_chk( strcmp( (
char *) dst_str,
"ffffffffffffffff" ) == 0 );
2119 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_32)
2121 unsigned char key_str[100];
2122 unsigned char src_str[100];
2123 unsigned char dst_str[100];
2124 unsigned char output[100];
2128 memset(key_str, 0x00, 100);
2129 memset(src_str, 0x00, 100);
2130 memset(dst_str, 0x00, 100);
2131 memset(output, 0x00, 100);
2133 key_len =
unhexify( key_str,
"ffffffffffffffff" );
2134 unhexify( src_str,
"f21e9a77b71c49bc" );
2140 hexify( dst_str, output, 8 );
2142 fct_chk( strcmp( (
char *) dst_str,
"0000000000000000" ) == 0 );
2148 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_33)
2150 unsigned char key_str[100];
2151 unsigned char src_str[100];
2152 unsigned char dst_str[100];
2153 unsigned char output[100];
2157 memset(key_str, 0x00, 100);
2158 memset(src_str, 0x00, 100);
2159 memset(dst_str, 0x00, 100);
2160 memset(output, 0x00, 100);
2162 key_len =
unhexify( key_str,
"0123456789abcdef" );
2163 unhexify( src_str,
"245946885754369a" );
2169 hexify( dst_str, output, 8 );
2171 fct_chk( strcmp( (
char *) dst_str,
"0000000000000000" ) == 0 );
2177 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_34)
2179 unsigned char key_str[100];
2180 unsigned char src_str[100];
2181 unsigned char dst_str[100];
2182 unsigned char output[100];
2186 memset(key_str, 0x00, 100);
2187 memset(src_str, 0x00, 100);
2188 memset(dst_str, 0x00, 100);
2189 memset(output, 0x00, 100);
2191 key_len =
unhexify( key_str,
"fedcba9876543210" );
2192 unhexify( src_str,
"6b5c5a9c5d9e0a5a" );
2198 hexify( dst_str, output, 8 );
2200 fct_chk( strcmp( (
char *) dst_str,
"ffffffffffffffff" ) == 0 );
2206 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_1)
2208 unsigned char key_str[100];
2209 unsigned char src_str[100];
2210 unsigned char dst_str[100];
2211 unsigned char output[100];
2215 memset(key_str, 0x00, 100);
2216 memset(src_str, 0x00, 100);
2217 memset(dst_str, 0x00, 100);
2218 memset(output, 0x00, 100);
2220 key_len =
unhexify( key_str,
"f0" );
2221 unhexify( src_str,
"fedcba9876543210" );
2227 hexify( dst_str, output, 8 );
2229 fct_chk( strcmp( (
char *) dst_str,
"" ) == 0 );
2235 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_2)
2237 unsigned char key_str[100];
2238 unsigned char src_str[100];
2239 unsigned char dst_str[100];
2240 unsigned char output[100];
2244 memset(key_str, 0x00, 100);
2245 memset(src_str, 0x00, 100);
2246 memset(dst_str, 0x00, 100);
2247 memset(output, 0x00, 100);
2249 key_len =
unhexify( key_str,
"f0e1" );
2250 unhexify( src_str,
"fedcba9876543210" );
2256 hexify( dst_str, output, 8 );
2258 fct_chk( strcmp( (
char *) dst_str,
"" ) == 0 );
2264 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_3)
2266 unsigned char key_str[100];
2267 unsigned char src_str[100];
2268 unsigned char dst_str[100];
2269 unsigned char output[100];
2273 memset(key_str, 0x00, 100);
2274 memset(src_str, 0x00, 100);
2275 memset(dst_str, 0x00, 100);
2276 memset(output, 0x00, 100);
2278 key_len =
unhexify( key_str,
"f0e1d2" );
2279 unhexify( src_str,
"fedcba9876543210" );
2285 hexify( dst_str, output, 8 );
2287 fct_chk( strcmp( (
char *) dst_str,
"" ) == 0 );
2293 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_4)
2295 unsigned char key_str[100];
2296 unsigned char src_str[100];
2297 unsigned char dst_str[100];
2298 unsigned char output[100];
2302 memset(key_str, 0x00, 100);
2303 memset(src_str, 0x00, 100);
2304 memset(dst_str, 0x00, 100);
2305 memset(output, 0x00, 100);
2307 key_len =
unhexify( key_str,
"f0e1d2c3" );
2308 unhexify( src_str,
"fedcba9876543210" );
2314 hexify( dst_str, output, 8 );
2316 fct_chk( strcmp( (
char *) dst_str,
"be1e639408640f05" ) == 0 );
2322 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_5)
2324 unsigned char key_str[100];
2325 unsigned char src_str[100];
2326 unsigned char dst_str[100];
2327 unsigned char output[100];
2331 memset(key_str, 0x00, 100);
2332 memset(src_str, 0x00, 100);
2333 memset(dst_str, 0x00, 100);
2334 memset(output, 0x00, 100);
2336 key_len =
unhexify( key_str,
"f0e1d2c3b4" );
2337 unhexify( src_str,
"fedcba9876543210" );
2343 hexify( dst_str, output, 8 );
2345 fct_chk( strcmp( (
char *) dst_str,
"b39e44481bdb1e6e" ) == 0 );
2351 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_6)
2353 unsigned char key_str[100];
2354 unsigned char src_str[100];
2355 unsigned char dst_str[100];
2356 unsigned char output[100];
2360 memset(key_str, 0x00, 100);
2361 memset(src_str, 0x00, 100);
2362 memset(dst_str, 0x00, 100);
2363 memset(output, 0x00, 100);
2365 key_len =
unhexify( key_str,
"f0e1d2c3b4a5" );
2366 unhexify( src_str,
"fedcba9876543210" );
2372 hexify( dst_str, output, 8 );
2374 fct_chk( strcmp( (
char *) dst_str,
"9457aa83b1928c0d" ) == 0 );
2380 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_7)
2382 unsigned char key_str[100];
2383 unsigned char src_str[100];
2384 unsigned char dst_str[100];
2385 unsigned char output[100];
2389 memset(key_str, 0x00, 100);
2390 memset(src_str, 0x00, 100);
2391 memset(dst_str, 0x00, 100);
2392 memset(output, 0x00, 100);
2394 key_len =
unhexify( key_str,
"f0e1d2c3b4a596" );
2395 unhexify( src_str,
"fedcba9876543210" );
2401 hexify( dst_str, output, 8 );
2403 fct_chk( strcmp( (
char *) dst_str,
"8bb77032f960629d" ) == 0 );
2409 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_8)
2411 unsigned char key_str[100];
2412 unsigned char src_str[100];
2413 unsigned char dst_str[100];
2414 unsigned char output[100];
2418 memset(key_str, 0x00, 100);
2419 memset(src_str, 0x00, 100);
2420 memset(dst_str, 0x00, 100);
2421 memset(output, 0x00, 100);
2423 key_len =
unhexify( key_str,
"f0e1d2c3b4a59687" );
2424 unhexify( src_str,
"fedcba9876543210" );
2430 hexify( dst_str, output, 8 );
2432 fct_chk( strcmp( (
char *) dst_str,
"e87a244e2cc85e82" ) == 0 );
2438 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_9)
2440 unsigned char key_str[100];
2441 unsigned char src_str[100];
2442 unsigned char dst_str[100];
2443 unsigned char output[100];
2447 memset(key_str, 0x00, 100);
2448 memset(src_str, 0x00, 100);
2449 memset(dst_str, 0x00, 100);
2450 memset(output, 0x00, 100);
2452 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778" );
2453 unhexify( src_str,
"fedcba9876543210" );
2459 hexify( dst_str, output, 8 );
2461 fct_chk( strcmp( (
char *) dst_str,
"15750e7a4f4ec577" ) == 0 );
2467 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_10)
2469 unsigned char key_str[100];
2470 unsigned char src_str[100];
2471 unsigned char dst_str[100];
2472 unsigned char output[100];
2476 memset(key_str, 0x00, 100);
2477 memset(src_str, 0x00, 100);
2478 memset(dst_str, 0x00, 100);
2479 memset(output, 0x00, 100);
2481 key_len =
unhexify( key_str,
"f0e1d2c3b4a596877869" );
2482 unhexify( src_str,
"fedcba9876543210" );
2488 hexify( dst_str, output, 8 );
2490 fct_chk( strcmp( (
char *) dst_str,
"122ba70b3ab64ae0" ) == 0 );
2496 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_11)
2498 unsigned char key_str[100];
2499 unsigned char src_str[100];
2500 unsigned char dst_str[100];
2501 unsigned char output[100];
2505 memset(key_str, 0x00, 100);
2506 memset(src_str, 0x00, 100);
2507 memset(dst_str, 0x00, 100);
2508 memset(output, 0x00, 100);
2510 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a" );
2511 unhexify( src_str,
"fedcba9876543210" );
2517 hexify( dst_str, output, 8 );
2519 fct_chk( strcmp( (
char *) dst_str,
"3a833c9affc537f6" ) == 0 );
2525 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_12)
2527 unsigned char key_str[100];
2528 unsigned char src_str[100];
2529 unsigned char dst_str[100];
2530 unsigned char output[100];
2534 memset(key_str, 0x00, 100);
2535 memset(src_str, 0x00, 100);
2536 memset(dst_str, 0x00, 100);
2537 memset(output, 0x00, 100);
2539 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b" );
2540 unhexify( src_str,
"fedcba9876543210" );
2546 hexify( dst_str, output, 8 );
2548 fct_chk( strcmp( (
char *) dst_str,
"9409da87a90f6bf2" ) == 0 );
2554 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_13)
2556 unsigned char key_str[100];
2557 unsigned char src_str[100];
2558 unsigned char dst_str[100];
2559 unsigned char output[100];
2563 memset(key_str, 0x00, 100);
2564 memset(src_str, 0x00, 100);
2565 memset(dst_str, 0x00, 100);
2566 memset(output, 0x00, 100);
2568 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c" );
2569 unhexify( src_str,
"fedcba9876543210" );
2575 hexify( dst_str, output, 8 );
2577 fct_chk( strcmp( (
char *) dst_str,
"884f80625060b8b4" ) == 0 );
2583 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_14)
2585 unsigned char key_str[100];
2586 unsigned char src_str[100];
2587 unsigned char dst_str[100];
2588 unsigned char output[100];
2592 memset(key_str, 0x00, 100);
2593 memset(src_str, 0x00, 100);
2594 memset(dst_str, 0x00, 100);
2595 memset(output, 0x00, 100);
2597 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d" );
2598 unhexify( src_str,
"fedcba9876543210" );
2604 hexify( dst_str, output, 8 );
2606 fct_chk( strcmp( (
char *) dst_str,
"1f85031c19e11968" ) == 0 );
2612 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_15)
2614 unsigned char key_str[100];
2615 unsigned char src_str[100];
2616 unsigned char dst_str[100];
2617 unsigned char output[100];
2621 memset(key_str, 0x00, 100);
2622 memset(src_str, 0x00, 100);
2623 memset(dst_str, 0x00, 100);
2624 memset(output, 0x00, 100);
2626 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e" );
2627 unhexify( src_str,
"fedcba9876543210" );
2633 hexify( dst_str, output, 8 );
2635 fct_chk( strcmp( (
char *) dst_str,
"79d9373a714ca34f" ) == 0 );
2641 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_16)
2643 unsigned char key_str[100];
2644 unsigned char src_str[100];
2645 unsigned char dst_str[100];
2646 unsigned char output[100];
2650 memset(key_str, 0x00, 100);
2651 memset(src_str, 0x00, 100);
2652 memset(dst_str, 0x00, 100);
2653 memset(output, 0x00, 100);
2655 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f" );
2656 unhexify( src_str,
"fedcba9876543210" );
2662 hexify( dst_str, output, 8 );
2664 fct_chk( strcmp( (
char *) dst_str,
"93142887ee3be15c" ) == 0 );
2670 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_17)
2672 unsigned char key_str[100];
2673 unsigned char src_str[100];
2674 unsigned char dst_str[100];
2675 unsigned char output[100];
2679 memset(key_str, 0x00, 100);
2680 memset(src_str, 0x00, 100);
2681 memset(dst_str, 0x00, 100);
2682 memset(output, 0x00, 100);
2684 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f00" );
2685 unhexify( src_str,
"fedcba9876543210" );
2691 hexify( dst_str, output, 8 );
2693 fct_chk( strcmp( (
char *) dst_str,
"03429e838ce2d14b" ) == 0 );
2699 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_18)
2701 unsigned char key_str[100];
2702 unsigned char src_str[100];
2703 unsigned char dst_str[100];
2704 unsigned char output[100];
2708 memset(key_str, 0x00, 100);
2709 memset(src_str, 0x00, 100);
2710 memset(dst_str, 0x00, 100);
2711 memset(output, 0x00, 100);
2713 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f0011" );
2714 unhexify( src_str,
"fedcba9876543210" );
2720 hexify( dst_str, output, 8 );
2722 fct_chk( strcmp( (
char *) dst_str,
"a4299e27469ff67b" ) == 0 );
2728 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_19)
2730 unsigned char key_str[100];
2731 unsigned char src_str[100];
2732 unsigned char dst_str[100];
2733 unsigned char output[100];
2737 memset(key_str, 0x00, 100);
2738 memset(src_str, 0x00, 100);
2739 memset(dst_str, 0x00, 100);
2740 memset(output, 0x00, 100);
2742 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f001122" );
2743 unhexify( src_str,
"fedcba9876543210" );
2749 hexify( dst_str, output, 8 );
2751 fct_chk( strcmp( (
char *) dst_str,
"afd5aed1c1bc96a8" ) == 0 );
2757 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_20)
2759 unsigned char key_str[100];
2760 unsigned char src_str[100];
2761 unsigned char dst_str[100];
2762 unsigned char output[100];
2766 memset(key_str, 0x00, 100);
2767 memset(src_str, 0x00, 100);
2768 memset(dst_str, 0x00, 100);
2769 memset(output, 0x00, 100);
2771 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f00112233" );
2772 unhexify( src_str,
"fedcba9876543210" );
2778 hexify( dst_str, output, 8 );
2780 fct_chk( strcmp( (
char *) dst_str,
"10851c0e3858da9f" ) == 0 );
2786 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_21)
2788 unsigned char key_str[100];
2789 unsigned char src_str[100];
2790 unsigned char dst_str[100];
2791 unsigned char output[100];
2795 memset(key_str, 0x00, 100);
2796 memset(src_str, 0x00, 100);
2797 memset(dst_str, 0x00, 100);
2798 memset(output, 0x00, 100);
2800 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f0011223344" );
2801 unhexify( src_str,
"fedcba9876543210" );
2807 hexify( dst_str, output, 8 );
2809 fct_chk( strcmp( (
char *) dst_str,
"e6f51ed79b9db21f" ) == 0 );
2815 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_22)
2817 unsigned char key_str[100];
2818 unsigned char src_str[100];
2819 unsigned char dst_str[100];
2820 unsigned char output[100];
2824 memset(key_str, 0x00, 100);
2825 memset(src_str, 0x00, 100);
2826 memset(dst_str, 0x00, 100);
2827 memset(output, 0x00, 100);
2829 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f001122334455" );
2830 unhexify( src_str,
"fedcba9876543210" );
2836 hexify( dst_str, output, 8 );
2838 fct_chk( strcmp( (
char *) dst_str,
"64a6e14afd36b46f" ) == 0 );
2844 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_23)
2846 unsigned char key_str[100];
2847 unsigned char src_str[100];
2848 unsigned char dst_str[100];
2849 unsigned char output[100];
2853 memset(key_str, 0x00, 100);
2854 memset(src_str, 0x00, 100);
2855 memset(dst_str, 0x00, 100);
2856 memset(output, 0x00, 100);
2858 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f00112233445566" );
2859 unhexify( src_str,
"fedcba9876543210" );
2865 hexify( dst_str, output, 8 );
2867 fct_chk( strcmp( (
char *) dst_str,
"80c7d7d45a5479ad" ) == 0 );
2873 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_24)
2875 unsigned char key_str[100];
2876 unsigned char src_str[100];
2877 unsigned char dst_str[100];
2878 unsigned char output[100];
2882 memset(key_str, 0x00, 100);
2883 memset(src_str, 0x00, 100);
2884 memset(dst_str, 0x00, 100);
2885 memset(output, 0x00, 100);
2887 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f0011223344556677" );
2888 unhexify( src_str,
"fedcba9876543210" );
2894 hexify( dst_str, output, 8 );
2896 fct_chk( strcmp( (
char *) dst_str,
"05044b62fa52d080" ) == 0 );
2902 FCT_TEST_BGN(blowfish_setkey_setkey_440_bits)
2904 unsigned char key_str[100];
2905 unsigned char src_str[100];
2906 unsigned char dst_str[100];
2907 unsigned char output[100];
2911 memset(key_str, 0x00, 100);
2912 memset(src_str, 0x00, 100);
2913 memset(dst_str, 0x00, 100);
2914 memset(output, 0x00, 100);
2916 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f00112233445566778899aabbccddeeff0123456789abcdef0102030405060708090a0b0c0d0e0f" );
2917 unhexify( src_str,
"fedcba9876543210" );
2923 hexify( dst_str, output, 8 );
2925 fct_chk( strcmp( (
char *) dst_str,
"9a2ab8f1b00c73d2" ) == 0 );
2931 FCT_TEST_BGN(blowfish_setkey_setkey_448_bits)
2933 unsigned char key_str[100];
2934 unsigned char src_str[100];
2935 unsigned char dst_str[100];
2936 unsigned char output[100];
2940 memset(key_str, 0x00, 100);
2941 memset(src_str, 0x00, 100);
2942 memset(dst_str, 0x00, 100);
2943 memset(output, 0x00, 100);
2945 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f00112233445566778899aabbccddeeff0123456789abcdef0102030405060708090a0b0c0d0e0fff" );
2946 unhexify( src_str,
"fedcba9876543210" );
2952 hexify( dst_str, output, 8 );
2954 fct_chk( strcmp( (
char *) dst_str,
"2fb3ab7f0ee91b69" ) == 0 );
2960 FCT_TEST_BGN(blowfish_setkey_setkey_456_bits)
2962 unsigned char key_str[100];
2963 unsigned char src_str[100];
2964 unsigned char dst_str[100];
2965 unsigned char output[100];
2969 memset(key_str, 0x00, 100);
2970 memset(src_str, 0x00, 100);
2971 memset(dst_str, 0x00, 100);
2972 memset(output, 0x00, 100);
2974 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f00112233445566778899aabbccddeeff0123456789abcdef0102030405060708090a0b0c0d0e0fffff" );
2975 unhexify( src_str,
"fedcba9876543210" );
2981 hexify( dst_str, output, 8 );
2983 fct_chk( strcmp( (
char *) dst_str,
"" ) == 0 );
2989 FCT_TEST_BGN(blowfish_cbc_encrypt)
2991 unsigned char key_str[100];
2992 unsigned char iv_str[100];
2993 unsigned char src_str[100];
2994 unsigned char dst_str[100];
2995 unsigned char output[100];
2997 int key_len, data_len;
2999 memset(key_str, 0x00, 100);
3000 memset(iv_str, 0x00, 100);
3001 memset(src_str, 0x00, 100);
3002 memset(dst_str, 0x00, 100);
3003 memset(output, 0x00, 100);
3005 key_len =
unhexify( key_str,
"0123456789ABCDEFF0E1D2C3B4A59687" );
3006 unhexify( iv_str,
"FEDCBA9876543210" );
3007 data_len =
unhexify( src_str,
"37363534333231204E6F77206973207468652074696D6520666F722000000000" );
3014 hexify( dst_str, output, data_len );
3016 fct_chk( strcmp( (
char *) dst_str,
"6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5ff92cc" ) == 0 );
3022 FCT_TEST_BGN(blowfish_cbc_decrypt)
3024 unsigned char key_str[100];
3025 unsigned char iv_str[100];
3026 unsigned char src_str[100];
3027 unsigned char dst_str[100];
3028 unsigned char output[100];
3030 int key_len, data_len;
3032 memset(key_str, 0x00, 100);
3033 memset(iv_str, 0x00, 100);
3034 memset(src_str, 0x00, 100);
3035 memset(dst_str, 0x00, 100);
3036 memset(output, 0x00, 100);
3038 key_len =
unhexify( key_str,
"0123456789ABCDEFF0E1D2C3B4A59687" );
3039 unhexify( iv_str,
"FEDCBA9876543210" );
3040 data_len =
unhexify( src_str,
"6B77B4D63006DEE605B156E27403979358DEB9E7154616D959F1652BD5FF92CC" );
3046 hexify( dst_str, output, data_len );
3048 fct_chk( strcmp( (
char *) dst_str,
"37363534333231204e6f77206973207468652074696d6520666f722000000000" ) == 0 );
3054 FCT_TEST_BGN(blowfish_cbc_encrypt)
3056 unsigned char key_str[100];
3057 unsigned char iv_str[100];
3058 unsigned char src_str[100];
3059 unsigned char dst_str[100];
3060 unsigned char output[100];
3062 int key_len, data_len;
3064 memset(key_str, 0x00, 100);
3065 memset(iv_str, 0x00, 100);
3066 memset(src_str, 0x00, 100);
3067 memset(dst_str, 0x00, 100);
3068 memset(output, 0x00, 100);
3070 key_len =
unhexify( key_str,
"0123456789ABCDEFF0E1D2C3B4A59687" );
3071 unhexify( iv_str,
"FEDCBA9876543210" );
3072 data_len =
unhexify( src_str,
"37363534333231204E6F77206973207468652074696D6520666F7220000000" );
3079 hexify( dst_str, output, data_len );
3081 fct_chk( strcmp( (
char *) dst_str,
"" ) == 0 );
3087 FCT_TEST_BGN(blowfish_cbc_decrypt)
3089 unsigned char key_str[100];
3090 unsigned char iv_str[100];
3091 unsigned char src_str[100];
3092 unsigned char dst_str[100];
3093 unsigned char output[100];
3095 int key_len, data_len;
3097 memset(key_str, 0x00, 100);
3098 memset(iv_str, 0x00, 100);
3099 memset(src_str, 0x00, 100);
3100 memset(dst_str, 0x00, 100);
3101 memset(output, 0x00, 100);
3103 key_len =
unhexify( key_str,
"0123456789ABCDEFF0E1D2C3B4A59687" );
3104 unhexify( iv_str,
"FEDCBA9876543210" );
3105 data_len =
unhexify( src_str,
"6B77B4D63006DEE605B156E27403979358DEB9E7154616D959F1652BD5FF92CC00" );
3111 hexify( dst_str, output, data_len );
3113 fct_chk( strcmp( (
char *) dst_str,
"" ) == 0 );
3119 FCT_TEST_BGN(blowfish_cfb_encrypt)
3121 unsigned char key_str[100];
3122 unsigned char iv_str[100];
3123 unsigned char src_str[100];
3124 unsigned char dst_str[100];
3125 unsigned char output[100];
3127 size_t iv_offset = 0;
3128 int key_len, src_len;
3130 memset(key_str, 0x00, 100);
3131 memset(iv_str, 0x00, 100);
3132 memset(src_str, 0x00, 100);
3133 memset(dst_str, 0x00, 100);
3134 memset(output, 0x00, 100);
3136 key_len =
unhexify( key_str,
"0123456789ABCDEFF0E1D2C3B4A59687" );
3137 unhexify( iv_str,
"FEDCBA9876543210" );
3138 src_len =
unhexify( src_str,
"37363534333231204E6F77206973207468652074696D6520666F722000" );
3142 hexify( dst_str, output, src_len );
3144 fct_chk( strcmp( (
char *) dst_str,
"e73214a2822139caf26ecf6d2eb9e76e3da3de04d1517200519d57a6c3" ) == 0 );
3149 FCT_TEST_BGN(blowfish_cfb_decrypt)
3151 unsigned char key_str[100];
3152 unsigned char iv_str[100];
3153 unsigned char src_str[100];
3154 unsigned char dst_str[100];
3155 unsigned char output[100];
3157 size_t iv_offset = 0;
3158 int key_len, src_len;
3160 memset(key_str, 0x00, 100);
3161 memset(iv_str, 0x00, 100);
3162 memset(src_str, 0x00, 100);
3163 memset(dst_str, 0x00, 100);
3164 memset(output, 0x00, 100);
3166 key_len =
unhexify( key_str,
"0123456789ABCDEFF0E1D2C3B4A59687" );
3167 unhexify( iv_str,
"FEDCBA9876543210" );
3168 src_len =
unhexify( src_str,
"E73214A2822139CAF26ECF6D2EB9E76E3DA3DE04D1517200519D57A6C3" );
3172 hexify( dst_str, output, src_len );
3174 fct_chk( strcmp( (
char *) dst_str,
"37363534333231204e6f77206973207468652074696d6520666f722000" ) == 0 );
3179 FCT_TEST_BGN(blowfish_ctr_encrypt)
3181 unsigned char key_str[100];
3182 unsigned char iv_str[100];
3183 unsigned char stream_str[100];
3184 unsigned char src_str[100];
3185 unsigned char dst_str[100];
3186 unsigned char output[100];
3188 size_t iv_offset = 0;
3189 int key_len, src_len;
3191 memset(key_str, 0x00, 100);
3192 memset(iv_str, 0x00, 100);
3193 memset(stream_str, 0x00, 100);
3194 memset(src_str, 0x00, 100);
3195 memset(dst_str, 0x00, 100);
3196 memset(output, 0x00, 100);
3198 key_len =
unhexify( key_str,
"0123456789ABCDEFF0E1D2C3B4A59687" );
3199 unhexify( iv_str,
"FEDCBA9876543210" );
3200 src_len =
unhexify( src_str,
"37363534333231204E6F77206973207468652074696D6520666F722000" );
3203 fct_chk(
blowfish_crypt_ctr( &ctx, src_len, &iv_offset, iv_str, stream_str, src_str, output ) == 0 );
3204 hexify( dst_str, output, src_len );
3206 fct_chk( strcmp( (
char *) dst_str,
"e73214a2822139ca60254740dd8c5b8acf5e9569c4affeb944b8fc020e" ) == 0 );
3211 FCT_TEST_BGN(blowfish_ctr_decrypt)
3213 unsigned char key_str[100];
3214 unsigned char iv_str[100];
3215 unsigned char stream_str[100];
3216 unsigned char src_str[100];
3217 unsigned char dst_str[100];
3218 unsigned char output[100];
3220 size_t iv_offset = 0;
3221 int key_len, src_len;
3223 memset(key_str, 0x00, 100);
3224 memset(iv_str, 0x00, 100);
3225 memset(stream_str, 0x00, 100);
3226 memset(src_str, 0x00, 100);
3227 memset(dst_str, 0x00, 100);
3228 memset(output, 0x00, 100);
3230 key_len =
unhexify( key_str,
"0123456789ABCDEFF0E1D2C3B4A59687" );
3231 unhexify( iv_str,
"FEDCBA9876543210" );
3232 src_len =
unhexify( src_str,
"e73214a2822139ca60254740dd8c5b8acf5e9569c4affeb944b8fc020e" );
3235 fct_chk(
blowfish_crypt_ctr( &ctx, src_len, &iv_offset, iv_str, stream_str, src_str, output ) == 0 );
3236 hexify( dst_str, output, src_len );
3238 fct_chk( strcmp( (
char *) dst_str,
"37363534333231204e6f77206973207468652074696d6520666f722000" ) == 0 );