Commit graph

16 commits

Author SHA1 Message Date
makejian
57ced95c07 crypto/openssl-wrapper: align SSL_CTX_new declaration with OpenSSL
Remove the extra rngctx parameter from SSL_CTX_new() to match
the standard OpenSSL API signature:
  SSL_CTX *SSL_CTX_new(const SSL_METHOD *method)

This improves compatibility with code written for OpenSSL.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-21 19:25:02 +08:00
makejian
690d8bddce crypto/openssl-wrapper: fix SSL error code mapping
Map mbedtls error codes to OpenSSL standard return codes in
SSL_connect/SSL_do_handshake:
- Return 1 on success
- Return 0 on controlled shutdown
- Return -1 on fatal error (was returning mbedtls error codes)

This aligns the return values with OpenSSL specification where
SSL_get_error() should be called to get the actual error reason.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-21 19:25:02 +08:00
makejian
825007aafb crypto/openssl-wrapper: export SSL_CTX_load_verify_file and SSL_CTX_load_verify_dir
Export SSL_CTX_load_verify_file() and SSL_CTX_load_verify_dir()
interfaces to allow loading CA certificates from file or directory.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-21 19:25:02 +08:00
makejian
d2902008fe openssl-wrapper: fix code style compliance
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 <makejian@xiaomi.com>
2026-01-19 22:51:14 +08:00
makejian
bafe30898a openssl-wrapper: mapping more error code whitin mbedtls and openssl when ssl error
VELAPLATFO-66562

Change-Id: Ibb1446a7fcae1d2bc09d75052466a6ce084103b8
Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-19 22:51:14 +08:00
makejian
49e2592e34 openssl-mbedtls-wrapper: export SSL_ASSERT* macro
VELAPLATFO-62586

Change-Id: I2ceac930c87196a16ea7ddf5e4130bb991b51025
Signed-off-by: makejian <makejian@xiaomi.com>
(cherry picked from commit d0547662d5006ec0a348d89d3d7e251ef4bb183c)
2026-01-19 22:51:14 +08:00
makejian
94ffd5e9f0 openssl_wrapper_mbedtls: extend openssl interfaces in ssl module for mqtt
VELAPLATFO-62586

Change-Id: I3b56b028e76aee118ed90211c097ac3fe86bc129
Signed-off-by: makejian <makejian@xiaomi.com>
(cherry picked from commit 7a567e98489f64b740044b9ce4066fa8d41af359)
2026-01-19 22:51:14 +08:00
makejian
33d5062ba6 openssl_wrapper_mbedtls: support bio interfaces in openssl
VELAPLATFO-62586

Change-Id: I5d7675c05dc3a52c1cb15a6132b969a19f848248
Signed-off-by: makejian <makejian@xiaomi.com>
(cherry picked from commit 409c86a062a816b56a3a48b1111102d12f24a48f)
2026-01-19 22:51:14 +08:00
Alin Jerpelea
5b68158154 crypto: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-12-19 15:25:28 +08:00
makejian
84292d5013 mbedtls: compile warning fix
- apps/crypto/openssl_mbedtls_wrapper/mbedtls/err.c
- apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c

Signed-off-by: makejian <makejian@xiaomi.com>
2024-10-27 20:57:11 +08:00
xuxin19
597c701518 cmake:add openssl_mbedtls_wrapper cmake build support
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-27 20:57:11 +08:00
makejian
fbcc320321 openssl_mbedtls_wrapper: Implement SHA1 Interface
Signed-off-by: makejian <makejian@xiaomi.com>
2024-10-27 20:57:11 +08:00
makejian
42e0e4c6b2 openssl_mbedtls_wrapper: support X509_new()
Signed-off-by: makejian <makejian@xiaomi.com>
2024-10-27 20:57:11 +08:00
cuiziwei
6721ae3555 fix build warning.
CC:  vfs/fs_lseek.c /home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c: In function ‘HMAC_CTX_new’:
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:57:31: warning: implicit declaration of function ‘malloc’ [-Wimplicit-function-declaration]
   57 |       (mbedtls_md_context_t *)malloc(sizeof(mbedtls_md_context_t));
      |                               ^~~~~~
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:28:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘malloc’
   27 | #include <mbedtls/hmac_drbg.h>
  +++ |+#include <stdlib.h>
   28 | #include <mbedtls/md.h>
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:57:31: warning: incompatible implicit declaration of built-in function ‘malloc’ [-Wbuiltin-declaration-mismatch]
   57 |       (mbedtls_md_context_t *)malloc(sizeof(mbedtls_md_context_t));
      |                               ^~~~~~
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:57:31: note: include ‘<stdlib.h>’ or provide a declaration of ‘malloc’
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c: In function ‘HMAC_CTX_free’:
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:126:3: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]
  126 |   free(ctx);
      |   ^~~~
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:126:3: note: include ‘<stdlib.h>’ or provide a declaration of ‘free’
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:126:3: warning: incompatible implicit declaration of built-in function ‘free’ [-Wbuiltin-declaration-mismatch]
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:126:3: note: include ‘<stdlib.h>’ or provide a declaration of ‘free’

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-27 20:57:11 +08:00
makejian
f7582e34e5 openssl_mbedtls_wrapper: add ssl wrapper from libwebsockets
Signed-off-by: makejian <makejian@xiaomi.com>
2024-10-27 20:57:11 +08:00
yanghuatao
f1ace3774f apps/crypto: Add project openssl_mbedtls_wrapper
Add openssl mbedtls wrapper project

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-10-27 20:57:11 +08:00