mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-05 19:35:48 +03:00
Introduce a test for a sw implementation of inet_pton
Create a bypass define to simulate platforms without AF_INET6. Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
@@ -2558,10 +2558,11 @@ find_parent:
|
|||||||
* dependencies, and Solaris requires additional link dependencies.
|
* dependencies, and Solaris requires additional link dependencies.
|
||||||
* Also, as a coarse heuristic, use the local implementation if the compiler
|
* Also, as a coarse heuristic, use the local implementation if the compiler
|
||||||
* does not support __has_include(), or if the definition of AF_INET6 is not
|
* does not support __has_include(), or if the definition of AF_INET6 is not
|
||||||
* provided by headers included (or not) via __has_include() above. */
|
* provided by headers included (or not) via __has_include() above.
|
||||||
#ifndef AF_INET6
|
* MBEDTLS_TEST_SW_INET_PTON is a bypass define to force testing of this code //no-check-names
|
||||||
|
* despite having a platform that has inet_pton. */
|
||||||
/* definition located further below to possibly reduce compiler inlining */
|
#if !defined(AF_INET6) || defined(MBEDTLS_TEST_SW_INET_PTON) //no-check-names
|
||||||
|
/* Definition located further below to possibly reduce compiler inlining */
|
||||||
static int x509_inet_pton_ipv4(const char *src, void *dst);
|
static int x509_inet_pton_ipv4(const char *src, void *dst);
|
||||||
|
|
||||||
#define li_cton(c, n) \
|
#define li_cton(c, n) \
|
||||||
@@ -2654,7 +2655,7 @@ static int x509_inet_pton_ipv4(const char *src, void *dst)
|
|||||||
return inet_pton(AF_INET, src, dst) == 1 ? 0 : -1;
|
return inet_pton(AF_INET, src, dst) == 1 ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* AF_INET6 */
|
#endif /* !AF_INET6 || MBEDTLS_TEST_SW_INET_PTON */ //no-check-names
|
||||||
|
|
||||||
MBEDTLS_STATIC_TESTABLE
|
MBEDTLS_STATIC_TESTABLE
|
||||||
size_t mbedtls_x509_crt_parse_cn_inet_pton(const char *cn, void *dst)
|
size_t mbedtls_x509_crt_parse_cn_inet_pton(const char *cn, void *dst)
|
||||||
|
@@ -1219,6 +1219,17 @@ component_test_psa_external_rng_no_drbg_use_psa () {
|
|||||||
tests/ssl-opt.sh -f 'Default\|opaque'
|
tests/ssl-opt.sh -f 'Default\|opaque'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
component_test_sw_inet_pton () {
|
||||||
|
msg "build: default plus MBEDTLS_TEST_SW_INET_PTON"
|
||||||
|
|
||||||
|
# MBEDTLS_TEST_HOOKS required for x509_crt_parse_cn_inet_pton
|
||||||
|
scripts/config.py set MBEDTLS_TEST_HOOKS
|
||||||
|
make CFLAGS="-DMBEDTLS_TEST_SW_INET_PTON"
|
||||||
|
|
||||||
|
msg "test: default plus MBEDTLS_TEST_SW_INET_PTON"
|
||||||
|
make test
|
||||||
|
}
|
||||||
|
|
||||||
component_test_crypto_full_md_light_only () {
|
component_test_crypto_full_md_light_only () {
|
||||||
msg "build: crypto_full with only the light subset of MD"
|
msg "build: crypto_full with only the light subset of MD"
|
||||||
scripts/config.py crypto_full
|
scripts/config.py crypto_full
|
||||||
|
Reference in New Issue
Block a user