diff --git a/include/mbedtls/build_info.h b/include/mbedtls/build_info.h index 86a3e161d4..bfbf9de57e 100644 --- a/include/mbedtls/build_info.h +++ b/include/mbedtls/build_info.h @@ -87,9 +87,10 @@ #define MBEDTLS_MD_LIGHT #endif -/* Auto-enable MBEDTLS_MD_LIGHT it one module needs it. +/* Auto-enable MBEDTLS_MD_LIGHT if some module needs it. */ -#if defined(MBEDTLS_PEM_PARSE_C) +#if defined(MBEDTLS_PEM_PARSE_C) || \ + defined(MBEDTLS_RSA_C) #define MBEDTLS_MD_LIGHT #endif diff --git a/library/rsa.c b/library/rsa.c index 7159588e76..584b363cb0 100644 --- a/library/rsa.c +++ b/library/rsa.c @@ -2344,7 +2344,7 @@ void mbedtls_rsa_free(mbedtls_rsa_context *ctx) #if defined(MBEDTLS_SELF_TEST) -#include "mbedtls/sha1.h" +#include "mbedtls/md.h" /* * Example RSA-1024 keypair, for test purposes @@ -2508,7 +2508,8 @@ int mbedtls_rsa_self_test(int verbose) mbedtls_printf(" PKCS#1 data sign : "); } - if (mbedtls_sha1(rsa_plaintext, PT_LEN, sha1sum) != 0) { + if (mbedtls_md(mbedtls_md_info_from_type(MBEDTLS_MD_SHA1), + rsa_plaintext, PT_LEN, sha1sum) != 0) { if (verbose != 0) { mbedtls_printf("failed\n"); }