mbedtls/tests/suites
Janos Follath 18b08c6f4c Bignum: Add tests for primality testing
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 );
}
2018-10-11 15:43:12 +01:00
..
helpers.function generate_code: add #line directives 2018-03-13 19:15:06 +01:00
main_test.function generate_code: add #line directives 2018-03-13 19:15:06 +01:00
test_suite_aes.cbc.data
test_suite_aes.cfb.data The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_aes.ecb.data
test_suite_aes.function The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_aes.rest.data The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_arc4.data The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_arc4.function The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_asn1write.data The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_asn1write.function The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_base64.data Add test for base64 output length 2015-09-30 16:31:10 +02:00
test_suite_base64.function Avoid in-out length in base64 2015-06-02 16:30:35 +01:00
test_suite_blowfish.data The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_blowfish.function The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_camellia.data The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_camellia.function The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_ccm.data Split mbedtls_ccm_init() -> setkey() 2015-04-28 18:02:54 +02:00
test_suite_ccm.function Split mbedtls_ccm_init() -> setkey() 2015-04-28 18:02:54 +02:00
test_suite_cipher.aes.data Add tests for "return plaintext data faster on unpadded decryption" 2018-03-30 05:00:19 -04:00
test_suite_cipher.arc4.data Add tests for "return plaintext data faster on unpadded decryption" 2018-03-30 05:00:19 -04:00
test_suite_cipher.blowfish.data Add tests for "return plaintext data faster on unpadded decryption" 2018-03-30 05:00:19 -04:00
test_suite_cipher.camellia.data Add tests for "return plaintext data faster on unpadded decryption" 2018-03-30 05:00:19 -04:00
test_suite_cipher.ccm.data The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_cipher.des.data Add tests for "return plaintext data faster on unpadded decryption" 2018-03-30 05:00:19 -04:00
test_suite_cipher.function Add tests for "return plaintext data faster on unpadded decryption" 2018-03-30 05:00:19 -04:00
test_suite_cipher.gcm.data Add tests for "return plaintext data faster on unpadded decryption" 2018-03-30 05:00:19 -04:00
test_suite_cipher.null.data Add tests for "return plaintext data faster on unpadded decryption" 2018-03-30 05:00:19 -04:00
test_suite_cipher.padding.data fix bug in get_one_and_zeros_padding() 2018-01-17 23:58:14 +01:00
test_suite_ctr_drbg.data The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_ctr_drbg.function Split mbedtls_ctr_drbg_init() -> seed() 2015-04-28 22:38:08 +02:00
test_suite_debug.data Tests: add omitted dependency on MBEDTLS_ECDSA_C in test_suite_debug 2018-03-05 13:45:36 +01:00
test_suite_debug.function Merging iotssl-457-badtail with development branch 2015-09-03 13:06:01 +01:00
test_suite_des.data The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_des.function The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_dhm.data tests: dhm: Rename Hallman to Hellman 2018-07-06 14:28:02 +01:00
test_suite_dhm.function DHM: Add negative tests for parameter checking 2017-09-21 10:20:23 +01:00
test_suite_ecdh.data The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_ecdh.function Rename ecp_use_known_dp -> mbedtls_ecp_group_load() 2015-05-11 18:46:47 +02:00
test_suite_ecdsa.data Add tests for invalid private parameter in mbedtls_ecdsa_sign 2017-11-20 17:11:42 +00:00
test_suite_ecdsa.function Add tests for invalid private parameter in mbedtls_ecdsa_sign 2017-11-20 17:11:42 +00:00
test_suite_ecp.data Add invalid key tests for curve SECP224K1 2017-02-28 18:55:25 +00:00
test_suite_ecp.function Add invalid key tests for curve SECP224K1 2017-02-28 18:55:25 +00:00
test_suite_entropy.data Correct typo in entropy test suite data 2017-09-08 09:13:49 +01:00
test_suite_entropy.function Guard some tests by presence of strong entropy 2017-09-08 10:20:40 +01:00
test_suite_error.data The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_error.function The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_gcm.aes128_de.data Backport 2.1: check if iv is zero in gcm. 2017-07-20 00:30:44 +02:00
test_suite_gcm.aes128_en.data Backport 2.1: check if iv is zero in gcm. 2017-07-20 00:30:44 +02:00
test_suite_gcm.aes192_de.data Backport 2.1: check if iv is zero in gcm. 2017-07-20 00:30:44 +02:00
test_suite_gcm.aes192_en.data Backport 2.1: check if iv is zero in gcm. 2017-07-20 00:30:44 +02:00
test_suite_gcm.aes256_de.data Backport 2.1: check if iv is zero in gcm. 2017-07-20 00:30:44 +02:00
test_suite_gcm.aes256_en.data Backport 2.1: check if iv is zero in gcm. 2017-07-20 00:30:44 +02:00
test_suite_gcm.camellia.data The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_gcm.function Fix multiple quality issues in the source 2018-06-22 11:22:44 +01:00
test_suite_hmac_drbg.function Split mbedtls_hmac_drbg_init() -> seed{,_buf}() 2015-04-28 22:07:14 +02:00
test_suite_hmac_drbg.misc.data The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_hmac_drbg.no_reseed.data The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_hmac_drbg.nopr.data The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_hmac_drbg.pr.data The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_md.data Allow comments in test data files 2017-10-02 11:26:09 +02:00
test_suite_md.function Fix small issues in tests found by Coverity 2015-06-24 01:08:09 +02:00
test_suite_mdx.data Allow comments in test data files 2017-10-02 11:26:09 +02:00
test_suite_mdx.function Remove individual mdX_file() and shaX_file() 2015-05-28 17:28:38 +02:00
test_suite_memory_buffer_alloc.data Test corner case uses of memory_buffer_alloc.c 2018-01-23 21:03:49 +00:00
test_suite_memory_buffer_alloc.function Test corner case uses of memory_buffer_alloc.c 2018-01-23 21:03:49 +00:00
test_suite_mpi.data Bignum: Add tests for primality testing 2018-10-11 15:43:12 +01:00
test_suite_mpi.function Bignum: Add tests for primality testing 2018-10-11 15:43:12 +01:00
test_suite_pem.data Add negative testing for mbedtls_pem_read_buffer() 2017-05-30 17:01:42 +01:00
test_suite_pem.function Add negative testing for mbedtls_pem_read_buffer() 2017-05-30 17:01:42 +01:00
test_suite_pk.data Fix depends_on:pk_alg in test suites 2018-03-05 13:41:18 +01:00
test_suite_pk.function Merge remote-tracking branch 'upstream-restricted/pr/360' into mbedtls-2.1-restricted-proposed 2018-03-13 17:26:49 +01:00
test_suite_pkcs1_v15.data Fix multiple quality issues in the source 2018-06-22 11:22:44 +01:00
test_suite_pkcs1_v15.function Remove unused code from PKCS1v15 test suite 2016-05-18 19:36:04 +01:00
test_suite_pkcs1_v21.data RSA PSS: fix first byte check for keys of size 8N+1 2017-10-19 15:43:53 +02:00
test_suite_pkcs1_v21.function The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_pkcs5.data tests/pkcs5/pbkdf2_hmac: add unit tests for additional SHA algorithms 2018-02-14 11:12:58 +01:00
test_suite_pkcs5.function Fix test dependencies of pkcs5 pbs2 on asn1 parse 2018-03-27 21:33:07 +01:00
test_suite_pkparse.data Change test dependencies to RC4 from DES 2018-07-27 17:33:54 +01:00
test_suite_pkparse.function Remove redundant dependency 2017-09-22 11:07:31 +01:00
test_suite_pkwrite.data The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_pkwrite.function Finish test in pkwrite 2015-08-19 10:24:34 +02:00
test_suite_rsa.data Allow comments in test data files 2017-10-02 11:26:09 +02:00
test_suite_rsa.function Fix depends_on:pk_alg in test suites 2018-03-05 13:41:18 +01:00
test_suite_shax.data Allow comments in test data files 2017-10-02 11:26:09 +02:00
test_suite_shax.function Remove individual mdX_file() and shaX_file() 2015-05-28 17:28:38 +02:00
test_suite_ssl.data Add test case calling ssl_set_hostname twice 2017-09-30 23:47:44 +01:00
test_suite_ssl.function Fix multiple quality issues in the source 2018-06-22 11:22:44 +01:00
test_suite_version.data Update library version number to 2.1.15 2018-08-31 16:10:48 +01:00
test_suite_version.function Fix some test deps 2018-03-27 23:22:34 +02:00
test_suite_x509parse.data Fix some test deps 2018-03-27 23:22:34 +02:00
test_suite_x509parse.function Fix test that didn't check full value of flags 2018-03-05 13:45:05 +01:00
test_suite_x509write.data Extend tests/data_files/Makefile to include CRT's for CRT write test 2017-10-04 14:36:38 +01:00
test_suite_x509write.function Fix remaining issues found by depend-pkalgs 2018-03-12 15:52:53 +01:00
test_suite_xtea.data The Great Renaming 2015-04-08 13:25:31 +02:00
test_suite_xtea.function The Great Renaming 2015-04-08 13:25:31 +02:00