mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 22:25:47 +01:00
Fixup: Add missing TinyCrypt guards
This commit is contained in:
parent
8239fad855
commit
88889c618e
@ -626,7 +626,8 @@ static inline mbedtls_pk_type_t mbedtls_ssl_get_ciphersuite_sig_alg_internal(
|
|||||||
|
|
||||||
#endif /* MBEDTLS_PK_C */
|
#endif /* MBEDTLS_PK_C */
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
#if defined(MBEDTLS_USE_TINYCRYPT) || \
|
||||||
|
defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
||||||
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||||
static inline int mbedtls_ssl_ciphersuite_uses_ec_internal(
|
static inline int mbedtls_ssl_ciphersuite_uses_ec_internal(
|
||||||
mbedtls_ssl_ciphersuite_handle_t info )
|
mbedtls_ssl_ciphersuite_handle_t info )
|
||||||
@ -645,7 +646,10 @@ static inline int mbedtls_ssl_ciphersuite_uses_ec_internal(
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_ECDH_C || MBEDTLS_ECDSA_C || MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
|
#endif /* MBEDTLS_USE_TINYCRYPT ||
|
||||||
|
MBEDTLS_ECDH_C ||
|
||||||
|
MBEDTLS_ECDSA_C ||
|
||||||
|
MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
|
||||||
|
|
||||||
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
|
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
|
||||||
static inline int mbedtls_ssl_ciphersuite_uses_psk_internal(
|
static inline int mbedtls_ssl_ciphersuite_uses_psk_internal(
|
||||||
@ -684,11 +688,14 @@ mbedtls_pk_type_t mbedtls_ssl_get_ciphersuite_sig_alg(
|
|||||||
mbedtls_ssl_ciphersuite_handle_t info );
|
mbedtls_ssl_ciphersuite_handle_t info );
|
||||||
#endif /* MBEDTLS_PK_C */
|
#endif /* MBEDTLS_PK_C */
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
#if defined(MBEDTLS_USE_TINYCRYPT) || \
|
||||||
|
defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
||||||
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||||
int mbedtls_ssl_ciphersuite_uses_ec( mbedtls_ssl_ciphersuite_handle_t info );
|
int mbedtls_ssl_ciphersuite_uses_ec( mbedtls_ssl_ciphersuite_handle_t info );
|
||||||
#endif /* MBEDTLS_ECDH_C || MBEDTLS_ECDSA_C ||
|
#endif /* MBEDTLS_USE_TINYCRYPT ||
|
||||||
MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED*/
|
MBEDTLS_ECDH_C ||
|
||||||
|
MBEDTLS_ECDSA_C ||
|
||||||
|
MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
|
||||||
|
|
||||||
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
|
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
|
||||||
int mbedtls_ssl_ciphersuite_uses_psk( mbedtls_ssl_ciphersuite_handle_t info );
|
int mbedtls_ssl_ciphersuite_uses_psk( mbedtls_ssl_ciphersuite_handle_t info );
|
||||||
@ -710,15 +717,18 @@ static inline mbedtls_pk_type_t mbedtls_ssl_get_ciphersuite_sig_alg(
|
|||||||
}
|
}
|
||||||
#endif /* MBEDTLS_PK_C */
|
#endif /* MBEDTLS_PK_C */
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
#if defined(MBEDTLS_USE_TINYCRYPT) || \
|
||||||
|
defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
||||||
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||||
static inline int mbedtls_ssl_ciphersuite_uses_ec(
|
static inline int mbedtls_ssl_ciphersuite_uses_ec(
|
||||||
mbedtls_ssl_ciphersuite_handle_t info )
|
mbedtls_ssl_ciphersuite_handle_t info )
|
||||||
{
|
{
|
||||||
return( mbedtls_ssl_ciphersuite_uses_ec_internal( info ) );
|
return( mbedtls_ssl_ciphersuite_uses_ec_internal( info ) );
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_ECDH_C || MBEDTLS_ECDSA_C ||
|
#endif /* MBEDTLS_USE_TINYCRYPT ||
|
||||||
MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED*/
|
MBEDTLS_ECDH_C ||
|
||||||
|
MBEDTLS_ECDSA_C ||
|
||||||
|
MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
|
||||||
|
|
||||||
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
|
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
|
||||||
static inline int mbedtls_ssl_ciphersuite_uses_psk(
|
static inline int mbedtls_ssl_ciphersuite_uses_psk(
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
/* Use CRTs with Secp256r1-only if Secp384r1 is disabled.
|
/* Use CRTs with Secp256r1-only if Secp384r1 is disabled.
|
||||||
* Otherwise, fall back to previous test CRTs using both
|
* Otherwise, fall back to previous test CRTs using both
|
||||||
* Secp256r1 and Secp384r1. */
|
* Secp256r1 and Secp384r1. */
|
||||||
#if !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
|
#if !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) || defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
|
|
||||||
/* This is taken from tests/data_files/test-ca3.crt.pem */
|
/* This is taken from tests/data_files/test-ca3.crt.pem */
|
||||||
/* BEGIN FILE string macro TEST_CA_CRT_EC_PEM tests/data_files/test-ca3.crt.pem */
|
/* BEGIN FILE string macro TEST_CA_CRT_EC_PEM tests/data_files/test-ca3.crt.pem */
|
||||||
@ -135,7 +135,7 @@
|
|||||||
}
|
}
|
||||||
/* END FILE */
|
/* END FILE */
|
||||||
|
|
||||||
#else /* !MBEDTLS_ECP_DP_SECP384R1_ENABLED */
|
#else /* !MBEDTLS_ECP_DP_SECP384R1_ENABLED || MBEDTLS_USE_TINYCRYPT */
|
||||||
|
|
||||||
/* This is taken from tests/data_files/test-ca2.crt */
|
/* This is taken from tests/data_files/test-ca2.crt */
|
||||||
/* BEGIN FILE string macro TEST_CA_CRT_EC_PEM tests/data_files/test-ca2.crt */
|
/* BEGIN FILE string macro TEST_CA_CRT_EC_PEM tests/data_files/test-ca2.crt */
|
||||||
@ -241,7 +241,7 @@
|
|||||||
}
|
}
|
||||||
/* END FILE */
|
/* END FILE */
|
||||||
|
|
||||||
#endif /* MBEDTLS_ECP_DP_SECP384R1_ENABLED */
|
#endif /* MBEDTLS_ECP_DP_SECP384R1_ENABLED || MBEDTLS_USE_TINYCRYPT */
|
||||||
|
|
||||||
#define TEST_CA_PWD_EC_PEM "PolarSSLTest"
|
#define TEST_CA_PWD_EC_PEM "PolarSSLTest"
|
||||||
|
|
||||||
@ -607,7 +607,7 @@
|
|||||||
/* Use CRTs with Secp256r1-only if Secp384r1 is disabled.
|
/* Use CRTs with Secp256r1-only if Secp384r1 is disabled.
|
||||||
* Otherwise, fall back to previous test CRTs using both
|
* Otherwise, fall back to previous test CRTs using both
|
||||||
* Secp256r1 and Secp384r1. */
|
* Secp256r1 and Secp384r1. */
|
||||||
#if !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
|
#if !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) || defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
|
|
||||||
/* This is taken from tests/data_files/server11.crt.pem. */
|
/* This is taken from tests/data_files/server11.crt.pem. */
|
||||||
/* BEGIN FILE string macro TEST_SRV_CRT_EC_PEM tests/data_files/server11.crt.pem */
|
/* BEGIN FILE string macro TEST_SRV_CRT_EC_PEM tests/data_files/server11.crt.pem */
|
||||||
@ -696,7 +696,7 @@
|
|||||||
}
|
}
|
||||||
/* END FILE */
|
/* END FILE */
|
||||||
|
|
||||||
#else /* MBEDTLS_ECP_DP_SECP384R1_ENABLED */
|
#else /* MBEDTLS_ECP_DP_SECP384R1_ENABLED || MBEDTLS_USE_TINYCRYPT */
|
||||||
|
|
||||||
/* This is taken from tests/data_files/server5.crt. */
|
/* This is taken from tests/data_files/server5.crt. */
|
||||||
/* BEGIN FILE string macro TEST_SRV_CRT_EC_PEM tests/data_files/server5.crt */
|
/* BEGIN FILE string macro TEST_SRV_CRT_EC_PEM tests/data_files/server5.crt */
|
||||||
@ -796,7 +796,7 @@
|
|||||||
}
|
}
|
||||||
/* END FILE */
|
/* END FILE */
|
||||||
|
|
||||||
#endif /* MBEDTLS_ECP_DP_SECP384R1_ENABLED */
|
#endif /* MBEDTLS_ECP_DP_SECP384R1_ENABLED || MBEDTLS_USE_TINYCRYPT */
|
||||||
|
|
||||||
/* This is taken from tests/data_files/server2-sha256.crt. */
|
/* This is taken from tests/data_files/server2-sha256.crt. */
|
||||||
/* BEGIN FILE string macro TEST_SRV_CRT_RSA_SHA256_PEM tests/data_files/server2-sha256.crt */
|
/* BEGIN FILE string macro TEST_SRV_CRT_RSA_SHA256_PEM tests/data_files/server2-sha256.crt */
|
||||||
@ -1152,7 +1152,7 @@
|
|||||||
/* Use CRTs with Secp256r1-only if Secp384r1 is disabled.
|
/* Use CRTs with Secp256r1-only if Secp384r1 is disabled.
|
||||||
* Otherwise, fall back to previous test CRTs using both
|
* Otherwise, fall back to previous test CRTs using both
|
||||||
* Secp256r1 and Secp384r1. */
|
* Secp256r1 and Secp384r1. */
|
||||||
#if !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
|
#if !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) || defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
|
|
||||||
/* This is taken from tests/data_files/cli3.crt. */
|
/* This is taken from tests/data_files/cli3.crt. */
|
||||||
/* BEGIN FILE string macro TEST_CLI_CRT_EC_PEM tests/data_files/cli3.crt.pem */
|
/* BEGIN FILE string macro TEST_CLI_CRT_EC_PEM tests/data_files/cli3.crt.pem */
|
||||||
@ -1242,7 +1242,7 @@
|
|||||||
}
|
}
|
||||||
/* END FILE */
|
/* END FILE */
|
||||||
|
|
||||||
#else /* MBEDTLS_ECP_DP_SECP384R1_ENABLED */
|
#else /* MBEDTLS_ECP_DP_SECP384R1_ENABLED || MBEDTLS_USE_TINYCRYPT */
|
||||||
|
|
||||||
/* This is taken from tests/data_files/cli2.crt. */
|
/* This is taken from tests/data_files/cli2.crt. */
|
||||||
/* BEGIN FILE string macro TEST_CLI_CRT_EC_PEM tests/data_files/cli2.crt */
|
/* BEGIN FILE string macro TEST_CLI_CRT_EC_PEM tests/data_files/cli2.crt */
|
||||||
@ -1336,7 +1336,7 @@
|
|||||||
}
|
}
|
||||||
/* END FILE */
|
/* END FILE */
|
||||||
|
|
||||||
#endif /* MBEDTLS_ECP_DP_SECP384R1_ENABLED */
|
#endif /* MBEDTLS_ECP_DP_SECP384R1_ENABLED || MBEDTLS_USE_TINYCRYPT */
|
||||||
|
|
||||||
/* This is taken from tests/data_files/cli-rsa-sha256.crt. */
|
/* This is taken from tests/data_files/cli-rsa-sha256.crt. */
|
||||||
/* BEGIN FILE string macro TEST_CLI_CRT_RSA_PEM tests/data_files/cli-rsa-sha256.crt */
|
/* BEGIN FILE string macro TEST_CLI_CRT_RSA_PEM tests/data_files/cli-rsa-sha256.crt */
|
||||||
@ -1975,9 +1975,9 @@ const char * mbedtls_test_cas[] = {
|
|||||||
#if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_SHA256_C)
|
#if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_SHA256_C)
|
||||||
mbedtls_test_ca_crt_rsa_sha256,
|
mbedtls_test_ca_crt_rsa_sha256,
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_ECDSA_C)
|
#if defined(MBEDTLS_ECDSA_C) || defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
mbedtls_test_ca_crt_ec,
|
mbedtls_test_ca_crt_ec,
|
||||||
#endif
|
#endif /* MBEDTLS_ECDSA_C || MBEDTLS_USE_TINYCRYPT */
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
const size_t mbedtls_test_cas_len[] = {
|
const size_t mbedtls_test_cas_len[] = {
|
||||||
@ -1987,9 +1987,9 @@ const size_t mbedtls_test_cas_len[] = {
|
|||||||
#if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_SHA256_C)
|
#if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_SHA256_C)
|
||||||
sizeof( mbedtls_test_ca_crt_rsa_sha256 ),
|
sizeof( mbedtls_test_ca_crt_rsa_sha256 ),
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_ECDSA_C)
|
#if defined(MBEDTLS_ECDSA_C) || defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
sizeof( mbedtls_test_ca_crt_ec ),
|
sizeof( mbedtls_test_ca_crt_ec ),
|
||||||
#endif
|
#endif /* MBEDTLS_ECDSA_C || MBEDTLS_USE_TINYCRYPT */
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2003,9 +2003,9 @@ const unsigned char * mbedtls_test_cas_der[] = {
|
|||||||
mbedtls_test_ca_crt_rsa_sha1_der,
|
mbedtls_test_ca_crt_rsa_sha1_der,
|
||||||
#endif /* MBEDTLS_SHA1_C */
|
#endif /* MBEDTLS_SHA1_C */
|
||||||
#endif /* MBEDTLS_RSA_C */
|
#endif /* MBEDTLS_RSA_C */
|
||||||
#if defined(MBEDTLS_ECDSA_C)
|
#if defined(MBEDTLS_ECDSA_C) || defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
mbedtls_test_ca_crt_ec_der,
|
mbedtls_test_ca_crt_ec_der,
|
||||||
#endif /* MBEDTLS_ECDSA_C */
|
#endif /* MBEDTLS_ECDSA_C || MBEDTLS_USE_TINYCRYPT */
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2018,9 +2018,9 @@ const size_t mbedtls_test_cas_der_len[] = {
|
|||||||
sizeof( mbedtls_test_ca_crt_rsa_sha1_der ),
|
sizeof( mbedtls_test_ca_crt_rsa_sha1_der ),
|
||||||
#endif /* MBEDTLS_SHA1_C */
|
#endif /* MBEDTLS_SHA1_C */
|
||||||
#endif /* MBEDTLS_RSA_C */
|
#endif /* MBEDTLS_RSA_C */
|
||||||
#if defined(MBEDTLS_ECDSA_C)
|
#if defined(MBEDTLS_ECDSA_C) || defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
sizeof( mbedtls_test_ca_crt_ec_der ),
|
sizeof( mbedtls_test_ca_crt_ec_der ),
|
||||||
#endif /* MBEDTLS_ECDSA_C */
|
#endif /* MBEDTLS_ECDSA_C || MBEDTLS_USE_TINYCRYPT */
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2035,9 +2035,9 @@ const char mbedtls_test_cas_pem[] =
|
|||||||
TEST_CA_CRT_RSA_SHA1_PEM
|
TEST_CA_CRT_RSA_SHA1_PEM
|
||||||
#endif /* MBEDTLS_SHA1_C */
|
#endif /* MBEDTLS_SHA1_C */
|
||||||
#endif /* MBEDTLS_RSA_C */
|
#endif /* MBEDTLS_RSA_C */
|
||||||
#if defined(MBEDTLS_ECDSA_C)
|
#if defined(MBEDTLS_ECDSA_C) || defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
TEST_CA_CRT_EC_PEM
|
TEST_CA_CRT_EC_PEM
|
||||||
#endif /* MBEDTLS_ECDSA_C */
|
#endif /* MBEDTLS_ECDSA_C || MBEDTLS_USE_TINYCRYPT */
|
||||||
"";
|
"";
|
||||||
const size_t mbedtls_test_cas_pem_len = sizeof( mbedtls_test_cas_pem );
|
const size_t mbedtls_test_cas_pem_len = sizeof( mbedtls_test_cas_pem );
|
||||||
#endif /* MBEDTLS_PEM_PARSE_C */
|
#endif /* MBEDTLS_PEM_PARSE_C */
|
||||||
|
@ -385,7 +385,7 @@ static const oid_sig_alg_t oid_sig_alg[] =
|
|||||||
},
|
},
|
||||||
#endif /* MBEDTLS_SHA1_C */
|
#endif /* MBEDTLS_SHA1_C */
|
||||||
#endif /* MBEDTLS_RSA_C */
|
#endif /* MBEDTLS_RSA_C */
|
||||||
#if defined(MBEDTLS_ECDSA_C)
|
#if defined(MBEDTLS_ECDSA_C) || defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
#if defined(MBEDTLS_SHA1_C)
|
#if defined(MBEDTLS_SHA1_C)
|
||||||
{
|
{
|
||||||
OID_DESCRIPTOR( MBEDTLS_OID_ECDSA_SHA1, "ecdsa-with-SHA1", "ECDSA with SHA1" ),
|
OID_DESCRIPTOR( MBEDTLS_OID_ECDSA_SHA1, "ecdsa-with-SHA1", "ECDSA with SHA1" ),
|
||||||
@ -412,7 +412,7 @@ static const oid_sig_alg_t oid_sig_alg[] =
|
|||||||
MBEDTLS_MD_SHA512, MBEDTLS_PK_ECDSA,
|
MBEDTLS_MD_SHA512, MBEDTLS_PK_ECDSA,
|
||||||
},
|
},
|
||||||
#endif /* MBEDTLS_SHA512_C */
|
#endif /* MBEDTLS_SHA512_C */
|
||||||
#endif /* MBEDTLS_ECDSA_C */
|
#endif /* MBEDTLS_ECDSA_C || MBEDTLS_USE_TINYCRYPT */
|
||||||
#if defined(MBEDTLS_RSA_C)
|
#if defined(MBEDTLS_RSA_C)
|
||||||
{
|
{
|
||||||
OID_DESCRIPTOR( MBEDTLS_OID_RSASSA_PSS, "RSASSA-PSS", "RSASSA-PSS" ),
|
OID_DESCRIPTOR( MBEDTLS_OID_RSASSA_PSS, "RSASSA-PSS", "RSASSA-PSS" ),
|
||||||
|
@ -228,11 +228,11 @@ int mbedtls_pk_write_pubkey( unsigned char **p, unsigned char *start,
|
|||||||
MBEDTLS_ASN1_CHK_ADD( len, pk_write_rsa_pubkey( p, start, mbedtls_pk_rsa( *key ) ) );
|
MBEDTLS_ASN1_CHK_ADD( len, pk_write_rsa_pubkey( p, start, mbedtls_pk_rsa( *key ) ) );
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_ECP_C)
|
#if defined(MBEDTLS_ECP_C) || defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
if( mbedtls_pk_get_type( key ) == MBEDTLS_PK_ECKEY )
|
if( mbedtls_pk_get_type( key ) == MBEDTLS_PK_ECKEY )
|
||||||
MBEDTLS_ASN1_CHK_ADD( len, pk_write_ec_pubkey( p, start, key ) );
|
MBEDTLS_ASN1_CHK_ADD( len, pk_write_ec_pubkey( p, start, key ) );
|
||||||
else
|
else
|
||||||
#endif
|
#endif /* MBEDTLS_ECP_C || MBEDTLS_USE_TINYCRYPT */
|
||||||
return( MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE );
|
return( MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE );
|
||||||
|
|
||||||
return( (int) len );
|
return( (int) len );
|
||||||
@ -274,12 +274,12 @@ int mbedtls_pk_write_pubkey_der( mbedtls_pk_context *key, unsigned char *buf, si
|
|||||||
return( ret );
|
return( ret );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECP_C)
|
#if defined(MBEDTLS_ECP_C) || defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
if( mbedtls_pk_get_type( key ) == MBEDTLS_PK_ECKEY )
|
if( mbedtls_pk_get_type( key ) == MBEDTLS_PK_ECKEY )
|
||||||
{
|
{
|
||||||
MBEDTLS_ASN1_CHK_ADD( par_len, pk_write_ec_param( &c, buf, key ) );
|
MBEDTLS_ASN1_CHK_ADD( par_len, pk_write_ec_param( &c, buf, key ) );
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* MBEDTLS_ECP_C || MBEDTLS_USE_TINYCRYPT */
|
||||||
|
|
||||||
MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_algorithm_identifier( &c, buf, oid, oid_len,
|
MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_algorithm_identifier( &c, buf, oid, oid_len,
|
||||||
par_len ) );
|
par_len ) );
|
||||||
@ -383,7 +383,7 @@ int mbedtls_pk_write_key_der( mbedtls_pk_context *key, unsigned char *buf, size_
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* MBEDTLS_RSA_C */
|
#endif /* MBEDTLS_RSA_C */
|
||||||
#if defined(MBEDTLS_ECP_C)
|
#if defined(MBEDTLS_ECP_C) || defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
if( mbedtls_pk_get_type( key ) == MBEDTLS_PK_ECKEY )
|
if( mbedtls_pk_get_type( key ) == MBEDTLS_PK_ECKEY )
|
||||||
{
|
{
|
||||||
size_t pub_len = 0, par_len = 0;
|
size_t pub_len = 0, par_len = 0;
|
||||||
@ -435,7 +435,7 @@ int mbedtls_pk_write_key_der( mbedtls_pk_context *key, unsigned char *buf, size_
|
|||||||
MBEDTLS_ASN1_SEQUENCE ) );
|
MBEDTLS_ASN1_SEQUENCE ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* MBEDTLS_ECP_C */
|
#endif /* MBEDTLS_ECP_C || MBEDTLS_USE_TINYCRYPT */
|
||||||
return( MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE );
|
return( MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE );
|
||||||
|
|
||||||
return( (int) len );
|
return( (int) len );
|
||||||
@ -579,15 +579,15 @@ int mbedtls_pk_write_key_pem( mbedtls_pk_context *key, unsigned char *buf, size_
|
|||||||
end = PEM_END_PRIVATE_KEY_RSA;
|
end = PEM_END_PRIVATE_KEY_RSA;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif /* MBEDTLS_RSA_C */
|
||||||
#if defined(MBEDTLS_ECP_C)
|
#if defined(MBEDTLS_ECP_C) || defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
if( mbedtls_pk_get_type( key ) == MBEDTLS_PK_ECKEY )
|
if( mbedtls_pk_get_type( key ) == MBEDTLS_PK_ECKEY )
|
||||||
{
|
{
|
||||||
begin = PEM_BEGIN_PRIVATE_KEY_EC;
|
begin = PEM_BEGIN_PRIVATE_KEY_EC;
|
||||||
end = PEM_END_PRIVATE_KEY_EC;
|
end = PEM_END_PRIVATE_KEY_EC;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif /* MBEDTLS_ECP_C || MBEDTLS_USE_TINYCRYPT */
|
||||||
return( MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE );
|
return( MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE );
|
||||||
|
|
||||||
if( ( ret = mbedtls_pem_write_buffer( begin, end,
|
if( ( ret = mbedtls_pem_write_buffer( begin, end,
|
||||||
|
@ -2307,14 +2307,17 @@ mbedtls_pk_type_t mbedtls_ssl_get_ciphersuite_sig_alg(
|
|||||||
}
|
}
|
||||||
#endif /* MBEDTLS_PK_C */
|
#endif /* MBEDTLS_PK_C */
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
#if defined(MBEDTLS_USE_TINYCRYPT) || \
|
||||||
|
defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
||||||
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||||
int mbedtls_ssl_ciphersuite_uses_ec(
|
int mbedtls_ssl_ciphersuite_uses_ec(
|
||||||
mbedtls_ssl_ciphersuite_handle_t info )
|
mbedtls_ssl_ciphersuite_handle_t info )
|
||||||
{
|
{
|
||||||
return( mbedtls_ssl_ciphersuite_uses_ec_internal( info ) );
|
return( mbedtls_ssl_ciphersuite_uses_ec_internal( info ) );
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_ECDH_C || MBEDTLS_ECDSA_C ||
|
#endif /* MBEDTLS_USE_TINYCRYPT ||
|
||||||
|
MBEDTLS_ECDH_C ||
|
||||||
|
MBEDTLS_ECDSA_C ||
|
||||||
MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
|
MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
|
||||||
|
|
||||||
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
|
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
|
||||||
|
@ -815,7 +815,8 @@ static int ssl_write_client_hello( mbedtls_ssl_context *ssl )
|
|||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
unsigned char *p, *q;
|
unsigned char *p, *q;
|
||||||
unsigned char offer_compress;
|
unsigned char offer_compress;
|
||||||
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
#if defined(MBEDTLS_USE_TINYCRYPT) || \
|
||||||
|
defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
||||||
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||||
int uses_ec = 0;
|
int uses_ec = 0;
|
||||||
#endif
|
#endif
|
||||||
@ -979,7 +980,8 @@ static int ssl_write_client_hello( mbedtls_ssl_context *ssl )
|
|||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, add ciphersuite: %04x",
|
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, add ciphersuite: %04x",
|
||||||
mbedtls_ssl_suite_get_id( ciphersuite_info ) ) );
|
mbedtls_ssl_suite_get_id( ciphersuite_info ) ) );
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
#if defined(MBEDTLS_USE_TINYCRYPT) || \
|
||||||
|
defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
||||||
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||||
uses_ec |= mbedtls_ssl_ciphersuite_uses_ec( ciphersuite_info );
|
uses_ec |= mbedtls_ssl_ciphersuite_uses_ec( ciphersuite_info );
|
||||||
#endif
|
#endif
|
||||||
@ -1076,7 +1078,8 @@ static int ssl_write_client_hello( mbedtls_ssl_context *ssl )
|
|||||||
ext_len += olen;
|
ext_len += olen;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECDH_C) || \
|
#if defined(MBEDTLS_USE_TINYCRYPT) || \
|
||||||
|
defined(MBEDTLS_ECDH_C) || \
|
||||||
defined(MBEDTLS_ECDSA_C) || \
|
defined(MBEDTLS_ECDSA_C) || \
|
||||||
defined(MBEDTLS_USE_TINYCRYPT) || \
|
defined(MBEDTLS_USE_TINYCRYPT) || \
|
||||||
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||||
@ -2058,7 +2061,8 @@ server_picked_valid_suite:
|
|||||||
break;
|
break;
|
||||||
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
|
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
#if defined(MBEDTLS_USE_TINYCRYPT) || \
|
||||||
|
defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
||||||
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||||
case MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS:
|
case MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS:
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found supported_point_formats extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found supported_point_formats extension" ) );
|
||||||
|
@ -2610,7 +2610,7 @@ int main( int argc, char *argv[] )
|
|||||||
}
|
}
|
||||||
key_cert_init = 2;
|
key_cert_init = 2;
|
||||||
#endif /* MBEDTLS_RSA_C */
|
#endif /* MBEDTLS_RSA_C */
|
||||||
#if defined(MBEDTLS_ECDSA_C)
|
#if defined(MBEDTLS_ECDSA_C) || defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
if( ( ret = mbedtls_x509_crt_parse( &srvcert2,
|
if( ( ret = mbedtls_x509_crt_parse( &srvcert2,
|
||||||
(const unsigned char *) mbedtls_test_srv_crt_ec,
|
(const unsigned char *) mbedtls_test_srv_crt_ec,
|
||||||
mbedtls_test_srv_crt_ec_len ) ) != 0 )
|
mbedtls_test_srv_crt_ec_len ) ) != 0 )
|
||||||
@ -2628,7 +2628,7 @@ int main( int argc, char *argv[] )
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
key_cert_init2 = 2;
|
key_cert_init2 = 2;
|
||||||
#endif /* MBEDTLS_ECDSA_C */
|
#endif /* MBEDTLS_ECDSA_C || MBEDTLS_USE_TINYCRYPT */
|
||||||
#endif /* MBEDTLS_CERTS_C */
|
#endif /* MBEDTLS_CERTS_C */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3070,7 +3070,7 @@ int main( int argc, char *argv[] )
|
|||||||
mbedtls_ssl_conf_curves( &conf, curve_list );
|
mbedtls_ssl_conf_curves( &conf, curve_list );
|
||||||
}
|
}
|
||||||
#endif /* !MBEDTLS_SSL_CONF_SINGLE_EC */
|
#endif /* !MBEDTLS_SSL_CONF_SINGLE_EC */
|
||||||
#endif /* MBEDTLS_ECP_C */
|
#endif /* MBEDTLS_ECP_C*/
|
||||||
|
|
||||||
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
|
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
|
||||||
if( strlen( opt.psk ) != 0 && strlen( opt.psk_identity ) != 0 )
|
if( strlen( opt.psk ) != 0 && strlen( opt.psk_identity ) != 0 )
|
||||||
|
Loading…
Reference in New Issue
Block a user