Closed douzzer closed 1 month ago
refactor wolfcrypt constructors:
add delete APIs, matching recently added wc_AesNew, wc_curve25519_new, wc_ed25519_new, wc_HashNew, and wc_NewRsaKey:
wc_AesNew
wc_curve25519_new
wc_ed25519_new
wc_HashNew
wc_NewRsaKey
wc_AesDelete()
wc_HashDelete()
wc_DeleteRsaKey()
wc_curve25519_delete()
wc_ed25519_delete()
remove handling in corresponding preexisting free APIs for recently added .isAllocated member -- this restores preexisting semantics;
.isAllocated
add WC_NO_CONSTRUCTORS gate, and auto-activate it when NO_WOLFSSL_MEMORY && WOLFSSL_NO_MALLOC (unless preempted by XMALLOC_USER or XMALLOC_OVERRIDE);
WC_NO_CONSTRUCTORS
NO_WOLFSSL_MEMORY
WOLFSSL_NO_MALLOC
XMALLOC_USER
XMALLOC_OVERRIDE
exclude recently added .isAllocated members from wolfcrypt structs when defined(WC_NO_CONSTRUCTORS).
defined(WC_NO_CONSTRUCTORS)
tested with wolfssl-multi-test.sh ... check-source-text quantum-safe-wolfssl-all-g++-latest-debug quantum-safe-wolfssl-all-cppcheck fortify-source-all-asm fortify-source-all-noasm clang-tidy-all-sp-all sanitizer-all-intelasm-c-fallback-fuzzer all-gcc-c99-asn-original cryptonly-opensslextra-gcc-c99 allcryptonly-no-malloc allcryptonly-no-malloc-no-wolf-memory allcryptonly-gcc-c89 quantum-safe-wolfssl-all-valgrind quantum-safe-wolfssl-all-smallstack-valgrind cppcheck-all-smallstack
wolfssl-multi-test.sh ... check-source-text quantum-safe-wolfssl-all-g++-latest-debug quantum-safe-wolfssl-all-cppcheck fortify-source-all-asm fortify-source-all-noasm clang-tidy-all-sp-all sanitizer-all-intelasm-c-fallback-fuzzer all-gcc-c99-asn-original cryptonly-opensslextra-gcc-c99 allcryptonly-no-malloc allcryptonly-no-malloc-no-wolf-memory allcryptonly-gcc-c89 quantum-safe-wolfssl-all-valgrind quantum-safe-wolfssl-all-smallstack-valgrind cppcheck-all-smallstack
This modifies the new/free logic from https://github.com/wolfSSL/wolfssl/pull/3166.
@aidangarske please add documentation for these new API's. Thank you
refactor wolfcrypt constructors:
add delete APIs, matching recently added
wc_AesNew
,wc_curve25519_new
,wc_ed25519_new
,wc_HashNew
, andwc_NewRsaKey
:wc_AesDelete()
wc_HashDelete()
wc_DeleteRsaKey()
wc_curve25519_delete()
wc_ed25519_delete()
remove handling in corresponding preexisting free APIs for recently added
.isAllocated
member -- this restores preexisting semantics;add
WC_NO_CONSTRUCTORS
gate, and auto-activate it whenNO_WOLFSSL_MEMORY
&&WOLFSSL_NO_MALLOC
(unless preempted byXMALLOC_USER
orXMALLOC_OVERRIDE
);exclude recently added
.isAllocated
members from wolfcrypt structs whendefined(WC_NO_CONSTRUCTORS)
.tested with
wolfssl-multi-test.sh ... check-source-text quantum-safe-wolfssl-all-g++-latest-debug quantum-safe-wolfssl-all-cppcheck fortify-source-all-asm fortify-source-all-noasm clang-tidy-all-sp-all sanitizer-all-intelasm-c-fallback-fuzzer all-gcc-c99-asn-original cryptonly-opensslextra-gcc-c99 allcryptonly-no-malloc allcryptonly-no-malloc-no-wolf-memory allcryptonly-gcc-c89 quantum-safe-wolfssl-all-valgrind quantum-safe-wolfssl-all-smallstack-valgrind cppcheck-all-smallstack