Lines Matching full:0
75 memset(ctx, 0, sizeof(mbedtls_ctr_drbg_context)); in mbedtls_ctr_drbg_init()
152 return 0; in mbedtls_ctr_drbg_set_nonce_len()
170 int ret = 0; in block_cipher_df()
189 memset(buf, 0, MBEDTLS_CTR_DRBG_MAX_SEED_INPUT + in block_cipher_df()
196 * data || 0x80 in block_cipher_df()
200 MBEDTLS_PUT_UINT32_BE(data_len, p, 0); in block_cipher_df()
204 p[data_len] = 0x80; in block_cipher_df()
208 for (i = 0; i < MBEDTLS_CTR_DRBG_KEYSIZE; i++) { in block_cipher_df()
216 MBEDTLS_CTR_DRBG_KEYBITS)) != 0) { in block_cipher_df()
230 for (j = 0; j < MBEDTLS_CTR_DRBG_SEEDLEN; j += MBEDTLS_CTR_DRBG_BLOCKSIZE) { in block_cipher_df()
232 memset(chain, 0, MBEDTLS_CTR_DRBG_BLOCKSIZE); in block_cipher_df()
235 while (use_len > 0) { in block_cipher_df()
243 chain, chain)) != 0) { in block_cipher_df()
269 MBEDTLS_CTR_DRBG_KEYBITS)) != 0) { in block_cipher_df()
284 for (j = 0; j < MBEDTLS_CTR_DRBG_SEEDLEN; j += MBEDTLS_CTR_DRBG_BLOCKSIZE) { in block_cipher_df()
287 iv, iv)) != 0) { in block_cipher_df()
314 if (0 != ret) { in block_cipher_df()
338 int ret = 0; in ctr_drbg_update_internal()
344 memset(tmp, 0, MBEDTLS_CTR_DRBG_SEEDLEN); in ctr_drbg_update_internal()
346 for (j = 0; j < MBEDTLS_CTR_DRBG_SEEDLEN; j += MBEDTLS_CTR_DRBG_BLOCKSIZE) { in ctr_drbg_update_internal()
357 ctx->counter, p)) != 0) { in ctr_drbg_update_internal()
379 MBEDTLS_CTR_DRBG_KEYBITS)) != 0) { in ctr_drbg_update_internal()
405 * ctx->counter = all-bits-0
406 * ctx->aes_ctx = context from all-bits-0 key
418 if (add_len == 0) { in mbedtls_ctr_drbg_update()
419 return 0; in mbedtls_ctr_drbg_update()
422 if ((ret = block_cipher_df(add_input, additional, add_len)) != 0) { in mbedtls_ctr_drbg_update()
425 if ((ret = ctr_drbg_update_internal(ctx, add_input)) != 0) { in mbedtls_ctr_drbg_update()
453 size_t seedlen = 0; in mbedtls_ctr_drbg_reseed_internal()
466 memset(seed, 0, MBEDTLS_CTR_DRBG_MAX_SEED_INPUT); in mbedtls_ctr_drbg_reseed_internal()
469 if (0 != ctx->f_entropy(ctx->p_entropy, seed, ctx->entropy_len)) { in mbedtls_ctr_drbg_reseed_internal()
475 if (nonce_len != 0) { in mbedtls_ctr_drbg_reseed_internal()
476 if (0 != ctx->f_entropy(ctx->p_entropy, seed + seedlen, nonce_len)) { in mbedtls_ctr_drbg_reseed_internal()
483 if (additional != NULL && len != 0) { in mbedtls_ctr_drbg_reseed_internal()
489 if ((ret = block_cipher_df(seed, seed, seedlen)) != 0) { in mbedtls_ctr_drbg_reseed_internal()
494 if ((ret = ctr_drbg_update_internal(ctx, seed)) != 0) { in mbedtls_ctr_drbg_reseed_internal()
507 return mbedtls_ctr_drbg_reseed_internal(ctx, additional, len, 0); in mbedtls_ctr_drbg_reseed()
518 return 0; in good_nonce_len()
545 memset(key, 0, MBEDTLS_CTR_DRBG_KEYSIZE); in mbedtls_ctr_drbg_seed()
555 if (ctx->entropy_len == 0) { in mbedtls_ctr_drbg_seed()
562 nonce_len = (ctx->reseed_counter >= 0 ? in mbedtls_ctr_drbg_seed()
569 MBEDTLS_CTR_DRBG_KEYBITS)) != 0) { in mbedtls_ctr_drbg_seed()
584 nonce_len)) != 0) { in mbedtls_ctr_drbg_seed()
587 return 0; in mbedtls_ctr_drbg_seed()
613 int ret = 0; in mbedtls_ctr_drbg_random_with_add()
630 memset(locals.add_input, 0, MBEDTLS_CTR_DRBG_SEEDLEN); in mbedtls_ctr_drbg_random_with_add()
634 if ((ret = mbedtls_ctr_drbg_reseed(ctx, additional, add_len)) != 0) { in mbedtls_ctr_drbg_random_with_add()
637 add_len = 0; in mbedtls_ctr_drbg_random_with_add()
640 if (add_len > 0) { in mbedtls_ctr_drbg_random_with_add()
641 if ((ret = block_cipher_df(locals.add_input, additional, add_len)) != 0) { in mbedtls_ctr_drbg_random_with_add()
644 if ((ret = ctr_drbg_update_internal(ctx, locals.add_input)) != 0) { in mbedtls_ctr_drbg_random_with_add()
649 while (output_len > 0) { in mbedtls_ctr_drbg_random_with_add()
660 ctx->counter, locals.tmp)) != 0) { in mbedtls_ctr_drbg_random_with_add()
685 if ((ret = ctr_drbg_update_internal(ctx, locals.add_input)) != 0) { in mbedtls_ctr_drbg_random_with_add()
703 if ((ret = mbedtls_mutex_lock(&ctx->mutex)) != 0) { in mbedtls_ctr_drbg_random()
708 ret = mbedtls_ctr_drbg_random_with_add(ctx, output, output_len, NULL, 0); in mbedtls_ctr_drbg_random()
711 if (mbedtls_mutex_unlock(&ctx->mutex) != 0) { in mbedtls_ctr_drbg_random()
735 MBEDTLS_CTR_DRBG_MAX_INPUT)) != 0) { in mbedtls_ctr_drbg_write_seed_file()
743 ret = 0; in mbedtls_ctr_drbg_write_seed_file()
756 int ret = 0; in mbedtls_ctr_drbg_update_seed_file()
770 if (fread(&c, 1, 1, f) != 0) { in mbedtls_ctr_drbg_update_seed_file()
774 if (n == 0 || ferror(f)) { in mbedtls_ctr_drbg_update_seed_file()
788 if (ret != 0) { in mbedtls_ctr_drbg_update_seed_file()
807 * [AdditionalInputLen = 0]
815 * [AdditionalInputLen = 0]
822 { 0x04, 0xd9, 0x49, 0xa6, 0xdc, 0xe8, 0x6e, 0xbb,
823 0xf1, 0x08, 0x77, 0x2b, 0x9e, 0x08, 0xca, 0x92,
824 0x65, 0x16, 0xda, 0x99, 0xa2, 0x59, 0xf3, 0xe8,
825 0x38, 0x7e, 0x3f, 0x6b, 0x51, 0x70, 0x7b, 0x20,
826 0xec, 0x53, 0xd0, 0x66, 0xc3, 0x0f, 0xe3, 0xb0,
827 0xe0, 0x86, 0xa6, 0xaa, 0x5f, 0x72, 0x2f, 0xad,
828 0xf7, 0xef, 0x06, 0xb8, 0xd6, 0x9c, 0x9d, 0xe8 };
831 { 0x07, 0x0d, 0x59, 0x63, 0x98, 0x73, 0xa5, 0x45,
832 0x27, 0x38, 0x22, 0x7b, 0x76, 0x85, 0xd1, 0xa9,
833 0x74, 0x18, 0x1f, 0x3c, 0x22, 0xf6, 0x49, 0x20,
834 0x4a, 0x47, 0xc2, 0xf3, 0x85, 0x16, 0xb4, 0x6f,
835 0x00, 0x2e, 0x71, 0xda, 0xed, 0x16, 0x9b, 0x5c };
838 { 0xbf, 0xa4, 0x9a, 0x8f, 0x7b, 0xd8, 0xb1, 0x7a,
839 0x9d, 0xfa, 0x45, 0xed, 0x21, 0x52, 0xb3, 0xad };
842 { 0x4e, 0x61, 0x79, 0xd4, 0xc2, 0x72, 0xa1, 0x4c,
843 0xf1, 0x3d, 0xf6, 0x5e, 0xa3, 0xa6, 0xe5, 0x0f };
846 { 0xc9, 0x0a, 0xaf, 0x85, 0x89, 0x71, 0x44, 0x66,
847 0x4f, 0x25, 0x0b, 0x2b, 0xde, 0xd8, 0xfa, 0xff,
848 0x52, 0x5a, 0x1b, 0x32, 0x5e, 0x41, 0x7a, 0x10,
849 0x1f, 0xef, 0x1e, 0x62, 0x23, 0xe9, 0x20, 0x30,
850 0xc9, 0x0d, 0xad, 0x69, 0xb4, 0x9c, 0x5b, 0xf4,
851 0x87, 0x42, 0xd5, 0xae, 0x5e, 0x5e, 0x43, 0xcc,
852 0xd9, 0xfd, 0x0b, 0x93, 0x4a, 0xe3, 0xd4, 0x06,
853 0x37, 0x36, 0x0f, 0x3f, 0x72, 0x82, 0x0c, 0xcf };
856 { 0x31, 0xc9, 0x91, 0x09, 0xf8, 0xc5, 0x10, 0x13,
857 0x3c, 0xd3, 0x96, 0xf9, 0xbc, 0x2c, 0x12, 0xc0,
858 0x7c, 0xc1, 0x61, 0x5f, 0xa3, 0x09, 0x99, 0xaf,
859 0xd7, 0xf2, 0x36, 0xfd, 0x40, 0x1a, 0x8b, 0xf2,
860 0x33, 0x38, 0xee, 0x1d, 0x03, 0x5f, 0x83, 0xb7,
861 0xa2, 0x53, 0xdc, 0xee, 0x18, 0xfc, 0xa7, 0xf2,
862 0xee, 0x96, 0xc6, 0xc2, 0xcd, 0x0c, 0xff, 0x02,
863 0x76, 0x70, 0x69, 0xaa, 0x69, 0xd1, 0x3b, 0xe8 };
867 { 0xca, 0x58, 0xfd, 0xf2, 0xb9, 0x77, 0xcb, 0x49,
868 0xd4, 0xe0, 0x5b, 0xe2, 0x39, 0x50, 0xd9, 0x8a,
869 0x6a, 0xb3, 0xc5, 0x2f, 0xdf, 0x74, 0xd5, 0x85,
870 0x8f, 0xd1, 0xba, 0x64, 0x54, 0x7b, 0xdb, 0x1e,
871 0xc5, 0xea, 0x24, 0xc0, 0xfa, 0x0c, 0x90, 0x15,
872 0x09, 0x20, 0x92, 0x42, 0x32, 0x36, 0x45, 0x45,
873 0x7d, 0x20, 0x76, 0x6b, 0xcf, 0xa2, 0x15, 0xc8,
874 0x2f, 0x9f, 0xbc, 0x88, 0x3f, 0x80, 0xd1, 0x2c,
875 0xb7, 0x16, 0xd1, 0x80, 0x9e, 0xe1, 0xc9, 0xb3,
876 0x88, 0x1b, 0x21, 0x45, 0xef, 0xa1, 0x7f, 0xce,
877 0xc8, 0x92, 0x35, 0x55, 0x2a, 0xd9, 0x1d, 0x8e,
878 0x12, 0x38, 0xac, 0x01, 0x4e, 0x38, 0x18, 0x76,
879 0x9c, 0xf2, 0xb6, 0xd4, 0x13, 0xb6, 0x2c, 0x77,
880 0xc0, 0xe7, 0xe6, 0x0c, 0x47, 0x44, 0x95, 0xbe };
883 { 0x4c, 0xfb, 0x21, 0x86, 0x73, 0x34, 0x6d, 0x9d,
884 0x50, 0xc9, 0x22, 0xe4, 0x9b, 0x0d, 0xfc, 0xd0,
885 0x90, 0xad, 0xf0, 0x4f, 0x5c, 0x3b, 0xa4, 0x73,
886 0x27, 0xdf, 0xcd, 0x6f, 0xa6, 0x3a, 0x78, 0x5c,
887 0x01, 0x69, 0x62, 0xa7, 0xfd, 0x27, 0x87, 0xa2,
888 0x4b, 0xf6, 0xbe, 0x47, 0xef, 0x37, 0x83, 0xf1,
889 0xb7, 0xec, 0x46, 0x07, 0x23, 0x63, 0x83, 0x4a,
890 0x1b, 0x01, 0x33, 0xf2, 0xc2, 0x38, 0x91, 0xdb,
891 0x4f, 0x11, 0xa6, 0x86, 0x51, 0xf2, 0x3e, 0x3a,
892 0x8b, 0x1f, 0xdc, 0x03, 0xb1, 0x92, 0xc7, 0xe7 };
895 { 0x5a, 0x70, 0x95, 0xe9, 0x81, 0x40, 0x52, 0x33,
896 0x91, 0x53, 0x7e, 0x75, 0xd6, 0x19, 0x9d, 0x1e,
897 0xad, 0x0d, 0xc6, 0xa7, 0xde, 0x6c, 0x1f, 0xe0,
898 0xea, 0x18, 0x33, 0xa8, 0x7e, 0x06, 0x20, 0xe9 };
901 { 0x88, 0xee, 0xb8, 0xe0, 0xe8, 0x3b, 0xf3, 0x29,
902 0x4b, 0xda, 0xcd, 0x60, 0x99, 0xeb, 0xe4, 0xbf,
903 0x55, 0xec, 0xd9, 0x11, 0x3f, 0x71, 0xe5, 0xeb,
904 0xcb, 0x45, 0x75, 0xf3, 0xd6, 0xa6, 0x8a, 0x6b };
907 { 0xce, 0x2f, 0xdb, 0xb6, 0xd9, 0xb7, 0x39, 0x85,
908 0x04, 0xc5, 0xc0, 0x42, 0xc2, 0x31, 0xc6, 0x1d,
909 0x9b, 0x5a, 0x59, 0xf8, 0x7e, 0x0d, 0xcc, 0x62,
910 0x7b, 0x65, 0x11, 0x55, 0x10, 0xeb, 0x9e, 0x3d,
911 0xa4, 0xfb, 0x1c, 0x6a, 0x18, 0xc0, 0x74, 0xdb,
912 0xdd, 0xe7, 0x02, 0x23, 0x63, 0x21, 0xd0, 0x39,
913 0xf9, 0xa7, 0xc4, 0x52, 0x84, 0x3b, 0x49, 0x40,
914 0x72, 0x2b, 0xb0, 0x6c, 0x9c, 0xdb, 0xc3, 0x43 };
917 { 0xa5, 0x51, 0x80, 0xa1, 0x90, 0xbe, 0xf3, 0xad,
918 0xaf, 0x28, 0xf6, 0xb7, 0x95, 0xe9, 0xf1, 0xf3,
919 0xd6, 0xdf, 0xa1, 0xb2, 0x7d, 0xd0, 0x46, 0x7b,
920 0x0c, 0x75, 0xf5, 0xfa, 0x93, 0x1e, 0x97, 0x14,
921 0x75, 0xb2, 0x7c, 0xae, 0x03, 0xa2, 0x96, 0x54,
922 0xe2, 0xf4, 0x09, 0x66, 0xea, 0x33, 0x64, 0x30,
923 0x40, 0xd1, 0x40, 0x0f, 0xe6, 0x77, 0x87, 0x3a,
924 0xf8, 0x09, 0x7c, 0x1f, 0xe9, 0xf0, 0x02, 0x98 };
934 return 0; in ctr_drbg_self_test_entropy()
937 #define CHK(c) if ((c) != 0) \
939 if (verbose != 0) \
959 if (verbose != 0) { in mbedtls_ctr_drbg_self_test()
963 test_offset = 0; in mbedtls_ctr_drbg_self_test()
977 if (verbose != 0) { in mbedtls_ctr_drbg_self_test()
984 if (verbose != 0) { in mbedtls_ctr_drbg_self_test()
990 test_offset = 0; in mbedtls_ctr_drbg_self_test()
997 CHK(mbedtls_ctr_drbg_reseed(&ctx, NULL, 0)); in mbedtls_ctr_drbg_self_test()
1004 if (verbose != 0) { in mbedtls_ctr_drbg_self_test()
1008 if (verbose != 0) { in mbedtls_ctr_drbg_self_test()
1012 return 0; in mbedtls_ctr_drbg_self_test()