9 typedef UINT32 uint32_t;
18 #define GET_UINT32_BE(n,b,i) \
20 (n) = ( (uint32_t) (b)[(i) ] << 24 ) \
21 | ( (uint32_t) (b)[(i) + 1] << 16 ) \
22 | ( (uint32_t) (b)[(i) + 2] << 8 ) \
23 | ( (uint32_t) (b)[(i) + 3] ); \
28 #define PUT_UINT32_BE(n,b,i) \
30 (b)[(i) ] = (unsigned char) ( (n) >> 24 ); \
31 (b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \
32 (b)[(i) + 2] = (unsigned char) ( (n) >> 8 ); \
33 (b)[(i) + 3] = (unsigned char) ( (n) ); \
37 int unhexify(
unsigned char *obuf,
const char *ibuf)
40 int len = strlen(ibuf) / 2;
41 assert(!(strlen(ibuf) %1));
46 if( c >=
'0' && c <=
'9' )
48 else if( c >=
'a' && c <=
'f' )
50 else if( c >=
'A' && c <=
'F' )
56 if( c2 >=
'0' && c2 <=
'9' )
58 else if( c2 >=
'a' && c2 <=
'f' )
60 else if( c2 >=
'A' && c2 <=
'F' )
65 *obuf++ = ( c << 4 ) | c2;
71 void hexify(
unsigned char *obuf,
const unsigned char *ibuf,
int len)
83 *obuf++ =
'a' + h - 10;
88 *obuf++ =
'a' + l - 10;
104 static int rnd_std_rand(
void *rng_state,
unsigned char *output,
size_t len )
108 if( rng_state != NULL )
111 for( i = 0; i < len; ++i )
122 static int rnd_zero_rand(
void *rng_state,
unsigned char *output,
size_t len )
124 if( rng_state != NULL )
127 memset( output, 0, len );
154 if( rng_state == NULL )
163 memcpy( output, info->
buf, use_len );
164 info->
buf += use_len;
168 if( len - use_len > 0 )
169 return(
rnd_std_rand( NULL, output + use_len, len - use_len ) );
198 uint32_t i, *k, sum, delta=0x9E3779B9;
199 unsigned char result[4];
201 if( rng_state == NULL )
208 size_t use_len = ( len > 4 ) ? 4 : len;
211 for( i = 0; i < 32; i++ )
213 info->
v0 += (((info->
v1 << 4) ^ (info->
v1 >> 5)) + info->
v1) ^ (sum + k[sum & 3]);
215 info->
v1 += (((info->
v0 << 4) ^ (info->
v0 >> 5)) + info->
v0) ^ (sum + k[(sum>>11) & 3]);
219 memcpy( output, result, use_len );
229 #ifdef POLARSSL_BLOWFISH_C
232 FCT_SUITE_BGN(test_suite_blowfish)
235 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_1)
237 unsigned char key_str[100];
238 unsigned char src_str[100];
239 unsigned char dst_str[100];
240 unsigned char output[100];
244 memset(key_str, 0x00, 100);
245 memset(src_str, 0x00, 100);
246 memset(dst_str, 0x00, 100);
247 memset(output, 0x00, 100);
249 key_len =
unhexify( key_str,
"0000000000000000" );
250 unhexify( src_str,
"0000000000000000" );
256 hexify( dst_str, output, 8 );
258 fct_chk( strcmp( (
char *) dst_str,
"4ef997456198dd78" ) == 0 );
264 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_2)
266 unsigned char key_str[100];
267 unsigned char src_str[100];
268 unsigned char dst_str[100];
269 unsigned char output[100];
273 memset(key_str, 0x00, 100);
274 memset(src_str, 0x00, 100);
275 memset(dst_str, 0x00, 100);
276 memset(output, 0x00, 100);
278 key_len =
unhexify( key_str,
"ffffffffffffffff" );
279 unhexify( src_str,
"ffffffffffffffff" );
285 hexify( dst_str, output, 8 );
287 fct_chk( strcmp( (
char *) dst_str,
"51866fd5b85ecb8a" ) == 0 );
293 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_3)
295 unsigned char key_str[100];
296 unsigned char src_str[100];
297 unsigned char dst_str[100];
298 unsigned char output[100];
302 memset(key_str, 0x00, 100);
303 memset(src_str, 0x00, 100);
304 memset(dst_str, 0x00, 100);
305 memset(output, 0x00, 100);
307 key_len =
unhexify( key_str,
"3000000000000000" );
308 unhexify( src_str,
"1000000000000001" );
314 hexify( dst_str, output, 8 );
316 fct_chk( strcmp( (
char *) dst_str,
"7d856f9a613063f2" ) == 0 );
322 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_4)
324 unsigned char key_str[100];
325 unsigned char src_str[100];
326 unsigned char dst_str[100];
327 unsigned char output[100];
331 memset(key_str, 0x00, 100);
332 memset(src_str, 0x00, 100);
333 memset(dst_str, 0x00, 100);
334 memset(output, 0x00, 100);
336 key_len =
unhexify( key_str,
"1111111111111111" );
337 unhexify( src_str,
"1111111111111111" );
343 hexify( dst_str, output, 8 );
345 fct_chk( strcmp( (
char *) dst_str,
"2466dd878b963c9d" ) == 0 );
351 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_5)
353 unsigned char key_str[100];
354 unsigned char src_str[100];
355 unsigned char dst_str[100];
356 unsigned char output[100];
360 memset(key_str, 0x00, 100);
361 memset(src_str, 0x00, 100);
362 memset(dst_str, 0x00, 100);
363 memset(output, 0x00, 100);
365 key_len =
unhexify( key_str,
"0123456789abcdef" );
366 unhexify( src_str,
"1111111111111111" );
372 hexify( dst_str, output, 8 );
374 fct_chk( strcmp( (
char *) dst_str,
"61f9c3802281b096" ) == 0 );
380 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_6)
382 unsigned char key_str[100];
383 unsigned char src_str[100];
384 unsigned char dst_str[100];
385 unsigned char output[100];
389 memset(key_str, 0x00, 100);
390 memset(src_str, 0x00, 100);
391 memset(dst_str, 0x00, 100);
392 memset(output, 0x00, 100);
394 key_len =
unhexify( key_str,
"1111111111111111" );
395 unhexify( src_str,
"0123456789abcdef" );
401 hexify( dst_str, output, 8 );
403 fct_chk( strcmp( (
char *) dst_str,
"7d0cc630afda1ec7" ) == 0 );
409 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_7)
411 unsigned char key_str[100];
412 unsigned char src_str[100];
413 unsigned char dst_str[100];
414 unsigned char output[100];
418 memset(key_str, 0x00, 100);
419 memset(src_str, 0x00, 100);
420 memset(dst_str, 0x00, 100);
421 memset(output, 0x00, 100);
423 key_len =
unhexify( key_str,
"0000000000000000" );
424 unhexify( src_str,
"0000000000000000" );
430 hexify( dst_str, output, 8 );
432 fct_chk( strcmp( (
char *) dst_str,
"4ef997456198dd78" ) == 0 );
438 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_8)
440 unsigned char key_str[100];
441 unsigned char src_str[100];
442 unsigned char dst_str[100];
443 unsigned char output[100];
447 memset(key_str, 0x00, 100);
448 memset(src_str, 0x00, 100);
449 memset(dst_str, 0x00, 100);
450 memset(output, 0x00, 100);
452 key_len =
unhexify( key_str,
"fedcba9876543210" );
453 unhexify( src_str,
"0123456789abcdef" );
459 hexify( dst_str, output, 8 );
461 fct_chk( strcmp( (
char *) dst_str,
"0aceab0fc6a0a28d" ) == 0 );
467 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_9)
469 unsigned char key_str[100];
470 unsigned char src_str[100];
471 unsigned char dst_str[100];
472 unsigned char output[100];
476 memset(key_str, 0x00, 100);
477 memset(src_str, 0x00, 100);
478 memset(dst_str, 0x00, 100);
479 memset(output, 0x00, 100);
481 key_len =
unhexify( key_str,
"7ca110454a1a6e57" );
482 unhexify( src_str,
"01a1d6d039776742" );
488 hexify( dst_str, output, 8 );
490 fct_chk( strcmp( (
char *) dst_str,
"59c68245eb05282b" ) == 0 );
496 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_10)
498 unsigned char key_str[100];
499 unsigned char src_str[100];
500 unsigned char dst_str[100];
501 unsigned char output[100];
505 memset(key_str, 0x00, 100);
506 memset(src_str, 0x00, 100);
507 memset(dst_str, 0x00, 100);
508 memset(output, 0x00, 100);
510 key_len =
unhexify( key_str,
"0131d9619dc1376e" );
511 unhexify( src_str,
"5cd54ca83def57da" );
517 hexify( dst_str, output, 8 );
519 fct_chk( strcmp( (
char *) dst_str,
"b1b8cc0b250f09a0" ) == 0 );
525 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_11)
527 unsigned char key_str[100];
528 unsigned char src_str[100];
529 unsigned char dst_str[100];
530 unsigned char output[100];
534 memset(key_str, 0x00, 100);
535 memset(src_str, 0x00, 100);
536 memset(dst_str, 0x00, 100);
537 memset(output, 0x00, 100);
539 key_len =
unhexify( key_str,
"07a1133e4a0b2686" );
540 unhexify( src_str,
"0248d43806f67172" );
546 hexify( dst_str, output, 8 );
548 fct_chk( strcmp( (
char *) dst_str,
"1730e5778bea1da4" ) == 0 );
554 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_12)
556 unsigned char key_str[100];
557 unsigned char src_str[100];
558 unsigned char dst_str[100];
559 unsigned char output[100];
563 memset(key_str, 0x00, 100);
564 memset(src_str, 0x00, 100);
565 memset(dst_str, 0x00, 100);
566 memset(output, 0x00, 100);
568 key_len =
unhexify( key_str,
"3849674c2602319e" );
569 unhexify( src_str,
"51454b582ddf440a" );
575 hexify( dst_str, output, 8 );
577 fct_chk( strcmp( (
char *) dst_str,
"a25e7856cf2651eb" ) == 0 );
583 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_13)
585 unsigned char key_str[100];
586 unsigned char src_str[100];
587 unsigned char dst_str[100];
588 unsigned char output[100];
592 memset(key_str, 0x00, 100);
593 memset(src_str, 0x00, 100);
594 memset(dst_str, 0x00, 100);
595 memset(output, 0x00, 100);
597 key_len =
unhexify( key_str,
"04b915ba43feb5b6" );
598 unhexify( src_str,
"42fd443059577fa2" );
604 hexify( dst_str, output, 8 );
606 fct_chk( strcmp( (
char *) dst_str,
"353882b109ce8f1a" ) == 0 );
612 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_14)
614 unsigned char key_str[100];
615 unsigned char src_str[100];
616 unsigned char dst_str[100];
617 unsigned char output[100];
621 memset(key_str, 0x00, 100);
622 memset(src_str, 0x00, 100);
623 memset(dst_str, 0x00, 100);
624 memset(output, 0x00, 100);
626 key_len =
unhexify( key_str,
"0113b970fd34f2ce" );
627 unhexify( src_str,
"059b5e0851cf143a" );
633 hexify( dst_str, output, 8 );
635 fct_chk( strcmp( (
char *) dst_str,
"48f4d0884c379918" ) == 0 );
641 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_15)
643 unsigned char key_str[100];
644 unsigned char src_str[100];
645 unsigned char dst_str[100];
646 unsigned char output[100];
650 memset(key_str, 0x00, 100);
651 memset(src_str, 0x00, 100);
652 memset(dst_str, 0x00, 100);
653 memset(output, 0x00, 100);
655 key_len =
unhexify( key_str,
"0170f175468fb5e6" );
656 unhexify( src_str,
"0756d8e0774761d2" );
662 hexify( dst_str, output, 8 );
664 fct_chk( strcmp( (
char *) dst_str,
"432193b78951fc98" ) == 0 );
670 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_16)
672 unsigned char key_str[100];
673 unsigned char src_str[100];
674 unsigned char dst_str[100];
675 unsigned char output[100];
679 memset(key_str, 0x00, 100);
680 memset(src_str, 0x00, 100);
681 memset(dst_str, 0x00, 100);
682 memset(output, 0x00, 100);
684 key_len =
unhexify( key_str,
"43297fad38e373fe" );
685 unhexify( src_str,
"762514b829bf486a" );
691 hexify( dst_str, output, 8 );
693 fct_chk( strcmp( (
char *) dst_str,
"13f04154d69d1ae5" ) == 0 );
699 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_17)
701 unsigned char key_str[100];
702 unsigned char src_str[100];
703 unsigned char dst_str[100];
704 unsigned char output[100];
708 memset(key_str, 0x00, 100);
709 memset(src_str, 0x00, 100);
710 memset(dst_str, 0x00, 100);
711 memset(output, 0x00, 100);
713 key_len =
unhexify( key_str,
"07a7137045da2a16" );
714 unhexify( src_str,
"3bdd119049372802" );
720 hexify( dst_str, output, 8 );
722 fct_chk( strcmp( (
char *) dst_str,
"2eedda93ffd39c79" ) == 0 );
728 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_18)
730 unsigned char key_str[100];
731 unsigned char src_str[100];
732 unsigned char dst_str[100];
733 unsigned char output[100];
737 memset(key_str, 0x00, 100);
738 memset(src_str, 0x00, 100);
739 memset(dst_str, 0x00, 100);
740 memset(output, 0x00, 100);
742 key_len =
unhexify( key_str,
"04689104c2fd3b2f" );
743 unhexify( src_str,
"26955f6835af609a" );
749 hexify( dst_str, output, 8 );
751 fct_chk( strcmp( (
char *) dst_str,
"d887e0393c2da6e3" ) == 0 );
757 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_19)
759 unsigned char key_str[100];
760 unsigned char src_str[100];
761 unsigned char dst_str[100];
762 unsigned char output[100];
766 memset(key_str, 0x00, 100);
767 memset(src_str, 0x00, 100);
768 memset(dst_str, 0x00, 100);
769 memset(output, 0x00, 100);
771 key_len =
unhexify( key_str,
"37d06bb516cb7546" );
772 unhexify( src_str,
"164d5e404f275232" );
778 hexify( dst_str, output, 8 );
780 fct_chk( strcmp( (
char *) dst_str,
"5f99d04f5b163969" ) == 0 );
786 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_20)
788 unsigned char key_str[100];
789 unsigned char src_str[100];
790 unsigned char dst_str[100];
791 unsigned char output[100];
795 memset(key_str, 0x00, 100);
796 memset(src_str, 0x00, 100);
797 memset(dst_str, 0x00, 100);
798 memset(output, 0x00, 100);
800 key_len =
unhexify( key_str,
"1f08260d1ac2465e" );
801 unhexify( src_str,
"6b056e18759f5cca" );
807 hexify( dst_str, output, 8 );
809 fct_chk( strcmp( (
char *) dst_str,
"4a057a3b24d3977b" ) == 0 );
815 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_21)
817 unsigned char key_str[100];
818 unsigned char src_str[100];
819 unsigned char dst_str[100];
820 unsigned char output[100];
824 memset(key_str, 0x00, 100);
825 memset(src_str, 0x00, 100);
826 memset(dst_str, 0x00, 100);
827 memset(output, 0x00, 100);
829 key_len =
unhexify( key_str,
"584023641aba6176" );
830 unhexify( src_str,
"004bd6ef09176062" );
836 hexify( dst_str, output, 8 );
838 fct_chk( strcmp( (
char *) dst_str,
"452031c1e4fada8e" ) == 0 );
844 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_22)
846 unsigned char key_str[100];
847 unsigned char src_str[100];
848 unsigned char dst_str[100];
849 unsigned char output[100];
853 memset(key_str, 0x00, 100);
854 memset(src_str, 0x00, 100);
855 memset(dst_str, 0x00, 100);
856 memset(output, 0x00, 100);
858 key_len =
unhexify( key_str,
"025816164629b007" );
859 unhexify( src_str,
"480d39006ee762f2" );
865 hexify( dst_str, output, 8 );
867 fct_chk( strcmp( (
char *) dst_str,
"7555ae39f59b87bd" ) == 0 );
873 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_23)
875 unsigned char key_str[100];
876 unsigned char src_str[100];
877 unsigned char dst_str[100];
878 unsigned char output[100];
882 memset(key_str, 0x00, 100);
883 memset(src_str, 0x00, 100);
884 memset(dst_str, 0x00, 100);
885 memset(output, 0x00, 100);
887 key_len =
unhexify( key_str,
"49793ebc79b3258f" );
888 unhexify( src_str,
"437540c8698f3cfa" );
894 hexify( dst_str, output, 8 );
896 fct_chk( strcmp( (
char *) dst_str,
"53c55f9cb49fc019" ) == 0 );
902 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_24)
904 unsigned char key_str[100];
905 unsigned char src_str[100];
906 unsigned char dst_str[100];
907 unsigned char output[100];
911 memset(key_str, 0x00, 100);
912 memset(src_str, 0x00, 100);
913 memset(dst_str, 0x00, 100);
914 memset(output, 0x00, 100);
916 key_len =
unhexify( key_str,
"4fb05e1515ab73a7" );
917 unhexify( src_str,
"072d43a077075292" );
923 hexify( dst_str, output, 8 );
925 fct_chk( strcmp( (
char *) dst_str,
"7a8e7bfa937e89a3" ) == 0 );
931 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_25)
933 unsigned char key_str[100];
934 unsigned char src_str[100];
935 unsigned char dst_str[100];
936 unsigned char output[100];
940 memset(key_str, 0x00, 100);
941 memset(src_str, 0x00, 100);
942 memset(dst_str, 0x00, 100);
943 memset(output, 0x00, 100);
945 key_len =
unhexify( key_str,
"49e95d6d4ca229bf" );
946 unhexify( src_str,
"02fe55778117f12a" );
952 hexify( dst_str, output, 8 );
954 fct_chk( strcmp( (
char *) dst_str,
"cf9c5d7a4986adb5" ) == 0 );
960 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_26)
962 unsigned char key_str[100];
963 unsigned char src_str[100];
964 unsigned char dst_str[100];
965 unsigned char output[100];
969 memset(key_str, 0x00, 100);
970 memset(src_str, 0x00, 100);
971 memset(dst_str, 0x00, 100);
972 memset(output, 0x00, 100);
974 key_len =
unhexify( key_str,
"018310dc409b26d6" );
975 unhexify( src_str,
"1d9d5c5018f728c2" );
981 hexify( dst_str, output, 8 );
983 fct_chk( strcmp( (
char *) dst_str,
"d1abb290658bc778" ) == 0 );
989 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_27)
991 unsigned char key_str[100];
992 unsigned char src_str[100];
993 unsigned char dst_str[100];
994 unsigned char output[100];
998 memset(key_str, 0x00, 100);
999 memset(src_str, 0x00, 100);
1000 memset(dst_str, 0x00, 100);
1001 memset(output, 0x00, 100);
1003 key_len =
unhexify( key_str,
"1c587f1c13924fef" );
1004 unhexify( src_str,
"305532286d6f295a" );
1010 hexify( dst_str, output, 8 );
1012 fct_chk( strcmp( (
char *) dst_str,
"55cb3774d13ef201" ) == 0 );
1018 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_28)
1020 unsigned char key_str[100];
1021 unsigned char src_str[100];
1022 unsigned char dst_str[100];
1023 unsigned char output[100];
1027 memset(key_str, 0x00, 100);
1028 memset(src_str, 0x00, 100);
1029 memset(dst_str, 0x00, 100);
1030 memset(output, 0x00, 100);
1032 key_len =
unhexify( key_str,
"0101010101010101" );
1033 unhexify( src_str,
"0123456789abcdef" );
1039 hexify( dst_str, output, 8 );
1041 fct_chk( strcmp( (
char *) dst_str,
"fa34ec4847b268b2" ) == 0 );
1047 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_29)
1049 unsigned char key_str[100];
1050 unsigned char src_str[100];
1051 unsigned char dst_str[100];
1052 unsigned char output[100];
1056 memset(key_str, 0x00, 100);
1057 memset(src_str, 0x00, 100);
1058 memset(dst_str, 0x00, 100);
1059 memset(output, 0x00, 100);
1061 key_len =
unhexify( key_str,
"1f1f1f1f0e0e0e0e" );
1062 unhexify( src_str,
"0123456789abcdef" );
1068 hexify( dst_str, output, 8 );
1070 fct_chk( strcmp( (
char *) dst_str,
"a790795108ea3cae" ) == 0 );
1076 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_30)
1078 unsigned char key_str[100];
1079 unsigned char src_str[100];
1080 unsigned char dst_str[100];
1081 unsigned char output[100];
1085 memset(key_str, 0x00, 100);
1086 memset(src_str, 0x00, 100);
1087 memset(dst_str, 0x00, 100);
1088 memset(output, 0x00, 100);
1090 key_len =
unhexify( key_str,
"e0fee0fef1fef1fe" );
1091 unhexify( src_str,
"0123456789abcdef" );
1097 hexify( dst_str, output, 8 );
1099 fct_chk( strcmp( (
char *) dst_str,
"c39e072d9fac631d" ) == 0 );
1105 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_31)
1107 unsigned char key_str[100];
1108 unsigned char src_str[100];
1109 unsigned char dst_str[100];
1110 unsigned char output[100];
1114 memset(key_str, 0x00, 100);
1115 memset(src_str, 0x00, 100);
1116 memset(dst_str, 0x00, 100);
1117 memset(output, 0x00, 100);
1119 key_len =
unhexify( key_str,
"0000000000000000" );
1120 unhexify( src_str,
"ffffffffffffffff" );
1126 hexify( dst_str, output, 8 );
1128 fct_chk( strcmp( (
char *) dst_str,
"014933e0cdaff6e4" ) == 0 );
1134 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_32)
1136 unsigned char key_str[100];
1137 unsigned char src_str[100];
1138 unsigned char dst_str[100];
1139 unsigned char output[100];
1143 memset(key_str, 0x00, 100);
1144 memset(src_str, 0x00, 100);
1145 memset(dst_str, 0x00, 100);
1146 memset(output, 0x00, 100);
1148 key_len =
unhexify( key_str,
"ffffffffffffffff" );
1149 unhexify( src_str,
"0000000000000000" );
1155 hexify( dst_str, output, 8 );
1157 fct_chk( strcmp( (
char *) dst_str,
"f21e9a77b71c49bc" ) == 0 );
1163 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_33)
1165 unsigned char key_str[100];
1166 unsigned char src_str[100];
1167 unsigned char dst_str[100];
1168 unsigned char output[100];
1172 memset(key_str, 0x00, 100);
1173 memset(src_str, 0x00, 100);
1174 memset(dst_str, 0x00, 100);
1175 memset(output, 0x00, 100);
1177 key_len =
unhexify( key_str,
"0123456789abcdef" );
1178 unhexify( src_str,
"0000000000000000" );
1184 hexify( dst_str, output, 8 );
1186 fct_chk( strcmp( (
char *) dst_str,
"245946885754369a" ) == 0 );
1192 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_34)
1194 unsigned char key_str[100];
1195 unsigned char src_str[100];
1196 unsigned char dst_str[100];
1197 unsigned char output[100];
1201 memset(key_str, 0x00, 100);
1202 memset(src_str, 0x00, 100);
1203 memset(dst_str, 0x00, 100);
1204 memset(output, 0x00, 100);
1206 key_len =
unhexify( key_str,
"fedcba9876543210" );
1207 unhexify( src_str,
"ffffffffffffffff" );
1213 hexify( dst_str, output, 8 );
1215 fct_chk( strcmp( (
char *) dst_str,
"6b5c5a9c5d9e0a5a" ) == 0 );
1221 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_1)
1223 unsigned char key_str[100];
1224 unsigned char src_str[100];
1225 unsigned char dst_str[100];
1226 unsigned char output[100];
1230 memset(key_str, 0x00, 100);
1231 memset(src_str, 0x00, 100);
1232 memset(dst_str, 0x00, 100);
1233 memset(output, 0x00, 100);
1235 key_len =
unhexify( key_str,
"0000000000000000" );
1236 unhexify( src_str,
"4ef997456198dd78" );
1242 hexify( dst_str, output, 8 );
1244 fct_chk( strcmp( (
char *) dst_str,
"0000000000000000" ) == 0 );
1250 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_2)
1252 unsigned char key_str[100];
1253 unsigned char src_str[100];
1254 unsigned char dst_str[100];
1255 unsigned char output[100];
1259 memset(key_str, 0x00, 100);
1260 memset(src_str, 0x00, 100);
1261 memset(dst_str, 0x00, 100);
1262 memset(output, 0x00, 100);
1264 key_len =
unhexify( key_str,
"ffffffffffffffff" );
1265 unhexify( src_str,
"51866fd5b85ecb8a" );
1271 hexify( dst_str, output, 8 );
1273 fct_chk( strcmp( (
char *) dst_str,
"ffffffffffffffff" ) == 0 );
1279 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_3)
1281 unsigned char key_str[100];
1282 unsigned char src_str[100];
1283 unsigned char dst_str[100];
1284 unsigned char output[100];
1288 memset(key_str, 0x00, 100);
1289 memset(src_str, 0x00, 100);
1290 memset(dst_str, 0x00, 100);
1291 memset(output, 0x00, 100);
1293 key_len =
unhexify( key_str,
"3000000000000000" );
1294 unhexify( src_str,
"7d856f9a613063f2" );
1300 hexify( dst_str, output, 8 );
1302 fct_chk( strcmp( (
char *) dst_str,
"1000000000000001" ) == 0 );
1308 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_4)
1310 unsigned char key_str[100];
1311 unsigned char src_str[100];
1312 unsigned char dst_str[100];
1313 unsigned char output[100];
1317 memset(key_str, 0x00, 100);
1318 memset(src_str, 0x00, 100);
1319 memset(dst_str, 0x00, 100);
1320 memset(output, 0x00, 100);
1322 key_len =
unhexify( key_str,
"1111111111111111" );
1323 unhexify( src_str,
"2466dd878b963c9d" );
1329 hexify( dst_str, output, 8 );
1331 fct_chk( strcmp( (
char *) dst_str,
"1111111111111111" ) == 0 );
1337 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_5)
1339 unsigned char key_str[100];
1340 unsigned char src_str[100];
1341 unsigned char dst_str[100];
1342 unsigned char output[100];
1346 memset(key_str, 0x00, 100);
1347 memset(src_str, 0x00, 100);
1348 memset(dst_str, 0x00, 100);
1349 memset(output, 0x00, 100);
1351 key_len =
unhexify( key_str,
"0123456789abcdef" );
1352 unhexify( src_str,
"61f9c3802281b096" );
1358 hexify( dst_str, output, 8 );
1360 fct_chk( strcmp( (
char *) dst_str,
"1111111111111111" ) == 0 );
1366 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_6)
1368 unsigned char key_str[100];
1369 unsigned char src_str[100];
1370 unsigned char dst_str[100];
1371 unsigned char output[100];
1375 memset(key_str, 0x00, 100);
1376 memset(src_str, 0x00, 100);
1377 memset(dst_str, 0x00, 100);
1378 memset(output, 0x00, 100);
1380 key_len =
unhexify( key_str,
"1111111111111111" );
1381 unhexify( src_str,
"7d0cc630afda1ec7" );
1387 hexify( dst_str, output, 8 );
1389 fct_chk( strcmp( (
char *) dst_str,
"0123456789abcdef" ) == 0 );
1395 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_7)
1397 unsigned char key_str[100];
1398 unsigned char src_str[100];
1399 unsigned char dst_str[100];
1400 unsigned char output[100];
1404 memset(key_str, 0x00, 100);
1405 memset(src_str, 0x00, 100);
1406 memset(dst_str, 0x00, 100);
1407 memset(output, 0x00, 100);
1409 key_len =
unhexify( key_str,
"0000000000000000" );
1410 unhexify( src_str,
"4ef997456198dd78" );
1416 hexify( dst_str, output, 8 );
1418 fct_chk( strcmp( (
char *) dst_str,
"0000000000000000" ) == 0 );
1424 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_8)
1426 unsigned char key_str[100];
1427 unsigned char src_str[100];
1428 unsigned char dst_str[100];
1429 unsigned char output[100];
1433 memset(key_str, 0x00, 100);
1434 memset(src_str, 0x00, 100);
1435 memset(dst_str, 0x00, 100);
1436 memset(output, 0x00, 100);
1438 key_len =
unhexify( key_str,
"fedcba9876543210" );
1439 unhexify( src_str,
"0aceab0fc6a0a28d" );
1445 hexify( dst_str, output, 8 );
1447 fct_chk( strcmp( (
char *) dst_str,
"0123456789abcdef" ) == 0 );
1453 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_9)
1455 unsigned char key_str[100];
1456 unsigned char src_str[100];
1457 unsigned char dst_str[100];
1458 unsigned char output[100];
1462 memset(key_str, 0x00, 100);
1463 memset(src_str, 0x00, 100);
1464 memset(dst_str, 0x00, 100);
1465 memset(output, 0x00, 100);
1467 key_len =
unhexify( key_str,
"7ca110454a1a6e57" );
1468 unhexify( src_str,
"59c68245eb05282b" );
1474 hexify( dst_str, output, 8 );
1476 fct_chk( strcmp( (
char *) dst_str,
"01a1d6d039776742" ) == 0 );
1482 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_10)
1484 unsigned char key_str[100];
1485 unsigned char src_str[100];
1486 unsigned char dst_str[100];
1487 unsigned char output[100];
1491 memset(key_str, 0x00, 100);
1492 memset(src_str, 0x00, 100);
1493 memset(dst_str, 0x00, 100);
1494 memset(output, 0x00, 100);
1496 key_len =
unhexify( key_str,
"0131d9619dc1376e" );
1497 unhexify( src_str,
"b1b8cc0b250f09a0" );
1503 hexify( dst_str, output, 8 );
1505 fct_chk( strcmp( (
char *) dst_str,
"5cd54ca83def57da" ) == 0 );
1511 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_11)
1513 unsigned char key_str[100];
1514 unsigned char src_str[100];
1515 unsigned char dst_str[100];
1516 unsigned char output[100];
1520 memset(key_str, 0x00, 100);
1521 memset(src_str, 0x00, 100);
1522 memset(dst_str, 0x00, 100);
1523 memset(output, 0x00, 100);
1525 key_len =
unhexify( key_str,
"07a1133e4a0b2686" );
1526 unhexify( src_str,
"1730e5778bea1da4" );
1532 hexify( dst_str, output, 8 );
1534 fct_chk( strcmp( (
char *) dst_str,
"0248d43806f67172" ) == 0 );
1540 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_12)
1542 unsigned char key_str[100];
1543 unsigned char src_str[100];
1544 unsigned char dst_str[100];
1545 unsigned char output[100];
1549 memset(key_str, 0x00, 100);
1550 memset(src_str, 0x00, 100);
1551 memset(dst_str, 0x00, 100);
1552 memset(output, 0x00, 100);
1554 key_len =
unhexify( key_str,
"3849674c2602319e" );
1555 unhexify( src_str,
"a25e7856cf2651eb" );
1561 hexify( dst_str, output, 8 );
1563 fct_chk( strcmp( (
char *) dst_str,
"51454b582ddf440a" ) == 0 );
1569 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_13)
1571 unsigned char key_str[100];
1572 unsigned char src_str[100];
1573 unsigned char dst_str[100];
1574 unsigned char output[100];
1578 memset(key_str, 0x00, 100);
1579 memset(src_str, 0x00, 100);
1580 memset(dst_str, 0x00, 100);
1581 memset(output, 0x00, 100);
1583 key_len =
unhexify( key_str,
"04b915ba43feb5b6" );
1584 unhexify( src_str,
"353882b109ce8f1a" );
1590 hexify( dst_str, output, 8 );
1592 fct_chk( strcmp( (
char *) dst_str,
"42fd443059577fa2" ) == 0 );
1598 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_14)
1600 unsigned char key_str[100];
1601 unsigned char src_str[100];
1602 unsigned char dst_str[100];
1603 unsigned char output[100];
1607 memset(key_str, 0x00, 100);
1608 memset(src_str, 0x00, 100);
1609 memset(dst_str, 0x00, 100);
1610 memset(output, 0x00, 100);
1612 key_len =
unhexify( key_str,
"0113b970fd34f2ce" );
1613 unhexify( src_str,
"48f4d0884c379918" );
1619 hexify( dst_str, output, 8 );
1621 fct_chk( strcmp( (
char *) dst_str,
"059b5e0851cf143a" ) == 0 );
1627 FCT_TEST_BGN(blowfish_ecb_encrypt_ssleay_reference_15)
1629 unsigned char key_str[100];
1630 unsigned char src_str[100];
1631 unsigned char dst_str[100];
1632 unsigned char output[100];
1636 memset(key_str, 0x00, 100);
1637 memset(src_str, 0x00, 100);
1638 memset(dst_str, 0x00, 100);
1639 memset(output, 0x00, 100);
1641 key_len =
unhexify( key_str,
"0170f175468fb5e6" );
1642 unhexify( src_str,
"0756d8e0774761d2" );
1648 hexify( dst_str, output, 8 );
1650 fct_chk( strcmp( (
char *) dst_str,
"432193b78951fc98" ) == 0 );
1656 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_16)
1658 unsigned char key_str[100];
1659 unsigned char src_str[100];
1660 unsigned char dst_str[100];
1661 unsigned char output[100];
1665 memset(key_str, 0x00, 100);
1666 memset(src_str, 0x00, 100);
1667 memset(dst_str, 0x00, 100);
1668 memset(output, 0x00, 100);
1670 key_len =
unhexify( key_str,
"43297fad38e373fe" );
1671 unhexify( src_str,
"13f04154d69d1ae5" );
1677 hexify( dst_str, output, 8 );
1679 fct_chk( strcmp( (
char *) dst_str,
"762514b829bf486a" ) == 0 );
1685 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_17)
1687 unsigned char key_str[100];
1688 unsigned char src_str[100];
1689 unsigned char dst_str[100];
1690 unsigned char output[100];
1694 memset(key_str, 0x00, 100);
1695 memset(src_str, 0x00, 100);
1696 memset(dst_str, 0x00, 100);
1697 memset(output, 0x00, 100);
1699 key_len =
unhexify( key_str,
"07a7137045da2a16" );
1700 unhexify( src_str,
"2eedda93ffd39c79" );
1706 hexify( dst_str, output, 8 );
1708 fct_chk( strcmp( (
char *) dst_str,
"3bdd119049372802" ) == 0 );
1714 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_18)
1716 unsigned char key_str[100];
1717 unsigned char src_str[100];
1718 unsigned char dst_str[100];
1719 unsigned char output[100];
1723 memset(key_str, 0x00, 100);
1724 memset(src_str, 0x00, 100);
1725 memset(dst_str, 0x00, 100);
1726 memset(output, 0x00, 100);
1728 key_len =
unhexify( key_str,
"04689104c2fd3b2f" );
1729 unhexify( src_str,
"d887e0393c2da6e3" );
1735 hexify( dst_str, output, 8 );
1737 fct_chk( strcmp( (
char *) dst_str,
"26955f6835af609a" ) == 0 );
1743 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_19)
1745 unsigned char key_str[100];
1746 unsigned char src_str[100];
1747 unsigned char dst_str[100];
1748 unsigned char output[100];
1752 memset(key_str, 0x00, 100);
1753 memset(src_str, 0x00, 100);
1754 memset(dst_str, 0x00, 100);
1755 memset(output, 0x00, 100);
1757 key_len =
unhexify( key_str,
"37d06bb516cb7546" );
1758 unhexify( src_str,
"5f99d04f5b163969" );
1764 hexify( dst_str, output, 8 );
1766 fct_chk( strcmp( (
char *) dst_str,
"164d5e404f275232" ) == 0 );
1772 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_20)
1774 unsigned char key_str[100];
1775 unsigned char src_str[100];
1776 unsigned char dst_str[100];
1777 unsigned char output[100];
1781 memset(key_str, 0x00, 100);
1782 memset(src_str, 0x00, 100);
1783 memset(dst_str, 0x00, 100);
1784 memset(output, 0x00, 100);
1786 key_len =
unhexify( key_str,
"1f08260d1ac2465e" );
1787 unhexify( src_str,
"4a057a3b24d3977b" );
1793 hexify( dst_str, output, 8 );
1795 fct_chk( strcmp( (
char *) dst_str,
"6b056e18759f5cca" ) == 0 );
1801 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_21)
1803 unsigned char key_str[100];
1804 unsigned char src_str[100];
1805 unsigned char dst_str[100];
1806 unsigned char output[100];
1810 memset(key_str, 0x00, 100);
1811 memset(src_str, 0x00, 100);
1812 memset(dst_str, 0x00, 100);
1813 memset(output, 0x00, 100);
1815 key_len =
unhexify( key_str,
"584023641aba6176" );
1816 unhexify( src_str,
"452031c1e4fada8e" );
1822 hexify( dst_str, output, 8 );
1824 fct_chk( strcmp( (
char *) dst_str,
"004bd6ef09176062" ) == 0 );
1830 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_22)
1832 unsigned char key_str[100];
1833 unsigned char src_str[100];
1834 unsigned char dst_str[100];
1835 unsigned char output[100];
1839 memset(key_str, 0x00, 100);
1840 memset(src_str, 0x00, 100);
1841 memset(dst_str, 0x00, 100);
1842 memset(output, 0x00, 100);
1844 key_len =
unhexify( key_str,
"025816164629b007" );
1845 unhexify( src_str,
"7555ae39f59b87bd" );
1851 hexify( dst_str, output, 8 );
1853 fct_chk( strcmp( (
char *) dst_str,
"480d39006ee762f2" ) == 0 );
1859 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_23)
1861 unsigned char key_str[100];
1862 unsigned char src_str[100];
1863 unsigned char dst_str[100];
1864 unsigned char output[100];
1868 memset(key_str, 0x00, 100);
1869 memset(src_str, 0x00, 100);
1870 memset(dst_str, 0x00, 100);
1871 memset(output, 0x00, 100);
1873 key_len =
unhexify( key_str,
"49793ebc79b3258f" );
1874 unhexify( src_str,
"53c55f9cb49fc019" );
1880 hexify( dst_str, output, 8 );
1882 fct_chk( strcmp( (
char *) dst_str,
"437540c8698f3cfa" ) == 0 );
1888 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_24)
1890 unsigned char key_str[100];
1891 unsigned char src_str[100];
1892 unsigned char dst_str[100];
1893 unsigned char output[100];
1897 memset(key_str, 0x00, 100);
1898 memset(src_str, 0x00, 100);
1899 memset(dst_str, 0x00, 100);
1900 memset(output, 0x00, 100);
1902 key_len =
unhexify( key_str,
"4fb05e1515ab73a7" );
1903 unhexify( src_str,
"7a8e7bfa937e89a3" );
1909 hexify( dst_str, output, 8 );
1911 fct_chk( strcmp( (
char *) dst_str,
"072d43a077075292" ) == 0 );
1917 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_25)
1919 unsigned char key_str[100];
1920 unsigned char src_str[100];
1921 unsigned char dst_str[100];
1922 unsigned char output[100];
1926 memset(key_str, 0x00, 100);
1927 memset(src_str, 0x00, 100);
1928 memset(dst_str, 0x00, 100);
1929 memset(output, 0x00, 100);
1931 key_len =
unhexify( key_str,
"49e95d6d4ca229bf" );
1932 unhexify( src_str,
"cf9c5d7a4986adb5" );
1938 hexify( dst_str, output, 8 );
1940 fct_chk( strcmp( (
char *) dst_str,
"02fe55778117f12a" ) == 0 );
1946 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_26)
1948 unsigned char key_str[100];
1949 unsigned char src_str[100];
1950 unsigned char dst_str[100];
1951 unsigned char output[100];
1955 memset(key_str, 0x00, 100);
1956 memset(src_str, 0x00, 100);
1957 memset(dst_str, 0x00, 100);
1958 memset(output, 0x00, 100);
1960 key_len =
unhexify( key_str,
"018310dc409b26d6" );
1961 unhexify( src_str,
"d1abb290658bc778" );
1967 hexify( dst_str, output, 8 );
1969 fct_chk( strcmp( (
char *) dst_str,
"1d9d5c5018f728c2" ) == 0 );
1975 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_27)
1977 unsigned char key_str[100];
1978 unsigned char src_str[100];
1979 unsigned char dst_str[100];
1980 unsigned char output[100];
1984 memset(key_str, 0x00, 100);
1985 memset(src_str, 0x00, 100);
1986 memset(dst_str, 0x00, 100);
1987 memset(output, 0x00, 100);
1989 key_len =
unhexify( key_str,
"1c587f1c13924fef" );
1990 unhexify( src_str,
"55cb3774d13ef201" );
1996 hexify( dst_str, output, 8 );
1998 fct_chk( strcmp( (
char *) dst_str,
"305532286d6f295a" ) == 0 );
2004 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_28)
2006 unsigned char key_str[100];
2007 unsigned char src_str[100];
2008 unsigned char dst_str[100];
2009 unsigned char output[100];
2013 memset(key_str, 0x00, 100);
2014 memset(src_str, 0x00, 100);
2015 memset(dst_str, 0x00, 100);
2016 memset(output, 0x00, 100);
2018 key_len =
unhexify( key_str,
"0101010101010101" );
2019 unhexify( src_str,
"fa34ec4847b268b2" );
2025 hexify( dst_str, output, 8 );
2027 fct_chk( strcmp( (
char *) dst_str,
"0123456789abcdef" ) == 0 );
2033 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_29)
2035 unsigned char key_str[100];
2036 unsigned char src_str[100];
2037 unsigned char dst_str[100];
2038 unsigned char output[100];
2042 memset(key_str, 0x00, 100);
2043 memset(src_str, 0x00, 100);
2044 memset(dst_str, 0x00, 100);
2045 memset(output, 0x00, 100);
2047 key_len =
unhexify( key_str,
"1f1f1f1f0e0e0e0e" );
2048 unhexify( src_str,
"a790795108ea3cae" );
2054 hexify( dst_str, output, 8 );
2056 fct_chk( strcmp( (
char *) dst_str,
"0123456789abcdef" ) == 0 );
2062 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_30)
2064 unsigned char key_str[100];
2065 unsigned char src_str[100];
2066 unsigned char dst_str[100];
2067 unsigned char output[100];
2071 memset(key_str, 0x00, 100);
2072 memset(src_str, 0x00, 100);
2073 memset(dst_str, 0x00, 100);
2074 memset(output, 0x00, 100);
2076 key_len =
unhexify( key_str,
"e0fee0fef1fef1fe" );
2077 unhexify( src_str,
"c39e072d9fac631d" );
2083 hexify( dst_str, output, 8 );
2085 fct_chk( strcmp( (
char *) dst_str,
"0123456789abcdef" ) == 0 );
2091 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_31)
2093 unsigned char key_str[100];
2094 unsigned char src_str[100];
2095 unsigned char dst_str[100];
2096 unsigned char output[100];
2100 memset(key_str, 0x00, 100);
2101 memset(src_str, 0x00, 100);
2102 memset(dst_str, 0x00, 100);
2103 memset(output, 0x00, 100);
2105 key_len =
unhexify( key_str,
"0000000000000000" );
2106 unhexify( src_str,
"014933e0cdaff6e4" );
2112 hexify( dst_str, output, 8 );
2114 fct_chk( strcmp( (
char *) dst_str,
"ffffffffffffffff" ) == 0 );
2120 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_32)
2122 unsigned char key_str[100];
2123 unsigned char src_str[100];
2124 unsigned char dst_str[100];
2125 unsigned char output[100];
2129 memset(key_str, 0x00, 100);
2130 memset(src_str, 0x00, 100);
2131 memset(dst_str, 0x00, 100);
2132 memset(output, 0x00, 100);
2134 key_len =
unhexify( key_str,
"ffffffffffffffff" );
2135 unhexify( src_str,
"f21e9a77b71c49bc" );
2141 hexify( dst_str, output, 8 );
2143 fct_chk( strcmp( (
char *) dst_str,
"0000000000000000" ) == 0 );
2149 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_33)
2151 unsigned char key_str[100];
2152 unsigned char src_str[100];
2153 unsigned char dst_str[100];
2154 unsigned char output[100];
2158 memset(key_str, 0x00, 100);
2159 memset(src_str, 0x00, 100);
2160 memset(dst_str, 0x00, 100);
2161 memset(output, 0x00, 100);
2163 key_len =
unhexify( key_str,
"0123456789abcdef" );
2164 unhexify( src_str,
"245946885754369a" );
2170 hexify( dst_str, output, 8 );
2172 fct_chk( strcmp( (
char *) dst_str,
"0000000000000000" ) == 0 );
2178 FCT_TEST_BGN(blowfish_ecb_decrypt_ssleay_reference_34)
2180 unsigned char key_str[100];
2181 unsigned char src_str[100];
2182 unsigned char dst_str[100];
2183 unsigned char output[100];
2187 memset(key_str, 0x00, 100);
2188 memset(src_str, 0x00, 100);
2189 memset(dst_str, 0x00, 100);
2190 memset(output, 0x00, 100);
2192 key_len =
unhexify( key_str,
"fedcba9876543210" );
2193 unhexify( src_str,
"6b5c5a9c5d9e0a5a" );
2199 hexify( dst_str, output, 8 );
2201 fct_chk( strcmp( (
char *) dst_str,
"ffffffffffffffff" ) == 0 );
2207 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_1)
2209 unsigned char key_str[100];
2210 unsigned char src_str[100];
2211 unsigned char dst_str[100];
2212 unsigned char output[100];
2216 memset(key_str, 0x00, 100);
2217 memset(src_str, 0x00, 100);
2218 memset(dst_str, 0x00, 100);
2219 memset(output, 0x00, 100);
2221 key_len =
unhexify( key_str,
"f0" );
2222 unhexify( src_str,
"fedcba9876543210" );
2228 hexify( dst_str, output, 8 );
2230 fct_chk( strcmp( (
char *) dst_str,
"" ) == 0 );
2236 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_2)
2238 unsigned char key_str[100];
2239 unsigned char src_str[100];
2240 unsigned char dst_str[100];
2241 unsigned char output[100];
2245 memset(key_str, 0x00, 100);
2246 memset(src_str, 0x00, 100);
2247 memset(dst_str, 0x00, 100);
2248 memset(output, 0x00, 100);
2250 key_len =
unhexify( key_str,
"f0e1" );
2251 unhexify( src_str,
"fedcba9876543210" );
2257 hexify( dst_str, output, 8 );
2259 fct_chk( strcmp( (
char *) dst_str,
"" ) == 0 );
2265 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_3)
2267 unsigned char key_str[100];
2268 unsigned char src_str[100];
2269 unsigned char dst_str[100];
2270 unsigned char output[100];
2274 memset(key_str, 0x00, 100);
2275 memset(src_str, 0x00, 100);
2276 memset(dst_str, 0x00, 100);
2277 memset(output, 0x00, 100);
2279 key_len =
unhexify( key_str,
"f0e1d2" );
2280 unhexify( src_str,
"fedcba9876543210" );
2286 hexify( dst_str, output, 8 );
2288 fct_chk( strcmp( (
char *) dst_str,
"" ) == 0 );
2294 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_4)
2296 unsigned char key_str[100];
2297 unsigned char src_str[100];
2298 unsigned char dst_str[100];
2299 unsigned char output[100];
2303 memset(key_str, 0x00, 100);
2304 memset(src_str, 0x00, 100);
2305 memset(dst_str, 0x00, 100);
2306 memset(output, 0x00, 100);
2308 key_len =
unhexify( key_str,
"f0e1d2c3" );
2309 unhexify( src_str,
"fedcba9876543210" );
2315 hexify( dst_str, output, 8 );
2317 fct_chk( strcmp( (
char *) dst_str,
"be1e639408640f05" ) == 0 );
2323 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_5)
2325 unsigned char key_str[100];
2326 unsigned char src_str[100];
2327 unsigned char dst_str[100];
2328 unsigned char output[100];
2332 memset(key_str, 0x00, 100);
2333 memset(src_str, 0x00, 100);
2334 memset(dst_str, 0x00, 100);
2335 memset(output, 0x00, 100);
2337 key_len =
unhexify( key_str,
"f0e1d2c3b4" );
2338 unhexify( src_str,
"fedcba9876543210" );
2344 hexify( dst_str, output, 8 );
2346 fct_chk( strcmp( (
char *) dst_str,
"b39e44481bdb1e6e" ) == 0 );
2352 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_6)
2354 unsigned char key_str[100];
2355 unsigned char src_str[100];
2356 unsigned char dst_str[100];
2357 unsigned char output[100];
2361 memset(key_str, 0x00, 100);
2362 memset(src_str, 0x00, 100);
2363 memset(dst_str, 0x00, 100);
2364 memset(output, 0x00, 100);
2366 key_len =
unhexify( key_str,
"f0e1d2c3b4a5" );
2367 unhexify( src_str,
"fedcba9876543210" );
2373 hexify( dst_str, output, 8 );
2375 fct_chk( strcmp( (
char *) dst_str,
"9457aa83b1928c0d" ) == 0 );
2381 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_7)
2383 unsigned char key_str[100];
2384 unsigned char src_str[100];
2385 unsigned char dst_str[100];
2386 unsigned char output[100];
2390 memset(key_str, 0x00, 100);
2391 memset(src_str, 0x00, 100);
2392 memset(dst_str, 0x00, 100);
2393 memset(output, 0x00, 100);
2395 key_len =
unhexify( key_str,
"f0e1d2c3b4a596" );
2396 unhexify( src_str,
"fedcba9876543210" );
2402 hexify( dst_str, output, 8 );
2404 fct_chk( strcmp( (
char *) dst_str,
"8bb77032f960629d" ) == 0 );
2410 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_8)
2412 unsigned char key_str[100];
2413 unsigned char src_str[100];
2414 unsigned char dst_str[100];
2415 unsigned char output[100];
2419 memset(key_str, 0x00, 100);
2420 memset(src_str, 0x00, 100);
2421 memset(dst_str, 0x00, 100);
2422 memset(output, 0x00, 100);
2424 key_len =
unhexify( key_str,
"f0e1d2c3b4a59687" );
2425 unhexify( src_str,
"fedcba9876543210" );
2431 hexify( dst_str, output, 8 );
2433 fct_chk( strcmp( (
char *) dst_str,
"e87a244e2cc85e82" ) == 0 );
2439 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_9)
2441 unsigned char key_str[100];
2442 unsigned char src_str[100];
2443 unsigned char dst_str[100];
2444 unsigned char output[100];
2448 memset(key_str, 0x00, 100);
2449 memset(src_str, 0x00, 100);
2450 memset(dst_str, 0x00, 100);
2451 memset(output, 0x00, 100);
2453 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778" );
2454 unhexify( src_str,
"fedcba9876543210" );
2460 hexify( dst_str, output, 8 );
2462 fct_chk( strcmp( (
char *) dst_str,
"15750e7a4f4ec577" ) == 0 );
2468 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_10)
2470 unsigned char key_str[100];
2471 unsigned char src_str[100];
2472 unsigned char dst_str[100];
2473 unsigned char output[100];
2477 memset(key_str, 0x00, 100);
2478 memset(src_str, 0x00, 100);
2479 memset(dst_str, 0x00, 100);
2480 memset(output, 0x00, 100);
2482 key_len =
unhexify( key_str,
"f0e1d2c3b4a596877869" );
2483 unhexify( src_str,
"fedcba9876543210" );
2489 hexify( dst_str, output, 8 );
2491 fct_chk( strcmp( (
char *) dst_str,
"122ba70b3ab64ae0" ) == 0 );
2497 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_11)
2499 unsigned char key_str[100];
2500 unsigned char src_str[100];
2501 unsigned char dst_str[100];
2502 unsigned char output[100];
2506 memset(key_str, 0x00, 100);
2507 memset(src_str, 0x00, 100);
2508 memset(dst_str, 0x00, 100);
2509 memset(output, 0x00, 100);
2511 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a" );
2512 unhexify( src_str,
"fedcba9876543210" );
2518 hexify( dst_str, output, 8 );
2520 fct_chk( strcmp( (
char *) dst_str,
"3a833c9affc537f6" ) == 0 );
2526 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_12)
2528 unsigned char key_str[100];
2529 unsigned char src_str[100];
2530 unsigned char dst_str[100];
2531 unsigned char output[100];
2535 memset(key_str, 0x00, 100);
2536 memset(src_str, 0x00, 100);
2537 memset(dst_str, 0x00, 100);
2538 memset(output, 0x00, 100);
2540 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b" );
2541 unhexify( src_str,
"fedcba9876543210" );
2547 hexify( dst_str, output, 8 );
2549 fct_chk( strcmp( (
char *) dst_str,
"9409da87a90f6bf2" ) == 0 );
2555 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_13)
2557 unsigned char key_str[100];
2558 unsigned char src_str[100];
2559 unsigned char dst_str[100];
2560 unsigned char output[100];
2564 memset(key_str, 0x00, 100);
2565 memset(src_str, 0x00, 100);
2566 memset(dst_str, 0x00, 100);
2567 memset(output, 0x00, 100);
2569 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c" );
2570 unhexify( src_str,
"fedcba9876543210" );
2576 hexify( dst_str, output, 8 );
2578 fct_chk( strcmp( (
char *) dst_str,
"884f80625060b8b4" ) == 0 );
2584 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_14)
2586 unsigned char key_str[100];
2587 unsigned char src_str[100];
2588 unsigned char dst_str[100];
2589 unsigned char output[100];
2593 memset(key_str, 0x00, 100);
2594 memset(src_str, 0x00, 100);
2595 memset(dst_str, 0x00, 100);
2596 memset(output, 0x00, 100);
2598 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d" );
2599 unhexify( src_str,
"fedcba9876543210" );
2605 hexify( dst_str, output, 8 );
2607 fct_chk( strcmp( (
char *) dst_str,
"1f85031c19e11968" ) == 0 );
2613 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_15)
2615 unsigned char key_str[100];
2616 unsigned char src_str[100];
2617 unsigned char dst_str[100];
2618 unsigned char output[100];
2622 memset(key_str, 0x00, 100);
2623 memset(src_str, 0x00, 100);
2624 memset(dst_str, 0x00, 100);
2625 memset(output, 0x00, 100);
2627 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e" );
2628 unhexify( src_str,
"fedcba9876543210" );
2634 hexify( dst_str, output, 8 );
2636 fct_chk( strcmp( (
char *) dst_str,
"79d9373a714ca34f" ) == 0 );
2642 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_16)
2644 unsigned char key_str[100];
2645 unsigned char src_str[100];
2646 unsigned char dst_str[100];
2647 unsigned char output[100];
2651 memset(key_str, 0x00, 100);
2652 memset(src_str, 0x00, 100);
2653 memset(dst_str, 0x00, 100);
2654 memset(output, 0x00, 100);
2656 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f" );
2657 unhexify( src_str,
"fedcba9876543210" );
2663 hexify( dst_str, output, 8 );
2665 fct_chk( strcmp( (
char *) dst_str,
"93142887ee3be15c" ) == 0 );
2671 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_17)
2673 unsigned char key_str[100];
2674 unsigned char src_str[100];
2675 unsigned char dst_str[100];
2676 unsigned char output[100];
2680 memset(key_str, 0x00, 100);
2681 memset(src_str, 0x00, 100);
2682 memset(dst_str, 0x00, 100);
2683 memset(output, 0x00, 100);
2685 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f00" );
2686 unhexify( src_str,
"fedcba9876543210" );
2692 hexify( dst_str, output, 8 );
2694 fct_chk( strcmp( (
char *) dst_str,
"03429e838ce2d14b" ) == 0 );
2700 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_18)
2702 unsigned char key_str[100];
2703 unsigned char src_str[100];
2704 unsigned char dst_str[100];
2705 unsigned char output[100];
2709 memset(key_str, 0x00, 100);
2710 memset(src_str, 0x00, 100);
2711 memset(dst_str, 0x00, 100);
2712 memset(output, 0x00, 100);
2714 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f0011" );
2715 unhexify( src_str,
"fedcba9876543210" );
2721 hexify( dst_str, output, 8 );
2723 fct_chk( strcmp( (
char *) dst_str,
"a4299e27469ff67b" ) == 0 );
2729 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_19)
2731 unsigned char key_str[100];
2732 unsigned char src_str[100];
2733 unsigned char dst_str[100];
2734 unsigned char output[100];
2738 memset(key_str, 0x00, 100);
2739 memset(src_str, 0x00, 100);
2740 memset(dst_str, 0x00, 100);
2741 memset(output, 0x00, 100);
2743 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f001122" );
2744 unhexify( src_str,
"fedcba9876543210" );
2750 hexify( dst_str, output, 8 );
2752 fct_chk( strcmp( (
char *) dst_str,
"afd5aed1c1bc96a8" ) == 0 );
2758 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_20)
2760 unsigned char key_str[100];
2761 unsigned char src_str[100];
2762 unsigned char dst_str[100];
2763 unsigned char output[100];
2767 memset(key_str, 0x00, 100);
2768 memset(src_str, 0x00, 100);
2769 memset(dst_str, 0x00, 100);
2770 memset(output, 0x00, 100);
2772 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f00112233" );
2773 unhexify( src_str,
"fedcba9876543210" );
2779 hexify( dst_str, output, 8 );
2781 fct_chk( strcmp( (
char *) dst_str,
"10851c0e3858da9f" ) == 0 );
2787 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_21)
2789 unsigned char key_str[100];
2790 unsigned char src_str[100];
2791 unsigned char dst_str[100];
2792 unsigned char output[100];
2796 memset(key_str, 0x00, 100);
2797 memset(src_str, 0x00, 100);
2798 memset(dst_str, 0x00, 100);
2799 memset(output, 0x00, 100);
2801 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f0011223344" );
2802 unhexify( src_str,
"fedcba9876543210" );
2808 hexify( dst_str, output, 8 );
2810 fct_chk( strcmp( (
char *) dst_str,
"e6f51ed79b9db21f" ) == 0 );
2816 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_22)
2818 unsigned char key_str[100];
2819 unsigned char src_str[100];
2820 unsigned char dst_str[100];
2821 unsigned char output[100];
2825 memset(key_str, 0x00, 100);
2826 memset(src_str, 0x00, 100);
2827 memset(dst_str, 0x00, 100);
2828 memset(output, 0x00, 100);
2830 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f001122334455" );
2831 unhexify( src_str,
"fedcba9876543210" );
2837 hexify( dst_str, output, 8 );
2839 fct_chk( strcmp( (
char *) dst_str,
"64a6e14afd36b46f" ) == 0 );
2845 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_23)
2847 unsigned char key_str[100];
2848 unsigned char src_str[100];
2849 unsigned char dst_str[100];
2850 unsigned char output[100];
2854 memset(key_str, 0x00, 100);
2855 memset(src_str, 0x00, 100);
2856 memset(dst_str, 0x00, 100);
2857 memset(output, 0x00, 100);
2859 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f00112233445566" );
2860 unhexify( src_str,
"fedcba9876543210" );
2866 hexify( dst_str, output, 8 );
2868 fct_chk( strcmp( (
char *) dst_str,
"80c7d7d45a5479ad" ) == 0 );
2874 FCT_TEST_BGN(blowfish_setkey_setkey_ssleay_reference_24)
2876 unsigned char key_str[100];
2877 unsigned char src_str[100];
2878 unsigned char dst_str[100];
2879 unsigned char output[100];
2883 memset(key_str, 0x00, 100);
2884 memset(src_str, 0x00, 100);
2885 memset(dst_str, 0x00, 100);
2886 memset(output, 0x00, 100);
2888 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f0011223344556677" );
2889 unhexify( src_str,
"fedcba9876543210" );
2895 hexify( dst_str, output, 8 );
2897 fct_chk( strcmp( (
char *) dst_str,
"05044b62fa52d080" ) == 0 );
2903 FCT_TEST_BGN(blowfish_setkey_setkey_440_bits)
2905 unsigned char key_str[100];
2906 unsigned char src_str[100];
2907 unsigned char dst_str[100];
2908 unsigned char output[100];
2912 memset(key_str, 0x00, 100);
2913 memset(src_str, 0x00, 100);
2914 memset(dst_str, 0x00, 100);
2915 memset(output, 0x00, 100);
2917 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f00112233445566778899aabbccddeeff0123456789abcdef0102030405060708090a0b0c0d0e0f" );
2918 unhexify( src_str,
"fedcba9876543210" );
2924 hexify( dst_str, output, 8 );
2926 fct_chk( strcmp( (
char *) dst_str,
"9a2ab8f1b00c73d2" ) == 0 );
2932 FCT_TEST_BGN(blowfish_setkey_setkey_448_bits)
2934 unsigned char key_str[100];
2935 unsigned char src_str[100];
2936 unsigned char dst_str[100];
2937 unsigned char output[100];
2941 memset(key_str, 0x00, 100);
2942 memset(src_str, 0x00, 100);
2943 memset(dst_str, 0x00, 100);
2944 memset(output, 0x00, 100);
2946 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f00112233445566778899aabbccddeeff0123456789abcdef0102030405060708090a0b0c0d0e0fff" );
2947 unhexify( src_str,
"fedcba9876543210" );
2953 hexify( dst_str, output, 8 );
2955 fct_chk( strcmp( (
char *) dst_str,
"2fb3ab7f0ee91b69" ) == 0 );
2961 FCT_TEST_BGN(blowfish_setkey_setkey_456_bits)
2963 unsigned char key_str[100];
2964 unsigned char src_str[100];
2965 unsigned char dst_str[100];
2966 unsigned char output[100];
2970 memset(key_str, 0x00, 100);
2971 memset(src_str, 0x00, 100);
2972 memset(dst_str, 0x00, 100);
2973 memset(output, 0x00, 100);
2975 key_len =
unhexify( key_str,
"f0e1d2c3b4a5968778695a4b3c2d1e0f00112233445566778899aabbccddeeff0123456789abcdef0102030405060708090a0b0c0d0e0fffff" );
2976 unhexify( src_str,
"fedcba9876543210" );
2982 hexify( dst_str, output, 8 );
2984 fct_chk( strcmp( (
char *) dst_str,
"" ) == 0 );
2990 FCT_TEST_BGN(blowfish_cbc_encrypt)
2992 unsigned char key_str[100];
2993 unsigned char iv_str[100];
2994 unsigned char src_str[100];
2995 unsigned char dst_str[100];
2996 unsigned char output[100];
2998 int key_len, data_len;
3000 memset(key_str, 0x00, 100);
3001 memset(iv_str, 0x00, 100);
3002 memset(src_str, 0x00, 100);
3003 memset(dst_str, 0x00, 100);
3004 memset(output, 0x00, 100);
3006 key_len =
unhexify( key_str,
"0123456789ABCDEFF0E1D2C3B4A59687" );
3007 unhexify( iv_str,
"FEDCBA9876543210" );
3008 data_len =
unhexify( src_str,
"37363534333231204E6F77206973207468652074696D6520666F722000000000" );
3015 hexify( dst_str, output, data_len );
3017 fct_chk( strcmp( (
char *) dst_str,
"6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5ff92cc" ) == 0 );
3023 FCT_TEST_BGN(blowfish_cbc_decrypt)
3025 unsigned char key_str[100];
3026 unsigned char iv_str[100];
3027 unsigned char src_str[100];
3028 unsigned char dst_str[100];
3029 unsigned char output[100];
3031 int key_len, data_len;
3033 memset(key_str, 0x00, 100);
3034 memset(iv_str, 0x00, 100);
3035 memset(src_str, 0x00, 100);
3036 memset(dst_str, 0x00, 100);
3037 memset(output, 0x00, 100);
3039 key_len =
unhexify( key_str,
"0123456789ABCDEFF0E1D2C3B4A59687" );
3040 unhexify( iv_str,
"FEDCBA9876543210" );
3041 data_len =
unhexify( src_str,
"6B77B4D63006DEE605B156E27403979358DEB9E7154616D959F1652BD5FF92CC" );
3047 hexify( dst_str, output, data_len );
3049 fct_chk( strcmp( (
char *) dst_str,
"37363534333231204e6f77206973207468652074696d6520666f722000000000" ) == 0 );
3055 FCT_TEST_BGN(blowfish_cbc_encrypt)
3057 unsigned char key_str[100];
3058 unsigned char iv_str[100];
3059 unsigned char src_str[100];
3060 unsigned char dst_str[100];
3061 unsigned char output[100];
3063 int key_len, data_len;
3065 memset(key_str, 0x00, 100);
3066 memset(iv_str, 0x00, 100);
3067 memset(src_str, 0x00, 100);
3068 memset(dst_str, 0x00, 100);
3069 memset(output, 0x00, 100);
3071 key_len =
unhexify( key_str,
"0123456789ABCDEFF0E1D2C3B4A59687" );
3072 unhexify( iv_str,
"FEDCBA9876543210" );
3073 data_len =
unhexify( src_str,
"37363534333231204E6F77206973207468652074696D6520666F7220000000" );
3080 hexify( dst_str, output, data_len );
3082 fct_chk( strcmp( (
char *) dst_str,
"" ) == 0 );
3088 FCT_TEST_BGN(blowfish_cbc_decrypt)
3090 unsigned char key_str[100];
3091 unsigned char iv_str[100];
3092 unsigned char src_str[100];
3093 unsigned char dst_str[100];
3094 unsigned char output[100];
3096 int key_len, data_len;
3098 memset(key_str, 0x00, 100);
3099 memset(iv_str, 0x00, 100);
3100 memset(src_str, 0x00, 100);
3101 memset(dst_str, 0x00, 100);
3102 memset(output, 0x00, 100);
3104 key_len =
unhexify( key_str,
"0123456789ABCDEFF0E1D2C3B4A59687" );
3105 unhexify( iv_str,
"FEDCBA9876543210" );
3106 data_len =
unhexify( src_str,
"6B77B4D63006DEE605B156E27403979358DEB9E7154616D959F1652BD5FF92CC00" );
3112 hexify( dst_str, output, data_len );
3114 fct_chk( strcmp( (
char *) dst_str,
"" ) == 0 );
3120 FCT_TEST_BGN(blowfish_cfb_encrypt)
3122 unsigned char key_str[100];
3123 unsigned char iv_str[100];
3124 unsigned char src_str[100];
3125 unsigned char dst_str[100];
3126 unsigned char output[100];
3128 size_t iv_offset = 0;
3129 int key_len, src_len;
3131 memset(key_str, 0x00, 100);
3132 memset(iv_str, 0x00, 100);
3133 memset(src_str, 0x00, 100);
3134 memset(dst_str, 0x00, 100);
3135 memset(output, 0x00, 100);
3137 key_len =
unhexify( key_str,
"0123456789ABCDEFF0E1D2C3B4A59687" );
3138 unhexify( iv_str,
"FEDCBA9876543210" );
3139 src_len =
unhexify( src_str,
"37363534333231204E6F77206973207468652074696D6520666F722000" );
3143 hexify( dst_str, output, src_len );
3145 fct_chk( strcmp( (
char *) dst_str,
"e73214a2822139caf26ecf6d2eb9e76e3da3de04d1517200519d57a6c3" ) == 0 );
3150 FCT_TEST_BGN(blowfish_cfb_decrypt)
3152 unsigned char key_str[100];
3153 unsigned char iv_str[100];
3154 unsigned char src_str[100];
3155 unsigned char dst_str[100];
3156 unsigned char output[100];
3158 size_t iv_offset = 0;
3159 int key_len, src_len;
3161 memset(key_str, 0x00, 100);
3162 memset(iv_str, 0x00, 100);
3163 memset(src_str, 0x00, 100);
3164 memset(dst_str, 0x00, 100);
3165 memset(output, 0x00, 100);
3167 key_len =
unhexify( key_str,
"0123456789ABCDEFF0E1D2C3B4A59687" );
3168 unhexify( iv_str,
"FEDCBA9876543210" );
3169 src_len =
unhexify( src_str,
"E73214A2822139CAF26ECF6D2EB9E76E3DA3DE04D1517200519D57A6C3" );
3173 hexify( dst_str, output, src_len );
3175 fct_chk( strcmp( (
char *) dst_str,
"37363534333231204e6f77206973207468652074696d6520666f722000" ) == 0 );
3180 FCT_TEST_BGN(blowfish_ctr_encrypt)
3182 unsigned char key_str[100];
3183 unsigned char iv_str[100];
3184 unsigned char stream_str[100];
3185 unsigned char src_str[100];
3186 unsigned char dst_str[100];
3187 unsigned char output[100];
3189 size_t iv_offset = 0;
3190 int key_len, src_len;
3192 memset(key_str, 0x00, 100);
3193 memset(iv_str, 0x00, 100);
3194 memset(stream_str, 0x00, 100);
3195 memset(src_str, 0x00, 100);
3196 memset(dst_str, 0x00, 100);
3197 memset(output, 0x00, 100);
3199 key_len =
unhexify( key_str,
"0123456789ABCDEFF0E1D2C3B4A59687" );
3200 unhexify( iv_str,
"FEDCBA9876543210" );
3201 src_len =
unhexify( src_str,
"37363534333231204E6F77206973207468652074696D6520666F722000" );
3204 fct_chk(
blowfish_crypt_ctr( &ctx, src_len, &iv_offset, iv_str, stream_str, src_str, output ) == 0 );
3205 hexify( dst_str, output, src_len );
3207 fct_chk( strcmp( (
char *) dst_str,
"e73214a2822139ca60254740dd8c5b8acf5e9569c4affeb944b8fc020e" ) == 0 );
3212 FCT_TEST_BGN(blowfish_ctr_decrypt)
3214 unsigned char key_str[100];
3215 unsigned char iv_str[100];
3216 unsigned char stream_str[100];
3217 unsigned char src_str[100];
3218 unsigned char dst_str[100];
3219 unsigned char output[100];
3221 size_t iv_offset = 0;
3222 int key_len, src_len;
3224 memset(key_str, 0x00, 100);
3225 memset(iv_str, 0x00, 100);
3226 memset(stream_str, 0x00, 100);
3227 memset(src_str, 0x00, 100);
3228 memset(dst_str, 0x00, 100);
3229 memset(output, 0x00, 100);
3231 key_len =
unhexify( key_str,
"0123456789ABCDEFF0E1D2C3B4A59687" );
3232 unhexify( iv_str,
"FEDCBA9876543210" );
3233 src_len =
unhexify( src_str,
"e73214a2822139ca60254740dd8c5b8acf5e9569c4affeb944b8fc020e" );
3236 fct_chk(
blowfish_crypt_ctr( &ctx, src_len, &iv_offset, iv_str, stream_str, src_str, output ) == 0 );
3237 hexify( dst_str, output, src_len );
3239 fct_chk( strcmp( (
char *) dst_str,
"37363534333231204e6f77206973207468652074696d6520666f722000" ) == 0 );