-
Notifications
You must be signed in to change notification settings - Fork 674
Mbedtls wrapper fix #3338
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
base: master
Are you sure you want to change the base?
Mbedtls wrapper fix #3338
Conversation
VELAPLATFO-62586 Change-Id: I5d7675c05dc3a52c1cb15a6132b969a19f848248 Signed-off-by: makejian <[email protected]> (cherry picked from commit 409c86a062a816b56a3a48b1111102d12f24a48f)
…mqtt VELAPLATFO-62586 Change-Id: I3b56b028e76aee118ed90211c097ac3fe86bc129 Signed-off-by: makejian <[email protected]> (cherry picked from commit 7a567e98489f64b740044b9ce4066fa8d41af359)
VELAPLATFO-62586 Change-Id: I2ceac930c87196a16ea7ddf5e4130bb991b51025 Signed-off-by: makejian <[email protected]> (cherry picked from commit d0547662d5006ec0a348d89d3d7e251ef4bb183c)
…hen ssl error VELAPLATFO-66562 Change-Id: Ibb1446a7fcae1d2bc09d75052466a6ce084103b8 Signed-off-by: makejian <[email protected]>
|
@xiaoxiang781216 How can I ignore the case-sensitive style check for this commit? |
let's ignore the warning directly, but fix the spell warning. The 3rd party case issue doen't need fix. |
|
@ThePassionate please fix check error. |
Fix coding style issues in OpenSSL/MbedTLS wrapper implementation: - Align whitespace and indentation - Fix line formatting - Ensure consistent code style per NuttX standards Signed-off-by: makejian <[email protected]>
Thanks, i have fixed check error expect 'error: Mixed case identifier found' |
Summary
This commit introduces significant functional enhancements and code optimizations to the
crypto/openssl_mbedtls_wrappercomponent. The primary goal is to improve the functional completeness, debugging convenience, code robustness, and memory safety of this wrapper layer, providing upper-layer applications with a more stable MbedTLS backend that more closely aligns with the standard OpenSSL API.Key Changes and Rationale:
New Configuration Options (
Kconfig): Introduces four debug behavior configurations (DEBUG,EXIT,DEBUG_EXIT,DEBUG_BLOCK) for theSSL_ASSERTmacros. This allows developers to flexibly choose the handling strategy upon assertion failure (print only, return error code only, print then return, print then block) based on debugging or production environment needs, significantly enhancing issue diagnosis capabilities.Greatly Expanded API Compatibility:
bio.h,err.h,evp.h,ssl.h,ssl_local.h,tls1.h,types.h, andx509.h. For example, critical APIs forBIOchaining,SSLsession management,TLSprotocol version methods, andX509certificate file loading were added, substantially improving compatibility with existing OpenSSL code.bio_b64.c(Base64 BIO filter),bio_lib.c(BIO core library), andbss_mem.c(memory BIO), completing foundational functionality.Refactored and Optimized Core Implementation (
ssl_pm.c,ssl_lib.c, etc.):x509_pm.x509_crt) from a dynamically allocated pointer to a stack object. This simplifies lifecycle management and eliminates potential memory leaks and null pointer dereferences.x509_pm_load_fileandx509_pm_load_pathmethods to thex509_pmstructure, supporting direct certificate loading from files or paths for improved usability.SSL_ERROR_WANT_READ/WRITE) in functions likessl_pm_read/write, leading to more precise error handling.LOCAL_ATTRmacro for consistent coding style. Replacedprintfdebug outputs with the project-definedSSL_DEBUGmacro for more standardized and controllable logging.Impact
Impact on Users (Developers):
BIO_f_base64,SSL_CTX_use_certificate_chain_file,ERR_print_errors_cb), improving portability and development experience. The new debug options provide powerful tools for troubleshooting TLS/SSL issues.struct x509_pm(x509_crtchanged from a pointer to an embedded object), any third-party code or downstream patches directly manipulating this internal structure may require adjustments. This change is necessary for advancing towards a safer, simpler memory model.Impact on Security: Positive impact. The optimized memory management model reduces risks associated with improper memory handling. More complete error handling aids developers in writing more robust secure communication code.
Testing
Verification Methods:
OPENSSL_MBEDTLS_WRAPPERenabled, ensuring no compilation errors or warnings.SSL_CTX_use_certificate_chain_file.SSL_ASSERTconfiguration modes behave as expected under simulated error conditions (e.g., printing info, exiting, or blocking upon assertion failure).Test Environment (Example, please update based on actual situation):
sim:nsh(simulator)CRYPTO_MBEDTLSandOPENSSL_MBEDTLS_WRAPPER.please ignore openssl mix case warning: