• Hanno Becker's avatar
    Undo API change from SHA1 deprecation · 59df56e9
    Hanno Becker authored
    The previous commit bd5ceee484f201b90a384636ba12de86bd330cba removed
    the definition of the global constants
    - mbedtls_test_ca_crt_rsa_len,
    - mbedtls_test_cli_crt_rsa_len,
    - mbedtls_test_ca_crt_rsa, and
    - mbedtls_test_cli_crt_rsa.
    This commit restores these to maintain ABI compatibility.
    
    Further, it was noticed that without SHA256_C being enabled the
    previous code failed to compile because because the SHA1 resp. SHA256
    certificates were only defined when the respective SHAXXX_C options
    were set, but the emission of the global variable mbedtls_test_ca_crt
    was unconditionally defined through the SHA256
    certificate. Previously, the RSA SHA1 certificate was unconditionally
    defined and used for that.
    
    As a remedy, this commit makes sure some RSA certificate is defined
    and exported through the following rule:
    1. If SHA256_C is active, define an RSA SHA256 certificate and export
       it as mbedtls_test_ca_crt. Also, define SHA1 certificates only if
       SHA1_C is set.
    2. If SHA256_C is not set, always define SHA1 certificate and export
       it as mbedtls_test_ca_crt.
    59df56e9
certs.c 21.1 KB