Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build failure if compiled without MBEDTLS_PK_RSA_ALT_SUPPORT #3174

Closed
fefe17 opened this issue Apr 7, 2020 · 3 comments · Fixed by #6950
Closed

build failure if compiled without MBEDTLS_PK_RSA_ALT_SUPPORT #3174

fefe17 opened this issue Apr 7, 2020 · 3 comments · Fixed by #6950
Labels
bug component-x509 good-first-issue Good for newcomers historical-reviewing Currently reviewing (for legacy PR/issues)

Comments

@fefe17
Copy link

fefe17 commented Apr 7, 2020

Note: This is just a template, so feel free to use/remove the unnecessary things

Description

  • Type: Bug
  • Priority: Major

Bug

OS
linux

mbed TLS build:
Version: 4500e83
OS version: 5.6.0
Configuration: please attach config.h file where possible
Compiler and options (if you used a pre-built binary, please indicate how you obtained it):
Additional environment information:

Peer device TLS stack and version
n/a
Version:

Expected behavior
builds without errors

Actual behavior
[ 74%] Linking C executable test_suite_x509write
/usr/lib64/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/test_suite_x509write.dir/test_suite_x509write.c.o: in function execute_tests': test_suite_x509write.c:(.text+0x1756): warning: warning: your code uses stdio (7+k bloat). /usr/lib64/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /opt/diet/lib-x86_64/libc.a(vsnprintf.o): in function vsnprintf':
vsnprintf.c:(.text.vsnprintf+0x4c): warning: warning: the printf functions add several kilobytes of bloat.
/usr/lib64/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/test_suite_x509write.dir/test_suite_x509write.c.o: in function test_x509_crt_check': test_suite_x509write.c:(.text+0x976): undefined reference to mbedtls_pk_setup_rsa_alt'
collect2: error: ld returned 1 exit status

The bloat warning message comes from my special libc. You can disregard it here.

Steps to reproduce


Enhancement\Feature Request

Justification - why does the library need this feature?

Suggested enhancement


Question

Please first check for answers in the Mbed TLS knowledge Base. If you can't find the answer you're looking for then please use the Mbed TLS mailing list

@fefe17
Copy link
Author

fefe17 commented Apr 7, 2020

my config.h can be found at https://ptrace.fefe.de/mbedtls-config.h

@fefe17
Copy link
Author

fefe17 commented Apr 7, 2020

Suggested fix:

diff --git a/tests/suites/test_suite_x509write.function b/tests/suites/test_suite_x509write.function
index 0db2b0e94..75de8ec32 100644
--- a/tests/suites/test_suite_x509write.function
+++ b/tests/suites/test_suite_x509write.function
@@ -225,7 +225,7 @@ void x509_crt_check( char *subject_key_file, char *subject_pwd,
TEST_ASSERT( mbedtls_pk_parse_keyfile( &issuer_key, issuer_key_file,
issuer_pwd ) == 0 );

-#if defined(MBEDTLS_RSA_C)
+#if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
/* For RSA PK contexts, create a copy as an alternative RSA context. */
if( rsa_alt == 1 && mbedtls_pk_get_type( &issuer_key ) == MBEDTLS_PK_RSA )
{

@gilles-peskine-arm
Copy link
Contributor

Ah, the joys of option combinations. We test builds with: MBEDTLS_RSA_C && MBEDTLS_PK_RSA_ALT_SUPPORT && MBEDTLS_X509_CRT_WRITE_C , MBEDTLS_RSA_C && !MBEDTLS_PK_RSA_ALT_SUPPORT && !MBEDTLS_X509_CRT_WRITE_C , !MBEDTLS_RSA_C && …, but not MBEDTLS_RSA_C && !MBEDTLS_PK_RSA_ALT_SUPPORT && MBEDTLS_X509_CRT_WRITE_C . Thanks for reporting this!

@daverodgman daverodgman added the historical-reviewing Currently reviewing (for legacy PR/issues) label Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component-x509 good-first-issue Good for newcomers historical-reviewing Currently reviewing (for legacy PR/issues)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants