mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-27 03:34:21 +01:00
18b08c6f4c
Primality tests have to deal with different distribution when generating primes and when validating primes. These new tests are testing if mbedtls_mpi_is_prime() is working properly in the latter setting. The new tests involve pseudoprimes with maximum number of non-witnesses. The non-witnesses were generated by printing them from mpi_miller_rabin(). The pseudoprimes were generated by the following function: void gen_monier( mbedtls_mpi* res, int nbits ) { mbedtls_mpi p_2x_plus_1, p_4x_plus_1, x, tmp; mbedtls_mpi_init( &p_2x_plus_1 ); mbedtls_mpi_init( &p_4x_plus_1 ); mbedtls_mpi_init( &x ); mbedtls_mpi_init( &tmp ); do { mbedtls_mpi_gen_prime( &p_2x_plus_1, nbits >> 1, 0, rnd_std_rand, NULL ); mbedtls_mpi_sub_int( &x, &p_2x_plus_1, 1 ); mbedtls_mpi_div_int( &x, &tmp, &x, 2 ); if( mbedtls_mpi_get_bit( &x, 0 ) == 0 ) continue; mbedtls_mpi_mul_int( &p_4x_plus_1, &x, 4 ); mbedtls_mpi_add_int( &p_4x_plus_1, &p_4x_plus_1, 1 ); if( mbedtls_mpi_is_prime( &p_4x_plus_1, rnd_std_rand, NULL ) == 0 ) break; } while( 1 ); mbedtls_mpi_mul_mpi( res, &p_2x_plus_1, &p_4x_plus_1 ); } |
||
---|---|---|
.. | ||
helpers.function | ||
main_test.function | ||
test_suite_aes.cbc.data | ||
test_suite_aes.cfb.data | ||
test_suite_aes.ecb.data | ||
test_suite_aes.function | ||
test_suite_aes.rest.data | ||
test_suite_arc4.data | ||
test_suite_arc4.function | ||
test_suite_asn1write.data | ||
test_suite_asn1write.function | ||
test_suite_base64.data | ||
test_suite_base64.function | ||
test_suite_blowfish.data | ||
test_suite_blowfish.function | ||
test_suite_camellia.data | ||
test_suite_camellia.function | ||
test_suite_ccm.data | ||
test_suite_ccm.function | ||
test_suite_cipher.aes.data | ||
test_suite_cipher.arc4.data | ||
test_suite_cipher.blowfish.data | ||
test_suite_cipher.camellia.data | ||
test_suite_cipher.ccm.data | ||
test_suite_cipher.des.data | ||
test_suite_cipher.function | ||
test_suite_cipher.gcm.data | ||
test_suite_cipher.null.data | ||
test_suite_cipher.padding.data | ||
test_suite_ctr_drbg.data | ||
test_suite_ctr_drbg.function | ||
test_suite_debug.data | ||
test_suite_debug.function | ||
test_suite_des.data | ||
test_suite_des.function | ||
test_suite_dhm.data | ||
test_suite_dhm.function | ||
test_suite_ecdh.data | ||
test_suite_ecdh.function | ||
test_suite_ecdsa.data | ||
test_suite_ecdsa.function | ||
test_suite_ecp.data | ||
test_suite_ecp.function | ||
test_suite_entropy.data | ||
test_suite_entropy.function | ||
test_suite_error.data | ||
test_suite_error.function | ||
test_suite_gcm.aes128_de.data | ||
test_suite_gcm.aes128_en.data | ||
test_suite_gcm.aes192_de.data | ||
test_suite_gcm.aes192_en.data | ||
test_suite_gcm.aes256_de.data | ||
test_suite_gcm.aes256_en.data | ||
test_suite_gcm.camellia.data | ||
test_suite_gcm.function | ||
test_suite_hmac_drbg.function | ||
test_suite_hmac_drbg.misc.data | ||
test_suite_hmac_drbg.no_reseed.data | ||
test_suite_hmac_drbg.nopr.data | ||
test_suite_hmac_drbg.pr.data | ||
test_suite_md.data | ||
test_suite_md.function | ||
test_suite_mdx.data | ||
test_suite_mdx.function | ||
test_suite_memory_buffer_alloc.data | ||
test_suite_memory_buffer_alloc.function | ||
test_suite_mpi.data | ||
test_suite_mpi.function | ||
test_suite_pem.data | ||
test_suite_pem.function | ||
test_suite_pk.data | ||
test_suite_pk.function | ||
test_suite_pkcs1_v15.data | ||
test_suite_pkcs1_v15.function | ||
test_suite_pkcs1_v21.data | ||
test_suite_pkcs1_v21.function | ||
test_suite_pkcs5.data | ||
test_suite_pkcs5.function | ||
test_suite_pkparse.data | ||
test_suite_pkparse.function | ||
test_suite_pkwrite.data | ||
test_suite_pkwrite.function | ||
test_suite_rsa.data | ||
test_suite_rsa.function | ||
test_suite_shax.data | ||
test_suite_shax.function | ||
test_suite_ssl.data | ||
test_suite_ssl.function | ||
test_suite_version.data | ||
test_suite_version.function | ||
test_suite_x509parse.data | ||
test_suite_x509parse.function | ||
test_suite_x509write.data | ||
test_suite_x509write.function | ||
test_suite_xtea.data | ||
test_suite_xtea.function |