diff --git a/include/mbedtls/rsa.h b/include/mbedtls/rsa.h index c0a3a8e43..55209b0dc 100644 --- a/include/mbedtls/rsa.h +++ b/include/mbedtls/rsa.h @@ -68,14 +68,15 @@ * The above constants may be used even if the RSA module is compile out, * eg for alternative (PKCS#11) RSA implemenations in the PK layers. */ -#if defined(MBEDTLS_RSA_C) + +#if !defined(MBEDTLS_RSA_ALT) +// Regular implementation +// #ifdef __cplusplus extern "C" { #endif -#if !defined(MBEDTLS_RSA_ALT) - /** * \brief RSA context structure * @@ -125,12 +126,6 @@ typedef struct } mbedtls_rsa_context; -#else - -#include "rsa_alt.h" - -#endif /* MBEDTLS_RSA_ALT */ - /** * \brief Initialize an RSA context * @@ -928,6 +923,18 @@ int mbedtls_rsa_copy( mbedtls_rsa_context *dst, const mbedtls_rsa_context *src ) */ void mbedtls_rsa_free( mbedtls_rsa_context *ctx ); +#ifdef __cplusplus +} +#endif + +#else /* MBEDTLS_RSA_ALT */ +#include "rsa_alt.h" +#endif /* MBEDTLS_RSA_ALT */ + +#ifdef __cplusplus +extern "C" { +#endif + /** * \brief Checkup routine * @@ -939,6 +946,4 @@ int mbedtls_rsa_self_test( int verbose ); } #endif -#endif /* MBEDTLS_RSA_C */ - #endif /* rsa.h */ diff --git a/include/mbedtls/rsa_internal.h b/include/mbedtls/rsa_internal.h index 235347046..080f09f7a 100644 --- a/include/mbedtls/rsa_internal.h +++ b/include/mbedtls/rsa_internal.h @@ -58,8 +58,6 @@ #include "bignum.h" -#if defined(MBEDTLS_RSA_C) - #ifdef __cplusplus extern "C" { #endif @@ -213,7 +211,4 @@ int mbedtls_rsa_validate_crt( const mbedtls_mpi *P, const mbedtls_mpi *Q, const mbedtls_mpi *D, const mbedtls_mpi *DP, const mbedtls_mpi *DQ, const mbedtls_mpi *QP ); - -#endif /* MBEDTLS_RSA_C */ - #endif /* rsa_internal.h */