Add server only guards for psk callback
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
parent
80ca44f33c
commit
8897c07075
3 changed files with 9 additions and 1 deletions
|
@ -1390,10 +1390,12 @@ struct mbedtls_ssl_config
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
|
#if defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
|
||||||
|
#if defined(MBEDTLS_SSL_SRV_C)
|
||||||
/** Callback to retrieve PSK key from identity */
|
/** Callback to retrieve PSK key from identity */
|
||||||
int (*MBEDTLS_PRIVATE(f_psk))(void *, mbedtls_ssl_context *, const unsigned char *, size_t);
|
int (*MBEDTLS_PRIVATE(f_psk))(void *, mbedtls_ssl_context *, const unsigned char *, size_t);
|
||||||
void *MBEDTLS_PRIVATE(p_psk); /*!< context for PSK callback */
|
void *MBEDTLS_PRIVATE(p_psk); /*!< context for PSK callback */
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
|
#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
|
||||||
/** Callback to create & write a cookie for ClientHello verification */
|
/** Callback to create & write a cookie for ClientHello verification */
|
||||||
|
@ -3415,6 +3417,7 @@ int mbedtls_ssl_set_hs_psk_opaque( mbedtls_ssl_context *ssl,
|
||||||
mbedtls_svc_key_id_t psk );
|
mbedtls_svc_key_id_t psk );
|
||||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_SRV_C)
|
||||||
/**
|
/**
|
||||||
* \brief Set the PSK callback (server-side only).
|
* \brief Set the PSK callback (server-side only).
|
||||||
*
|
*
|
||||||
|
@ -3457,6 +3460,7 @@ void mbedtls_ssl_conf_psk_cb( mbedtls_ssl_config *conf,
|
||||||
int (*f_psk)(void *, mbedtls_ssl_context *, const unsigned char *,
|
int (*f_psk)(void *, mbedtls_ssl_context *, const unsigned char *,
|
||||||
size_t),
|
size_t),
|
||||||
void *p_psk );
|
void *p_psk );
|
||||||
|
#endif /* MBEDTLS_SSL_SRV_C */
|
||||||
#endif /* MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED */
|
#endif /* MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED */
|
||||||
|
|
||||||
#if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_SRV_C)
|
#if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_SRV_C)
|
||||||
|
|
|
@ -1795,6 +1795,7 @@ int mbedtls_ssl_set_hs_psk_opaque( mbedtls_ssl_context *ssl,
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_SRV_C)
|
||||||
void mbedtls_ssl_conf_psk_cb( mbedtls_ssl_config *conf,
|
void mbedtls_ssl_conf_psk_cb( mbedtls_ssl_config *conf,
|
||||||
int (*f_psk)(void *, mbedtls_ssl_context *, const unsigned char *,
|
int (*f_psk)(void *, mbedtls_ssl_context *, const unsigned char *,
|
||||||
size_t),
|
size_t),
|
||||||
|
@ -1803,6 +1804,8 @@ void mbedtls_ssl_conf_psk_cb( mbedtls_ssl_config *conf,
|
||||||
conf->f_psk = f_psk;
|
conf->f_psk = f_psk;
|
||||||
conf->p_psk = p_psk;
|
conf->p_psk = p_psk;
|
||||||
}
|
}
|
||||||
|
#endif /* MBEDTLS_SSL_SRV_C */
|
||||||
|
|
||||||
#endif /* MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED */
|
#endif /* MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED */
|
||||||
|
|
||||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||||
|
|
|
@ -2184,8 +2184,9 @@ void perform_handshake( handshake_test_options *options )
|
||||||
options->psk_str->len,
|
options->psk_str->len,
|
||||||
(const unsigned char *) psk_identity,
|
(const unsigned char *) psk_identity,
|
||||||
strlen( psk_identity ) ) == 0 );
|
strlen( psk_identity ) ) == 0 );
|
||||||
|
#if defined(MBEDTLS_SSL_SRV_C)
|
||||||
mbedtls_ssl_conf_psk_cb( &server.conf, psk_dummy_callback, NULL );
|
mbedtls_ssl_conf_psk_cb( &server.conf, psk_dummy_callback, NULL );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_SSL_RENEGOTIATION)
|
#if defined(MBEDTLS_SSL_RENEGOTIATION)
|
||||||
|
|
Loading…
Reference in a new issue