diff --git a/CMakeLists.txt b/CMakeLists.txt index 28312f8cb..f2da855cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,11 +28,11 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") You must delete them, or cmake will refuse to work.") endif() -project(wolfssl VERSION 5.2.0 LANGUAGES C ASM) +project(wolfssl VERSION 5.4.0 LANGUAGES C ASM) # shared library versioning # increment if interfaces have been added, removed or changed -set(LIBTOOL_CURRENT 32) +set(LIBTOOL_CURRENT 34) # increment if source code has changed set to zero if current is incremented set(LIBTOOL_REVISION 0) # increment if interfaces have been added set to zero if interfaces have been @@ -1425,24 +1425,9 @@ endif() # - wolfCrypt only # fastmath -set(FASTMATH_DEFAULT "no") - -if(("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64") OR - ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")) - set(FASTMATH_DEFAULT "yes") -endif() - -if(WOLFSSL_LINUXKM_DEFAULTS) - set(FASTMATH_DEFAULT "no") -endif() - -if(WOLFSSL_SP_MATH) - set(FASTMATH_DEFAULT "no") -endif() - add_option("WOLFSSL_FAST_MATH" - "Enable fast math ops (default: enabled on x86_64/aarch64)" - ${FASTMATH_DEFAULT} "yes;no") + "Enable fast math ops (default: disabled)" + "no" "yes;no") if(WOLFSSL_FAST_MATH) # turn off fastmath if leanpsk on or asn off (w/o DH and ECC) @@ -1468,6 +1453,11 @@ endif() # TODO: - Fast huge math +# SP math all +add_option("WOLFSSL_SP_MATH_ALL" + "Enable Single Precision math implementation for full algorithm suite (default: enabled)" + "yes" "yes;no") + # Enable examples, used to disable examples if(WOLFSSL_LINUX_KM) set(EXAMPLES_DEFAULT "no") diff --git a/ChangeLog.md b/ChangeLog.md index 5b1f1f691..cde67e5ae 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,153 @@ +# wolfSSL Release 5.4.0 (July 11, 2022) + +Note: +** Future releases of wolfSSL will turn off TLS 1.1 by default +** Release 5.4.0 made SP math the default math implementation. To make an equivalent build as –disable-fastmath from previous versions of wolfSSL, now requires using the configure option –enable-heapmath instead. + +Release 5.4.0 of wolfSSL embedded TLS has bug fixes and new features including: + +## Vulnerabilities +* [High] Potential for DTLS DoS attack. In wolfSSL versions before 5.4.0 the return-routability check is wrongly skipped in a specific edge case. The check on the return-routability is there for stopping attacks that either consume excessive resources on the server, or try to use the server as an amplifier sending an excessive amount of messages to a victim IP. If using DTLS 1.0/1.2 on the server side users should update to avoid the potential DoS attack. CVE-2022-34293 +* [Medium] Ciphertext side channel attack on ECC and DH operations. Users on systems where rogue agents can monitor memory use should update the version of wolfSSL and change private ECC keys. Thanks to Sen Deng from Southern University of Science and Technology (SUSTech) for the report. +* [Medium] Public disclosure of a side channel vulnerability that has been fixed since wolfSSL version 5.1.0. When running on AMD there is the potential to leak private key information with ECDSA operations due to a ciphertext side channel attack. Users on AMD doing ECDSA operations with wolfSSL versions less than 5.1.0 should update their wolfSSL version used. Thanks to professor Yinqian Zhang from Southern University of Science and Technology (SUSTech), his Ph.D. student Mengyuan Li from The Ohio State University, and his M.S students Sen Deng and Yining Tang from SUStech along with other collaborators; Luca Wilke, Jan Wichelmann and Professor Thomas Eisenbarth from the University of Lubeck, Professor Shuai Wang from Hong Kong University of Science and Technology, Professor Radu Teodorescu from The Ohio State University, Huibo Wang, Kang Li and Yueqiang Cheng from Baidu Security and Shoumeng Yang from Ant Financial Services Group. +CVE-2020-12966 https://www.amd.com/en/corporate/product-security/bulletin/amd-sb-1013 CVE-2021-46744 https://www.amd.com/en/corporate/product-security/bulletin/amd-sb-1033 + + +## New Feature Additions + +### DTLS 1.3 +* Support for using the new DTLSv1.3 protocol was added +* Enhancements to bundled examples for an event driven server with DTLS 1.3 was added +### Ports +* Update for the version of VxWorks supported, adding in support for version 6.x +* Support for new DPP and EAP-TEAP/EAP-FAST in wpa_supplicant +* Update for TSIP version support, adding support for version 1.15 for RX65N and RX72N +* Improved TSIP build to handle having the options WOLFSSL_AEAD_ONLY defined or NO_AES_CBC defined +* Added support for offloading TLS1.3 operations to Renesas RX boards with TSIP +### Misc. +* Constant time improvements due to development of new constant time tests +* Initial translation of API headers to Japanese and expansion of Japanese help message support in example applications +* Add support for some FPKI (Federal PKI) certificate cases, UUID, FASC-N, PIV extension for use with smart cards +* Add support for parsing additional CSR attributes such as unstructured name and content type +* Add support for Linux getrandom() when defining the macro WOLFSSL_GETRANDOM +* Add TLS 1.2 ciphersuite ECDHE_PSK_WITH_AES_128_GCM_SHA256 from RFC 8442 +* Expand CAAM support with QNX to include i.MX8 boards and add AES-CTR support +* Enhanced glitching protection by hardening the TLS encrypt operations + +## Math and Performance + +### SP Math Additions +* Support for ARMv3, ARMv6 and ARMv7a + - Changes and improvements to get SP building for armv7-a + - Updated assembly for moving large immediate values on ARMv6 + - Support for architectures with no ldrd/strd and clz +* Reworked generation using common asm ruby code for 32bit ARM +* Enable wolfSSL SP math all by default (sp_int.c) +* Update SP math all to not use sp_int_word when SQR_MUL_ASM is available +### SP Math Fixes +* Fixes for constant time with div function +* Fix casting warnings for Windows builds and assembly changes to support XMM6-15 being non-volatile +* Fix for div_word when not using div function +* Fixes for user settings with SP ASM and ED/Curve25519 small +* Additional Wycheproof tests ran and fixes +* Fix for SP math ECC non-blocking to always check `hashLen` +* Fix for SP math handling edge case with submod + +## Improvements and Optimizations + +### Compatibility Layer +* Provide access to "Finished" messages outside of compatibility layer builds +* Remove unneeded FIPS guard on wolfSSL_EVP_PKEY_derive +* Fix control command issues with AES-GCM, control command EVP_CTRL_GCM_IV_GEN +* Add support for importing private only EC key to a WOLFSSL_EVP_PKEY struct +* Add support for more extensions to wolfSSL_X509_print_ex +* Update for internal to DER (i2d) AIPs to move the buffer pointer when passed in and the operation is successful +* Return subject and issuer X509_NAME object even when not set +### Ports +* Renesas RA6M4 example update and fixes +* Support multi-threaded use cases with Renesas SCE protected mode and TSIP +* Add a global variable for heap-hint for use with TSIP +* Changes to support v5.3.0 cube pack for STM32 +* Use the correct mutex type for embOS +* ESP-IDF build cleanup and enhancements, adding in note regarding ESP-IDF Version +* Support for SEGGER embOS and emNET +* Fix to handle WOLFSSL_DTLS macro in Micrium build +### Build Options +* Support for verify only and no-PSS builds updated +* Add the enable options wolfssh (mapped to the existing –enable-ssh) +* Remove WOLFSSL_ALT_NAMES restriction on notBefore/notAfter use in Cert struct +* Move several more definitions outside the BUILDING_WOLFSSL gate with linux kernel module build +* Modify --enable-openssh to not enable non-FIPS algos for FIPS builds +* Remove the Python wrappers from wolfSSL source (use pip install instead of using wolfSSL with Python and our separate Python repository) +* Add --enable-openldap option to configure.ac for building the OpenLDAP port +* Resolve DTLS build to handle not having –enable-hrrcookie when not needed +* Add an --enable-strongswan option to configure.ac for building the Strongswan port +* Improve defaults for 64-bit BSDs in configure +* Crypto only build can now be used openssl extra +* Update ASN template build to properly handle WOLFSSL_CERT_EXT and HAVE_OID_ENCODING +* Allow using 3DES and MD5 with FIPS 140-3, as they fall outside of the FIPS boundary +* Add the build option --enable-dh=const which replaces setting the macro WOLFSSL_DH_CONST and now conditionally link to -lm as needed +* Add the macro WOLFSSL_HOSTNAME_VERIFY_ALT_NAME_ONLY which is used to verify hostname/ip address using alternate name (SAN) only and does not use the common name +* WOLFSSL_DTLS_NO_HVR_ON_RESUME macro added (off by default to favor more security). If defined, a DTLS server will not do a cookie exchange on successful client resumption: the resumption will be faster (one RTT less) and will consume less bandwidth (one ClientHello and one HelloVerifyRequest less). On the other hand, if a valid SessionID is collected, forged clientHello messages will consume resources on the server. +* Misc. +* Refactoring of some internal TLS functions to reduce the memory usage +* Make old less secure TimingPadVerify implementation available +* Add support for aligned data with clang LLVM +* Remove subject/issuer email from the list of alt. Email names in the DecodedCerts struct +* Zeroizing of pre-master secret buffer in TLS 1.3 +* Update to allow TLS 1.3 application server to send session ticket +* Improve the sniffer asynchronous test case to support multiple concurrent streams +* Clean up wolfSSL_clear() and add more logging +* Update to not error out on bad CRL next date if using NO_VERIFY when parsing +* Add an example C# PSK client +* Add ESP-IDF WOLFSSL_ESP8266 setting for ESP8266 devices +* Support longer sigalg list for post quantum use cases and inter-op with OQS's OpenSSL fork +* Improve AES-GCM word implementation of GMULT to be constant time +* Additional sanity check with Ed25519/Ed448, now defaults to assume public key is not trusted +* Support PSK ciphersuites in benchmark apps +* FIPS in core hash using SHA2-256 and SHA2-384 +* Add ability to store issuer name components when parsing a certificate +* Make the critical extension flags in DecodedCert always available +* Updates to the default values for basic constraint with X509’s +* Support using RSA OAEP with no malloc and add additional sanity checks +* Leverage async code paths to support WANT_WRITE while sending packet fragments +* New azsphere example for continuous integration testing +* Update RSA key generation function to handle pairwise consistency tests with static memory pools used +* Resolve build time warning by passing in and checking output length with internal SetCurve function +* Support DTLS bidirectional shutdown in the examples +* Improve DTLS version negotiation and downgrade capability + +### General Fixes +* Fixes for STM32 Hash/PKA, add some missing mutex frees, and add an additional benchmark +* Fix missing return checks in KSDK ED25519 code +* Fix compilation warnings from IAR +* Fixes for STM32U5/H7 hash/crypto support +* Fix for using track memory feature with FreeRTOS +* Fixup XSTR processing for MICRIUM +* Update Zephyr fs.h path +* DTLS fixes with WANT_WRITE simulations +* Fixes for BER use with PKCS7 to have additional sanity checks and guards on edge cases +* Fix to handle exceptional edge case with TFM mp_exptmod_ex +* Fix for stack and heap measurements of a 32-bit build +* Fix to allow enabling AES key wrap (direct) with KCAPI +* Fix --enable-openssh FIPS detection syntax in configure.ac +* Fix to move wolfSSL_ERR_clear_error outside gate for OPENSSL_EXTRA +* Remove MCAPI project's dependency on zlib version +* Only use __builtin_offset on supported GCC versions (4+) +* Fix for c89 builds with using WOLF_C89 +* Fix 64bit postfix for constants building with powerpc +* Fixed async Sniffer with TLS v1.3, async removal of `WC_HW_WAIT_E` and sanitize leak +* Fix for QAT ECC to gate use of HW based on marker +* Fix the supported version extension to always check minDowngrade +* Fix for TLS v1.1 length sanity check for large messages +* Fixes for loading a long DER/ASN.1 certificate chain +* Fix to expose the RSA public DER export functions with certgen +* Fixes for building with small version of SHA3 +* Fix configure with WOLFSSL_WPAS_SMALL +* Fix to free PKCS7 recipient list in error cases +* Sanity check to confirm ssl->hsHashes is not NULL before attempting to dereference it +* Clear the leftover byte count in Aes struct when setting IV + # wolfSSL Release 5.3.0 (May 3rd, 2022) Release 5.3.0 of wolfSSL embedded TLS has bug fixes and new features including: diff --git a/IDE/ARDUINO/sketches/wolfssl_client/wolfssl_client.ino b/IDE/ARDUINO/sketches/wolfssl_client/wolfssl_client.ino index 6984d886f..d3ae54f73 100644 --- a/IDE/ARDUINO/sketches/wolfssl_client/wolfssl_client.ino +++ b/IDE/ARDUINO/sketches/wolfssl_client/wolfssl_client.ino @@ -1,6 +1,6 @@ /* wolfssl_client.ino * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ARDUINO/sketches/wolfssl_server/wolfssl_server.ino b/IDE/ARDUINO/sketches/wolfssl_server/wolfssl_server.ino index 2b2492ad8..c8d39428c 100644 --- a/IDE/ARDUINO/sketches/wolfssl_server/wolfssl_server.ino +++ b/IDE/ARDUINO/sketches/wolfssl_server/wolfssl_server.ino @@ -1,6 +1,6 @@ /* wolfssl_server.ino * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/CRYPTOCELL/main.c b/IDE/CRYPTOCELL/main.c index ea889b8c8..866b3127f 100644 --- a/IDE/CRYPTOCELL/main.c +++ b/IDE/CRYPTOCELL/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + #include #include #include diff --git a/IDE/CRYPTOCELL/user_settings.h b/IDE/CRYPTOCELL/user_settings.h index f3a9ad6a5..6e051c33d 100644 --- a/IDE/CRYPTOCELL/user_settings.h +++ b/IDE/CRYPTOCELL/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/DEOS/deos_malloc.c b/IDE/ECLIPSE/DEOS/deos_malloc.c index f56dd5620..0421e7fb1 100644 --- a/IDE/ECLIPSE/DEOS/deos_malloc.c +++ b/IDE/ECLIPSE/DEOS/deos_malloc.c @@ -1,6 +1,6 @@ /* deos_malloc.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/DEOS/tls_wolfssl.c b/IDE/ECLIPSE/DEOS/tls_wolfssl.c index 18a0cf005..3f3e7c540 100644 --- a/IDE/ECLIPSE/DEOS/tls_wolfssl.c +++ b/IDE/ECLIPSE/DEOS/tls_wolfssl.c @@ -1,6 +1,6 @@ /* tls_wolfssl.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/DEOS/tls_wolfssl.h b/IDE/ECLIPSE/DEOS/tls_wolfssl.h index d54205b42..520cdad0c 100644 --- a/IDE/ECLIPSE/DEOS/tls_wolfssl.h +++ b/IDE/ECLIPSE/DEOS/tls_wolfssl.h @@ -1,6 +1,6 @@ /* tls_wolfssl.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/DEOS/user_settings.h b/IDE/ECLIPSE/DEOS/user_settings.h index 5f74bc563..98423cb41 100644 --- a/IDE/ECLIPSE/DEOS/user_settings.h +++ b/IDE/ECLIPSE/DEOS/user_settings.h @@ -1,6 +1,6 @@ /* user_setting.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/MICRIUM/client_wolfssl.c b/IDE/ECLIPSE/MICRIUM/client_wolfssl.c index 4e28a92eb..43c31b74c 100644 --- a/IDE/ECLIPSE/MICRIUM/client_wolfssl.c +++ b/IDE/ECLIPSE/MICRIUM/client_wolfssl.c @@ -1,6 +1,6 @@ /* client_wolfssl.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/MICRIUM/client_wolfssl.h b/IDE/ECLIPSE/MICRIUM/client_wolfssl.h index e1600674f..3b569f038 100644 --- a/IDE/ECLIPSE/MICRIUM/client_wolfssl.h +++ b/IDE/ECLIPSE/MICRIUM/client_wolfssl.h @@ -1,6 +1,6 @@ /* client_wolfssl.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/MICRIUM/server_wolfssl.c b/IDE/ECLIPSE/MICRIUM/server_wolfssl.c index 20fe49073..43cdd7dc9 100644 --- a/IDE/ECLIPSE/MICRIUM/server_wolfssl.c +++ b/IDE/ECLIPSE/MICRIUM/server_wolfssl.c @@ -1,6 +1,6 @@ /* server_wolfssl.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/MICRIUM/server_wolfssl.h b/IDE/ECLIPSE/MICRIUM/server_wolfssl.h index f338db11f..5e96459f1 100644 --- a/IDE/ECLIPSE/MICRIUM/server_wolfssl.h +++ b/IDE/ECLIPSE/MICRIUM/server_wolfssl.h @@ -1,6 +1,6 @@ /* server_wolfssl.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/MICRIUM/user_settings.h b/IDE/ECLIPSE/MICRIUM/user_settings.h index 154a67714..feb3ec340 100644 --- a/IDE/ECLIPSE/MICRIUM/user_settings.h +++ b/IDE/ECLIPSE/MICRIUM/user_settings.h @@ -1,6 +1,6 @@ /* user_setting.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/MICRIUM/wolfsslRunTests.c b/IDE/ECLIPSE/MICRIUM/wolfsslRunTests.c index 538484d49..6520b95f9 100644 --- a/IDE/ECLIPSE/MICRIUM/wolfsslRunTests.c +++ b/IDE/ECLIPSE/MICRIUM/wolfsslRunTests.c @@ -1,6 +1,6 @@ /* wolfsslRunTests.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/RTTHREAD/user_settings.h b/IDE/ECLIPSE/RTTHREAD/user_settings.h index 9ea3951ab..b74813f4a 100644 --- a/IDE/ECLIPSE/RTTHREAD/user_settings.h +++ b/IDE/ECLIPSE/RTTHREAD/user_settings.h @@ -1,6 +1,6 @@ /* user_setting.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ECLIPSE/RTTHREAD/wolfssl_test.c b/IDE/ECLIPSE/RTTHREAD/wolfssl_test.c index 7268303fd..8e82cfafa 100644 --- a/IDE/ECLIPSE/RTTHREAD/wolfssl_test.c +++ b/IDE/ECLIPSE/RTTHREAD/wolfssl_test.c @@ -1,6 +1,6 @@ /* wolfsslRunTests.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Espressif/ESP-IDF/dummy_config_h b/IDE/Espressif/ESP-IDF/dummy_config_h index 74a682e85..fb4cbceac 100644 --- a/IDE/Espressif/ESP-IDF/dummy_config_h +++ b/IDE/Espressif/ESP-IDF/dummy_config_h @@ -1,6 +1,6 @@ /* config.h - dummy * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Espressif/ESP-IDF/dummy_test_paths.h b/IDE/Espressif/ESP-IDF/dummy_test_paths.h index 7a9d3a173..cd79e7adf 100644 --- a/IDE/Espressif/ESP-IDF/dummy_test_paths.h +++ b/IDE/Espressif/ESP-IDF/dummy_test_paths.h @@ -1,6 +1,6 @@ /* wolfcrypt/test/test_paths.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/helper.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/helper.c index 5c67b26d2..8d4736ac0 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/helper.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/helper.c @@ -1,6 +1,6 @@ /* helper.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c index 1a4d20a6c..2d4d3eaf8 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c @@ -1,6 +1,6 @@ /* client-tls-callback.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/wifi_connect.h b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/wifi_connect.h index ab7de663b..165a9800d 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/wifi_connect.h +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/wifi_connect.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/wifi_connect.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/wifi_connect.c index bc290b2ce..00475d460 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/wifi_connect.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/wifi_connect.c @@ -1,6 +1,6 @@ /* wifi_connect.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/include/wifi_connect.h b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/include/wifi_connect.h index 5dd9625ee..8729ca57d 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/include/wifi_connect.h +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/include/wifi_connect.h @@ -1,6 +1,6 @@ /* wifi_connect.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/server-tls.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/server-tls.c index c31e21855..c9faec404 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/server-tls.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/server-tls.c @@ -1,6 +1,6 @@ /* server-tls-callback.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/wifi_connect.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/wifi_connect.c index cfbe2fd87..d2125000c 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/wifi_connect.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/wifi_connect.c @@ -1,6 +1,6 @@ /* wifi_connect.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/GCC-ARM/Header/user_settings.h b/IDE/GCC-ARM/Header/user_settings.h index 96eb94b1f..d9300b93c 100644 --- a/IDE/GCC-ARM/Header/user_settings.h +++ b/IDE/GCC-ARM/Header/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/GCC-ARM/Source/armtarget.c b/IDE/GCC-ARM/Source/armtarget.c index 7df8158e3..3095f31d0 100644 --- a/IDE/GCC-ARM/Source/armtarget.c +++ b/IDE/GCC-ARM/Source/armtarget.c @@ -1,6 +1,6 @@ /* armtarget.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/GCC-ARM/Source/benchmark_main.c b/IDE/GCC-ARM/Source/benchmark_main.c index d6d610fd0..7c2dec6a4 100644 --- a/IDE/GCC-ARM/Source/benchmark_main.c +++ b/IDE/GCC-ARM/Source/benchmark_main.c @@ -1,6 +1,6 @@ /* benchmark_main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/GCC-ARM/Source/test_main.c b/IDE/GCC-ARM/Source/test_main.c index 9320c57c5..53839c62d 100644 --- a/IDE/GCC-ARM/Source/test_main.c +++ b/IDE/GCC-ARM/Source/test_main.c @@ -1,6 +1,6 @@ /* test_main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/GCC-ARM/Source/tls_client.c b/IDE/GCC-ARM/Source/tls_client.c index f2d2ca130..cb0fb21e1 100644 --- a/IDE/GCC-ARM/Source/tls_client.c +++ b/IDE/GCC-ARM/Source/tls_client.c @@ -1,6 +1,6 @@ /* tls_client.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/GCC-ARM/Source/tls_server.c b/IDE/GCC-ARM/Source/tls_server.c index 1fe89f39c..6f0f82dfa 100644 --- a/IDE/GCC-ARM/Source/tls_server.c +++ b/IDE/GCC-ARM/Source/tls_server.c @@ -1,6 +1,6 @@ /* tls_server.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/GCC-ARM/Source/wolf_main.c b/IDE/GCC-ARM/Source/wolf_main.c index c47b0cec6..b713aea3b 100644 --- a/IDE/GCC-ARM/Source/wolf_main.c +++ b/IDE/GCC-ARM/Source/wolf_main.c @@ -1,6 +1,6 @@ /* wolf_main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/HEXAGON/DSP/Makefile b/IDE/HEXAGON/DSP/Makefile index 42022dda3..f2c31b57a 100644 --- a/IDE/HEXAGON/DSP/Makefile +++ b/IDE/HEXAGON/DSP/Makefile @@ -1,6 +1,6 @@ # Makefile # -# Copyright (C) 2006-2021 wolfSSL Inc. +# Copyright (C) 2006-2022 wolfSSL Inc. # # This file is part of wolfSSL. # @@ -17,7 +17,6 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -#/ ENVI=hexagon diff --git a/IDE/HEXAGON/Makefile b/IDE/HEXAGON/Makefile index 7606ea418..4a9a311b3 100644 --- a/IDE/HEXAGON/Makefile +++ b/IDE/HEXAGON/Makefile @@ -1,6 +1,6 @@ # Makefile # -# Copyright (C) 2006-2021 wolfSSL Inc. +# Copyright (C) 2006-2022 wolfSSL Inc. # # This file is part of wolfSSL. # @@ -17,7 +17,6 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -#/ ENVI=UbuntuARM diff --git a/IDE/HEXAGON/ecc-verify-benchmark.c b/IDE/HEXAGON/ecc-verify-benchmark.c index 6bc183fed..56b4a0bd4 100644 --- a/IDE/HEXAGON/ecc-verify-benchmark.c +++ b/IDE/HEXAGON/ecc-verify-benchmark.c @@ -1,6 +1,6 @@ /* ecc-verify-benchmark.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/HEXAGON/ecc-verify.c b/IDE/HEXAGON/ecc-verify.c index 0ffed79ad..368141f9f 100644 --- a/IDE/HEXAGON/ecc-verify.c +++ b/IDE/HEXAGON/ecc-verify.c @@ -1,6 +1,6 @@ /* ecc-verify.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/IAR-EWARM/Projects/benchmark/benchmark-main.c b/IDE/IAR-EWARM/Projects/benchmark/benchmark-main.c index 44016be28..4478ba421 100644 --- a/IDE/IAR-EWARM/Projects/benchmark/benchmark-main.c +++ b/IDE/IAR-EWARM/Projects/benchmark/benchmark-main.c @@ -1,6 +1,6 @@ /* benchmark-main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/IAR-EWARM/Projects/benchmark/current_time.c b/IDE/IAR-EWARM/Projects/benchmark/current_time.c index 1fbc1d17f..1585ac31a 100644 --- a/IDE/IAR-EWARM/Projects/benchmark/current_time.c +++ b/IDE/IAR-EWARM/Projects/benchmark/current_time.c @@ -1,6 +1,6 @@ /* current-time.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/IAR-EWARM/Projects/common/minimum-startup.c b/IDE/IAR-EWARM/Projects/common/minimum-startup.c index 01ceaa51c..aaab4dca3 100644 --- a/IDE/IAR-EWARM/Projects/common/minimum-startup.c +++ b/IDE/IAR-EWARM/Projects/common/minimum-startup.c @@ -1,6 +1,6 @@ /* minimum-startup.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/IAR-EWARM/Projects/test/test-main.c b/IDE/IAR-EWARM/Projects/test/test-main.c index 4b1b61430..18c41578b 100644 --- a/IDE/IAR-EWARM/Projects/test/test-main.c +++ b/IDE/IAR-EWARM/Projects/test/test-main.c @@ -1,6 +1,6 @@ /* test-main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/IAR-MSP430/main.c b/IDE/IAR-MSP430/main.c index 192f77292..2f28d50d0 100644 --- a/IDE/IAR-MSP430/main.c +++ b/IDE/IAR-MSP430/main.c @@ -1,6 +1,6 @@ /* MSP430 example main.c * - * Copyright (C) 2022 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -18,6 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + #include diff --git a/IDE/IAR-MSP430/user_settings.h b/IDE/IAR-MSP430/user_settings.h index dea4ea1e2..7ae8b3ad4 100644 --- a/IDE/IAR-MSP430/user_settings.h +++ b/IDE/IAR-MSP430/user_settings.h @@ -18,6 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + #ifndef WOLFSSL_USER_SETTINGS_H #define WOLFSSL_USER_SETTINGS_H diff --git a/IDE/LPCXPRESSO/lib_wolfssl/lpc_18xx_port.c b/IDE/LPCXPRESSO/lib_wolfssl/lpc_18xx_port.c index 810e5cf83..55475d285 100644 --- a/IDE/LPCXPRESSO/lib_wolfssl/lpc_18xx_port.c +++ b/IDE/LPCXPRESSO/lib_wolfssl/lpc_18xx_port.c @@ -1,6 +1,6 @@ /* lpc_18xx_port.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/LPCXPRESSO/wolf_example/src/lpc_18xx_startup.c b/IDE/LPCXPRESSO/wolf_example/src/lpc_18xx_startup.c index e5b722c4f..cc8e99896 100644 --- a/IDE/LPCXPRESSO/wolf_example/src/lpc_18xx_startup.c +++ b/IDE/LPCXPRESSO/wolf_example/src/lpc_18xx_startup.c @@ -1,6 +1,6 @@ /* lpc_18xx_startup.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/M68K/benchmark/main.cpp b/IDE/M68K/benchmark/main.cpp index b66b805f6..133bcfe19 100644 --- a/IDE/M68K/benchmark/main.cpp +++ b/IDE/M68K/benchmark/main.cpp @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/M68K/testwolfcrypt/main.cpp b/IDE/M68K/testwolfcrypt/main.cpp index 6380bd782..5e4ae1990 100644 --- a/IDE/M68K/testwolfcrypt/main.cpp +++ b/IDE/M68K/testwolfcrypt/main.cpp @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/LPC43xx/time-LCP43xx.c b/IDE/MDK-ARM/LPC43xx/time-LCP43xx.c index 150415861..f312cf62b 100644 --- a/IDE/MDK-ARM/LPC43xx/time-LCP43xx.c +++ b/IDE/MDK-ARM/LPC43xx/time-LCP43xx.c @@ -1,6 +1,6 @@ /* time.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/cert_data.c b/IDE/MDK-ARM/MDK-ARM/wolfSSL/cert_data.c index 5b7402f57..3b506160f 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/cert_data.c +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/cert_data.c @@ -1,6 +1,6 @@ /* certs_test.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-BARE-METAL.h b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-BARE-METAL.h index 7591269a7..5f913b631 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-BARE-METAL.h +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-BARE-METAL.h @@ -1,6 +1,6 @@ /* config-BEREFOOT.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-FS.h b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-FS.h index f9180cff3..6ac77cea2 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-FS.h +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-FS.h @@ -1,6 +1,6 @@ /* config-FS.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-RTX-TCP-FS.h b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-RTX-TCP-FS.h index 558f32bc9..a19cb497c 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-RTX-TCP-FS.h +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-RTX-TCP-FS.h @@ -1,6 +1,6 @@ /* config-RTX-TCP-FS.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config.h b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config.h index fba3347eb..021d75701 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config.h +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config.h @@ -1,6 +1,6 @@ /* config.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/main.c b/IDE/MDK-ARM/MDK-ARM/wolfSSL/main.c index d018d6767..174380b8a 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/main.c +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/shell.c b/IDE/MDK-ARM/MDK-ARM/wolfSSL/shell.c index 46e9c7126..14b9651d6 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/shell.c +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/shell.c @@ -1,6 +1,6 @@ /*shell.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/time-CortexM3-4.c b/IDE/MDK-ARM/MDK-ARM/wolfSSL/time-CortexM3-4.c index a057f6d63..29c27c783 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/time-CortexM3-4.c +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/time-CortexM3-4.c @@ -1,6 +1,6 @@ /* time-STM32F2.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/time-dummy.c b/IDE/MDK-ARM/MDK-ARM/wolfSSL/time-dummy.c index 07c8bb682..a3146c5cd 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/time-dummy.c +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/time-dummy.c @@ -1,6 +1,6 @@ /* time-dummy.c.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/wolfssl_MDK_ARM.c b/IDE/MDK-ARM/MDK-ARM/wolfSSL/wolfssl_MDK_ARM.c index 6a9a345d3..2240aa314 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/wolfssl_MDK_ARM.c +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/wolfssl_MDK_ARM.c @@ -1,6 +1,6 @@ /* wolfssl_KEIL_RL.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/wolfssl_MDK_ARM.h b/IDE/MDK-ARM/MDK-ARM/wolfSSL/wolfssl_MDK_ARM.h index 6a2165fab..0375b72eb 100644 --- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/wolfssl_MDK_ARM.h +++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/wolfssl_MDK_ARM.h @@ -1,6 +1,6 @@ /* wolfssl_KEIL_RL.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK-ARM/STM32F2xx_StdPeriph_Lib/time-STM32F2xx.c b/IDE/MDK-ARM/STM32F2xx_StdPeriph_Lib/time-STM32F2xx.c index 8a2ce67b8..48c217a01 100644 --- a/IDE/MDK-ARM/STM32F2xx_StdPeriph_Lib/time-STM32F2xx.c +++ b/IDE/MDK-ARM/STM32F2xx_StdPeriph_Lib/time-STM32F2xx.c @@ -1,6 +1,6 @@ /* time-STM32F2xx.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Conf/user_settings.h b/IDE/MDK5-ARM/Conf/user_settings.h index 58a9a25c0..7f277c715 100644 --- a/IDE/MDK5-ARM/Conf/user_settings.h +++ b/IDE/MDK5-ARM/Conf/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h b/IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h index 00bce98bf..3a40f69f5 100644 --- a/IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h +++ b/IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h @@ -1,6 +1,6 @@ /* wolfssl_KEIL_ARM.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/CryptBenchmark/RTE/wolfSSL/user_settings.h index 637fe4a01..a96d565e1 100644 --- a/IDE/MDK5-ARM/Projects/CryptBenchmark/RTE/wolfSSL/user_settings.h +++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/RTE/wolfSSL/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c b/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c index 38c167ac0..ab6b1e3fa 100644 --- a/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c +++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/CryptTest/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/CryptTest/RTE/wolfSSL/user_settings.h index 07834160f..45c56d9c4 100644 --- a/IDE/MDK5-ARM/Projects/CryptTest/RTE/wolfSSL/user_settings.h +++ b/IDE/MDK5-ARM/Projects/CryptTest/RTE/wolfSSL/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/CryptTest/main.c b/IDE/MDK5-ARM/Projects/CryptTest/main.c index 7ff887cd8..e8f406528 100644 --- a/IDE/MDK5-ARM/Projects/CryptTest/main.c +++ b/IDE/MDK5-ARM/Projects/CryptTest/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/EchoClient/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/EchoClient/RTE/wolfSSL/user_settings.h index 66ad62610..f1330fbf9 100644 --- a/IDE/MDK5-ARM/Projects/EchoClient/RTE/wolfSSL/user_settings.h +++ b/IDE/MDK5-ARM/Projects/EchoClient/RTE/wolfSSL/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/EchoClient/main.c b/IDE/MDK5-ARM/Projects/EchoClient/main.c index 62832e60a..5c530161e 100644 --- a/IDE/MDK5-ARM/Projects/EchoClient/main.c +++ b/IDE/MDK5-ARM/Projects/EchoClient/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/EchoServer/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/EchoServer/RTE/wolfSSL/user_settings.h index e253ba1a0..58b95790d 100644 --- a/IDE/MDK5-ARM/Projects/EchoServer/RTE/wolfSSL/user_settings.h +++ b/IDE/MDK5-ARM/Projects/EchoServer/RTE/wolfSSL/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/EchoServer/main.c b/IDE/MDK5-ARM/Projects/EchoServer/main.c index 2be031964..05a780c34 100644 --- a/IDE/MDK5-ARM/Projects/EchoServer/main.c +++ b/IDE/MDK5-ARM/Projects/EchoServer/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/SimpleClient/RTE/wolfSSL/user_settings.h index b7a823fb2..fdff446b7 100644 --- a/IDE/MDK5-ARM/Projects/SimpleClient/RTE/wolfSSL/user_settings.h +++ b/IDE/MDK5-ARM/Projects/SimpleClient/RTE/wolfSSL/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/main.c b/IDE/MDK5-ARM/Projects/SimpleClient/main.c index 09447b745..70bdae9be 100644 --- a/IDE/MDK5-ARM/Projects/SimpleClient/main.c +++ b/IDE/MDK5-ARM/Projects/SimpleClient/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/SimpleServer/RTE/wolfSSL/user_settings.h index b7a823fb2..fdff446b7 100644 --- a/IDE/MDK5-ARM/Projects/SimpleServer/RTE/wolfSSL/user_settings.h +++ b/IDE/MDK5-ARM/Projects/SimpleServer/RTE/wolfSSL/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/main.c b/IDE/MDK5-ARM/Projects/SimpleServer/main.c index 9f28ab1e2..dd938a1df 100644 --- a/IDE/MDK5-ARM/Projects/SimpleServer/main.c +++ b/IDE/MDK5-ARM/Projects/SimpleServer/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c b/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c index 57562cc60..f6fc15b03 100644 --- a/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c b/IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c index 8a97fd134..fac594098 100644 --- a/IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c @@ -1,6 +1,6 @@ /*shell.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c b/IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c index b64340f75..ea56f2f1f 100644 --- a/IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c @@ -1,6 +1,6 @@ /* time-STM32F2.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/RTE/wolfSSL/user_settings.h index b7a823fb2..fdff446b7 100644 --- a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/RTE/wolfSSL/user_settings.h +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/RTE/wolfSSL/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MDK5-ARM/Src/ssl-dummy.c b/IDE/MDK5-ARM/Src/ssl-dummy.c index 1aec62898..9395868ec 100644 --- a/IDE/MDK5-ARM/Src/ssl-dummy.c +++ b/IDE/MDK5-ARM/Src/ssl-dummy.c @@ -1,6 +1,6 @@ /* ssl-dummy.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MQX/client-tls.c b/IDE/MQX/client-tls.c index ced96d33c..2f8669299 100644 --- a/IDE/MQX/client-tls.c +++ b/IDE/MQX/client-tls.c @@ -1,6 +1,6 @@ /* client-tls.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + /* wolfSSL */ diff --git a/IDE/MQX/server-tls.c b/IDE/MQX/server-tls.c index 211f65513..68ffd77f8 100644 --- a/IDE/MQX/server-tls.c +++ b/IDE/MQX/server-tls.c @@ -1,6 +1,6 @@ /* server-tls.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + /* wolfSSL */ #include diff --git a/IDE/MSVS-2019-AZSPHERE/client/client.c b/IDE/MSVS-2019-AZSPHERE/client/client.c index 1c7e70efc..794b83082 100644 --- a/IDE/MSVS-2019-AZSPHERE/client/client.c +++ b/IDE/MSVS-2019-AZSPHERE/client/client.c @@ -1,6 +1,6 @@ /* client.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MSVS-2019-AZSPHERE/server/server.c b/IDE/MSVS-2019-AZSPHERE/server/server.c index da6671b9a..9c34433ec 100644 --- a/IDE/MSVS-2019-AZSPHERE/server/server.c +++ b/IDE/MSVS-2019-AZSPHERE/server/server.c @@ -1,6 +1,6 @@ /* server.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MSVS-2019-AZSPHERE/server/server.h b/IDE/MSVS-2019-AZSPHERE/server/server.h index eaa8edec0..b73774cee 100644 --- a/IDE/MSVS-2019-AZSPHERE/server/server.h +++ b/IDE/MSVS-2019-AZSPHERE/server/server.h @@ -1,6 +1,6 @@ /* server.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + #ifndef WOLFSSL_SERVER_H diff --git a/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/avnet_mt3620_sk/inc/hw/template_appliance.h b/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/avnet_mt3620_sk/inc/hw/template_appliance.h index e956d5921..5bf3d54b4 100644 --- a/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/avnet_mt3620_sk/inc/hw/template_appliance.h +++ b/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/avnet_mt3620_sk/inc/hw/template_appliance.h @@ -1,6 +1,6 @@ /* template_appliance.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/seeed_mt3620_mdb/inc/hw/template_appliance.h b/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/seeed_mt3620_mdb/inc/hw/template_appliance.h index e2af66bec..6f867ab9e 100644 --- a/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/seeed_mt3620_mdb/inc/hw/template_appliance.h +++ b/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/HardwareDefinitions/seeed_mt3620_mdb/inc/hw/template_appliance.h @@ -1,6 +1,6 @@ /* template_appliance.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/main.c b/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/main.c index 104e0c8df..183de4015 100644 --- a/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/main.c +++ b/IDE/MSVS-2019-AZSPHERE/wolfssl_new_azsphere/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/MYSQL/CMakeLists_wolfCrypt.txt b/IDE/MYSQL/CMakeLists_wolfCrypt.txt index 1e2563df1..c558bc74f 100644 --- a/IDE/MYSQL/CMakeLists_wolfCrypt.txt +++ b/IDE/MYSQL/CMakeLists_wolfCrypt.txt @@ -1,6 +1,6 @@ # CMakeLists.txt # -# Copyright (C) 2006-2021 wolfSSL Inc. +# Copyright (C) 2006-2022 wolfSSL Inc. # # This file is part of wolfSSL. # @@ -17,8 +17,6 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -#/ -#/ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include diff --git a/IDE/MYSQL/CMakeLists_wolfSSL.txt b/IDE/MYSQL/CMakeLists_wolfSSL.txt index aab778220..4f0eec23b 100644 --- a/IDE/MYSQL/CMakeLists_wolfSSL.txt +++ b/IDE/MYSQL/CMakeLists_wolfSSL.txt @@ -1,6 +1,6 @@ # CMakeLists.txt # -# Copyright (C) 2006-2021 wolfSSL Inc. +# Copyright (C) 2006-2022 wolfSSL Inc. # # This file is part of wolfSSL. # @@ -17,8 +17,6 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -#/ -#/ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include diff --git a/IDE/NETOS/wolfssl_netos_custom.c b/IDE/NETOS/wolfssl_netos_custom.c index 2094cf6b4..49674be83 100644 --- a/IDE/NETOS/wolfssl_netos_custom.c +++ b/IDE/NETOS/wolfssl_netos_custom.c @@ -1,6 +1,6 @@ /* wolfssl_netos_custom.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/QNX/example-client/client-tls.c b/IDE/QNX/example-client/client-tls.c index d6e890d4a..b8704daf3 100644 --- a/IDE/QNX/example-client/client-tls.c +++ b/IDE/QNX/example-client/client-tls.c @@ -1,6 +1,6 @@ /* client-tls.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/QNX/example-cmac/cmac-test.c b/IDE/QNX/example-cmac/cmac-test.c index f82155652..d9590aa29 100644 --- a/IDE/QNX/example-cmac/cmac-test.c +++ b/IDE/QNX/example-cmac/cmac-test.c @@ -1,6 +1,6 @@ /* cmac-test.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/QNX/example-server/server-tls.c b/IDE/QNX/example-server/server-tls.c index ebd68ece8..9eb87d1c8 100644 --- a/IDE/QNX/example-server/server-tls.c +++ b/IDE/QNX/example-server/server-tls.c @@ -1,6 +1,6 @@ /* server-tls.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/RISCV/SIFIVE-HIFIVE1/main.c b/IDE/RISCV/SIFIVE-HIFIVE1/main.c index 84611784b..60633d0c1 100644 --- a/IDE/RISCV/SIFIVE-HIFIVE1/main.c +++ b/IDE/RISCV/SIFIVE-HIFIVE1/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/RISCV/SIFIVE-HIFIVE1/user_settings.h b/IDE/RISCV/SIFIVE-HIFIVE1/user_settings.h index f4bb8258b..8b8709f00 100644 --- a/IDE/RISCV/SIFIVE-HIFIVE1/user_settings.h +++ b/IDE/RISCV/SIFIVE-HIFIVE1/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/arm_startup.c b/IDE/ROWLEY-CROSSWORKS-ARM/arm_startup.c index d838357b1..fbf746a32 100644 --- a/IDE/ROWLEY-CROSSWORKS-ARM/arm_startup.c +++ b/IDE/ROWLEY-CROSSWORKS-ARM/arm_startup.c @@ -1,6 +1,6 @@ /* arm_startup.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c b/IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c index 6b10417a5..94720e4d9 100644 --- a/IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c +++ b/IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c @@ -1,6 +1,6 @@ /* benchmark_main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/kinetis_hw.c b/IDE/ROWLEY-CROSSWORKS-ARM/kinetis_hw.c index bdbce0bda..ee2e0fe9d 100644 --- a/IDE/ROWLEY-CROSSWORKS-ARM/kinetis_hw.c +++ b/IDE/ROWLEY-CROSSWORKS-ARM/kinetis_hw.c @@ -1,6 +1,6 @@ /* kinetis_hw.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/retarget.c b/IDE/ROWLEY-CROSSWORKS-ARM/retarget.c index b3841f671..97772cff3 100644 --- a/IDE/ROWLEY-CROSSWORKS-ARM/retarget.c +++ b/IDE/ROWLEY-CROSSWORKS-ARM/retarget.c @@ -1,6 +1,6 @@ /* retarget.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/test_main.c b/IDE/ROWLEY-CROSSWORKS-ARM/test_main.c index 3b2b3e644..c78a9d135 100644 --- a/IDE/ROWLEY-CROSSWORKS-ARM/test_main.c +++ b/IDE/ROWLEY-CROSSWORKS-ARM/test_main.c @@ -1,6 +1,6 @@ /* test_main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/cs+/Projects/common/strings.h b/IDE/Renesas/cs+/Projects/common/strings.h index e3752588e..4e935718d 100644 --- a/IDE/Renesas/cs+/Projects/common/strings.h +++ b/IDE/Renesas/cs+/Projects/common/strings.h @@ -1,6 +1,6 @@ /* strings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/cs+/Projects/common/unistd.h b/IDE/Renesas/cs+/Projects/common/unistd.h index 962ad47ee..aa758a3b7 100644 --- a/IDE/Renesas/cs+/Projects/common/unistd.h +++ b/IDE/Renesas/cs+/Projects/common/unistd.h @@ -1,6 +1,6 @@ /* unistd.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/cs+/Projects/common/user_settings.h b/IDE/Renesas/cs+/Projects/common/user_settings.h index eef1d3331..0ce546d6a 100644 --- a/IDE/Renesas/cs+/Projects/common/user_settings.h +++ b/IDE/Renesas/cs+/Projects/common/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/cs+/Projects/common/wolfssl_dummy.c b/IDE/Renesas/cs+/Projects/common/wolfssl_dummy.c index cfba7259e..b40309c9c 100644 --- a/IDE/Renesas/cs+/Projects/common/wolfssl_dummy.c +++ b/IDE/Renesas/cs+/Projects/common/wolfssl_dummy.c @@ -1,6 +1,6 @@ /* wolfssl_dummy.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/cs+/Projects/t4_demo/wolf_client.c b/IDE/Renesas/cs+/Projects/t4_demo/wolf_client.c index 49628d8ba..ce67548cb 100644 --- a/IDE/Renesas/cs+/Projects/t4_demo/wolf_client.c +++ b/IDE/Renesas/cs+/Projects/t4_demo/wolf_client.c @@ -1,6 +1,6 @@ /* wolf_client.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/cs+/Projects/t4_demo/wolf_main.c b/IDE/Renesas/cs+/Projects/t4_demo/wolf_main.c index c50c858c2..f631d10ea 100644 --- a/IDE/Renesas/cs+/Projects/t4_demo/wolf_main.c +++ b/IDE/Renesas/cs+/Projects/t4_demo/wolf_main.c @@ -1,6 +1,6 @@ /* wolf_main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/cs+/Projects/t4_demo/wolf_server.c b/IDE/Renesas/cs+/Projects/t4_demo/wolf_server.c index 97ca42816..53d851367 100644 --- a/IDE/Renesas/cs+/Projects/t4_demo/wolf_server.c +++ b/IDE/Renesas/cs+/Projects/t4_demo/wolf_server.c @@ -1,6 +1,6 @@ /* wolf_server.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/cs+/Projects/test/test_main.c b/IDE/Renesas/cs+/Projects/test/test_main.c index 9493273cb..772c58941 100644 --- a/IDE/Renesas/cs+/Projects/test/test_main.c +++ b/IDE/Renesas/cs+/Projects/test/test_main.c @@ -1,6 +1,6 @@ /* test_main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/cs+/Projects/wolfssl_lib/wolfssl_lib.mtpj b/IDE/Renesas/cs+/Projects/wolfssl_lib/wolfssl_lib.mtpj index df403274a..6ad2995b3 100644 --- a/IDE/Renesas/cs+/Projects/wolfssl_lib/wolfssl_lib.mtpj +++ b/IDE/Renesas/cs+/Projects/wolfssl_lib/wolfssl_lib.mtpj @@ -1,2277 +1,2296 @@ - - 8.01.00.00 - - - 2.0 - 8.1 - 805a7df9-f7cc-472f-9206-7f15b6ccd6ac - d0def283-fa90-4332-b42c-8fccd3585a64 - e38de3e6-e537-43bc-9f7d-3958453b991f - fb98844b-2c27-4275-9804-f6e63e204da0 - 805a7df9-f7cc-472f-9206-7f15b6ccd6ac - - - src - Category - e38de3e6-e537-43bc-9f7d-3958453b991f - 1329e557-253c-4918-9334-b7a7bb78bcc3 - - - wolfcrypt - Category - e38de3e6-e537-43bc-9f7d-3958453b991f - b113ecd1-816e-459a-afa4-fbc8975bfcb1 - - - user_settings.h - File - ..\common\user_settings.h - 03cad1e8-2eb3-4cde-a8a3-982423631122 - e38de3e6-e537-43bc-9f7d-3958453b991f - - - crl.c - File - ..\..\..\..\..\src\crl.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 643856af-37e1-473f-8b2a-3671425d00f7 - - - internal.c - File - ..\..\..\..\..\src\internal.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 643856af-37e1-473f-8b2a-3671425d00f7 - - - keys.c - File - ..\..\..\..\..\src\keys.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 643856af-37e1-473f-8b2a-3671425d00f7 - - - ocsp.c - File - ..\..\..\..\..\src\ocsp.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 643856af-37e1-473f-8b2a-3671425d00f7 - - - sniffer.c - File - ..\..\..\..\..\src\sniffer.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 643856af-37e1-473f-8b2a-3671425d00f7 - - - ssl.c - File - ..\..\..\..\..\src\ssl.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 643856af-37e1-473f-8b2a-3671425d00f7 - - - tls.c - File - ..\..\..\..\..\src\tls.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 643856af-37e1-473f-8b2a-3671425d00f7 - - - tls13.c - File - ..\..\..\..\..\src\tls13.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 643856af-37e1-473f-8b2a-3671425d00f7 - - - wolfio.c - File - ..\..\..\..\..\src\wolfio.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 643856af-37e1-473f-8b2a-3671425d00f7 - - - src - Category - 78a99f10-6945-4b7b-ab83-895a78962b99 - b3a0ee4c-7893-43ab-aa14-cc84267a24b4 - - - aes.c - File - ..\..\..\..\..\wolfcrypt\src\aes.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - arc4.c - File - ..\..\..\..\..\wolfcrypt\src\arc4.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - asm.c - File - ..\..\..\..\..\wolfcrypt\src\asm.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - asn.c - File - ..\..\..\..\..\wolfcrypt\src\asn.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - blake2b.c - File - ..\..\..\..\..\wolfcrypt\src\blake2b.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - camellia.c - File - ..\..\..\..\..\wolfcrypt\src\camellia.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - chacha.c - File - ..\..\..\..\..\wolfcrypt\src\chacha.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - chacha20_poly1305.c - File - ..\..\..\..\..\wolfcrypt\src\chacha20_poly1305.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - cmac.c - File - ..\..\..\..\..\wolfcrypt\src\cmac.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - coding.c - File - ..\..\..\..\..\wolfcrypt\src\coding.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - compress.c - File - ..\..\..\..\..\wolfcrypt\src\compress.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - cpuid.c - File - ..\..\..\..\..\wolfcrypt\src\cpuid.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - curve25519.c - File - ..\..\..\..\..\wolfcrypt\src\curve25519.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - des3.c - File - ..\..\..\..\..\wolfcrypt\src\des3.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - dh.c - File - ..\..\..\..\..\wolfcrypt\src\dh.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - dsa.c - File - ..\..\..\..\..\wolfcrypt\src\dsa.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - ecc.c - File - ..\..\..\..\..\wolfcrypt\src\ecc.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - ecc_fp.c - File - ..\..\..\..\..\wolfcrypt\src\ecc_fp.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - ed25519.c - File - ..\..\..\..\..\wolfcrypt\src\ed25519.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - error.c - File - ..\..\..\..\..\wolfcrypt\src\error.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - fe_low_mem.c - File - ..\..\..\..\..\wolfcrypt\src\fe_low_mem.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - fe_operations.c - File - ..\..\..\..\..\wolfcrypt\src\fe_operations.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - ge_low_mem.c - File - ..\..\..\..\..\wolfcrypt\src\ge_low_mem.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - ge_operations.c - File - ..\..\..\..\..\wolfcrypt\src\ge_operations.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - hash.c - File - ..\..\..\..\..\wolfcrypt\src\hash.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - hmac.c - File - ..\..\..\..\..\wolfcrypt\src\hmac.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - integer.c - File - ..\..\..\..\..\wolfcrypt\src\integer.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - kdf.c - File - ..\..\..\..\..\wolfcrypt\src\kdf.c - 2170607d-803e-45b0-80af-6507d495a8de - 2d70eb4e-e44a-4902-85bd-c2213863b503 - - - logging.c - File - ..\..\..\..\..\wolfcrypt\src\logging.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - md2.c - File - ..\..\..\..\..\wolfcrypt\src\md2.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - md4.c - File - ..\..\..\..\..\wolfcrypt\src\md4.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - md5.c - File - ..\..\..\..\..\wolfcrypt\src\md5.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - memory.c - File - ..\..\..\..\..\wolfcrypt\src\memory.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - pkcs7.c - File - ..\..\..\..\..\wolfcrypt\src\pkcs7.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - pkcs12.c - File - ..\..\..\..\..\wolfcrypt\src\pkcs12.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - poly1305.c - File - ..\..\..\..\..\wolfcrypt\src\poly1305.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - pwdbased.c - File - ..\..\..\..\..\wolfcrypt\src\pwdbased.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - random.c - File - ..\..\..\..\..\wolfcrypt\src\random.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - ripemd.c - File - ..\..\..\..\..\wolfcrypt\src\ripemd.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - rsa.c - File - ..\..\..\..\..\wolfcrypt\src\rsa.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - sha.c - File - ..\..\..\..\..\wolfcrypt\src\sha.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - sha3.c - File - ..\..\..\..\..\wolfcrypt\src\sha3.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - sha256.c - File - ..\..\..\..\..\wolfcrypt\src\sha256.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - sha512.c - File - ..\..\..\..\..\wolfcrypt\src\sha512.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - signature.c - File - ..\..\..\..\..\wolfcrypt\src\signature.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - sp_int.c - File - ..\..\..\..\..\wolfcrypt\src\sp_int.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - srp.c - File - ..\..\..\..\..\wolfcrypt\src\srp.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - tfm.c - File - ..\..\..\..\..\wolfcrypt\src\tfm.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - wc_encrypt.c - File - ..\..\..\..\..\wolfcrypt\src\wc_encrypt.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - wc_port.c - File - ..\..\..\..\..\wolfcrypt\src\wc_port.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - wolfevent.c - File - ..\..\..\..\..\wolfcrypt\src\wolfevent.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - wolfmath.c - File - ..\..\..\..\..\wolfcrypt\src\wolfmath.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - sp_arm32.c - File - ..\..\..\..\..\wolfcrypt\src\sp_arm32.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - sp_arm64.c - File - ..\..\..\..\..\wolfcrypt\src\sp_arm64.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - sp_c32.c - File - ..\..\..\..\..\wolfcrypt\src\sp_c32.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - sp_c64.c - File - ..\..\..\..\..\wolfcrypt\src\sp_c64.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - sp_x86_64.c - File - ..\..\..\..\..\wolfcrypt\src\sp_x86_64.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 2170607d-803e-45b0-80af-6507d495a8de - - - - - True - 0 - - - - - 0 - - - 0 - - - 0 - - - - - 7020d445-1358-4043-a8ea-3b101e73ceaa - f96683fa-8de4-4c6d-a1ab-925d7f232c09 - - - - - 0e793ff3-2e3f-43c0-bdc9-926269595403 - - - - - 1.0 - - - R5F571MLDxFC - 0 - - - - - 1 - R5F565N7BxFB - - - - - 3a79707d-5977-45f7-ac11-19c35e333132 - - - - - 1.4 - 1 - RABlAGYAYQB1AGwAdABCAHUAaQBsAGQA - False - DefaultBuild - caa2365b-7326-4cbb-bd88-b0ecf296df18 - CSource - 88a38e4a-4dfb-4898-9cb1-3fca23baa801 - CSource - 14d110f9-107a-468d-ae40-b782fb65281c - CSource - 41081f6c-6d11-44bd-bd41-132950d4b65f - CSource - 73d53150-3cf0-45d5-9cd7-3794e323ac7c - CSource - b08783cd-82bc-4f1e-83be-b63606e18e1e - CSource - 5f8fbe9c-a21c-4da6-a01a-101aa17342e6 - CSource - 7e5cafe8-1ca7-47bf-8a56-75c90f0aeb2b - CSource - 9e89d082-b6ef-42cf-abba-b19ecd779121 - CSource - cfc4ddef-2ff8-440d-9135-5e36e230a9d0 - CSource - 5e231ff0-c118-4dc7-a48b-4a49019341fd - CSource - 833048b3-3a29-4897-9e42-6442e3651b16 - CSource - 3fc95b85-bb90-43d5-aa79-b3fb598696f9 - CSource - 8dfd13ae-48b6-4617-823d-c9d47886b2f1 - CSource - ad6d521e-8d24-4e7f-b731-6c09014373d6 - CSource - 2ae5859b-d47d-4473-8868-5f8d4ccc13fd - CSource - 7a86f97b-01cd-4d3f-8266-1a51e412c9eb - CSource - 8a45bb03-e6c7-480d-bbf6-fa49d6a18fb8 - CSource - 77038a87-cf7c-49fa-804c-e0aa205e3577 - CSource - 32c7b2d9-0fbe-4b95-ae23-a72399676db7 - CSource - b70e920e-a6ab-45d9-8712-cb894c7be8ec - CSource - 5abad234-5533-4425-8868-ca5dd16c7b0a - CSource - e0ef155e-a525-41f6-a2a6-b2b932dd79da - CSource - cd628038-e785-4445-93d6-9767879ff444 - CSource - ab743436-e914-44a6-bb32-6e9f5970a157 - CSource - ff3b1bee-5d5f-4822-8450-8a4d7288893a - CSource - 2cab52f3-45f5-4a6b-bed5-c49c1fcb3154 - CSource - be5dce22-07e7-4fcd-bbc7-9fbca0808ee3 - CSource - 2de1ac30-78dd-4a8a-a4c1-b03e0a72f7c8 - CSource - 58a3c174-a180-48e2-8ecd-2a55bdc950f1 - CSource - e1d8a94d-79fe-411c-8af9-5deddb3f6e58 - CSource - 0e3a6c2a-0fd5-4d86-83d9-f0256ae9e1d2 - CSource - 19b17c0d-d6fe-4aa2-b534-d02d59b392cb - CSource - 1529a7d4-0b6c-4ea8-900a-ec81b5eac904 - CSource - 85c26e25-fbfe-4ece-afca-4d142c6ea135 - CSource - d2806186-287c-47e3-bf79-8daa033201cb - CSource - 83d865e6-46a2-49da-8549-b021d2114a0e - CSource - d2f5a477-e313-47c6-acd6-094c38f1ab1a - CSource - f45859b1-b772-490f-a33a-b5b4a5a3c588 - CSource - b471977c-7300-4655-bd30-3796dc3d258e - CSource - 3fdef9c1-79c2-4de3-b252-9e999235ac35 - CSource - 209f29fe-f9fe-4822-ab88-9feaad450052 - CSource - 9d5b45a5-4bed-444b-915c-b002bc2a2fa6 - CSource - 3ede6353-7678-4ee8-9a02-eab7215dc75a - CSource - 9bf244df-506e-4b4c-ad2f-e5dc9ee7dd98 - CSource - 91aab859-8af5-44f1-a8c9-e80cce8db8ac - CSource - 344691e8-47e1-4656-8d67-554b79beeb09 - CSource - c70b46e7-e59d-4f63-b374-25c07445cbd9 - CSource - 84abe674-65a0-4a83-9950-b3b2de5541e8 - CSource - 97a9f706-2d1d-423b-ae9d-67f1953b4646 - CSource - 43097e29-0472-439a-94e3-12705379cb30 - CSource - 953be9ae-7876-4d95-bccf-4d9872e5893e - CSource - 811d4212-787b-4006-a87f-eb5c82ff497b - CSource - eb209abd-c2f3-40fc-b36d-3489af8c2789 - CSource - 27b7c24f-ed90-4cdf-9e0f-8b8c97d1ef3d - CSource - 9a47b4ee-7f6b-4b54-914a-d52b6c697869 - CSource - b1390d66-373b-4f43-9ec5-024078ccd77e - CSource - 815a4f81-17bf-43d9-8891-bbe2d22555a9 - CSource - 51299014-db14-4e23-a579-ae04ec1ff314 - CSource - 17e90222-3ae5-41b9-a3be-70013eae67f2 - CSource - 75311d1a-e849-465b-bb0b-77546709e1ec - CSource - 52c93bf0-a1fe-4691-afab-4b9811aade10 - CSource - 317a55ec-33e2-45da-be24-8bc5730885fe - CSource - 221078b7-a232-4160-8909-cbc48b3f6a2a - CSource - d1a109cd-a5af-4f79-8bef-7acd6d46c8db - CSource - 66 - 1 - - - - DefaultBuild - - RXv2 - LibraryFile - False - True - True - Debug - - - %TargetFiles% - - - - -0 - %TargetFiles% : %Program% %Options% - RX600 - False - %BuildModeName% - None - Stype - Debug - False - - - Rebuild - Fpu - True - %BuildModeName% - None - True - True - False - Little - %ProjectName%.mot - False - - False - Level2 - Nearest - - False - - False - False - Off - 1E - False - Size - SinglePrecision - False - False - False - False - False - False - False - Unsigned - - False - - Unsigned - False - False - False - Right - False - False - False - None - Branch24 - None - None - 00000000 - None - None - False - False - -8586657078646268366 - DefaultBuild - - %TargetFiles% - %TargetFiles% : %Program% %Options% - False - - - RXv2 - LibraryFile - False - True - - -0 - RX600 - False - %BuildModeName% - None - Rebuild - Fpu - True - %BuildModeName% - False - Little - %ProjectName%.mot - False - Nearest - - False - False - Off - False - SinglePrecision - False - False - False - False - False - Unsigned - False - - Unsigned - False - False - False - Right - False - False - False - None - Branch24 - None - None - 00000000 - None - None - False - V2.08.00 - - - C - False - False - Misra2012 - Level2 - Object - False - -output=obj - None - False - Cpp - None - %BuildModeName% - None - False - False - None - True - - - - False - Size - Auto - - - P - False - - 2 - - - - C - False - -isa=rxv2 --fpu --include=..\..\..\..\..\wolfssl\openssl --include=..\..\..\..\.. --include=. --include=..\common --define=WOLFSSL_USER_SETTINGS --output=obj --obj_path=%BuildModeName% --debug --nologo --exec_time - - - Auto - - D - 100 - - B - - - False - None - L - Auto - False - - W - - - False - False - Auto - - - False - Auto - - - False - No - Intrinsic - - False - - - Noinstalign - Auto - False - - False - Auto - No - NoMap - True - - False - None - False - - - No - False - Sjis - - False - - Fpu - False - - Auto - False - No - False - Sjis - False - -8586767488619021802 - C99 - False - False - Misra2012 - Level2 - Object - False - -output=obj - None - False - Cpp - None - %BuildModeName% - None - False - False - None - True - ..\..\..\..\..\wolfssl\openssl -..\..\..\..\.. -. -..\common - - - - False - Size - Auto - - - P - False - - 2 - - - - C - False - -isa=rxv2 --fpu --include=..\..\..\..\..\wolfssl\openssl --include=..\..\..\..\.. --include=. --include=..\common --define=WOLFSSL_USER_SETTINGS --output=obj --obj_path=%BuildModeName% --debug --nologo --exec_time - - WOLFSSL_USER_SETTINGS - - Auto - - D - 100 - - B - - - False - None - L - Auto - - W - - - False - False - Auto - - False - Auto - - - False - No - Intrinsic - - False - - - Noinstalign - Auto - False - False - Auto - No - NoMap - True - - False - None - False - - No - False - Sjis - - False - Fpu - False - - Auto - False - No - False - Sjis - - - False - False - - False - -output - %BuildModeName% - False - True - False - - False - False - - False - SJIS - False - False - - - - -isa=rxv2 --fpu --output=obj --obj_path=%BuildModeName% --debug --nologo --exec_time - - False - -8586796872818976776 - False - False - - False - -output - %BuildModeName% - False - True - False - - False - False - - False - SJIS - False - False - - - - -isa=rxv2 --fpu --output=obj --obj_path=%BuildModeName% --debug --nologo --exec_time - - - - False - Absolute - Stype - - None - None - False - - False - - Debug - - - False - None - False - - False - False - False - %BuildModeName% - None - False - - - None - - False - %ProjectName%.abs - - 1E - False - - %BuildModeName% - - False - False - False - None - %ProjectName%.mot - False - NoMessage - False - False - - - False - - False - - None - - Auto - - False - None - - False - - FF - - False - False - - FF - False - - None - False - False - 0 - - - False - - - - - False - - - - False - -8586795540117778576 - False - Absolute - Stype - - None - None - False - - False - - Debug - - - False - None - False - - False - False - False - %BuildModeName% - None - False - - - None - - False - %ProjectName%.abs - - 1E - False - - %BuildModeName% - - False - False - False - None - %ProjectName%.mot - False - NoMessage - False - False - - - False - - False - - None - - Auto - - False - None - - False - - FF - - False - False - - FF - False - - None - False - False - 0 - - - False - - - - - False - - - - - - Stype - True - True - NoMessage - %BuildModeName% - None - - %ProjectName%.mot - None - None - - None - - FF - None - False - - 1 - None - False - - FF - None - - - False - 0 - - Ccitt - - None - None - False - False - False - -8586796872818966962 - Stype - True - True - NoMessage - %BuildModeName% - None - - %ProjectName%.mot - None - None - - None - - FF - None - False - - 1 - None - False - - FF - None - - - False - 0 - - Ccitt - - None - None - False - False - - - LibraryU - - List - False - None - Debug - - False - - %BuildModeName% - False - - - None - %ProjectName%.lib - False - - NoMessage - Auto - False - None - - False - - False - False - False - - - - -noprelink --form=library=u --output=%BuildModeName%\%ProjectName%.lib --list=%BuildModeName%\%ProjectName%.lbp --nologo --exit - - False - -8586795540117778576 - LibraryU - - List - False - None - Debug - - False - - %BuildModeName% - False - - - None - %ProjectName%.lib - False - - NoMessage - Auto - False - None - - False - - False - False - False - - - - -noprelink --form=library=u --output=%BuildModeName%\%ProjectName%.lib --list=%BuildModeName%\%ProjectName%.lbp --nologo --exit - - - - C - None - False - %BuildModeName% - False - Custom - Level2 - %ProjectName%.lib - - None - False - True - - False - - False - Size - - False - Auto - False - False - 2 - False - False - Auto - P - True - 100 - C - - True - D - Auto - True - B - False - L - False - Auto - True - W - Auto - False - False - False - Intrinsic - False - False - False - Auto - False - False - Auto - False - False - Noinstalign - False - False - False - False - True - False - Fpu - False - False - -8586796872818966962 - C - None - False - %BuildModeName% - False - Custom - Level2 - %ProjectName%.lib - - None - False - - False - - False - Size - - False - Auto - False - False - 2 - False - False - Auto - P - True - 100 - C - - True - D - Auto - True - B - False - L - False - Auto - True - W - Auto - False - False - False - Intrinsic - False - False - False - Auto - False - False - Auto - False - False - Noinstalign - False - False - False - False - True - False - Fpu - False - - - 636575488687265696 - 1 - - - 636575488687265696 - 2 - - - 636575488687265696 - 3 - - - 636575488687265696 - 4 - - - 636575488687265696 - 5 - - - 636575488687265696 - 6 - - - 636575488687265696 - 7 - - - 636575488687265696 - 8 - - - 636575488687265696 - 9 - - - 636575488940589048 - 0 - - - 636575488940589048 - 1 - - - 636575488940589048 - 2 - - - 636575488940589048 - 3 - - - 636575496067311621 - 0 - - - 636575488940589048 - 5 - - - 636575488940589048 - 6 - - - 636575488940589048 - 7 - - - 636575488940589048 - 8 - - - 636575488940589048 - 9 - - - 636575488940589048 - 10 - - - 636575488940589048 - 11 - - - 636575488940589048 - 12 - - - 636575488940589048 - 13 - - - 636575488940589048 - 14 - - - 636575488940589048 - 15 - - - 636575488940589048 - 16 - - - 636575488940589048 - 17 - - - 636575488940589048 - 18 - - - 636575488940589048 - 19 - - - 636575488940589048 - 20 - - - 636575488940589048 - 22 - - - 636575488940589048 - 23 - - - 636575488940589048 - 25 - - - 636575488940589048 - 26 - - - 636575488940589048 - 27 - - - 636575488940589048 - 29 - - - 636575488940589048 - 31 - - - 636575488940589048 - 32 - - - 636575488940589048 - 33 - - - 636575488940589048 - 34 - - - 636575488940589048 - 35 - - - 636575488940589048 - 36 - - - 636575488940589048 - 37 - - - 636575488940589048 - 38 - - - 636575488940589048 - 39 - - - 636575488940589048 - 40 - - - 636575488940589048 - 42 - - - 636575488940589048 - 43 - - - 636575488940589048 - 44 - - - 636575488940589048 - 46 - - - 636575488940589048 - 47 - - - 636575488940589048 - 48 - - - 636575488940589048 - 49 - - - 636575488940589048 - 50 - - - 636575488940589048 - 52 - - - 636575488940589048 - 53 - - - 636575488940589048 - 54 - - - 636575488940589048 - 55 - - - 636575488940589048 - 56 - - - 636575488940589048 - 57 - - - 636575488940589048 - 58 - - - 636575494875104790 - 1 - - - 636575494875104790 - 2 - - - 636575494875104790 - 3 - - - 636575494875104790 - 4 - - - 636575494875104790 - 5 - - - -8586796872167510112 - False - True - False - -8586796872167510112 - False - True - False - -8586796872167510112 - False - True - False - -8586796872167510112 - False - True - False - -8586796872167510112 - False - True - False - -8586796872167510112 - False - True - False - -8586796872167510112 - False - True - False - -8586796872167500299 - False - True - False - -8586796872167500299 - False - True - False - -8586796871914181681 - False - True - False - -8586796871914181681 - False - True - False - -8586796871914181681 - False - True - False - -8586796871914181681 - False - True - False - -8586796871914176690 - False - True - False - -8586796871914176690 - False - True - False - -8586796871914171698 - False - True - False - -8586796871914171698 - False - True - False - -8586796871914166695 - False - True - False - -8586796871914166695 - False - True - False - -8586796871914166695 - False - True - False - -8586796871914166695 - False - True - False - -8586796871914166695 - False - True - False - -8586796871914166695 - False - True - False - -8586796871914166695 - False - True - False - -8586796871914166695 - False - True - False - -8586796871914166695 - False - True - False - -8586796871914166695 - False - True - False - -8586796871914166695 - False - True - False - -8586796871914166695 - False - True - False - -8586796871914166695 - False - True - False - -8586796871914156829 - False - True - False - -8586796871914156829 - False - True - False - -8586796871914156829 - False - True - False - -8586796871914156829 - False - True - False - -8586796871914156829 - False - True - False - -8586796871914156829 - False - True - False - -8586796871914156829 - False - True - False - -8586796871914156829 - False - True - False - -8586796871914151735 - False - True - False - -8586796871914151735 - False - True - False - -8586796871914151735 - False - True - False - -8586796871914151735 - False - True - False - -8586796871914151735 - False - True - False - -8586796871914151735 - False - True - False - -8586796871914151735 - False - True - False - -8586796871914146702 - False - True - False - -8586796871914146702 - False - True - False - -8586796871914146702 - False - True - False - -8586796871914141673 - False - True - False - -8586796871914141673 - False - True - False - -8586796871914141673 - False - True - False - -8586796871914141673 - False - True - False - -8586796871914141673 - False - True - False - -8586796871914141673 - False - True - False - -8586796871914141673 - False - True - False - -8586796871914141673 - False - True - False - -8586796871914141673 - False - True - False - -8586796871914141673 - False - True - False - -8586796871914141673 - False - True - False - -8586796871914141673 - False - True - False - -8586796871914136311 - False - True - False - -8586796871914136311 - False - True - False - -8586796871914136311 - False - True - False - -8586796865979661205 - False - True - False - -8586796865979661205 - False - True - False - -8586796865979661205 - False - True - False - -8586796865979661205 - False - True - False - -8586796865979661205 - False - True - False - - - - - True - 00000000-0000-0000-0000-000000000000 - - - - - - - - - - R5F565N7BxFB - - - - - 7d577131-4ec1-4e88-968d-89381f6c178a - - - - - 1.1 - - - False - False - False - True - Yes - Nanosecond - False - False - False - False - False - True - FilesNotToAnalyze - 0 - All - 0 - False - %ProjectName%.mtfl - %ProjectName%.mtvl - 10 - - - RealtimeSampling - - Synchronized - AtProgramStop - 20 - 1000000 - LineChart - False - PaleGreen - PaleTurquoise - 40ff0a4f - 405be416 - 40056def - 40ff541c - False - Auto - Channel01 - 0 - Rising - 0 - Orange - 10 - None - - - - - - - - - - - - - - - - - Auto - Auto - Auto - Auto - Auto - Auto - Auto - Auto - Auto - Auto - Auto - Auto - Auto - Auto - Auto - Auto - 25.5 - 25.5 - 25.5 - 25.5 - 25.5 - 25.5 - 25.5 - 25.5 - 25.5 - 25.5 - 25.5 - 25.5 - 25.5 - 25.5 - 25.5 - 25.5 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - c0ff0a4f - c05be416 - c0056dff - c0ff541c - c04fc1ff - c0a932ff - c0ffd91c - c0ff30a5 - c0bee02f - c05510ff - c0ff97e4 - c0913a37 - c0c68e15 - c0317f0c - c060493e - c072808e - - - - - 90536345-15c8-40cb-957c-e59974e4bf78 - - - - - E:\Renesas\wolfssl-3.14.0\wolfssl-3.14.0\IDE\Renesas\cs+\Projects\wolfssl_lib - E:\ProgramFiles\Renesas\SmartConfigurator\RX\eclipse\SmartConfigurator.exe - ab969cad-a48e-4926-b0d6-6ea8ba0de305 - wolfssl_lib.scfg - - - - - 8.01.00.00 - - - + + 9.03.00.00 + + + 2.0 + 9.3 + 805a7df9-f7cc-472f-9206-7f15b6ccd6ac + d0def283-fa90-4332-b42c-8fccd3585a64 + e38de3e6-e537-43bc-9f7d-3958453b991f + fb98844b-2c27-4275-9804-f6e63e204da0 + 805a7df9-f7cc-472f-9206-7f15b6ccd6ac + + + src + Category + e38de3e6-e537-43bc-9f7d-3958453b991f + 1329e557-253c-4918-9334-b7a7bb78bcc3 + + + wolfcrypt + Category + e38de3e6-e537-43bc-9f7d-3958453b991f + b113ecd1-816e-459a-afa4-fbc8975bfcb1 + + + user_settings.h + File + ..\common\user_settings.h + 03cad1e8-2eb3-4cde-a8a3-982423631122 + e38de3e6-e537-43bc-9f7d-3958453b991f + + + crl.c + File + ..\..\..\..\..\src\crl.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 643856af-37e1-473f-8b2a-3671425d00f7 + + + internal.c + File + ..\..\..\..\..\src\internal.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 643856af-37e1-473f-8b2a-3671425d00f7 + + + keys.c + File + ..\..\..\..\..\src\keys.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 643856af-37e1-473f-8b2a-3671425d00f7 + + + ocsp.c + File + ..\..\..\..\..\src\ocsp.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 643856af-37e1-473f-8b2a-3671425d00f7 + + + sniffer.c + File + ..\..\..\..\..\src\sniffer.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 643856af-37e1-473f-8b2a-3671425d00f7 + + + ssl.c + File + ..\..\..\..\..\src\ssl.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 643856af-37e1-473f-8b2a-3671425d00f7 + + + tls.c + File + ..\..\..\..\..\src\tls.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 643856af-37e1-473f-8b2a-3671425d00f7 + + + tls13.c + File + ..\..\..\..\..\src\tls13.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 643856af-37e1-473f-8b2a-3671425d00f7 + + + wolfio.c + File + ..\..\..\..\..\src\wolfio.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 643856af-37e1-473f-8b2a-3671425d00f7 + + + src + Category + 78a99f10-6945-4b7b-ab83-895a78962b99 + b3a0ee4c-7893-43ab-aa14-cc84267a24b4 + + + aes.c + File + ..\..\..\..\..\wolfcrypt\src\aes.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + arc4.c + File + ..\..\..\..\..\wolfcrypt\src\arc4.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + asm.c + File + ..\..\..\..\..\wolfcrypt\src\asm.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + asn.c + File + ..\..\..\..\..\wolfcrypt\src\asn.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + blake2b.c + File + ..\..\..\..\..\wolfcrypt\src\blake2b.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + camellia.c + File + ..\..\..\..\..\wolfcrypt\src\camellia.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + chacha.c + File + ..\..\..\..\..\wolfcrypt\src\chacha.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + chacha20_poly1305.c + File + ..\..\..\..\..\wolfcrypt\src\chacha20_poly1305.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + cmac.c + File + ..\..\..\..\..\wolfcrypt\src\cmac.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + coding.c + File + ..\..\..\..\..\wolfcrypt\src\coding.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + compress.c + File + ..\..\..\..\..\wolfcrypt\src\compress.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + cpuid.c + File + ..\..\..\..\..\wolfcrypt\src\cpuid.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + curve25519.c + File + ..\..\..\..\..\wolfcrypt\src\curve25519.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + des3.c + File + ..\..\..\..\..\wolfcrypt\src\des3.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + dh.c + File + ..\..\..\..\..\wolfcrypt\src\dh.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + dsa.c + File + ..\..\..\..\..\wolfcrypt\src\dsa.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + ecc.c + File + ..\..\..\..\..\wolfcrypt\src\ecc.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + ecc_fp.c + File + ..\..\..\..\..\wolfcrypt\src\ecc_fp.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + ed25519.c + File + ..\..\..\..\..\wolfcrypt\src\ed25519.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + error.c + File + ..\..\..\..\..\wolfcrypt\src\error.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + fe_low_mem.c + File + ..\..\..\..\..\wolfcrypt\src\fe_low_mem.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + fe_operations.c + File + ..\..\..\..\..\wolfcrypt\src\fe_operations.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + ge_low_mem.c + File + ..\..\..\..\..\wolfcrypt\src\ge_low_mem.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + ge_operations.c + File + ..\..\..\..\..\wolfcrypt\src\ge_operations.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + hash.c + File + ..\..\..\..\..\wolfcrypt\src\hash.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + hmac.c + File + ..\..\..\..\..\wolfcrypt\src\hmac.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + integer.c + File + ..\..\..\..\..\wolfcrypt\src\integer.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + kdf.c + File + ..\..\..\..\..\wolfcrypt\src\kdf.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + logging.c + File + ..\..\..\..\..\wolfcrypt\src\logging.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + md2.c + File + ..\..\..\..\..\wolfcrypt\src\md2.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + md4.c + File + ..\..\..\..\..\wolfcrypt\src\md4.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + md5.c + File + ..\..\..\..\..\wolfcrypt\src\md5.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + memory.c + File + ..\..\..\..\..\wolfcrypt\src\memory.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + pkcs7.c + File + ..\..\..\..\..\wolfcrypt\src\pkcs7.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + pkcs12.c + File + ..\..\..\..\..\wolfcrypt\src\pkcs12.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + poly1305.c + File + ..\..\..\..\..\wolfcrypt\src\poly1305.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + pwdbased.c + File + ..\..\..\..\..\wolfcrypt\src\pwdbased.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + random.c + File + ..\..\..\..\..\wolfcrypt\src\random.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + ripemd.c + File + ..\..\..\..\..\wolfcrypt\src\ripemd.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + rsa.c + File + ..\..\..\..\..\wolfcrypt\src\rsa.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sha.c + File + ..\..\..\..\..\wolfcrypt\src\sha.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sha3.c + File + ..\..\..\..\..\wolfcrypt\src\sha3.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sha256.c + File + ..\..\..\..\..\wolfcrypt\src\sha256.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sha512.c + File + ..\..\..\..\..\wolfcrypt\src\sha512.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + signature.c + File + ..\..\..\..\..\wolfcrypt\src\signature.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sp_int.c + File + ..\..\..\..\..\wolfcrypt\src\sp_int.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + srp.c + File + ..\..\..\..\..\wolfcrypt\src\srp.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + tfm.c + File + ..\..\..\..\..\wolfcrypt\src\tfm.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + wc_encrypt.c + File + ..\..\..\..\..\wolfcrypt\src\wc_encrypt.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + wc_port.c + File + ..\..\..\..\..\wolfcrypt\src\wc_port.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + wolfevent.c + File + ..\..\..\..\..\wolfcrypt\src\wolfevent.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + wolfmath.c + File + ..\..\..\..\..\wolfcrypt\src\wolfmath.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sp_arm32.c + File + ..\..\..\..\..\wolfcrypt\src\sp_arm32.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sp_arm64.c + File + ..\..\..\..\..\wolfcrypt\src\sp_arm64.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sp_c32.c + File + ..\..\..\..\..\wolfcrypt\src\sp_c32.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sp_c64.c + File + ..\..\..\..\..\wolfcrypt\src\sp_c64.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sp_x86_64.c + File + ..\..\..\..\..\wolfcrypt\src\sp_x86_64.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + + + True + 0 + + + + + 0 + + + 0 + + + 0 + + + + + 7020d445-1358-4043-a8ea-3b101e73ceaa + f96683fa-8de4-4c6d-a1ab-925d7f232c09 + + + + + 0e793ff3-2e3f-43c0-bdc9-926269595403 + + + + + 1.0 + + + R5F571MLDxFC + 0 + + + + + 1 + R5F565N7BxFB + + + + + 3a79707d-5977-45f7-ac11-19c35e333132 + + + + + 1.5 + 1 + RABlAGYAYQB1AGwAdABCAHUAaQBsAGQA + False + DefaultBuild + caa2365b-7326-4cbb-bd88-b0ecf296df18 + CSource + 88a38e4a-4dfb-4898-9cb1-3fca23baa801 + CSource + 14d110f9-107a-468d-ae40-b782fb65281c + CSource + 41081f6c-6d11-44bd-bd41-132950d4b65f + CSource + 73d53150-3cf0-45d5-9cd7-3794e323ac7c + CSource + b08783cd-82bc-4f1e-83be-b63606e18e1e + CSource + 5f8fbe9c-a21c-4da6-a01a-101aa17342e6 + CSource + 7e5cafe8-1ca7-47bf-8a56-75c90f0aeb2b + CSource + 9e89d082-b6ef-42cf-abba-b19ecd779121 + CSource + cfc4ddef-2ff8-440d-9135-5e36e230a9d0 + CSource + 5e231ff0-c118-4dc7-a48b-4a49019341fd + CSource + 833048b3-3a29-4897-9e42-6442e3651b16 + CSource + 3fc95b85-bb90-43d5-aa79-b3fb598696f9 + CSource + 8dfd13ae-48b6-4617-823d-c9d47886b2f1 + CSource + ad6d521e-8d24-4e7f-b731-6c09014373d6 + CSource + 2ae5859b-d47d-4473-8868-5f8d4ccc13fd + CSource + 7a86f97b-01cd-4d3f-8266-1a51e412c9eb + CSource + 8a45bb03-e6c7-480d-bbf6-fa49d6a18fb8 + CSource + 77038a87-cf7c-49fa-804c-e0aa205e3577 + CSource + 32c7b2d9-0fbe-4b95-ae23-a72399676db7 + CSource + b70e920e-a6ab-45d9-8712-cb894c7be8ec + CSource + 5abad234-5533-4425-8868-ca5dd16c7b0a + CSource + e0ef155e-a525-41f6-a2a6-b2b932dd79da + CSource + cd628038-e785-4445-93d6-9767879ff444 + CSource + ab743436-e914-44a6-bb32-6e9f5970a157 + CSource + ff3b1bee-5d5f-4822-8450-8a4d7288893a + CSource + 2cab52f3-45f5-4a6b-bed5-c49c1fcb3154 + CSource + be5dce22-07e7-4fcd-bbc7-9fbca0808ee3 + CSource + 2de1ac30-78dd-4a8a-a4c1-b03e0a72f7c8 + CSource + 58a3c174-a180-48e2-8ecd-2a55bdc950f1 + CSource + e1d8a94d-79fe-411c-8af9-5deddb3f6e58 + CSource + 0e3a6c2a-0fd5-4d86-83d9-f0256ae9e1d2 + CSource + 19b17c0d-d6fe-4aa2-b534-d02d59b392cb + CSource + 1529a7d4-0b6c-4ea8-900a-ec81b5eac904 + CSource + 85c26e25-fbfe-4ece-afca-4d142c6ea135 + CSource + d2806186-287c-47e3-bf79-8daa033201cb + CSource + 3e659978-d6e8-4d27-b8f7-6215eca64a09 + CSource + 83d865e6-46a2-49da-8549-b021d2114a0e + CSource + d2f5a477-e313-47c6-acd6-094c38f1ab1a + CSource + f45859b1-b772-490f-a33a-b5b4a5a3c588 + CSource + b471977c-7300-4655-bd30-3796dc3d258e + CSource + 3fdef9c1-79c2-4de3-b252-9e999235ac35 + CSource + 209f29fe-f9fe-4822-ab88-9feaad450052 + CSource + 9d5b45a5-4bed-444b-915c-b002bc2a2fa6 + CSource + 3ede6353-7678-4ee8-9a02-eab7215dc75a + CSource + 9bf244df-506e-4b4c-ad2f-e5dc9ee7dd98 + CSource + 91aab859-8af5-44f1-a8c9-e80cce8db8ac + CSource + 344691e8-47e1-4656-8d67-554b79beeb09 + CSource + c70b46e7-e59d-4f63-b374-25c07445cbd9 + CSource + 84abe674-65a0-4a83-9950-b3b2de5541e8 + CSource + 97a9f706-2d1d-423b-ae9d-67f1953b4646 + CSource + 43097e29-0472-439a-94e3-12705379cb30 + CSource + 953be9ae-7876-4d95-bccf-4d9872e5893e + CSource + 811d4212-787b-4006-a87f-eb5c82ff497b + CSource + eb209abd-c2f3-40fc-b36d-3489af8c2789 + CSource + 27b7c24f-ed90-4cdf-9e0f-8b8c97d1ef3d + CSource + 9a47b4ee-7f6b-4b54-914a-d52b6c697869 + CSource + b1390d66-373b-4f43-9ec5-024078ccd77e + CSource + 815a4f81-17bf-43d9-8891-bbe2d22555a9 + CSource + 51299014-db14-4e23-a579-ae04ec1ff314 + CSource + 17e90222-3ae5-41b9-a3be-70013eae67f2 + CSource + 75311d1a-e849-465b-bb0b-77546709e1ec + CSource + 52c93bf0-a1fe-4691-afab-4b9811aade10 + CSource + 317a55ec-33e2-45da-be24-8bc5730885fe + CSource + 221078b7-a232-4160-8909-cbc48b3f6a2a + CSource + d1a109cd-a5af-4f79-8bef-7acd6d46c8db + CSource + 66 + 1 + + + + DefaultBuild + + RXv2 + LibraryFile + False + True + True + Debug + + + %TargetFiles% + + + + +0 + %TargetFiles% : %Program% %Options% + RX600 + False + %BuildModeName% + None + Stype + Debug + False + + + Rebuild + Fpu + True + %BuildModeName% + None + True + True + False + Nodpfpu + %ProjectName%.mot + False + + False + Level2 + Little + + False + + False + False + Nearest + 1E + False + Size + Off + False + False + False + SinglePrecision + False + False + False + False + + False + + Unsigned + False + Unsigned + False + False + Right + False + False + False + None + Branch24 + None + None + 00000000 + None + None + False + False + -8585439445406589553 + DefaultBuild + + %TargetFiles% + %TargetFiles% : %Program% %Options% + False + + + RXv2 + LibraryFile + False + True + + +0 + RX600 + False + %BuildModeName% + None + Rebuild + Fpu + True + %BuildModeName% + False + Nodpfpu + %ProjectName%.mot + False + Little + + False + False + Nearest + False + Off + False + False + SinglePrecision + False + False + False + False + + Unsigned + False + Unsigned + False + False + Right + False + False + False + None + Branch24 + None + None + 00000000 + None + None + False + V3.02.00 + + + C + False + False + Misra2012 + Level2 + Object + False + -output=obj + None + False + Cpp + None + %BuildModeName% + None + False + False + None + True + + + + False + Size + True + Auto + + + False + + 2 + + + + P + False + -isa=rxv2 +-fpu +-include=..\..\..\..\..\wolfssl\openssl +-include=..\..\..\..\.. +-include=. +-include=..\common +-define=WOLFSSL_USER_SETTINGS +-output=obj +-obj_path=%BuildModeName% +-debug +-nologo +-exec_time + + + Auto + + C + 100 + + D + + + False + None + B + Auto + False + + L + + + W + False + Auto + + + False + Auto + + + False + No + Intrinsic + + False + + + False + Intrinsic + + False + Noinstalign + Auto + False + No + False + Auto + + NoMap + True + + False + None + False + No + + + False + Sjis + + False + + Fpu + False + False + Auto + No + False + Sjis + False + -8586767488619021802 + C99 + False + False + Misra2012 + Level2 + Object + False + -output=obj + None + False + Cpp + None + %BuildModeName% + None + False + False + None + True + ..\..\..\..\..\wolfssl\openssl +..\..\..\..\.. +. +..\common + + + + False + Size + True + Auto + + + False + + 2 + + + + P + False + -isa=rxv2 +-fpu +-include=..\..\..\..\..\wolfssl\openssl +-include=..\..\..\..\.. +-include=. +-include=..\common +-define=WOLFSSL_USER_SETTINGS +-output=obj +-obj_path=%BuildModeName% +-debug +-nologo +-exec_time + + WOLFSSL_USER_SETTINGS + + Auto + + C + 100 + + D + + + False + None + B + Auto + + L + + + W + False + Auto + + False + Auto + + + False + No + Intrinsic + + False + + + False + Intrinsic + False + Noinstalign + Auto + False + No + False + Auto + + NoMap + True + False + None + False + No + + + False + Sjis + False + + Fpu + False + False + Auto + No + False + Sjis + + + False + False + + False + -output + %BuildModeName% + False + True + False + + False + False + + False + False + SJIS + False + False + + + + -isa=rxv2 +-fpu +-output=obj +-obj_path=%BuildModeName% +-debug +-nologo +-exec_time + + False + -8586796872818976776 + False + False + + False + -output + %BuildModeName% + False + True + False + + False + False + + False + False + SJIS + False + False + + + + -isa=rxv2 +-fpu +-output=obj +-obj_path=%BuildModeName% +-debug +-nologo +-exec_time + + + + False + Absolute + Stype + + None + None + False + + False + + Debug + + + False + None + False + + False + False + False + %BuildModeName% + None + False + + + None + + False + %ProjectName%.abs + + 1E + False + + %BuildModeName% + + False + False + False + None + %ProjectName%.mot + False + NoMessage + False + False + + + False + + False + + None + + Auto + + False + None + + False + + FF + + False + False + + FF + False + + None + False + False + 0 + + + False + + + + + False + + + + False + False + -8585439440666565189 + False + Absolute + Stype + + None + None + False + + False + + Debug + + + False + None + False + + False + False + False + %BuildModeName% + None + False + + + None + + False + %ProjectName%.abs + + 1E + False + + %BuildModeName% + + False + False + False + None + %ProjectName%.mot + False + NoMessage + False + False + + + False + + False + + None + + Auto + + False + None + + False + + FF + + False + False + + FF + False + + None + False + False + 0 + + + False + + + + + False + + + + False + + + Stype + True + True + NoMessage + %BuildModeName% + None + + %ProjectName%.mot + None + None + + None + + + FF + None + False + + 1 + None + False + + FF + None + + + False + 0 + + Ccitt + + None + None + False + False + False + -8586796872818966962 + Stype + True + True + NoMessage + %BuildModeName% + None + + %ProjectName%.mot + None + None + + None + + + FF + None + False + + 1 + None + False + + FF + None + + + False + 0 + + Ccitt + + None + None + False + False + + + LibraryU + + List + False + None + Debug + + False + + %BuildModeName% + False + + + None + %ProjectName%.lib + False + + NoMessage + Auto + False + False + None + + False + + False + False + False + + + + -noprelink +-form=library=u +-output=%BuildModeName%\%ProjectName%.lib +-list=%BuildModeName%\%ProjectName%.lbp +-nologo +-exit + + False + -8585439440666565189 + LibraryU + + List + False + None + Debug + + False + + %BuildModeName% + False + + + None + %ProjectName%.lib + False + + NoMessage + Auto + False + False + None + + False + + False + False + False + + + + -noprelink +-form=library=u +-output=%BuildModeName%\%ProjectName%.lib +-list=%BuildModeName%\%ProjectName%.lbp +-nologo +-exit + + + + C + None + False + %BuildModeName% + False + Custom + Level2 + %ProjectName%.lib + + None + False + True + + False + + False + Size + + False + Auto + False + False + 2 + False + False + Auto + P + True + 100 + C + + True + D + Auto + True + B + False + L + False + Auto + True + W + Auto + False + False + False + Intrinsic + False + False + False + Auto + False + False + Auto + False + False + Noinstalign + False + False + False + False + True + False + Fpu + False + False + -8585439445406433343 + C + None + False + %BuildModeName% + False + Custom + Level2 + %ProjectName%.lib + + None + False + + False + + False + Size + + False + Auto + False + False + 2 + False + False + Auto + P + True + 100 + C + + True + D + Auto + True + B + False + L + False + Auto + True + W + Auto + False + False + False + Intrinsic + False + False + False + Auto + False + False + Auto + False + False + Noinstalign + False + False + False + False + True + False + Fpu + False + + + 636575488687265696 + 1 + + + 636575488687265696 + 2 + + + 636575488687265696 + 3 + + + 636575488687265696 + 4 + + + 636575488687265696 + 5 + + + 636575488687265696 + 6 + + + 636575488687265696 + 7 + + + 636575488687265696 + 8 + + + 636575488687265696 + 9 + + + 636575488940589048 + 0 + + + 636575488940589048 + 1 + + + 636575488940589048 + 2 + + + 636575488940589048 + 3 + + + 636575496067311621 + 0 + + + 636575488940589048 + 5 + + + 636575488940589048 + 6 + + + 636575488940589048 + 7 + + + 636575488940589048 + 8 + + + 636575488940589048 + 9 + + + 636575488940589048 + 10 + + + 636575488940589048 + 11 + + + 636575488940589048 + 12 + + + 636575488940589048 + 13 + + + 636575488940589048 + 14 + + + 636575488940589048 + 15 + + + 636575488940589048 + 16 + + + 636575488940589048 + 17 + + + 636575488940589048 + 18 + + + 636575488940589048 + 19 + + + 636575488940589048 + 20 + + + 636575488940589048 + 22 + + + 636575488940589048 + 23 + + + 636575488940589048 + 25 + + + 636575488940589048 + 26 + + + 636575488940589048 + 27 + + + 636575488940589048 + 29 + + + 636575488940589048 + 31 + + + 636575488940589048 + 32 + + + 636575488940589048 + 33 + + + 636575488940589048 + 34 + + + 636575488940589048 + 35 + + + 636575488940589048 + 36 + + + 636575488940589048 + 37 + + + 636575488940589048 + 38 + + + 636575488940589048 + 39 + + + 636575488940589048 + 40 + + + 636575488940589048 + 42 + + + 636575488940589048 + 43 + + + 636575488940589048 + 44 + + + 636575488940589048 + 46 + + + 636575488940589048 + 47 + + + 636575488940589048 + 48 + + + 636575488940589048 + 49 + + + 636575488940589048 + 50 + + + 636575488940589048 + 52 + + + 636575488940589048 + 53 + + + 636575488940589048 + 54 + + + 636575488940589048 + 55 + + + 636575488940589048 + 56 + + + 636575488940589048 + 57 + + + 636575488940589048 + 58 + + + 636575494875104790 + 1 + + + 636575494875104790 + 2 + + + 636575494875104790 + 3 + + + 636575494875104790 + 4 + + + 636575494875104790 + 5 + + + 637932915398307820 + 0 + + + 637932915398620293 + 0 + + + -8586796872167510112 + False + True + False + -8586796872167510112 + False + True + False + -8586796872167510112 + False + True + False + -8586796872167510112 + False + True + False + -8586796872167510112 + False + True + False + -8586796872167510112 + False + True + False + -8586796872167510112 + False + True + False + -8586796872167500299 + False + True + False + -8586796872167500299 + False + True + False + -8586796871914181681 + False + True + False + -8586796871914181681 + False + True + False + -8586796871914181681 + False + True + False + -8586796871914181681 + False + True + False + -8586796871914176690 + False + True + False + -8586796871914176690 + False + True + False + -8586796871914171698 + False + True + False + -8586796871914171698 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914156829 + False + True + False + -8586796871914156829 + False + True + False + -8586796871914156829 + False + True + False + -8586796871914156829 + False + True + False + -8586796871914156829 + False + True + False + -8586796871914156829 + False + True + False + -8585439445455999229 + False + True + False + -8586796871914151735 + False + True + False + -8586796871914151735 + False + True + False + -8586796871914151735 + False + True + False + -8586796871914151735 + False + True + False + -8586796871914151735 + False + True + False + -8586796871914151735 + False + True + False + -8586796871914151735 + False + True + False + -8586796871914146702 + False + True + False + -8586796871914146702 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914136311 + False + True + False + -8586796871914136311 + False + True + False + -8586796871914136311 + False + True + False + -8586796865979661205 + False + True + False + -8586796865979661205 + False + True + False + -8586796865979661205 + False + True + False + -8586796865979661205 + False + True + False + -8586796865979661205 + False + True + False + + + + + True + 00000000-0000-0000-0000-000000000000 + + + + + + + + + + R5F565N7BxFB + 1 + + + + + 7d577131-4ec1-4e88-968d-89381f6c178a + + + + + 1.1 + + + False + False + False + True + Yes + Nanosecond + False + False + False + False + False + True + FilesNotToAnalyze + 0 + All + 0 + False + %ProjectName%.mtfl + %ProjectName%.mtvl + 10 + + + RealtimeSampling + + Synchronized + AtProgramStop + 20 + 1000000 + LineChart + False + PaleGreen + PaleTurquoise + 40ff0a4f + 405be416 + 40056def + 40ff541c + False + Auto + Channel01 + 0 + Rising + 0 + Orange + 10 + None + + + + + + + + + + + + + + + + + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + c0ff0a4f + c05be416 + c0056dff + c0ff541c + c04fc1ff + c0a932ff + c0ffd91c + c0ff30a5 + c0bee02f + c05510ff + c0ff97e4 + c0913a37 + c0c68e15 + c0317f0c + c060493e + c072808e + + + + + 90536345-15c8-40cb-957c-e59974e4bf78 + + + + + E:\Renesas\wolfssl-3.14.0\wolfssl-3.14.0\IDE\Renesas\cs+\Projects\wolfssl_lib + E:\ProgramFiles\Renesas\SmartConfigurator\RX\eclipse\SmartConfigurator.exe + ab969cad-a48e-4926-b0d6-6ea8ba0de305 + wolfssl_lib.scfg + + + + + 8.01.00.00 + + + \ No newline at end of file diff --git a/IDE/Renesas/e2studio/DK-S7G2/benchmark-template/src/app_entry.c b/IDE/Renesas/e2studio/DK-S7G2/benchmark-template/src/app_entry.c index f78c41ca5..e0a78ed8c 100644 --- a/IDE/Renesas/e2studio/DK-S7G2/benchmark-template/src/app_entry.c +++ b/IDE/Renesas/e2studio/DK-S7G2/benchmark-template/src/app_entry.c @@ -1,6 +1,6 @@ /* app_entry.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + #include "app.h" #include "stdio.h" diff --git a/IDE/Renesas/e2studio/DK-S7G2/example_server-template/src/app_entry.c b/IDE/Renesas/e2studio/DK-S7G2/example_server-template/src/app_entry.c index d7df11ce9..569f50a05 100644 --- a/IDE/Renesas/e2studio/DK-S7G2/example_server-template/src/app_entry.c +++ b/IDE/Renesas/e2studio/DK-S7G2/example_server-template/src/app_entry.c @@ -1,6 +1,6 @@ /* app_entry.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + #include "app.h" diff --git a/IDE/Renesas/e2studio/DK-S7G2/wolfcrypttest-template/src/app_entry.c b/IDE/Renesas/e2studio/DK-S7G2/wolfcrypttest-template/src/app_entry.c index a0821fa04..cb9946269 100644 --- a/IDE/Renesas/e2studio/DK-S7G2/wolfcrypttest-template/src/app_entry.c +++ b/IDE/Renesas/e2studio/DK-S7G2/wolfcrypttest-template/src/app_entry.c @@ -1,6 +1,6 @@ /* app_entry.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + #include diff --git a/IDE/Renesas/e2studio/Projects/common/strings.h b/IDE/Renesas/e2studio/Projects/common/strings.h index e3752588e..4e935718d 100644 --- a/IDE/Renesas/e2studio/Projects/common/strings.h +++ b/IDE/Renesas/e2studio/Projects/common/strings.h @@ -1,6 +1,6 @@ /* strings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/Projects/common/unistd.h b/IDE/Renesas/e2studio/Projects/common/unistd.h index 962ad47ee..aa758a3b7 100644 --- a/IDE/Renesas/e2studio/Projects/common/unistd.h +++ b/IDE/Renesas/e2studio/Projects/common/unistd.h @@ -1,6 +1,6 @@ /* unistd.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/Projects/common/user_settings.h b/IDE/Renesas/e2studio/Projects/common/user_settings.h index 62648c9cc..d2c52f48d 100644 --- a/IDE/Renesas/e2studio/Projects/common/user_settings.h +++ b/IDE/Renesas/e2studio/Projects/common/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/Projects/common/wolfssl_dummy.c b/IDE/Renesas/e2studio/Projects/common/wolfssl_dummy.c index 9aa14dbf1..8cd257016 100644 --- a/IDE/Renesas/e2studio/Projects/common/wolfssl_dummy.c +++ b/IDE/Renesas/e2studio/Projects/common/wolfssl_dummy.c @@ -1,6 +1,6 @@ /* wolfssl_dummy.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/Projects/test/src/key_data.c b/IDE/Renesas/e2studio/Projects/test/src/key_data.c index cef0a9c99..5a18a7897 100644 --- a/IDE/Renesas/e2studio/Projects/test/src/key_data.c +++ b/IDE/Renesas/e2studio/Projects/test/src/key_data.c @@ -1,6 +1,6 @@ /* key_data.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + #include "key_data.h" #ifdef WOLFSSL_RENESAS_TSIP diff --git a/IDE/Renesas/e2studio/Projects/test/src/key_data.h b/IDE/Renesas/e2studio/Projects/test/src/key_data.h index e2e53e72a..45459f6e3 100644 --- a/IDE/Renesas/e2studio/Projects/test/src/key_data.h +++ b/IDE/Renesas/e2studio/Projects/test/src/key_data.h @@ -1,6 +1,6 @@ /* key_data.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + #ifndef KEY_DATA_H_ #define KEY_DATA_H_ #include diff --git a/IDE/Renesas/e2studio/Projects/test/src/test_main.c b/IDE/Renesas/e2studio/Projects/test/src/test_main.c index 063d41a73..7f72a0833 100644 --- a/IDE/Renesas/e2studio/Projects/test/src/test_main.c +++ b/IDE/Renesas/e2studio/Projects/test/src/test_main.c @@ -1,6 +1,6 @@ /* test_main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/Projects/test/src/wolf_client.c b/IDE/Renesas/e2studio/Projects/test/src/wolf_client.c index 5f0e96ac1..8ab141606 100644 --- a/IDE/Renesas/e2studio/Projects/test/src/wolf_client.c +++ b/IDE/Renesas/e2studio/Projects/test/src/wolf_client.c @@ -1,6 +1,6 @@ /* wolf_client.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/Projects/test/src/wolf_server.c b/IDE/Renesas/e2studio/Projects/test/src/wolf_server.c index b193fbe71..d054d5cc1 100644 --- a/IDE/Renesas/e2studio/Projects/test/src/wolf_server.c +++ b/IDE/Renesas/e2studio/Projects/test/src/wolf_server.c @@ -1,6 +1,6 @@ /* wolf_server.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/Projects/test/src/wolfssl_demo.h b/IDE/Renesas/e2studio/Projects/test/src/wolfssl_demo.h index 0241f9196..1d5717a26 100644 --- a/IDE/Renesas/e2studio/Projects/test/src/wolfssl_demo.h +++ b/IDE/Renesas/e2studio/Projects/test/src/wolfssl_demo.h @@ -1,6 +1,6 @@ /* wolfssl_demo.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M3/benchmark-wolfcrypt/src/wolfssl_thread_entry.c b/IDE/Renesas/e2studio/RA6M3/benchmark-wolfcrypt/src/wolfssl_thread_entry.c index 170383312..b17e2b32c 100644 --- a/IDE/Renesas/e2studio/RA6M3/benchmark-wolfcrypt/src/wolfssl_thread_entry.c +++ b/IDE/Renesas/e2studio/RA6M3/benchmark-wolfcrypt/src/wolfssl_thread_entry.c @@ -1,6 +1,6 @@ /* wolfssl_thread_entry.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M3/client-wolfssl/src/wolfssl_thread_entry.c b/IDE/Renesas/e2studio/RA6M3/client-wolfssl/src/wolfssl_thread_entry.c index 24844025a..14805e782 100644 --- a/IDE/Renesas/e2studio/RA6M3/client-wolfssl/src/wolfssl_thread_entry.c +++ b/IDE/Renesas/e2studio/RA6M3/client-wolfssl/src/wolfssl_thread_entry.c @@ -1,6 +1,6 @@ /* wolfssl_thread_entry.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M3/client-wolfssl/wolfssl_thread_entry.h b/IDE/Renesas/e2studio/RA6M3/client-wolfssl/wolfssl_thread_entry.h index 7df391daa..b4d8fc497 100644 --- a/IDE/Renesas/e2studio/RA6M3/client-wolfssl/wolfssl_thread_entry.h +++ b/IDE/Renesas/e2studio/RA6M3/client-wolfssl/wolfssl_thread_entry.h @@ -1,6 +1,6 @@ /* wolfssl_thread_entry.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M3/common/src/freertos_tcp_port.c b/IDE/Renesas/e2studio/RA6M3/common/src/freertos_tcp_port.c index a10162026..388f52c78 100644 --- a/IDE/Renesas/e2studio/RA6M3/common/src/freertos_tcp_port.c +++ b/IDE/Renesas/e2studio/RA6M3/common/src/freertos_tcp_port.c @@ -1,6 +1,6 @@ /* freertos_tcp_port.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M3/common/user_settings.h b/IDE/Renesas/e2studio/RA6M3/common/user_settings.h index 0225c95da..984a638d2 100644 --- a/IDE/Renesas/e2studio/RA6M3/common/user_settings.h +++ b/IDE/Renesas/e2studio/RA6M3/common/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M3/common/util.h b/IDE/Renesas/e2studio/RA6M3/common/util.h index f1445ff45..628e9b791 100644 --- a/IDE/Renesas/e2studio/RA6M3/common/util.h +++ b/IDE/Renesas/e2studio/RA6M3/common/util.h @@ -1,6 +1,6 @@ /* util.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M3/server-wolfssl/src/wolfssl_thread_entry.c b/IDE/Renesas/e2studio/RA6M3/server-wolfssl/src/wolfssl_thread_entry.c index fbdb955a9..437fe08a0 100644 --- a/IDE/Renesas/e2studio/RA6M3/server-wolfssl/src/wolfssl_thread_entry.c +++ b/IDE/Renesas/e2studio/RA6M3/server-wolfssl/src/wolfssl_thread_entry.c @@ -1,6 +1,6 @@ /* wolfssl_thread_entry.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M3/server-wolfssl/wolfssl_thread_entry.h b/IDE/Renesas/e2studio/RA6M3/server-wolfssl/wolfssl_thread_entry.h index 2180a5373..7a23d43d7 100644 --- a/IDE/Renesas/e2studio/RA6M3/server-wolfssl/wolfssl_thread_entry.h +++ b/IDE/Renesas/e2studio/RA6M3/server-wolfssl/wolfssl_thread_entry.h @@ -1,6 +1,6 @@ /* wolfssl_thread_entry.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M3/test-wolfcrypt/src/wolfssl_thread_entry.c b/IDE/Renesas/e2studio/RA6M3/test-wolfcrypt/src/wolfssl_thread_entry.c index 665e8f11f..dfc97cc1a 100644 --- a/IDE/Renesas/e2studio/RA6M3/test-wolfcrypt/src/wolfssl_thread_entry.c +++ b/IDE/Renesas/e2studio/RA6M3/test-wolfcrypt/src/wolfssl_thread_entry.c @@ -1,6 +1,6 @@ /* wolfssl_thread_entry.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M4/common/user_settings.h b/IDE/Renesas/e2studio/RA6M4/common/user_settings.h index 2284f0985..b2ed1671f 100644 --- a/IDE/Renesas/e2studio/RA6M4/common/user_settings.h +++ b/IDE/Renesas/e2studio/RA6M4/common/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RA6M4/test/key_data/key_data_sce.c b/IDE/Renesas/e2studio/RA6M4/test/key_data/key_data_sce.c index 5b751c18e..f8b4065b1 100644 --- a/IDE/Renesas/e2studio/RA6M4/test/key_data/key_data_sce.c +++ b/IDE/Renesas/e2studio/RA6M4/test/key_data/key_data_sce.c @@ -1,6 +1,6 @@ /* key_data.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/strings.h b/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/strings.h index e3752588e..4e935718d 100644 --- a/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/strings.h +++ b/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/strings.h @@ -1,6 +1,6 @@ /* strings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/unistd.h b/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/unistd.h index 962ad47ee..aa758a3b7 100644 --- a/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/unistd.h +++ b/IDE/Renesas/e2studio/RX65N/GR-ROSE/common/unistd.h @@ -1,6 +1,6 @@ /* unistd.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/key_data.c b/IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/key_data.c index c44027670..7c16659bb 100644 --- a/IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/key_data.c +++ b/IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/key_data.c @@ -18,6 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + #include "key_data.h" diff --git a/IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/key_data.h b/IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/key_data.h index 788448517..38d3925d8 100644 --- a/IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/key_data.h +++ b/IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/key_data.h @@ -1,6 +1,6 @@ /* key_data.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -18,6 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + diff --git a/IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/wolf_server.c b/IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/wolf_server.c index db1fb918b..379d5f509 100644 --- a/IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/wolf_server.c +++ b/IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/wolf_server.c @@ -1,6 +1,6 @@ /* wolf_server.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/wolfssl_demo.h b/IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/wolfssl_demo.h index 664186b36..a8cf6ee4d 100644 --- a/IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/wolfssl_demo.h +++ b/IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/wolfssl_demo.h @@ -1,6 +1,6 @@ /* wolfssl_demo.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/Renesas/e2studio/RX65N/RSK/wolfssl_demo/key_data.c b/IDE/Renesas/e2studio/RX65N/RSK/wolfssl_demo/key_data.c index 051da9ae0..b91a80c6b 100644 --- a/IDE/Renesas/e2studio/RX65N/RSK/wolfssl_demo/key_data.c +++ b/IDE/Renesas/e2studio/RX65N/RSK/wolfssl_demo/key_data.c @@ -18,6 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + #include "key_data.h" diff --git a/IDE/Renesas/e2studio/RX65N/RSK/wolfssl_demo/key_data.h b/IDE/Renesas/e2studio/RX65N/RSK/wolfssl_demo/key_data.h index 1122c1185..38d3925d8 100644 --- a/IDE/Renesas/e2studio/RX65N/RSK/wolfssl_demo/key_data.h +++ b/IDE/Renesas/e2studio/RX65N/RSK/wolfssl_demo/key_data.h @@ -18,6 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + diff --git a/IDE/Renesas/e2studio/RX72N/EnvisionKit/include.am b/IDE/Renesas/e2studio/RX72N/EnvisionKit/include.am index d1463ba1d..dbd5f4aad 100644 --- a/IDE/Renesas/e2studio/RX72N/EnvisionKit/include.am +++ b/IDE/Renesas/e2studio/RX72N/EnvisionKit/include.am @@ -14,4 +14,5 @@ EXTRA_DIST+= IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/key_data.c EXTRA_DIST+= IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/key_data.h EXTRA_DIST+= IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_demo.c EXTRA_DIST+= IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_demo.h -EXTRA_DIST+= IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/user_settings.h \ No newline at end of file +EXTRA_DIST+= IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/user_settings.h +EXTRA_DIST+= IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_tsip_unit_test.c diff --git a/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/key_data.c b/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/key_data.c index a47d37183..d28c51c52 100644 --- a/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/key_data.c +++ b/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/key_data.c @@ -18,6 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + #include "key_data.h" diff --git a/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/key_data.h b/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/key_data.h index 1122c1185..38d3925d8 100644 --- a/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/key_data.h +++ b/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/key_data.h @@ -18,6 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + diff --git a/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_demo.c b/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_demo.c index e33cc0bbe..8c712a67f 100644 --- a/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_demo.c +++ b/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_demo.c @@ -55,10 +55,13 @@ #include extern const st_key_block_data_t g_key_block_data; - user_PKCbInfo guser_PKCbInfo; uint32_t g_encrypted_root_public_key[140]; - static TsipUserCtx userContext; - + #if defined(TLS_MULTITHREAD_TEST) + static TsipUserCtx userContext_taskA; + static TsipUserCtx userContext_taskB; + #else + static TsipUserCtx userContext; + #endif #endif /* WOLFSSL_RENESAS_TSIP_TLS */ static WOLFSSL_CTX* client_ctx; @@ -69,9 +72,60 @@ #define YEAR 2022 #define MON 3 #define FREQ 10000 /* Hz */ +#define MAX_MSGSTR 80 static long tick; static int tmTick; + + +#if defined(TSIP_CRYPT_UNIT_TEST) + int tsip_crypt_test(); + int tsip_crypt_sha_multitest(); + int tsip_crypt_AesCbc_multitest(); + int tsip_crypt_AesGcm_multitest(); + int tsip_crypt_Sha_AesCbcGcm_multitest(); +#endif + +#if defined(TLS_MULTITHREAD_TEST) +xSemaphoreHandle exit_semaph; +static xSemaphoreHandle Mutex; +#endif + +static int msg(const char* pname, int l, + const char * sFormat, ...) +{ + int ret = 0; + char buf[MAX_MSGSTR] = {0}; + + va_list ParamList; + +#if defined(TLS_MULTITHREAD_TEST) + xSemaphoreTake(Mutex, portMAX_DELAY); +#endif + va_start(ParamList, sFormat); + + printf("[%s][%02d] ", pname, l); + ret = vsnprintf(buf, sizeof(buf), sFormat, ParamList); + printf(buf); + + va_end(ParamList); + +#if defined(TLS_MULTITHREAD_TEST) + xSemaphoreGive(Mutex); +#endif + + return ret; +} + + +#if defined(TLS_MULTITHREAD_TEST) +static void my_Logging_cb(const int logLevel, const char *const logMessage) +{ + (void)logLevel; + msg("custom-log", logLevel, "%s\n", logMessage); +} +#endif + /* time * returns seconds from EPOCH */ @@ -98,10 +152,6 @@ double current_time(int reset) return ((double)tick/FREQ) ; } - - - - /* --------------------------------------------------------*/ /* Benchmark_demo */ /* --------------------------------------------------------*/ @@ -141,7 +191,7 @@ static void CryptTest_demo(void) /* Tls_client_demo */ /* --------------------------------------------------------*/ #if defined(TLS_CLIENT) -static void Tls_client_init(const char* cipherlist) +static void Tls_client_init() { #ifndef NO_FILESYSTEM @@ -165,10 +215,6 @@ static void Tls_client_init(const char* cipherlist) wolfSSL_Init(); - #ifdef DEBUG_WOLFSSL - wolfSSL_Debugging_ON(); - #endif - /* Create and initialize WOLFSSL_CTX */ if ((client_ctx = wolfSSL_CTX_new(wolfSSLv23_client_method_ex((void *)NULL))) == NULL) { @@ -254,33 +300,32 @@ static void Tls_client_init(const char* cipherlist) return; } #endif - - - /* use specific cipher */ - if (cipherlist != NULL && - wolfSSL_CTX_set_cipher_list(client_ctx, cipherlist) != - WOLFSSL_SUCCESS) { - wolfSSL_CTX_free(client_ctx); client_ctx = NULL; - printf("client can't set cipher list"); - } } -static void Tls_client() +static void Tls_client(void *pvParam) { #define BUFF_SIZE 256 #define ADDR_SIZE 16 int ret; +#if defined(TLS_MULTITHREAD_TEST) + BaseType_t xStatus; +#endif + TestInfo* p = (TestInfo*)pvParam; WOLFSSL_CTX* ctx = (WOLFSSL_CTX *)client_ctx; - WOLFSSL* ssl; + WOLFSSL* ssl = NULL; Socket_t socket; socklen_t socksize = sizeof(struct freertos_sockaddr); struct freertos_sockaddr PeerAddr; char addrBuff[ADDR_SIZE] = {0}; - - static const char sendBuff[]= "Hello Server\n" ; + const char* pcName = p->name; + + static const char sendBuff[]= "Hello Server\n" ; char rcvBuff[BUFF_SIZE] = {0}; - + if (!p) { + printf("Unexpected error. Thread parameter is null\n"); + return; + } /* create TCP socket */ socket = FreeRTOS_socket(FREERTOS_AF_INET, @@ -294,78 +339,126 @@ static void Tls_client() /* attempt to connect TLS server */ PeerAddr.sin_addr = FreeRTOS_inet_addr(TLSSERVER_IP); - PeerAddr.sin_port = FreeRTOS_htons(TLSSERVER_PORT); + PeerAddr.sin_port = FreeRTOS_htons(p->port); ret = FreeRTOS_connect(socket, &PeerAddr, sizeof(PeerAddr)); if (ret != 0) { - printf("ERROR FreeRTOS_connect: %d\n",ret); + msg(pcName, p->id, "ERROR FreeRTOS_connect: %d\n",ret); + ret = -1; } + #if defined(TLS_MULTITHREAD_TEST) + msg(pcName, p->id, " Ready to connect.\n"); + xStatus = xSemaphoreTake(p->xBinarySemaphore, portMAX_DELAY); + if (xStatus != pdTRUE) { + msg(pcName, p->id, " Error : Failed to xSemaphoreTake\n"); + goto out; + } + #endif + /* create WOLFSSL object */ if (ret == 0) { ssl = wolfSSL_new(ctx); if (ssl == NULL) { - printf("ERROR wolfSSL_new: %d\n", wolfSSL_get_error(ssl, 0)); + msg(pcName, p->id, "ERROR wolfSSL_new: %d\n", + wolfSSL_get_error(ssl, 0)); ret = -1; } } + if (ret == 0) { #ifdef WOLFSSL_RENESAS_TSIP_TLS - tsip_set_callback_ctx(ssl, &userContext); + #if !defined(TLS_MULTITHREAD_TEST) + memset(&userContext, 0, sizeof(TsipUserCtx)); + tsip_set_callback_ctx(ssl, &userContext); + #else + if (p->port - TLSSERVER_PORT == 0) { + memset(&userContext_taskA, 0, sizeof(TsipUserCtx)); + tsip_set_callback_ctx(ssl, (void*)&userContext_taskA); + } + else { + memset(&userContext_taskB, 0, sizeof(TsipUserCtx)); + tsip_set_callback_ctx(ssl, (void*)&userContext_taskB); + } + #endif #endif } + msg(pcName, p->id, " Cipher : %s\n", p->cipher); + /* use specific cipher */ + if (p->cipher != NULL && + wolfSSL_set_cipher_list(ssl, p->cipher) != WOLFSSL_SUCCESS) { + ret = -1; + } + if (ret == 0) { /* associate socket with ssl object */ if (wolfSSL_set_fd(ssl, (int)socket) != WOLFSSL_SUCCESS) { - printf("ERROR wolfSSL_set_fd: %d\n", wolfSSL_get_error(ssl, 0)); + msg(pcName, p->id, "ERROR wolfSSL_set_fd: %d\n", + wolfSSL_get_error(ssl, 0)); ret = -1; } } - +#ifdef DEBUG_WOLFSSL + wolfSSL_Debugging_ON(); +#endif if (ret == 0) { if (wolfSSL_connect(ssl) != WOLFSSL_SUCCESS) { - printf("ERROR wolfSSL_connect: %d\n", wolfSSL_get_error(ssl, 0)); + msg(pcName, p->id, "ERROR wolfSSL_connect: %d\n", + wolfSSL_get_error(ssl, 0)); ret = -1; } } - +#ifdef DEBUG_WOLFSSL + wolfSSL_Debugging_OFF(); +#endif if (ret == 0) { if (wolfSSL_write(ssl, sendBuff, strlen(sendBuff)) != strlen(sendBuff)) { - printf("ERROR wolfSSL_write: %d\n", wolfSSL_get_error(ssl, 0)); + msg(pcName, p->id, "ERROR wolfSSL_write: %d\n", + wolfSSL_get_error(ssl, 0)); ret = -1; } } if (ret == 0) { if ((ret=wolfSSL_read(ssl, rcvBuff, BUFF_SIZE -1)) < 0) { - printf("ERROR wolfSSL_read: %d\n", wolfSSL_get_error(ssl, 0)); + msg(pcName, p->id, "ERROR wolfSSL_read: %d\n", + wolfSSL_get_error(ssl, 0)); ret = -1; } else { rcvBuff[ret] = '\0'; - printf("Received: %s\n\n", rcvBuff); + msg(pcName, p->id, "Received: %s\n\n", rcvBuff); ret = 0; } } - - wolfSSL_shutdown(ssl); - - FreeRTOS_shutdown(socket, FREERTOS_SHUT_RDWR); - while(FreeRTOS_recv(socket, rcvBuff, BUFF_SIZE -1, 0) >=0) { - vTaskDelay(250); +out: + if (ssl) { + wolfSSL_shutdown(ssl); + wolfSSL_free(ssl); + ssl = NULL; + /* reset call backs */ + #ifdef WOLFSSL_RENESAS_TSIP_TLS + tsip_set_callbacks(client_ctx); + #endif } - FreeRTOS_closesocket(socket); - - - wolfSSL_free(ssl); - wolfSSL_CTX_free(ctx); - wolfSSL_Cleanup(); + if (socket) { + FreeRTOS_shutdown(socket, FREERTOS_SHUT_RDWR); + while (FreeRTOS_recv(socket, rcvBuff, BUFF_SIZE -1, 0) >=0) { + vTaskDelay(250); + } + FreeRTOS_closesocket(socket); + socket = NULL; + } +#ifdef TLS_MULTITHREAD_TEST + xSemaphoreGive(exit_semaph); + vTaskDelete(NULL); +#endif return; } @@ -376,24 +469,23 @@ static void Tls_client_demo(void) #if defined(WOLFSSL_RENESAS_TSIP_TLS) - #ifdef USE_ECC_CERT + #ifdef USE_ECC_CERT const char* cipherlist[] = { #if defined(WOLFSSL_TLS13) "TLS13-AES128-GCM-SHA256", "TLS13-AES128-CCM-SHA256", #endif + "ECDHE-ECDSA-AES128-SHA256", "ECDHE-ECDSA-AES128-GCM-SHA256", - "ECDHE-ECDSA-AES128-SHA256" }; - int cipherlist_sz; #if defined(WOLFSSL_TLS13) - cipherlist_sz = 2; + #define cipherlist_sz 2 #else - cipherlist_sz = 2; + #define cipherlist_sz 2 #endif - - #else - const char* cipherlist[] = { + TestInfo info[cipherlist_sz]; + #else + const char* cipherlist[] = { #if defined(WOLFSSL_TLS13) "TLS13-AES128-GCM-SHA256", "TLS13-AES128-CCM-SHA256", @@ -404,23 +496,29 @@ static void Tls_client_demo(void) "AES128-SHA256", "AES256-SHA", "AES256-SHA256" - }; - int cipherlist_sz; - #if defined(WOLFSSL_TLS13) - cipherlist_sz = 2; - #else - cipherlist_sz = 6; + }; + #if defined(WOLFSSL_TLS13) + #define cipherlist_sz 2 + #else + #define cipherlist_sz 6 + #endif + TestInfo info[cipherlist_sz]; #endif - - #endif - #else const char* cipherlist[] = { NULL }; - const int cipherlist_sz = 0; - + #define cipherlist_sz 1 + TestInfo info[cipherlist_sz]; #endif int i = 0; +#ifdef TLS_MULTITHREAD_TEST + int j = 0; + BaseType_t xReturned; + BaseType_t xHigherPriorityTaskWoken; + xHigherPriorityTaskWoken = pdFALSE; + + Mutex = xSemaphoreCreateMutex(); +#endif printf("/*------------------------------------------------*/\n"); printf(" TLS_Client demo\n"); @@ -455,16 +553,82 @@ static void Tls_client_demo(void) #endif /* WOLFSSL_RENESAS_TSIP_TLS && (WOLFSSL_RENESAS_TSIP_VER >=109) */ + Tls_client_init(); + +#ifdef TLS_MULTITHREAD_TEST + + exit_semaph = xSemaphoreCreateCounting(cipherlist_sz, 0); + +#ifdef DEBUG_WOLFSSL + wolfSSL_SetLoggingCb(my_Logging_cb); +#endif + do { - if(cipherlist_sz > 0 ) printf("cipher : %s\n", cipherlist[i]); + for (j = i; j < (i+2); j++) { + info[j].id = j; + info[j].port = TLSSERVER_PORT + (j%2); + info[j].cipher = cipherlist[j]; + info[j].ctx = client_ctx; + info[j].xBinarySemaphore = xSemaphoreCreateBinary(); + info[j].log_f = my_Logging_cb; - Tls_client_init(cipherlist[i]); + memset(info[j].name, 0, sizeof(info[j].name)); + sprintf(info[j].name, "clt_thd_%s", ((j%2) == 0) ? + "taskA" : "taskB"); - Tls_client(); + printf(" %s connecting to %d port\n", info[j].name, info[j].port); + + xReturned = xTaskCreate(Tls_client, info[j].name, + THREAD_STACK_SIZE, &info[j], 3, NULL); + if (xReturned != pdPASS) { + printf("Failed to create task\n"); + } + } + + for (j = i; j < (i+2); j++) { + xSemaphoreGiveFromISR(info[j].xBinarySemaphore, + &xHigherPriorityTaskWoken); + } + + /* check if all tasks are completed */ + for (j = i; j < (i+2); j++) { + if(!xSemaphoreTake(exit_semaph, portMAX_DELAY)) { + printf("a semaphore was not given by a test task."); + } + } + + i += 2; + + } while (i < cipherlist_sz); + + vSemaphoreDelete(exit_semaph); + vSemaphoreDelete(Mutex); + +#else + + do { + + info[i].port = TLSSERVER_PORT; + info[i].cipher = cipherlist[i]; + info[i].ctx = client_ctx; + info[i].id = i; + + memset(info[i].name, 0, sizeof(info[i].name)); + sprintf(info[i].name, "wolfSSL_TLS_client_do(%02d)", i); + + Tls_client(&info[i]); i++; } while (i < cipherlist_sz); + if (client_ctx) { + wolfSSL_CTX_free(client_ctx); + } + +#endif + + wolfSSL_Cleanup(); + printf("End of TLS_Client demo.\n"); } #endif /* TLS_CLIENT */ @@ -495,6 +659,44 @@ void wolfSSL_demo_task(bool awsIotMqttMode, Benchmark_demo(); +#elif defined(TSIP_CRYPT_UNIT_TEST) + int ret = 0; + + if ((ret = wolfCrypt_Init()) != 0) { + printf("wolfCrypt_Init failed %d\n", ret); + } + + printf("Start wolf tsip crypt Test\n"); + + printf(" \n"); + printf(" simple crypt test by using TSIP\n"); + tsip_crypt_test(); + + printf(" \n"); + printf(" multi sha thread test\n"); + tsip_crypt_sha_multitest(); + + printf(" \n"); + printf(" multi aes cbc thread test\n"); + + tsip_crypt_AesCbc_multitest(); + + printf(" \n"); + printf(" multi aes gcm thread test\n"); + + tsip_crypt_AesGcm_multitest(); + + printf(" \n"); + printf(" multi sha aescbc aesgcm thread test\n"); + tsip_crypt_Sha_AesCbcGcm_multitest(); + + printf(" \n"); + printf("End wolf tsip crypt Test\n"); + + if ((ret = wolfCrypt_Cleanup()) != 0) { + printf("wolfCrypt_Cleanup failed %d\n", ret); + } + #elif defined(TLS_CLIENT) Tls_client_demo(); diff --git a/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_demo.h b/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_demo.h index 8df09c72a..3ac7a405a 100644 --- a/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_demo.h +++ b/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_demo.h @@ -47,10 +47,8 @@ #include "logging_stack.h" - - /* Enable wolfcrypt test demo */ -/*#define CRYPT_TEST*/ +/*#define CRYPT_TEST */ /* Enable benchmark demo */ /*#define BENCHMARK*/ @@ -59,5 +57,29 @@ /* cannot enable with other definition */ #define TLS_CLIENT +/* use multi-thread example */ +/* #define TLS_MULTITHREAD_TEST */ +#if defined(TLS_MULTITHREAD_TEST) && defined(WOLFSSL_TLS13) + #error "MULTITHREAD_TEST is only available when not set WOLFSSL_TLS13 \ + because it is not verified yet." +#endif + +#if defined(TLS_MULTITHREAD_TEST) + #define THREAD_STACK_SIZE (5 * 1024) +#endif + +typedef struct tagTestInfo +{ + int id; + int port; + char name[32]; + const char* cipher; + WOLFSSL_CTX* ctx; + wolfSSL_Logging_cb log_f; +#if defined(TLS_MULTITHREAD_TEST) + SemaphoreHandle_t xBinarySemaphore; +#endif +} TestInfo; + #endif /* WOLFSSL_DEMO_H_ */ diff --git a/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_tsip_unit_test.c b/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_tsip_unit_test.c new file mode 100644 index 000000000..3560d5ee7 --- /dev/null +++ b/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_tsip_unit_test.c @@ -0,0 +1,1027 @@ +/* wolfssl_tsip_unit_test.c + * + * Copyright (C) 2006-2022 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + +#include +#include +#include + +#include +#include +#include +#include +#ifdef NO_INLINE + #include +#else + #define WOLFSSL_MISC_INCLUDED + #include +#endif +#include + +#include "FreeRTOS.h" +#if defined(FREERTOS_TCP) + #include "FreeRTOS_IP.h" + #include "FreeRTOS_Sockets.h" + #include "platform/iot_network.h" + #include "platform.h" +#endif + +#ifndef NO_SHA + int sha_test(); +#endif + +#ifndef NO_SHA256 + int sha256_test(); +#endif + +#define SMALL_STACK_SIZE (1 * 1024) +#define STACK_SIZE (4 * 1024) + +#define RESULT_STR(ret) if (ret == 0)\ + printf(" passed \n");\ + else \ + printf(" failed \n"); + +static xSemaphoreHandle exit_semaph; +static byte exit_loop = 0; +static byte sha_multTst_rslt = 0; +static byte sha256_multTst_rslt = 0; +static byte Aes128_Cbc_multTst_rslt = 0; +static byte Aes256_Cbc_multTst_rslt = 0; +static byte Aes128_Gcm_multTst_rslt = 0; +static byte Aes256_Gcm_multTst_rslt = 0; + +#if defined(HAVE_AES_CBC) + +#if defined(WOLFSSL_AES_128) +static tsip_aes_key_index_t g_user_aes128_key_index1; +static tsip_aes_key_index_t g_user_aes128_key_index2; +#endif + +#if defined(WOLFSSL_AES_256) +static tsip_aes_key_index_t g_user_aes256_key_index1; +static tsip_aes_key_index_t g_user_aes256_key_index2; +#endif + +#endif + +typedef struct tagInfo +{ + tsip_aes_key_index_t aes_key; +} Info; + +#if defined(HAVE_AES_CBC) && defined(WOLFSSL_AES_128) + +static int tsip_aes_cbc_test(int prnt, tsip_aes_key_index_t* aes_key) +{ + + Aes aes[1]; + + byte cipher[AES_BLOCK_SIZE]; + byte plain[AES_BLOCK_SIZE]; + int ret = 0; + + WOLFSSL_SMALL_STACK_STATIC const byte msg[] = { + /* "Now is the time for all " w/o trailing 0 */ + 0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74, + 0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20, + 0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20 + }; + byte key[] = "0123456789abcdef "; /* align */ + byte iv[] = "1234567890abcdef "; /* align */ + + ForceZero(cipher, AES_BLOCK_SIZE); + ForceZero(plain, AES_BLOCK_SIZE); + + if (prnt) { + printf(" tsip_aes_cbc_test() "); + } + + ret = wc_AesInit(aes, NULL, INVALID_DEVID); + if (ret == 0) { + ret = wc_AesSetKey(aes, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION); + XMEMCPY(&aes->ctx.tsip_keyIdx, aes_key, + sizeof(tsip_aes_key_index_t)); + + aes->ctx.keySize = aes->keylen; + if (ret == 0) { + ret = wc_tsip_AesCbcEncrypt(aes, cipher, msg, AES_BLOCK_SIZE); + } + + wc_AesFree(aes); + } + + if (ret != 0) + ret = -1; + +#ifdef HAVE_AES_DECRYPT + if (ret == 0) + ret = wc_AesInit(aes, NULL, INVALID_DEVID); + if (ret == 0) { + ret = wc_AesSetKey(aes, key, AES_BLOCK_SIZE, iv, AES_DECRYPTION); + XMEMCPY(&aes->ctx.tsip_keyIdx, aes_key, + sizeof(tsip_aes_key_index_t)); + aes->ctx.keySize = aes->keylen; + if (ret == 0) + ret = wc_tsip_AesCbcDecrypt(aes, plain, cipher, AES_BLOCK_SIZE); + + wc_AesFree(aes); + } + if (ret != 0) + ret = -2; + if (XMEMCMP(plain, msg, AES_BLOCK_SIZE) != 0) + ret = -3; +#endif /* HAVE_AES_DECRYPT */ + + (void)plain; + + if (prnt) { + RESULT_STR(ret) + } + + return ret; +} + +static void tskAes128_Cbc_Test(void *pvParam) +{ + int ret = 0; + Info *p = (Info*)pvParam; + + while (exit_loop == false) { + ret = tsip_aes_cbc_test(0, &p->aes_key); + vTaskDelay(10/portTICK_PERIOD_MS); + if (ret != 0) { + printf(" result was not good(%d). tsip_aes_cbc_test\n", ret); + Aes128_Cbc_multTst_rslt = 1; + } + } + + xSemaphoreGive(exit_semaph); + vTaskDelete(NULL); +} + +#endif + +#ifdef WOLFSSL_AES_256 +static int tsip_aes256_test(int prnt, tsip_aes_key_index_t* aes_key) +{ + Aes enc[1]; + byte cipher[AES_BLOCK_SIZE]; + byte plain[AES_BLOCK_SIZE]; + Aes dec[1]; + int ret = 0; + + /* Test vectors from NIST Special Publication 800-38A, 2001 Edition, + * Appendix F.2.5 */ + WOLFSSL_SMALL_STACK_STATIC const byte msg[] = { + 0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96, + 0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a + }; + + WOLFSSL_SMALL_STACK_STATIC const byte verify[] = + { + 0xf5,0x8c,0x4c,0x04,0xd6,0xe5,0xf1,0xba, + 0x77,0x9e,0xab,0xfb,0x5f,0x7b,0xfb,0xd6 + }; + + WOLFSSL_SMALL_STACK_STATIC byte key[] = { + 0x60,0x3d,0xeb,0x10,0x15,0xca,0x71,0xbe, + 0x2b,0x73,0xae,0xf0,0x85,0x7d,0x77,0x81, + 0x1f,0x35,0x2c,0x07,0x3b,0x61,0x08,0xd7, + 0x2d,0x98,0x10,0xa3,0x09,0x14,0xdf,0xf4 + }; + WOLFSSL_SMALL_STACK_STATIC byte iv[] = { + 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F + }; + + if (prnt) + printf(" tsip_aes256_test() "); + + if (wc_AesInit(enc, NULL, INVALID_DEVID) != 0) { + ret = -1; + goto out; + } + + if (wc_AesInit(dec, NULL, INVALID_DEVID) != 0){ + ret = -2; + goto out; + } + + ret = wc_AesSetKey(enc, key, (int) sizeof(key), iv, AES_ENCRYPTION); + if (ret != 0){ + ret = -3; + goto out; + } else { + XMEMCPY(&enc->ctx.tsip_keyIdx, aes_key, + sizeof(tsip_aes_key_index_t)); + enc->ctx.keySize = enc->keylen; + } + + ret = wc_AesSetKey(dec, key, (int) sizeof(key), iv, AES_DECRYPTION); + if (ret != 0) { + ret = -4; + goto out; + } else { + XMEMCPY(&dec->ctx.tsip_keyIdx, aes_key, + sizeof(tsip_aes_key_index_t)); + dec->ctx.keySize = dec->keylen; + } + + ForceZero(cipher, AES_BLOCK_SIZE); + ret = wc_tsip_AesCbcEncrypt(enc, cipher, msg, (int) sizeof(msg)); + + if (ret != 0) { + ret = -5; + goto out; + } + + ForceZero(plain, AES_BLOCK_SIZE); + ret = wc_tsip_AesCbcDecrypt(dec, plain, cipher, (int) sizeof(cipher)); + + if (ret != 0){ + ret = -6; + goto out; + } + if (XMEMCMP(plain, msg, (int) sizeof(plain))) { + ret = -7; + goto out; + } + +out: + wc_AesFree(enc); + wc_AesFree(dec); + + if (prnt) { + RESULT_STR(ret) + } + + return ret; +} + +static void tskAes256_Cbc_Test(void *pvParam) +{ + int ret = 0; + Info *p = (Info*)pvParam; + + while (exit_loop == false) { + ret = tsip_aes256_test(0, &p->aes_key); + vTaskDelay(10/portTICK_PERIOD_MS); + if (ret != 0) { + printf(" result was not good(%d). tsip_aes256_test\n", ret); + Aes256_Cbc_multTst_rslt = 1; + } + } + + xSemaphoreGive(exit_semaph); + vTaskDelete(NULL); +} + +#endif /* WOLFSSL_AES_256 */ + +#if defined(WOLFSSL_AES_256) +static int tsip_aesgcm256_test(int prnt, tsip_aes_key_index_t* aes256_key) +{ + Aes enc[1]; + Aes dec[1]; + TsipUserCtx userContext; + + + /* + * This is Test Case 16 from the document Galois/ + * Counter Mode of Operation (GCM) by McGrew and + * Viega. + */ + WOLFSSL_SMALL_STACK_STATIC const byte p[] = + { + 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, + 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, + 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, + 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, + 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, + 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, + 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, + 0xba, 0x63, 0x7b, 0x39 + }; + + WOLFSSL_SMALL_STACK_STATIC const byte a[] = + { + 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, + 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, + 0xab, 0xad, 0xda, 0xd2 + }; + + WOLFSSL_SMALL_STACK_STATIC const byte k1[] = + { + 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, + 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, + 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, + 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08 + }; + + WOLFSSL_SMALL_STACK_STATIC const byte iv1[] = + { + 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, + 0xde, 0xca, 0xf8, 0x88 + }; + + WOLFSSL_SMALL_STACK_STATIC const byte c1[] = + { + 0x52, 0x2d, 0xc1, 0xf0, 0x99, 0x56, 0x7d, 0x07, + 0xf4, 0x7f, 0x37, 0xa3, 0x2a, 0x84, 0x42, 0x7d, + 0x64, 0x3a, 0x8c, 0xdc, 0xbf, 0xe5, 0xc0, 0xc9, + 0x75, 0x98, 0xa2, 0xbd, 0x25, 0x55, 0xd1, 0xaa, + 0x8c, 0xb0, 0x8e, 0x48, 0x59, 0x0d, 0xbb, 0x3d, + 0xa7, 0xb0, 0x8b, 0x10, 0x56, 0x82, 0x88, 0x38, + 0xc5, 0xf6, 0x1e, 0x63, 0x93, 0xba, 0x7a, 0x0a, + 0xbc, 0xc9, 0xf6, 0x62 + }; + + WOLFSSL_SMALL_STACK_STATIC const byte t1[] = + { + 0x76, 0xfc, 0x6e, 0xce, 0x0f, 0x4e, 0x17, 0x68, + 0xcd, 0xdf, 0x88, 0x53, 0xbb, 0x2d, 0x55, 0x1b + }; + + int ivlen; + + byte resultT[sizeof(t1)]; + byte resultP[sizeof(p) + AES_BLOCK_SIZE]; + byte resultC[sizeof(p) + AES_BLOCK_SIZE]; + int result = 0; + int ret; + int alen; + int plen; + + (void) result; + + if (prnt) { + printf(" tsip_aes256_gcm_test() "); + } + + ForceZero(resultT, sizeof(resultT)); + ForceZero(resultC, sizeof(resultC)); + ForceZero(resultP, sizeof(resultP)); + ForceZero(&userContext, sizeof(TsipUserCtx)); + + if (wc_AesInit(enc, NULL, INVALID_DEVID) != 0) { + ret = -1; + goto out; + } + if (wc_AesInit(dec, NULL, INVALID_DEVID) != 0) { + ret = -2; + goto out; + } + + result = wc_AesGcmSetKey(enc, k1, sizeof(k1)); + if (result != 0) { + ret = -3; + goto out; + } else { + XMEMCPY(&userContext.user_aes256_key_index, aes256_key, + sizeof(tsip_aes_key_index_t)); + userContext.user_aes256_key_set = 1; + enc->ctx.keySize = enc->keylen; + } + + /* AES-GCM encrypt and decrypt both use AES encrypt internally */ + result = wc_tsip_AesGcmEncrypt(enc, resultC, p, sizeof(p), + (byte*)iv1, sizeof(iv1), resultT, sizeof(resultT), + a, sizeof(a), &userContext); + + if (result != 0) { + ret = -4; + goto out; + } + + result = wc_AesGcmSetKey(dec, k1, sizeof(k1)); + if (result != 0) { + ret = -7; + goto out; + } else { + dec->ctx.keySize = enc->keylen; + } + + result = wc_tsip_AesGcmDecrypt(dec, resultP, resultC, sizeof(c1), + iv1, sizeof(iv1), resultT, sizeof(resultT), + a, sizeof(a), &userContext); + if (result != 0){ + ret = -8; + goto out; + } + if (XMEMCMP(p, resultP, sizeof(p))) { + ret = -9; + goto out; + } + + ForceZero(resultT, sizeof(resultT)); + ForceZero(resultC, sizeof(resultC)); + ForceZero(resultP, sizeof(resultP)); + + wc_AesGcmSetKey(enc, k1, sizeof(k1)); + /* AES-GCM encrypt and decrypt both use AES encrypt internally */ + result = wc_tsip_AesGcmEncrypt(enc, resultC, p, sizeof(p), iv1, sizeof(iv1), + resultT + 1, sizeof(resultT) - 1, + a, sizeof(a), &userContext); + if (result != 0) { + ret = -10; + goto out; + } + + result = wc_tsip_AesGcmDecrypt(enc, resultP, resultC, sizeof(p), + iv1, sizeof(iv1), resultT + 1, sizeof(resultT) - 1, + a, sizeof(a), &userContext); + + if (result != 0) { + ret = -11; + goto out; + } + if (XMEMCMP(p, resultP, sizeof(p))) { + ret = -12; + goto out; + } + + ret = 0; + + out: + wc_AesFree(enc); + wc_AesFree(dec); + + if (prnt) { + RESULT_STR(ret) + } + + return ret; +} + +static void tskAes256_Gcm_Test(void *pvParam) +{ + int ret = 0; + Info *p = (Info*)pvParam; + + while (exit_loop == false) { + ret = tsip_aesgcm256_test(0, &p->aes_key); + vTaskDelay(10/portTICK_PERIOD_MS); + if (ret != 0) { + printf(" result was not good(%d). tsip_aesgcm256_test\n", ret); + Aes256_Gcm_multTst_rslt = 1; + } + } + + xSemaphoreGive(exit_semaph); + vTaskDelete(NULL); +} +#endif + +#if defined(WOLFSSL_AES_128) + +static int tsip_aesgcm128_test(int prnt, tsip_aes_key_index_t* aes128_key) +{ + Aes enc[1]; + Aes dec[1]; + TsipUserCtx userContext; + + /* The following is an interesting test case from the example + * FIPS test vectors for AES-GCM. IVlen = 1 byte */ + WOLFSSL_SMALL_STACK_STATIC const byte p3[] = + { + 0x57, 0xce, 0x45, 0x1f, 0xa5, 0xe2, 0x35, 0xa5, + 0x8e, 0x1a, 0xa2, 0x3b, 0x77, 0xcb, 0xaf, 0xe2 + }; + + WOLFSSL_SMALL_STACK_STATIC const byte k3[] = + { + 0xbb, 0x01, 0xd7, 0x03, 0x81, 0x1c, 0x10, 0x1a, + 0x35, 0xe0, 0xff, 0xd2, 0x91, 0xba, 0xf2, 0x4b + }; + + WOLFSSL_SMALL_STACK_STATIC const byte iv3[] = + { + 0xca + }; + + WOLFSSL_SMALL_STACK_STATIC const byte c3[] = + { + 0x6b, 0x5f, 0xb3, 0x9d, 0xc1, 0xc5, 0x7a, 0x4f, + 0xf3, 0x51, 0x4d, 0xc2, 0xd5, 0xf0, 0xd0, 0x07 + }; + + WOLFSSL_SMALL_STACK_STATIC const byte a3[] = + { + 0x40, 0xfc, 0xdc, 0xd7, 0x4a, 0xd7, 0x8b, 0xf1, + 0x3e, 0x7c, 0x60, 0x55, 0x50, 0x51, 0xdd, 0x54 + }; + + WOLFSSL_SMALL_STACK_STATIC const byte t3[] = + { + 0x06, 0x90, 0xed, 0x01, 0x34, 0xdd, 0xc6, 0x95, + 0x31, 0x2e, 0x2a, 0xf9, 0x57, 0x7a, 0x1e, 0xa6 + }; + + byte resultT[16]; + byte resultP[60 + AES_BLOCK_SIZE]; + byte resultC[60 + AES_BLOCK_SIZE]; + int result = 0; + int ret; + + (void) result; + + if (prnt) { + printf(" tsip_aes128_gcm_test() "); + } + + ForceZero(resultT, sizeof(resultT)); + ForceZero(resultC, sizeof(resultC)); + ForceZero(resultP, sizeof(resultP)); + ForceZero(&userContext, sizeof(TsipUserCtx)); + + if (wc_AesInit(enc, NULL, INVALID_DEVID) != 0) { + ret = -1; + goto out; + } + + if (wc_AesInit(dec, NULL, INVALID_DEVID) != 0) { + ret = -2; + goto out; + } + + wc_AesGcmSetKey(enc, k3, sizeof(k3)); + if (result != 0) { + ret = -3; + goto out; + } else { + XMEMCPY(&userContext.user_aes128_key_index, aes128_key, + sizeof(tsip_aes_key_index_t)); + userContext.user_aes128_key_set = 1; + enc->ctx.keySize = enc->keylen; + } + /* AES-GCM encrypt and decrypt both use AES encrypt internally */ + result = wc_tsip_AesGcmEncrypt(enc, resultC, p3, sizeof(p3), + iv3, sizeof(iv3), + resultT, sizeof(t3), + a3, sizeof(a3), &userContext); + if (result != 0) { + ret = -4; + goto out; + } + result = wc_tsip_AesGcmDecrypt(enc, resultP, resultC, sizeof(c3), + iv3, sizeof(iv3), resultT, sizeof(resultT), + a3, sizeof(a3), &userContext); + if (result != 0) { + ret = -5; + goto out; + } + if (XMEMCMP(p3, resultP, sizeof(p3))) { + ret = -6; + goto out; + } + + ret = 0; + + out: + wc_AesFree(enc); + wc_AesFree(dec); + + if (prnt) { + RESULT_STR(ret) + } + + return ret; +} + +static void tskAes128_Gcm_Test(void *pvParam) +{ + int ret = 0; + Info *p = (Info*)pvParam; + + while (exit_loop == false) { + ret = tsip_aesgcm128_test(0, &p->aes_key); + vTaskDelay(10/portTICK_PERIOD_MS); + if (ret != 0) { + printf(" result was not good(%d). tsip_aesgcm128_test\n", ret); + Aes128_Gcm_multTst_rslt = 1; + } + } + + xSemaphoreGive(exit_semaph); + vTaskDelete(NULL); +} + +#endif + +int tsip_crypt_test() +{ + int ret = 0; + e_tsip_err_t tsip_error_code; + + /* Generate AES tsip Key */ + tsip_error_code = R_TSIP_GenerateAes128RandomKeyIndex( + &g_user_aes128_key_index1); + + if (tsip_error_code == TSIP_SUCCESS) + tsip_error_code = R_TSIP_GenerateAes128RandomKeyIndex( + &g_user_aes128_key_index2); + + if (tsip_error_code == TSIP_SUCCESS) + tsip_error_code = R_TSIP_GenerateAes256RandomKeyIndex( + &g_user_aes256_key_index1); + + if (tsip_error_code == TSIP_SUCCESS) + tsip_error_code = R_TSIP_GenerateAes256RandomKeyIndex( + &g_user_aes256_key_index2); + + if (tsip_error_code == TSIP_SUCCESS) { + + #ifndef NO_SHA + printf(" sha_test()"); + ret = sha_test(); + RESULT_STR(ret) + #endif + + #ifndef NO_SHA256 + printf(" sha256_test()"); + ret = sha256_test(); + RESULT_STR(ret) + #endif + + ret = tsip_aes_cbc_test(1, &g_user_aes128_key_index1); + + if (ret == 0) { + + ret = tsip_aes256_test(1, &g_user_aes256_key_index1); + + } + + if (ret == 0) { + + ret = tsip_aesgcm128_test(1, &g_user_aes128_key_index1); + + } + + if (ret == 0) { + + ret = tsip_aesgcm256_test(1, &g_user_aes256_key_index1); + + } + } + else + ret = -1; + + return ret; +} + +#ifndef NO_SHA + +static void tskSha_Test(void *pvParam) +{ + int ret = 0; + + while (exit_loop == false) { + ret = sha_test(); + vTaskDelay(10/portTICK_PERIOD_MS); + if (ret != 0) { + printf(" result was not good(%d). sha_test\n", ret); + sha_multTst_rslt = 1; + } + } + + xSemaphoreGive(exit_semaph); + vTaskDelete(NULL); +} +#endif + +#ifndef NO_SHA256 +static void tskSha256_Test(void *pvParam) +{ + int ret = 0; + + while (exit_loop == false) { + ret = sha256_test(); + vTaskDelay(10/portTICK_PERIOD_MS); + if (ret != 0) { + printf(" result was not good(%d). sha256_test\n", ret); + sha256_multTst_rslt = 1; + } + } + + xSemaphoreGive(exit_semaph); + vTaskDelete(NULL); +} +#endif + +int tsip_crypt_sha_multitest() +{ + int ret = 0; + int num = 0; + int i; + BaseType_t xRet; + +#ifndef NO_SHA + num++; +#endif +#ifndef NO_SHA256 + num++; +#endif + exit_loop = 0; + sha_multTst_rslt = 0; + sha256_multTst_rslt = 0; + + exit_semaph = xSemaphoreCreateCounting(num, 0); + xRet = pdPASS; + +#ifndef NO_SHA + xRet = xTaskCreate(tskSha_Test, "sha_test", + SMALL_STACK_SIZE, NULL, 3, NULL); +#endif +#ifndef NO_SHA256 + if (xRet == pdPASS) + xRet = xTaskCreate(tskSha256_Test, "sha256_test", + SMALL_STACK_SIZE, NULL, 3, NULL); +#endif + + if (xRet == pdPASS) { + printf(" Waiting for completing tasks ..."); + vTaskDelay(10000/portTICK_PERIOD_MS); + exit_loop = true; + + for (i = 0; i < num; i++) { + if (!xSemaphoreTake(exit_semaph, 2000/portTICK_PERIOD_MS)) { + printf("a semaphore was not given by a test task."); + ret = -1; + xRet = pdFAIL; + } + } + } + + vSemaphoreDelete(exit_semaph); + + if ((xRet == pdPASS) && + (sha_multTst_rslt == 0 && sha256_multTst_rslt == 0)) + ret = 0; + else + ret = -1; + + RESULT_STR(ret) + + return ret; +} + + +int tsip_crypt_AesCbc_multitest() +{ + int ret = 0; + int num = 0; + int i; + Info info_aes1; + Info info_aes2; + Info info_aes256_1; + Info info_aes256_2; + BaseType_t xRet; + +#if defined(HAVE_AES_CBC) && defined(WOLFSSL_AES_128) + num+=2; +#endif +#if defined(HAVE_AES_CBC) && defined(WOLFSSL_AES_256) + num+=2; +#endif + exit_loop = 0; + Aes128_Cbc_multTst_rslt = 0; + Aes256_Cbc_multTst_rslt = 0; + + exit_semaph = xSemaphoreCreateCounting(num, 0); + xRet = pdPASS; + +#if defined(HAVE_AES_CBC) && defined(WOLFSSL_AES_128) + XMEMCPY(&info_aes1.aes_key, &g_user_aes128_key_index1, + sizeof(tsip_aes_key_index_t)); + xRet = xTaskCreate(tskAes128_Cbc_Test, "aes_cbc_tes1t", + SMALL_STACK_SIZE, &info_aes1, 3, NULL); +#endif +#if defined(HAVE_AES_CBC) && defined(WOLFSSL_AES_128) + XMEMCPY(&info_aes2.aes_key, &g_user_aes128_key_index2, + sizeof(tsip_aes_key_index_t)); + if (xRet == pdPASS) + xRet = xTaskCreate(tskAes128_Cbc_Test, "aes_cbc_test2", + SMALL_STACK_SIZE, &info_aes2, 3, NULL); +#endif + +#if defined(HAVE_AES_CBC) && defined(WOLFSSL_AES_256) + XMEMCPY(&info_aes256_1.aes_key, &g_user_aes256_key_index1, + sizeof(tsip_aes_key_index_t)); + if (xRet == pdPASS) + xRet = xTaskCreate(tskAes256_Cbc_Test, "aes256_cbc_test1", + SMALL_STACK_SIZE, &info_aes256_1, 3, NULL); +#endif +#if defined(HAVE_AES_CBC) && defined(WOLFSSL_AES_256) + XMEMCPY(&info_aes256_2.aes_key, &g_user_aes256_key_index2, + sizeof(tsip_aes_key_index_t)); + if (xRet == pdPASS) + xRet = xTaskCreate(tskAes256_Cbc_Test, "aes256_cbc_test2", + SMALL_STACK_SIZE, &info_aes256_2, 3, NULL); +#endif + + if (xRet == pdPASS) { + printf(" Waiting for completing tasks ..."); + vTaskDelay(10000/portTICK_PERIOD_MS); + exit_loop = true; + + for (i = 0; i < num; i++) { + if (!xSemaphoreTake(exit_semaph, 2000/portTICK_PERIOD_MS)) { + printf("a semaphore was not given by a test task."); + ret = -1; + xRet = pdFAIL; + } + } + } + + vSemaphoreDelete(exit_semaph); + + if ((xRet == pdPASS) && + (Aes128_Cbc_multTst_rslt == 0 && Aes256_Cbc_multTst_rslt == 0)) + ret = 0; + else + ret = -1; + + RESULT_STR(ret) + + return ret; +} + + +int tsip_crypt_AesGcm_multitest() +{ + int ret = 0; + int num = 0; + int i; + Info info_aes1; + Info info_aes2; + Info info_aes256_1; + Info info_aes256_2; + BaseType_t xRet; + +#if defined(WOLFSSL_AES_128) + num+=2; +#endif +#if defined(WOLFSSL_AES_256) + num+=2; +#endif + + exit_loop = 0; + Aes128_Gcm_multTst_rslt = 0; + Aes256_Gcm_multTst_rslt = 0; + + exit_semaph = xSemaphoreCreateCounting(num, 0); + xRet = pdPASS; + +#if defined(WOLFSSL_AES_128) + XMEMCPY(&info_aes1.aes_key, &g_user_aes128_key_index1, + sizeof(tsip_aes_key_index_t)); + xTaskCreate(tskAes128_Gcm_Test, "aes128_gcm_test1", + STACK_SIZE, &info_aes1, 3, NULL); + + XMEMCPY(&info_aes2.aes_key, &g_user_aes128_key_index2, + sizeof(tsip_aes_key_index_t)); + if (xRet == pdPASS) + xRet = xTaskCreate(tskAes128_Gcm_Test, "aes128_gcm_test2", + STACK_SIZE, &info_aes2, 3, NULL); +#endif + + +#if defined(WOLFSSL_AES_256) + XMEMCPY(&info_aes256_1.aes_key, &g_user_aes256_key_index1, + sizeof(tsip_aes_key_index_t)); + if (xRet == pdPASS) + xRet = xTaskCreate(tskAes256_Gcm_Test, "aes256_gcm_test1", + STACK_SIZE, &info_aes256_1, 3, NULL); + XMEMCPY(&info_aes256_2.aes_key, &g_user_aes256_key_index2, + sizeof(tsip_aes_key_index_t)); + if (xRet == pdPASS) + xRet = xTaskCreate(tskAes256_Gcm_Test, "aes256_gcm_test2", + STACK_SIZE, &info_aes256_2, 3, NULL); +#endif + + if (xRet == pdPASS) { + printf(" Waiting for completing tasks ..."); + vTaskDelay(10000/portTICK_PERIOD_MS); + exit_loop = true; + + for (i = 0; i < num; i++) { + if (!xSemaphoreTake(exit_semaph, 5000/portTICK_PERIOD_MS)) { + printf("a semaphore was not given by a test task."); + ret = -1; + xRet = pdFAIL; + } + } + } + + vSemaphoreDelete(exit_semaph); + + if ((xRet == pdPASS) && + (Aes128_Gcm_multTst_rslt == 0 && Aes256_Gcm_multTst_rslt == 0)) + ret = 0; + else + ret = -1; + + RESULT_STR(ret) + + return ret; +} + +int tsip_crypt_Sha_AesCbcGcm_multitest() +{ + int ret = 0; + int num = 0; + int i; + Info info_aes128cbc; + Info info_aes128gcm; + Info info_aes256cbc; + Info info_aes256gcm; + BaseType_t xRet; + +#ifndef NO_SHA + num++; +#endif + +#if defined(WOLFSSL_AES_128) + num+=1; +#endif +#if defined(WOLFSSL_AES_256) + num+=1; +#endif + + exit_loop = 0; + sha_multTst_rslt = 0; + Aes256_Cbc_multTst_rslt = 0; + Aes256_Gcm_multTst_rslt = 0; + + exit_semaph = xSemaphoreCreateCounting(num, 0); + xRet = pdPASS; + +#ifndef NO_SHA + xRet = xTaskCreate(tskSha_Test, "sha_test", + SMALL_STACK_SIZE, NULL, 3, NULL); +#endif + +#if defined(WOLFSSL_AES_256) + XMEMCPY(&info_aes256cbc.aes_key, &g_user_aes256_key_index1, + sizeof(tsip_aes_key_index_t)); + if (xRet == pdPASS) + xRet = xTaskCreate(tskAes256_Cbc_Test, "aes256_cbc_test1", + SMALL_STACK_SIZE, &info_aes256cbc, 3, NULL); +#endif + +#if defined(WOLFSSL_AES_256) + XMEMCPY(&info_aes256gcm.aes_key, &g_user_aes256_key_index2, + sizeof(tsip_aes_key_index_t)); + if (xRet == pdPASS) + xRet = xTaskCreate(tskAes256_Gcm_Test, "aes256_gcm_test2", + STACK_SIZE, &info_aes256gcm, 3, NULL); +#endif + + if (xRet == pdPASS) { + printf(" Waiting for completing tasks ..."); + vTaskDelay(10000/portTICK_PERIOD_MS); + exit_loop = true; + + for (i = 0; i < num; i++) { + if (!xSemaphoreTake(exit_semaph, 2000/portTICK_PERIOD_MS)) { + printf("a semaphore was not given by a test task."); + ret = -1; + xRet = pdFAIL; + } + } + } + + vSemaphoreDelete(exit_semaph); + + if (xRet == pdPASS && sha_multTst_rslt == 0 && + (Aes256_Cbc_multTst_rslt == 0 && Aes256_Gcm_multTst_rslt == 0)) { + ret = 0; + } + else { + ret = -1; + } + + RESULT_STR(ret) + + return ret; +} + diff --git a/IDE/STM32Cube/main.c b/IDE/STM32Cube/main.c index 149f04397..c5b7e147e 100644 --- a/IDE/STM32Cube/main.c +++ b/IDE/STM32Cube/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/STM32Cube/wolfssl_example.c b/IDE/STM32Cube/wolfssl_example.c index c9411c12b..b0269b277 100644 --- a/IDE/STM32Cube/wolfssl_example.c +++ b/IDE/STM32Cube/wolfssl_example.c @@ -1,6 +1,6 @@ /* wolfssl_example.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/STM32Cube/wolfssl_example.h b/IDE/STM32Cube/wolfssl_example.h index 341667fd8..121eee9b1 100644 --- a/IDE/STM32Cube/wolfssl_example.h +++ b/IDE/STM32Cube/wolfssl_example.h @@ -1,6 +1,6 @@ /* wolfssl_example.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/VS-AZURE-SPHERE/client/client.c b/IDE/VS-AZURE-SPHERE/client/client.c index 8b8c43812..763214b12 100644 --- a/IDE/VS-AZURE-SPHERE/client/client.c +++ b/IDE/VS-AZURE-SPHERE/client/client.c @@ -1,6 +1,6 @@ /* client.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/VS-AZURE-SPHERE/client/client.h b/IDE/VS-AZURE-SPHERE/client/client.h index 8443a084a..a0c4fb038 100644 --- a/IDE/VS-AZURE-SPHERE/client/client.h +++ b/IDE/VS-AZURE-SPHERE/client/client.h @@ -1,6 +1,6 @@ /* client.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + #ifndef WOLFSSL_CLIENT_H #define WOLFSSL_CLIENT_H diff --git a/IDE/VS-AZURE-SPHERE/server/server.c b/IDE/VS-AZURE-SPHERE/server/server.c index a262dc417..48da2a576 100644 --- a/IDE/VS-AZURE-SPHERE/server/server.c +++ b/IDE/VS-AZURE-SPHERE/server/server.c @@ -1,6 +1,6 @@ /* server.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/VS-AZURE-SPHERE/server/server.h b/IDE/VS-AZURE-SPHERE/server/server.h index d623782dc..d0d09ebab 100644 --- a/IDE/VS-AZURE-SPHERE/server/server.h +++ b/IDE/VS-AZURE-SPHERE/server/server.h @@ -1,6 +1,6 @@ /* server.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + #ifndef WOLFSSL_SERVER_H diff --git a/IDE/VisualDSP/user_settings.h b/IDE/VisualDSP/user_settings.h index 2314048f5..a60035e46 100644 --- a/IDE/VisualDSP/user_settings.h +++ b/IDE/VisualDSP/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/VisualDSP/wolf_tasks.c b/IDE/VisualDSP/wolf_tasks.c index aff69ed15..abb830856 100644 --- a/IDE/VisualDSP/wolf_tasks.c +++ b/IDE/VisualDSP/wolf_tasks.c @@ -1,6 +1,6 @@ /* wolf-tasks.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/WIN/README.txt b/IDE/WIN/README.txt index c220bd630..25e4d7e8d 100644 --- a/IDE/WIN/README.txt +++ b/IDE/WIN/README.txt @@ -68,3 +68,16 @@ Additionally one may enable: * WOLFSSL_KEY_GEN These settings are defined in IDE/WIN/user_settings.h. + +# Notes on enabling DTLS including DTLS version 1.3 + +The file IDE/WIN/user_settings_dtls.h contains the needed build options for +enabling DTLS and DTLS version 1.3. + +To incorporate the build options: + + * Rename IDE/WIN/user_settings.h to IDE/WIN/user_settings.h.bak + * Rename IDE/WIN/user_settings_dtls.h to IDE/WIN/user_settings.h + +Alternatively, copy the DTLS labeled section from IDE/WIN/user_settings_dtls.h +in to IDE/WIN/user_settings.h. \ No newline at end of file diff --git a/IDE/WIN/include.am b/IDE/WIN/include.am index ef20c513e..a7a1b9a7e 100644 --- a/IDE/WIN/include.am +++ b/IDE/WIN/include.am @@ -7,3 +7,4 @@ EXTRA_DIST+= IDE/WIN/test.vcxproj EXTRA_DIST+= IDE/WIN/wolfssl-fips.sln EXTRA_DIST+= IDE/WIN/wolfssl-fips.vcxproj EXTRA_DIST+= IDE/WIN/user_settings.h +EXTRA_DIST+= IDE/WIN/user_settings_dtls.h diff --git a/IDE/WIN/user_settings_dtls.h b/IDE/WIN/user_settings_dtls.h new file mode 100644 index 000000000..6059137f9 --- /dev/null +++ b/IDE/WIN/user_settings_dtls.h @@ -0,0 +1,98 @@ +#ifndef _WIN_USER_SETTINGS_H_ +#define _WIN_USER_SETTINGS_H_ + +/* Verify this is Windows */ +#ifndef _WIN32 +#error This user_settings.h header is only designed for Windows +#endif + +/* DTLS configuration including DTLS v.1.3 which requires TLS v.1.3. */ + +/* The below DTLS configurations can be copied in to another user_settings.h + file that may have other settings that need to be preserved. +*/ +#define WOLFSSL_TLS13 +#define WOLFSSL_DTLS +#define WOLFSSL_DTLS13 +#define HAVE_HKDF +#define HAVE_FFDHE_2048 +#define WC_RSA_PSS + +/* DTLS configuration */ + +/* Configurations */ +#if defined(HAVE_FIPS) + /* FIPS */ + #define OPENSSL_EXTRA + #define HAVE_THREAD_LS + #define WOLFSSL_KEY_GEN + #define HAVE_AESGCM + #define HAVE_HASHDRBG + #define WOLFSSL_SHA384 + #define WOLFSSL_SHA512 + #define NO_PSK + #define NO_RC4 + #define NO_DSA + #define NO_MD4 + + #define GCM_NONCE_MID_SZ 12 +#else + /* Enables blinding mode, to prevent timing attacks */ + #define WC_RSA_BLINDING + #define NO_MULTIBYTE_PRINT + + #if defined(WOLFSSL_LIB) + /* The lib */ + #define OPENSSL_EXTRA + #define WOLFSSL_RIPEMD + #define NO_PSK + #define HAVE_EXTENDED_MASTER + #define WOLFSSL_SNIFFER + #define HAVE_SECURE_RENEGOTIATION + + #define HAVE_AESGCM + #define WOLFSSL_SHA384 + #define WOLFSSL_SHA512 + + #define HAVE_SUPPORTED_CURVES + #define HAVE_TLS_EXTENSIONS + + #define HAVE_ECC + #define ECC_SHAMIR + #define ECC_TIMING_RESISTANT + + /* Optional Performance Speedups */ + #if 0 + /* AESNI on x64 */ + #ifdef _WIN64 + #define HAVE_INTEL_RDSEED + #define WOLFSSL_AESNI + #endif + + /* Single Precision Support for RSA/DH 1024/2048/3072 and + * ECC P-256/P-384 */ + #define WOLFSSL_SP + #define WOLFSSL_HAVE_SP_ECC + #define WOLFSSL_HAVE_SP_DH + #define WOLFSSL_HAVE_SP_RSA + + #ifdef _WIN64 + /* Old versions of MASM compiler do not recognize newer + * instructions. */ + #if 0 + #define NO_AVX2_SUPPORT + #define NO_MOVBE_SUPPORT + #endif + #define WOLFSSL_SP_ASM + #define WOLFSSL_SP_X86_64_ASM + #endif + #endif + + #else + /* The servers and clients */ + #define OPENSSL_EXTRA + #define NO_PSK + #endif +#endif /* HAVE_FIPS */ + +#endif /* _WIN_USER_SETTINGS_H_ */ diff --git a/IDE/WIN10/wolfssl-fips.rc b/IDE/WIN10/wolfssl-fips.rc index 8363f9104..f1b9c2150 100644 --- a/IDE/WIN10/wolfssl-fips.rc +++ b/IDE/WIN10/wolfssl-fips.rc @@ -51,8 +51,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 5,3,0,0 - PRODUCTVERSION 5,3,0,0 + FILEVERSION 5,4,0,0 + PRODUCTVERSION 5,4,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -69,12 +69,12 @@ BEGIN BEGIN VALUE "CompanyName", "wolfSSL Inc." VALUE "FileDescription", "The wolfSSL FIPS embedded SSL library is a lightweight, portable, C-language-based SSL/TLS library targeted at IoT, embedded, and RTOS environments primarily because of its size, speed, and feature set." - VALUE "FileVersion", "5.3.0.0" + VALUE "FileVersion", "5.4.0.0" VALUE "InternalName", "wolfssl-fips" VALUE "LegalCopyright", "Copyright (C) 2022" VALUE "OriginalFilename", "wolfssl-fips.dll" VALUE "ProductName", "wolfSSL FIPS" - VALUE "ProductVersion", "5.3.0.0" + VALUE "ProductVersion", "5.4.0.0" END END BLOCK "VarFileInfo" diff --git a/IDE/XCODE-FIPSv2/user_settings.h b/IDE/XCODE-FIPSv2/user_settings.h index 2aaad06a4..4f5d97e43 100644 --- a/IDE/XCODE-FIPSv2/user_settings.h +++ b/IDE/XCODE-FIPSv2/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/XCODE/Benchmark/wolfBench/AppDelegate.h b/IDE/XCODE/Benchmark/wolfBench/AppDelegate.h index dc7165087..d60321f0c 100644 --- a/IDE/XCODE/Benchmark/wolfBench/AppDelegate.h +++ b/IDE/XCODE/Benchmark/wolfBench/AppDelegate.h @@ -1,6 +1,6 @@ /* AppDelegate.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/XCODE/Benchmark/wolfBench/AppDelegate.m b/IDE/XCODE/Benchmark/wolfBench/AppDelegate.m index 1da758448..99c54dec2 100644 --- a/IDE/XCODE/Benchmark/wolfBench/AppDelegate.m +++ b/IDE/XCODE/Benchmark/wolfBench/AppDelegate.m @@ -1,6 +1,6 @@ /* AppDelegate.m * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/XCODE/Benchmark/wolfBench/ViewController.h b/IDE/XCODE/Benchmark/wolfBench/ViewController.h index 4e9cfb8f3..9f7ed7685 100644 --- a/IDE/XCODE/Benchmark/wolfBench/ViewController.h +++ b/IDE/XCODE/Benchmark/wolfBench/ViewController.h @@ -1,6 +1,6 @@ /* ViewController.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/XCODE/Benchmark/wolfBench/ViewController.m b/IDE/XCODE/Benchmark/wolfBench/ViewController.m index ff0465b00..bb2d1d07c 100644 --- a/IDE/XCODE/Benchmark/wolfBench/ViewController.m +++ b/IDE/XCODE/Benchmark/wolfBench/ViewController.m @@ -1,6 +1,6 @@ /* ViewController.m * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/XCODE/Benchmark/wolfBench/main.m b/IDE/XCODE/Benchmark/wolfBench/main.m index 4ee19f302..a91665fc0 100644 --- a/IDE/XCODE/Benchmark/wolfBench/main.m +++ b/IDE/XCODE/Benchmark/wolfBench/main.m @@ -1,6 +1,6 @@ /* main.m * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/XilinxSDK/user_settings.h b/IDE/XilinxSDK/user_settings.h index 02d7f8096..9138f81f3 100644 --- a/IDE/XilinxSDK/user_settings.h +++ b/IDE/XilinxSDK/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/XilinxSDK/wolfssl_example.c b/IDE/XilinxSDK/wolfssl_example.c index eea82bd75..2c6518c3f 100644 --- a/IDE/XilinxSDK/wolfssl_example.c +++ b/IDE/XilinxSDK/wolfssl_example.c @@ -1,6 +1,6 @@ /* wolfssl_example.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/iotsafe-raspberrypi/client-tls13.c b/IDE/iotsafe-raspberrypi/client-tls13.c index 3b1f7b874..a1037dd9a 100644 --- a/IDE/iotsafe-raspberrypi/client-tls13.c +++ b/IDE/iotsafe-raspberrypi/client-tls13.c @@ -2,7 +2,7 @@ * * Copyright (C) 2006-2022 wolfSSL Inc. * - * This file is part of wolfSSL. (formerly known as CyaSSL) + * This file is part of wolfSSL. * * wolfSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ /* C Standard Library */ diff --git a/IDE/iotsafe-raspberrypi/main.c b/IDE/iotsafe-raspberrypi/main.c index 6c2e308dd..23ee90164 100644 --- a/IDE/iotsafe-raspberrypi/main.c +++ b/IDE/iotsafe-raspberrypi/main.c @@ -2,7 +2,7 @@ * * Copyright (C) 2006-2022 wolfSSL Inc. * - * This file is part of wolfSSL. (formerly known as CyaSSL) + * This file is part of wolfSSL. * * wolfSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ /* IoT-SAFE example diff --git a/IDE/iotsafe/ca-cert.c b/IDE/iotsafe/ca-cert.c index 3a9839f17..eb682f312 100644 --- a/IDE/iotsafe/ca-cert.c +++ b/IDE/iotsafe/ca-cert.c @@ -1,8 +1,8 @@ /* ca-cert.c * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * - * This file is part of wolfSSL. (formerly known as CyaSSL) + * This file is part of wolfSSL. * * wolfSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ diff --git a/IDE/iotsafe/devices.c b/IDE/iotsafe/devices.c index 77933f1d7..766068801 100644 --- a/IDE/iotsafe/devices.c +++ b/IDE/iotsafe/devices.c @@ -1,6 +1,6 @@ /* devices.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/iotsafe/devices.h b/IDE/iotsafe/devices.h index e6ed5d776..3fc195986 100644 --- a/IDE/iotsafe/devices.h +++ b/IDE/iotsafe/devices.h @@ -1,6 +1,6 @@ /* devices.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/iotsafe/main.c b/IDE/iotsafe/main.c index 6b98ba928..f76e7a5f4 100644 --- a/IDE/iotsafe/main.c +++ b/IDE/iotsafe/main.c @@ -1,8 +1,8 @@ /* main.c * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * - * This file is part of wolfSSL. (formerly known as CyaSSL) + * This file is part of wolfSSL. * * wolfSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ /* IoT-safe example diff --git a/IDE/iotsafe/memory-tls.c b/IDE/iotsafe/memory-tls.c index 2b60574b8..cae4d9b07 100644 --- a/IDE/iotsafe/memory-tls.c +++ b/IDE/iotsafe/memory-tls.c @@ -1,8 +1,8 @@ /* memory-tls.c * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * - * This file is part of wolfSSL. (formerly known as CyaSSL) + * This file is part of wolfSSL. * * wolfSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ /* IoT-safe client side demo diff --git a/IDE/iotsafe/startup.c b/IDE/iotsafe/startup.c index 07c2e8a35..e604016cc 100644 --- a/IDE/iotsafe/startup.c +++ b/IDE/iotsafe/startup.c @@ -1,6 +1,6 @@ /* startup.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/IDE/iotsafe/target.ld b/IDE/iotsafe/target.ld index 474bf5b3e..717705f9d 100644 --- a/IDE/iotsafe/target.ld +++ b/IDE/iotsafe/target.ld @@ -1,8 +1,8 @@ /* target.ld * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * - * This file is part of wolfSSL. (formerly known as CyaSSL) + * This file is part of wolfSSL. * * wolfSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ /* IoT-safe example diff --git a/IDE/iotsafe/user_settings.h b/IDE/iotsafe/user_settings.h index 51671df9c..2bdf71bbd 100644 --- a/IDE/iotsafe/user_settings.h +++ b/IDE/iotsafe/user_settings.h @@ -1,8 +1,8 @@ /* user_settings.h * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * - * This file is part of wolfSSL. (formerly known as CyaSSL) + * This file is part of wolfSSL. * * wolfSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ /* Example 'user_settings.h' for IoT-Safe demo */ diff --git a/IDE/mynewt/apps.wolfcrypttest.pkg.yml b/IDE/mynewt/apps.wolfcrypttest.pkg.yml index bac9422c6..ccc3a70c4 100644 --- a/IDE/mynewt/apps.wolfcrypttest.pkg.yml +++ b/IDE/mynewt/apps.wolfcrypttest.pkg.yml @@ -1,4 +1,4 @@ -# Copyright (C) 2006-2021 wolfSSL Inc. +# Copyright (C) 2006-2022 wolfSSL Inc. # # This file is part of wolfSSL. # @@ -15,9 +15,6 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -#/ -#/ -# pkg.name: "apps/wolfcrypttest" pkg.type: app diff --git a/IDE/mynewt/crypto.wolfssl.pkg.yml b/IDE/mynewt/crypto.wolfssl.pkg.yml index f8951fef8..44fa6bf9f 100644 --- a/IDE/mynewt/crypto.wolfssl.pkg.yml +++ b/IDE/mynewt/crypto.wolfssl.pkg.yml @@ -1,4 +1,4 @@ -# Copyright (C) 2006-2021 wolfSSL Inc. +# Copyright (C) 2006-2022 wolfSSL Inc. # # This file is part of wolfSSL. # @@ -15,9 +15,6 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -#/ -#/ -# pkg.name: "crypto/wolfssl" pkg.description: "wolfSSL Embedded SSL/TLS Library" diff --git a/README b/README index 56450b317..83808190d 100644 --- a/README +++ b/README @@ -70,164 +70,162 @@ should be used for the enum name. *** end Notes *** -# wolfSSL Release 5.3.0 (May 3rd, 2022) +# wolfSSL Release 5.4.0 (July 11, 2022) + +Note: +** Future releases of wolfSSL will turn off TLS 1.1 by default +** Release 5.4.0 made SP math the default math implementation. To make an equivalent build as –disable-fastmath from previous versions of wolfSSL, now requires using the configure option –enable-heapmath instead. + +Release 5.4.0 of wolfSSL embedded TLS has bug fixes and new features including: + +## Vulnerabilities +* [High] Potential for DTLS DoS attack. In wolfSSL versions before 5.4.0 the return-routability check is wrongly skipped in a specific edge case. The check on the return-routability is there for stopping attacks that either consume excessive resources on the server, or try to use the server as an amplifier sending an excessive amount of messages to a victim IP. If using DTLS 1.0/1.2 on the server side users should update to avoid the potential DoS attack. CVE-2022-34293 +* [Medium] Ciphertext side channel attack on ECC and DH operations. Users on systems where rogue agents can monitor memory use should update the version of wolfSSL and change private ECC keys. Thanks to Sen Deng from Southern University of Science and Technology (SUSTech) for the report. +* [Medium] Public disclosure of a side channel vulnerability that has been fixed since wolfSSL version 5.1.0. When running on AMD there is the potential to leak private key information with ECDSA operations due to a ciphertext side channel attack. Users on AMD doing ECDSA operations with wolfSSL versions less than 5.1.0 should update their wolfSSL version used. Thanks to professor Yinqian Zhang from Southern University of Science and Technology (SUSTech), his Ph.D. student Mengyuan Li from The Ohio State University, and his M.S students Sen Deng and Yining Tang from SUStech along with other collaborators; Luca Wilke, Jan Wichelmann and Professor Thomas Eisenbarth from the University of Lubeck, Professor Shuai Wang from Hong Kong University of Science and Technology, Professor Radu Teodorescu from The Ohio State University, Huibo Wang, Kang Li and Yueqiang Cheng from Baidu Security and Shoumeng Yang from Ant Financial Services Group. +CVE-2020-12966 https://www.amd.com/en/corporate/product-security/bulletin/amd-sb-1013 CVE-2021-46744 https://www.amd.com/en/corporate/product-security/bulletin/amd-sb-1033 -Release 5.3.0 of wolfSSL embedded TLS has bug fixes and new features including: ## New Feature Additions +### DTLS 1.3 +* Support for using the new DTLSv1.3 protocol was added +* Enhancements to bundled examples for an event driven server with DTLS 1.3 was added ### Ports -* Updated support for Stunnel to version 5.61 -* Add i.MX8 NXP SECO use for secure private ECC keys and expand cryptodev-linux for use with the RSA/Curve25519 with the Linux CAAM driver -* Allow encrypt then mac with Apache port -* Update Renesas TSIP version to 1.15 on GR-ROSE and certificate signature data for TSIP / SCE example -* Add IAR MSP430 example, located in IDE/IAR-MSP430 directory -* Add support for FFMPEG with the enable option `--enable-ffmpeg`, FFMPEG is used for recording and converting video and audio (https://ffmpeg.org/) -* Update the bind port to version 9.18.0 - -### Post Quantum -* Add Post-quantum KEM benchmark for STM32 -* Enable support for using post quantum algorithms with embedded STM32 boards and port to STM32U585 - -### Compatibility Layer Additions -* Add port to support libspdm (https://github.com/DMTF/libspdm/blob/main/README.md), compatibility functions added for the port were: - - ASN1_TIME_compare - - DH_new_by_nid - - OBJ_length, OBJ_get0_data, - - EVP layer ChaCha20-Poly1305, HKDF - - EC_POINT_get_affine_coordinates - - EC_POINT_set_affine_coordinates -* Additional functions added were: - - EC_KEY_print_fp - - EVP_PKEY_paramgen - - EVP_PKEY_sign/verify functionality - - PEM_write_RSAPublicKey - - PEM_write_EC_PUBKEY - - PKCS7_sign - - PKCS7_final - - SMIME_write_PKCS7 - - EC_KEY/DH_up_ref - - EVP_DecodeBlock - - EVP_EncodeBlock - - EC_KEY_get_conv_form - - BIO_eof - - Add support for BIO_CTRL_SET and BIO_CTRL_GET -* Add compile time support for the type SSL_R_NULL_SSL_METHOD_PASSED -* Enhanced X509_NAME_print_ex() to support RFC5523 basic escape -* More checks on OPENSSL_VERSION_NUMBER for API prototype differences -* Add extended key usage support to wolfSSL_X509_set_ext -* SSL_VERIFY_FAIL_IF_NO_PEER_CERT now can also connect with compatibility layer enabled and a TLS 1.3 PSK connection is used -* Improve wolfSSL_BN_rand to handle non byte boundaries and top/bottom parameters -* Changed X509_V_ERR codes to better match OpenSSL values used -* Improve wolfSSL_i2d_X509_name to allow for a NULL input in order to get the expected resulting size -* Enhance the smallstack build to reduce stack size farther when built with compatibility layer enabled - +* Update for the version of VxWorks supported, adding in support for version 6.x +* Support for new DPP and EAP-TEAP/EAP-FAST in wpa_supplicant +* Update for TSIP version support, adding support for version 1.15 for RX65N and RX72N +* Improved TSIP build to handle having the options WOLFSSL_AEAD_ONLY defined or NO_AES_CBC defined +* Added support for offloading TLS1.3 operations to Renesas RX boards with TSIP ### Misc. -* Sniffer asynchronous support addition, handling of DH shared secret and tested with Intel QuickAssist -* Added in support for OCSP with IPv6 -* Enhance SP (single precision) optimizations for use with the ECC P521 -* Add new public API wc_CheckCertSigPubKey() for use to easily check the signature of a certificate given a public key buffer -* Add CSR (Certificate Signing Request) userId support in subject name -* Injection and parsing of custom extensions in X.509 certificates -* Add WOLF_CRYPTO_CB_ONLY_RSA and WOLF_CRYPTO_CB_ONLY_ECC to reduce code size if using only crypto callback functions with RSA and ECC -* Created new --enable-engine configure flag used to build wolfSSL for use with wolfEngine -* With TLS 1.3 PSK, when WOLFSSL_PSK_MULTI_ID_PER_CS is defined multiple IDs for a cipher suite can be handled -* Added private key id/label support with improving the PK (Public Key) callbacks -* Support for Intel QuickAssist ECC KeyGen acceleration -* Add the function wolfSSL_CTX_SetCertCbCtx to set user context for certificate call back -* Add the functions wolfSSL_CTX_SetEccSignCtx(WOLFSSL_CTX* ctx, void *userCtx) and wolfSSL_CTX_GetEccSignCtx(WOLFSSL_CTX* ctx) for setting and getting a user context -* wolfRand for AMD --enable-amdrand +* Constant time improvements due to development of new constant time tests +* Initial translation of API headers to Japanese and expansion of Japanese help message support in example applications +* Add support for some FPKI (Federal PKI) certificate cases, UUID, FASC-N, PIV extension for use with smart cards +* Add support for parsing additional CSR attributes such as unstructured name and content type +* Add support for Linux getrandom() when defining the macro WOLFSSL_GETRANDOM +* Add TLS 1.2 ciphersuite ECDHE_PSK_WITH_AES_128_GCM_SHA256 from RFC 8442 +* Expand CAAM support with QNX to include i.MX8 boards and add AES-CTR support +* Enhanced glitching protection by hardening the TLS encrypt operations -## Fixes -### PORT Fixes -* KCAPI memory optimizations and page alignment fixes for ECC, AES mode fixes and reduction to memory usage -* Add the new kdf.c file to the TI-RTOS build -* Fix wait-until-done in RSA hardware primitive acceleration of ESP-IDF port -* IOTSafe workarounds when reading files with ending 0’s and for ECC signatures +## Math and Performance -### Math Library Fixes -* Sanity check with SP math that ECC points ordinates are not greater than modulus length -* Additional sanity checks that _sp_add_d does not error due to overflow -* Wycheproof fixes, testing integration, and fixes for AVX / AArch64 ASM edge case tests -* TFM fp_div_2_ct rework to avoid potential overflow +### SP Math Additions +* Support for ARMv3, ARMv6 and ARMv7a + - Changes and improvements to get SP building for armv7-a + - Updated assembly for moving large immediate values on ARMv6 + - Support for architectures with no ldrd/strd and clz +* Reworked generation using common asm ruby code for 32bit ARM +* Enable wolfSSL SP math all by default (sp_int.c) +* Update SP math all to not use sp_int_word when SQR_MUL_ASM is available +### SP Math Fixes +* Fixes for constant time with div function +* Fix casting warnings for Windows builds and assembly changes to support XMM6-15 being non-volatile +* Fix for div_word when not using div function +* Fixes for user settings with SP ASM and ED/Curve25519 small +* Additional Wycheproof tests ran and fixes +* Fix for SP math ECC non-blocking to always check `hashLen` +* Fix for SP math handling edge case with submod -### Misc. -* Fix for PKCS#7 with Crypto Callbacks -* Fix for larger curve sizes with deterministic ECC sign -* Fixes for building wolfSSL alongside openssl using --enable-opensslcoexist -* Fix for compatibility layer handling of certificates with SHA256 SKID (Subject Key ID) -* Fix for wolfSSL_ASN1_TIME_diff erroring out on a return value of 0 from mktime -* Remove extra padding when AES-CBC encrypted with PemToDer -* Fixes for TLS v1.3 early data with async. -* Fixes for async disables around the DevCopy calls -* Fixes for Windows AES-NI with clang compiler -* Fix for handling the detection of processing a plaintext TLS alert packet -* Fix for potential memory leak in an error case with TLSX supported groups -* Sanity check on `input` size in `DecodeNsCertType` -* AES-GCM stack alignment fixes with assembly code written for AVX/AVX2 -* Fix for PK callbacks with server side and setting a public key +## Improvements and Optimizations -## Improvements/Optimizations -### Build Options and Warnings -* Added example user settings template for FIPS v5 ready -* Automake file touch cleanup for use with Yocto devtool -* Allow disabling forced 'make clean' at the end of ./configure by using --disable-makeclean -* Enable TLS 1.3 early data when specifying `--enable-all` option -* Disable PK Callbacks with JNI FIPS builds -* Add a FIPS cert 3389 ready option, this is the fips-ready build -* Support (no)inline with Wind River Diab compiler -* ECDH_compute_key allow setting of globalRNG with FIPS 140-3 -* Add logic equivalent to configure.ac in settings.h for Poly1305 -* Fixes to support building opensslextra with SP math -* CPP protection for extern references to x86_64 asm code -* Updates and enhancements for Espressif ESP-IDF wolfSSL setup_win.bat -* Documentation improvements with auto generation -* Fix reproducible-build for working an updated version of libtool, version 2.4.7 -* Fixes for Diab C89 and armclang -* Fix `mcapi_test.c` to include the settings.h before crypto.h -* Update and handle builds with NO_WOLFSSL_SERVER and NO_WOLFSSL_CLIENT -* Fix for some macro defines with FIPS 140-3 build so that RSA_PKCS1_PSS_PADDING can be used with RSA sign/verify functions +### Compatibility Layer +* Provide access to "Finished" messages outside of compatibility layer builds +* Remove unneeded FIPS guard on wolfSSL_EVP_PKEY_derive +* Fix control command issues with AES-GCM, control command EVP_CTRL_GCM_IV_GEN +* Add support for importing private only EC key to a WOLFSSL_EVP_PKEY struct +* Add support for more extensions to wolfSSL_X509_print_ex +* Update for internal to DER (i2d) AIPs to move the buffer pointer when passed in and the operation is successful +* Return subject and issuer X509_NAME object even when not set +### Ports +* Renesas RA6M4 example update and fixes +* Support multi-threaded use cases with Renesas SCE protected mode and TSIP +* Add a global variable for heap-hint for use with TSIP +* Changes to support v5.3.0 cube pack for STM32 +* Use the correct mutex type for embOS +* ESP-IDF build cleanup and enhancements, adding in note regarding ESP-IDF Version +* Support for SEGGER embOS and emNET +* Fix to handle WOLFSSL_DTLS macro in Micrium build +### Build Options +* Support for verify only and no-PSS builds updated +* Add the enable options wolfssh (mapped to the existing –enable-ssh) +* Remove WOLFSSL_ALT_NAMES restriction on notBefore/notAfter use in Cert struct +* Move several more definitions outside the BUILDING_WOLFSSL gate with linux kernel module build +* Modify --enable-openssh to not enable non-FIPS algos for FIPS builds +* Remove the Python wrappers from wolfSSL source (use pip install instead of using wolfSSL with Python and our separate Python repository) +* Add --enable-openldap option to configure.ac for building the OpenLDAP port +* Resolve DTLS build to handle not having –enable-hrrcookie when not needed +* Add an --enable-strongswan option to configure.ac for building the Strongswan port +* Improve defaults for 64-bit BSDs in configure +* Crypto only build can now be used openssl extra +* Update ASN template build to properly handle WOLFSSL_CERT_EXT and HAVE_OID_ENCODING +* Allow using 3DES and MD5 with FIPS 140-3, as they fall outside of the FIPS boundary +* Add the build option --enable-dh=const which replaces setting the macro WOLFSSL_DH_CONST and now conditionally link to -lm as needed +* Add the macro WOLFSSL_HOSTNAME_VERIFY_ALT_NAME_ONLY which is used to verify hostname/ip address using alternate name (SAN) only and does not use the common name +* WOLFSSL_DTLS_NO_HVR_ON_RESUME macro added (off by default to favor more security). If defined, a DTLS server will not do a cookie exchange on successful client resumption: the resumption will be faster (one RTT less) and will consume less bandwidth (one ClientHello and one HelloVerifyRequest less). On the other hand, if a valid SessionID is collected, forged clientHello messages will consume resources on the server. +* Misc. +* Refactoring of some internal TLS functions to reduce the memory usage +* Make old less secure TimingPadVerify implementation available +* Add support for aligned data with clang LLVM +* Remove subject/issuer email from the list of alt. Email names in the DecodedCerts struct +* Zeroizing of pre-master secret buffer in TLS 1.3 +* Update to allow TLS 1.3 application server to send session ticket +* Improve the sniffer asynchronous test case to support multiple concurrent streams +* Clean up wolfSSL_clear() and add more logging +* Update to not error out on bad CRL next date if using NO_VERIFY when parsing +* Add an example C# PSK client +* Add ESP-IDF WOLFSSL_ESP8266 setting for ESP8266 devices +* Support longer sigalg list for post quantum use cases and inter-op with OQS's OpenSSL fork +* Improve AES-GCM word implementation of GMULT to be constant time +* Additional sanity check with Ed25519/Ed448, now defaults to assume public key is not trusted +* Support PSK ciphersuites in benchmark apps +* FIPS in core hash using SHA2-256 and SHA2-384 +* Add ability to store issuer name components when parsing a certificate +* Make the critical extension flags in DecodedCert always available +* Updates to the default values for basic constraint with X509’s +* Support using RSA OAEP with no malloc and add additional sanity checks +* Leverage async code paths to support WANT_WRITE while sending packet fragments +* New azsphere example for continuous integration testing +* Update RSA key generation function to handle pairwise consistency tests with static memory pools used +* Resolve build time warning by passing in and checking output length with internal SetCurve function +* Support DTLS bidirectional shutdown in the examples +* Improve DTLS version negotiation and downgrade capability -### Math Libraries -* Add RSA/DH check for even modulus -* Enhance TFM math to handle more alloc failure cases gracefully -* SP ASM performance improvements mostly around AArch64 -* SP ASM improvements for additional cache attack resistance -* Add RSA check for small difference between p and q -* 6-8% performance increase with ECC operations using SP int by improving the Montgomery Reduction +### General Fixes +* Fixes for STM32 Hash/PKA, add some missing mutex frees, and add an additional benchmark +* Fix missing return checks in KSDK ED25519 code +* Fix compilation warnings from IAR +* Fixes for STM32U5/H7 hash/crypto support +* Fix for using track memory feature with FreeRTOS +* Fixup XSTR processing for MICRIUM +* Update Zephyr fs.h path +* DTLS fixes with WANT_WRITE simulations +* Fixes for BER use with PKCS7 to have additional sanity checks and guards on edge cases +* Fix to handle exceptional edge case with TFM mp_exptmod_ex +* Fix for stack and heap measurements of a 32-bit build +* Fix to allow enabling AES key wrap (direct) with KCAPI +* Fix --enable-openssh FIPS detection syntax in configure.ac +* Fix to move wolfSSL_ERR_clear_error outside gate for OPENSSL_EXTRA +* Remove MCAPI project's dependency on zlib version +* Only use __builtin_offset on supported GCC versions (4+) +* Fix for c89 builds with using WOLF_C89 +* Fix 64bit postfix for constants building with powerpc +* Fixed async Sniffer with TLS v1.3, async removal of `WC_HW_WAIT_E` and sanitize leak +* Fix for QAT ECC to gate use of HW based on marker +* Fix the supported version extension to always check minDowngrade +* Fix for TLS v1.1 length sanity check for large messages +* Fixes for loading a long DER/ASN.1 certificate chain +* Fix to expose the RSA public DER export functions with certgen +* Fixes for building with small version of SHA3 +* Fix configure with WOLFSSL_WPAS_SMALL +* Fix to free PKCS7 recipient list in error cases +* Sanity check to confirm ssl->hsHashes is not NULL before attempting to dereference it +* Clear the leftover byte count in Aes struct when setting IV -### Testing and Validation -* All shell scripts in source tree now tested for correctness using shellcheck and bash -n -* Added build testing under gcc-12 and -std=c++17 and fixed warnings -* TLS 1.3 script test improvement to wait for server to write file -* Unit tests for ECC r/s zeroness handling -* CI server was expanded with a very “quiet” machine that can support multiple ContantTime tests ensuring ongoing mitigation against side-channel timing based attacks. Algorithms being assessed on this machine are: AES-CBC, AES-GCM, CHACHA20, ECC, POLY1305, RSA, SHA256, SHA512, CURVE25519. -* Added new multi configuration windows builds to CI testing for greater testing coverage of windows use-cases - -### Misc. -* Support for ECC import to check validity of key on import even if one of the coordinates (x or y) is 0 -* Modify example app to work with FreeRTOS+IoT -* Ease of access for cert used for verifying a PKCS#7 bundle -* Clean up Visual Studio output and intermediate directories -* With TLS 1.3 fail immediately if a server sends empty certificate message -* Enhance the benchmark application to support multi-threaded testing -* Improvement for `wc_EccPublicKeyToDer` to not overestimate the buffer size required -* Fix to check if `wc_EccPublicKeyToDer` has enough output buffer space -* Fix year 2038 problem in wolfSSL_ASN1_TIME_diff -* Various portability improvements (Time, DTLS epoch size, IV alloc) -* Prefer status_request_v2 over status_request when both are present -* Add separate "struct stat" definition XSTATSTRUCT to make overriding XSTAT easier for portability -* With SipHash replace gcc specific ASM instruction with generic -* Don't force a ECC CA when a custom CA is passed with `-A` -* Add peer authentication failsafe for TLS 1.2 and below -* Improve parsing of UID from subject and issuer name with the compatibility layer by -* Fallback to full TLS handshake if session ticket fails -* Internal refactoring of code to reduce ssl.c file size - -For additional vulnerability information visit the vulnerability page at https://www.wolfssl.com/docs/security-vulnerabilities/ +For additional vulnerability information visit the vulnerability page at: +https://www.wolfssl.com/docs/security-vulnerabilities/ See INSTALL file for build instructions. -More info can be found on-line at https://wolfssl.com/wolfSSL/Docs.html +More info can be found on-line at: https://wolfssl.com/wolfSSL/Docs.html +# wolfSSL Release 5.3.0 (May 3rd, 2022) *** Resources *** diff --git a/README.md b/README.md index 4e4d54b1e..a1f827e82 100644 --- a/README.md +++ b/README.md @@ -78,160 +78,155 @@ macro `NO_OLD_SHA_NAMES`. These names get mapped to the OpenSSL API for a single call hash function. Instead the name `WC_SHA`, `WC_SHA256`, `WC_SHA384` and `WC_SHA512` should be used for the enum name. +# wolfSSL Release 5.4.0 (July 11, 2022) -# wolfSSL Release 5.3.0 (May 3rd, 2022) +Note: +** Future releases of wolfSSL will turn off TLS 1.1 by default +** Release 5.4.0 made SP math the default math implementation. To make an equivalent build as –disable-fastmath from previous versions of wolfSSL, now requires using the configure option –enable-heapmath instead. + +Release 5.4.0 of wolfSSL embedded TLS has bug fixes and new features including: + +## Vulnerabilities +* [High] Potential for DTLS DoS attack. In wolfSSL versions before 5.4.0 the return-routability check is wrongly skipped in a specific edge case. The check on the return-routability is there for stopping attacks that either consume excessive resources on the server, or try to use the server as an amplifier sending an excessive amount of messages to a victim IP. If using DTLS 1.0/1.2 on the server side users should update to avoid the potential DoS attack. CVE-2022-34293 +* [Medium] Ciphertext side channel attack on ECC and DH operations. Users on systems where rogue agents can monitor memory use should update the version of wolfSSL and change private ECC keys. Thanks to Sen Deng from Southern University of Science and Technology (SUSTech) for the report. +* [Medium] Public disclosure of a side channel vulnerability that has been fixed since wolfSSL version 5.1.0. When running on AMD there is the potential to leak private key information with ECDSA operations due to a ciphertext side channel attack. Users on AMD doing ECDSA operations with wolfSSL versions less than 5.1.0 should update their wolfSSL version used. Thanks to professor Yinqian Zhang from Southern University of Science and Technology (SUSTech), his Ph.D. student Mengyuan Li from The Ohio State University, and his M.S students Sen Deng and Yining Tang from SUStech along with other collaborators; Luca Wilke, Jan Wichelmann and Professor Thomas Eisenbarth from the University of Lubeck, Professor Shuai Wang from Hong Kong University of Science and Technology, Professor Radu Teodorescu from The Ohio State University, Huibo Wang, Kang Li and Yueqiang Cheng from Baidu Security and Shoumeng Yang from Ant Financial Services Group. +CVE-2020-12966 https://www.amd.com/en/corporate/product-security/bulletin/amd-sb-1013 CVE-2021-46744 https://www.amd.com/en/corporate/product-security/bulletin/amd-sb-1033 -Release 5.3.0 of wolfSSL embedded TLS has bug fixes and new features including: ## New Feature Additions +### DTLS 1.3 +* Support for using the new DTLSv1.3 protocol was added +* Enhancements to bundled examples for an event driven server with DTLS 1.3 was added ### Ports -* Updated support for Stunnel to version 5.61 -* Add i.MX8 NXP SECO use for secure private ECC keys and expand cryptodev-linux for use with the RSA/Curve25519 with the Linux CAAM driver -* Allow encrypt then mac with Apache port -* Update Renesas TSIP version to 1.15 on GR-ROSE and certificate signature data for TSIP / SCE example -* Add IAR MSP430 example, located in IDE/IAR-MSP430 directory -* Add support for FFMPEG with the enable option `--enable-ffmpeg`, FFMPEG is used for recording and converting video and audio (https://ffmpeg.org/) -* Update the bind port to version 9.18.0 - -### Post Quantum -* Add Post-quantum KEM benchmark for STM32 -* Enable support for using post quantum algorithms with embedded STM32 boards and port to STM32U585 - -### Compatibility Layer Additions -* Add port to support libspdm (https://github.com/DMTF/libspdm/blob/main/README.md), compatibility functions added for the port were: - - ASN1_TIME_compare - - DH_new_by_nid - - OBJ_length, OBJ_get0_data, - - EVP layer ChaCha20-Poly1305, HKDF - - EC_POINT_get_affine_coordinates - - EC_POINT_set_affine_coordinates -* Additional functions added were: - - EC_KEY_print_fp - - EVP_PKEY_paramgen - - EVP_PKEY_sign/verify functionality - - PEM_write_RSAPublicKey - - PEM_write_EC_PUBKEY - - PKCS7_sign - - PKCS7_final - - SMIME_write_PKCS7 - - EC_KEY/DH_up_ref - - EVP_DecodeBlock - - EVP_EncodeBlock - - EC_KEY_get_conv_form - - BIO_eof - - Add support for BIO_CTRL_SET and BIO_CTRL_GET -* Add compile time support for the type SSL_R_NULL_SSL_METHOD_PASSED -* Enhanced X509_NAME_print_ex() to support RFC5523 basic escape -* More checks on OPENSSL_VERSION_NUMBER for API prototype differences -* Add extended key usage support to wolfSSL_X509_set_ext -* SSL_VERIFY_FAIL_IF_NO_PEER_CERT now can also connect with compatibility layer enabled and a TLS 1.3 PSK connection is used -* Improve wolfSSL_BN_rand to handle non byte boundaries and top/bottom parameters -* Changed X509_V_ERR codes to better match OpenSSL values used -* Improve wolfSSL_i2d_X509_name to allow for a NULL input in order to get the expected resulting size -* Enhance the smallstack build to reduce stack size farther when built with compatibility layer enabled - +* Update for the version of VxWorks supported, adding in support for version 6.x +* Support for new DPP and EAP-TEAP/EAP-FAST in wpa_supplicant +* Update for TSIP version support, adding support for version 1.15 for RX65N and RX72N +* Improved TSIP build to handle having the options WOLFSSL_AEAD_ONLY defined or NO_AES_CBC defined +* Added support for offloading TLS1.3 operations to Renesas RX boards with TSIP ### Misc. -* Sniffer asynchronous support addition, handling of DH shared secret and tested with Intel QuickAssist -* Added in support for OCSP with IPv6 -* Enhance SP (single precision) optimizations for use with the ECC P521 -* Add new public API wc_CheckCertSigPubKey() for use to easily check the signature of a certificate given a public key buffer -* Add CSR (Certificate Signing Request) userId support in subject name -* Injection and parsing of custom extensions in X.509 certificates -* Add WOLF_CRYPTO_CB_ONLY_RSA and WOLF_CRYPTO_CB_ONLY_ECC to reduce code size if using only crypto callback functions with RSA and ECC -* Created new --enable-engine configure flag used to build wolfSSL for use with wolfEngine -* With TLS 1.3 PSK, when WOLFSSL_PSK_MULTI_ID_PER_CS is defined multiple IDs for a cipher suite can be handled -* Added private key id/label support with improving the PK (Public Key) callbacks -* Support for Intel QuickAssist ECC KeyGen acceleration -* Add the function wolfSSL_CTX_SetCertCbCtx to set user context for certificate call back -* Add the functions wolfSSL_CTX_SetEccSignCtx(WOLFSSL_CTX* ctx, void *userCtx) and wolfSSL_CTX_GetEccSignCtx(WOLFSSL_CTX* ctx) for setting and getting a user context -* wolfRand for AMD --enable-amdrand +* Constant time improvements due to development of new constant time tests +* Initial translation of API headers to Japanese and expansion of Japanese help message support in example applications +* Add support for some FPKI (Federal PKI) certificate cases, UUID, FASC-N, PIV extension for use with smart cards +* Add support for parsing additional CSR attributes such as unstructured name and content type +* Add support for Linux getrandom() when defining the macro WOLFSSL_GETRANDOM +* Add TLS 1.2 ciphersuite ECDHE_PSK_WITH_AES_128_GCM_SHA256 from RFC 8442 +* Expand CAAM support with QNX to include i.MX8 boards and add AES-CTR support +* Enhanced glitching protection by hardening the TLS encrypt operations -## Fixes -### PORT Fixes -* KCAPI memory optimizations and page alignment fixes for ECC, AES mode fixes and reduction to memory usage -* Add the new kdf.c file to the TI-RTOS build -* Fix wait-until-done in RSA hardware primitive acceleration of ESP-IDF port -* IOTSafe workarounds when reading files with ending 0’s and for ECC signatures +## Math and Performance -### Math Library Fixes -* Sanity check with SP math that ECC points ordinates are not greater than modulus length -* Additional sanity checks that _sp_add_d does not error due to overflow -* Wycheproof fixes, testing integration, and fixes for AVX / AArch64 ASM edge case tests -* TFM fp_div_2_ct rework to avoid potential overflow +### SP Math Additions +* Support for ARMv3, ARMv6 and ARMv7a + - Changes and improvements to get SP building for armv7-a + - Updated assembly for moving large immediate values on ARMv6 + - Support for architectures with no ldrd/strd and clz +* Reworked generation using common asm ruby code for 32bit ARM +* Enable wolfSSL SP math all by default (sp_int.c) +* Update SP math all to not use sp_int_word when SQR_MUL_ASM is available +### SP Math Fixes +* Fixes for constant time with div function +* Fix casting warnings for Windows builds and assembly changes to support XMM6-15 being non-volatile +* Fix for div_word when not using div function +* Fixes for user settings with SP ASM and ED/Curve25519 small +* Additional Wycheproof tests ran and fixes +* Fix for SP math ECC non-blocking to always check `hashLen` +* Fix for SP math handling edge case with submod -### Misc. -* Fix for PKCS#7 with Crypto Callbacks -* Fix for larger curve sizes with deterministic ECC sign -* Fixes for building wolfSSL alongside openssl using --enable-opensslcoexist -* Fix for compatibility layer handling of certificates with SHA256 SKID (Subject Key ID) -* Fix for wolfSSL_ASN1_TIME_diff erroring out on a return value of 0 from mktime -* Remove extra padding when AES-CBC encrypted with PemToDer -* Fixes for TLS v1.3 early data with async. -* Fixes for async disables around the DevCopy calls -* Fixes for Windows AES-NI with clang compiler -* Fix for handling the detection of processing a plaintext TLS alert packet -* Fix for potential memory leak in an error case with TLSX supported groups -* Sanity check on `input` size in `DecodeNsCertType` -* AES-GCM stack alignment fixes with assembly code written for AVX/AVX2 -* Fix for PK callbacks with server side and setting a public key +## Improvements and Optimizations -## Improvements/Optimizations -### Build Options and Warnings -* Added example user settings template for FIPS v5 ready -* Automake file touch cleanup for use with Yocto devtool -* Allow disabling forced 'make clean' at the end of ./configure by using --disable-makeclean -* Enable TLS 1.3 early data when specifying `--enable-all` option -* Disable PK Callbacks with JNI FIPS builds -* Add a FIPS cert 3389 ready option, this is the fips-ready build -* Support (no)inline with Wind River Diab compiler -* ECDH_compute_key allow setting of globalRNG with FIPS 140-3 -* Add logic equivalent to configure.ac in settings.h for Poly1305 -* Fixes to support building opensslextra with SP math -* CPP protection for extern references to x86_64 asm code -* Updates and enhancements for Espressif ESP-IDF wolfSSL setup_win.bat -* Documentation improvements with auto generation -* Fix reproducible-build for working an updated version of libtool, version 2.4.7 -* Fixes for Diab C89 and armclang -* Fix `mcapi_test.c` to include the settings.h before crypto.h -* Update and handle builds with NO_WOLFSSL_SERVER and NO_WOLFSSL_CLIENT -* Fix for some macro defines with FIPS 140-3 build so that RSA_PKCS1_PSS_PADDING can be used with RSA sign/verify functions +### Compatibility Layer +* Provide access to "Finished" messages outside of compatibility layer builds +* Remove unneeded FIPS guard on wolfSSL_EVP_PKEY_derive +* Fix control command issues with AES-GCM, control command EVP_CTRL_GCM_IV_GEN +* Add support for importing private only EC key to a WOLFSSL_EVP_PKEY struct +* Add support for more extensions to wolfSSL_X509_print_ex +* Update for internal to DER (i2d) AIPs to move the buffer pointer when passed in and the operation is successful +* Return subject and issuer X509_NAME object even when not set +### Ports +* Renesas RA6M4 example update and fixes +* Support multi-threaded use cases with Renesas SCE protected mode and TSIP +* Add a global variable for heap-hint for use with TSIP +* Changes to support v5.3.0 cube pack for STM32 +* Use the correct mutex type for embOS +* ESP-IDF build cleanup and enhancements, adding in note regarding ESP-IDF Version +* Support for SEGGER embOS and emNET +* Fix to handle WOLFSSL_DTLS macro in Micrium build +### Build Options +* Support for verify only and no-PSS builds updated +* Add the enable options wolfssh (mapped to the existing –enable-ssh) +* Remove WOLFSSL_ALT_NAMES restriction on notBefore/notAfter use in Cert struct +* Move several more definitions outside the BUILDING_WOLFSSL gate with linux kernel module build +* Modify --enable-openssh to not enable non-FIPS algos for FIPS builds +* Remove the Python wrappers from wolfSSL source (use pip install instead of using wolfSSL with Python and our separate Python repository) +* Add --enable-openldap option to configure.ac for building the OpenLDAP port +* Resolve DTLS build to handle not having –enable-hrrcookie when not needed +* Add an --enable-strongswan option to configure.ac for building the Strongswan port +* Improve defaults for 64-bit BSDs in configure +* Crypto only build can now be used openssl extra +* Update ASN template build to properly handle WOLFSSL_CERT_EXT and HAVE_OID_ENCODING +* Allow using 3DES and MD5 with FIPS 140-3, as they fall outside of the FIPS boundary +* Add the build option --enable-dh=const which replaces setting the macro WOLFSSL_DH_CONST and now conditionally link to -lm as needed +* Add the macro WOLFSSL_HOSTNAME_VERIFY_ALT_NAME_ONLY which is used to verify hostname/ip address using alternate name (SAN) only and does not use the common name +* WOLFSSL_DTLS_NO_HVR_ON_RESUME macro added (off by default to favor more security). If defined, a DTLS server will not do a cookie exchange on successful client resumption: the resumption will be faster (one RTT less) and will consume less bandwidth (one ClientHello and one HelloVerifyRequest less). On the other hand, if a valid SessionID is collected, forged clientHello messages will consume resources on the server. +* Misc. +* Refactoring of some internal TLS functions to reduce the memory usage +* Make old less secure TimingPadVerify implementation available +* Add support for aligned data with clang LLVM +* Remove subject/issuer email from the list of alt. Email names in the DecodedCerts struct +* Zeroizing of pre-master secret buffer in TLS 1.3 +* Update to allow TLS 1.3 application server to send session ticket +* Improve the sniffer asynchronous test case to support multiple concurrent streams +* Clean up wolfSSL_clear() and add more logging +* Update to not error out on bad CRL next date if using NO_VERIFY when parsing +* Add an example C# PSK client +* Add ESP-IDF WOLFSSL_ESP8266 setting for ESP8266 devices +* Support longer sigalg list for post quantum use cases and inter-op with OQS's OpenSSL fork +* Improve AES-GCM word implementation of GMULT to be constant time +* Additional sanity check with Ed25519/Ed448, now defaults to assume public key is not trusted +* Support PSK ciphersuites in benchmark apps +* FIPS in core hash using SHA2-256 and SHA2-384 +* Add ability to store issuer name components when parsing a certificate +* Make the critical extension flags in DecodedCert always available +* Updates to the default values for basic constraint with X509’s +* Support using RSA OAEP with no malloc and add additional sanity checks +* Leverage async code paths to support WANT_WRITE while sending packet fragments +* New azsphere example for continuous integration testing +* Update RSA key generation function to handle pairwise consistency tests with static memory pools used +* Resolve build time warning by passing in and checking output length with internal SetCurve function +* Support DTLS bidirectional shutdown in the examples +* Improve DTLS version negotiation and downgrade capability -### Math Libraries -* Add RSA/DH check for even modulus -* Enhance TFM math to handle more alloc failure cases gracefully -* SP ASM performance improvements mostly around AArch64 -* SP ASM improvements for additional cache attack resistance -* Add RSA check for small difference between p and q -* 6-8% performance increase with ECC operations using SP int by improving the Montgomery Reduction - -### Testing and Validation -* All shell scripts in source tree now tested for correctness using shellcheck and bash -n -* Added build testing under gcc-12 and -std=c++17 and fixed warnings -* TLS 1.3 script test improvement to wait for server to write file -* Unit tests for ECC r/s zeroness handling -* CI server was expanded with a very “quiet” machine that can support multiple ContantTime tests ensuring ongoing mitigation against side-channel timing based attacks. Algorithms being assessed on this machine are: AES-CBC, AES-GCM, CHACHA20, ECC, POLY1305, RSA, SHA256, SHA512, CURVE25519. -* Added new multi configuration windows builds to CI testing for greater testing coverage of windows use-cases - -### Misc. -* Support for ECC import to check validity of key on import even if one of the coordinates (x or y) is 0 -* Modify example app to work with FreeRTOS+IoT -* Ease of access for cert used for verifying a PKCS#7 bundle -* Clean up Visual Studio output and intermediate directories -* With TLS 1.3 fail immediately if a server sends empty certificate message -* Enhance the benchmark application to support multi-threaded testing -* Improvement for `wc_EccPublicKeyToDer` to not overestimate the buffer size required -* Fix to check if `wc_EccPublicKeyToDer` has enough output buffer space -* Fix year 2038 problem in wolfSSL_ASN1_TIME_diff -* Various portability improvements (Time, DTLS epoch size, IV alloc) -* Prefer status_request_v2 over status_request when both are present -* Add separate "struct stat" definition XSTATSTRUCT to make overriding XSTAT easier for portability -* With SipHash replace gcc specific ASM instruction with generic -* Don't force a ECC CA when a custom CA is passed with `-A` -* Add peer authentication failsafe for TLS 1.2 and below -* Improve parsing of UID from subject and issuer name with the compatibility layer by -* Fallback to full TLS handshake if session ticket fails -* Internal refactoring of code to reduce ssl.c file size +### General Fixes +* Fixes for STM32 Hash/PKA, add some missing mutex frees, and add an additional benchmark +* Fix missing return checks in KSDK ED25519 code +* Fix compilation warnings from IAR +* Fixes for STM32U5/H7 hash/crypto support +* Fix for using track memory feature with FreeRTOS +* Fixup XSTR processing for MICRIUM +* Update Zephyr fs.h path +* DTLS fixes with WANT_WRITE simulations +* Fixes for BER use with PKCS7 to have additional sanity checks and guards on edge cases +* Fix to handle exceptional edge case with TFM mp_exptmod_ex +* Fix for stack and heap measurements of a 32-bit build +* Fix to allow enabling AES key wrap (direct) with KCAPI +* Fix --enable-openssh FIPS detection syntax in configure.ac +* Fix to move wolfSSL_ERR_clear_error outside gate for OPENSSL_EXTRA +* Remove MCAPI project's dependency on zlib version +* Only use __builtin_offset on supported GCC versions (4+) +* Fix for c89 builds with using WOLF_C89 +* Fix 64bit postfix for constants building with powerpc +* Fixed async Sniffer with TLS v1.3, async removal of `WC_HW_WAIT_E` and sanitize leak +* Fix for QAT ECC to gate use of HW based on marker +* Fix the supported version extension to always check minDowngrade +* Fix for TLS v1.1 length sanity check for large messages +* Fixes for loading a long DER/ASN.1 certificate chain +* Fix to expose the RSA public DER export functions with certgen +* Fixes for building with small version of SHA3 +* Fix configure with WOLFSSL_WPAS_SMALL +* Fix to free PKCS7 recipient list in error cases +* Sanity check to confirm ssl->hsHashes is not NULL before attempting to dereference it +* Clear the leftover byte count in Aes struct when setting IV For additional vulnerability information visit the vulnerability page at: https://www.wolfssl.com/docs/security-vulnerabilities/ diff --git a/cmake/functions.cmake b/cmake/functions.cmake index 3c839ce37..74d5a5504 100644 --- a/cmake/functions.cmake +++ b/cmake/functions.cmake @@ -266,7 +266,7 @@ function(generate_build_flags) if(WOLFSSL_SP_X86_64_ASM OR WOLFSSL_USER_SETTINGS) set(BUILD_SP_X86_64 "yes" PARENT_SCOPE) endif() - if(WOLFSSL_SP_MATH OR WOLFSSL_USER_SETTINGS) + if(WOLFSSL_SP_MATH OR WOLFSSL_SP_MATH_ALL OR WOLFSSL_USER_SETTINGS) set(BUILD_SP_INT "yes" PARENT_SCOPE) endif() set(BUILD_FAST_RSA ${WOLFSSL_FAST_RSA} PARENT_SCOPE) @@ -541,14 +541,13 @@ function(generate_lib_src_list LIB_SOURCES) list(APPEND LIB_SOURCES wolfcrypt/src/sp_arm64.c) endif() - if(BUILD_SP_INT) - list(APPEND LIB_SOURCES wolfcrypt/src/sp_int.c) - endif() - if(BUILD_SP_ARM_CORTEX) list(APPEND LIB_SOURCES wolfcrypt/src/sp_cortexm.c) endif() endif() + if(BUILD_SP_INT) + list(APPEND LIB_SOURCES wolfcrypt/src/sp_int.c) + endif() if(NOT BUILD_FIPS_V2) if(BUILD_AES) diff --git a/configure.ac b/configure.ac index cf23f96a2..944b04967 100644 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,7 @@ # AC_COPYRIGHT([Copyright (C) 2006-2020 wolfSSL Inc.]) AC_PREREQ([2.69]) -AC_INIT([wolfssl],[5.3.0],[https://github.com/wolfssl/wolfssl/issues],[wolfssl],[https://www.wolfssl.com]) +AC_INIT([wolfssl],[5.4.0],[https://github.com/wolfssl/wolfssl/issues],[wolfssl],[https://www.wolfssl.com]) AC_CONFIG_AUX_DIR([build-aux]) # The following sets CFLAGS to empty if unset on command line. We do not @@ -38,7 +38,7 @@ LT_INIT([disable-static win32-dll]) AC_ARG_VAR(EXTRA_CFLAGS, [Extra CFLAGS to add to autoconf-computed arg list. Can also supply directly to make.]) #shared library versioning -WOLFSSL_LIBRARY_VERSION=33:0:0 +WOLFSSL_LIBRARY_VERSION=34:0:0 # | | | # +------+ | +---+ # | | | @@ -603,7 +603,7 @@ then fi # if sp-math-all is not set, then enable fast math -if test "x$ENABLED_FASTMATH" = "xyes" && test "$enable_sp_math_all" = "" +if test "x$ENABLED_FASTMATH" = "xyes" && test "$enable_sp_math_all" = "" && test "$enable_sp_math" = "" then # turn off fastmth if leanpsk on or asn off (w/o DH and ECC) if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_ASN" = "no" @@ -640,7 +640,7 @@ AC_ARG_ENABLE([heapmath], [ ENABLED_HEAPMATH=$enableval ], [ ENABLED_HEAPMATH=no] ) -if test "x$ENABLED_HEAPMATH" = "xyes" || (test "x$ENABLED_SP_MATH_ALL" = "xno" && test "x$ENABLED_FASTMATH" = "xno") +if test "x$ENABLED_HEAPMATH" = "xyes" || (test "x$ENABLED_SP_MATH_ALL" = "xno" && test "x$ENABLED_FASTMATH" = "xno" && test "x$ENABLED_SP_MATH" = "xno") then AM_CFLAGS="$AM_CFLAGS -DUSE_INTEGER_HEAP_MATH" ENABLED_HEAPMATH="yes" @@ -1242,6 +1242,11 @@ AC_ARG_ENABLE([wpas-dpp], [ ENABLED_WPAS_DPP=no ] ) +if test "$ENABLED_WPAS_DPP" = "yes" +then + ENABLED_WPAS="yes" +fi + # ntp support AC_ARG_ENABLE([ntp], [AS_HELP_STRING([--enable-ntp],[Enable ntp support (default: disabled)])], @@ -1249,11 +1254,6 @@ AC_ARG_ENABLE([ntp], [ ENABLED_NTP=no ] ) -if test "$ENABLED_WPAS_DPP" = "yes" -then - ENABLED_WPAS="yes" -fi - # Fortress build AC_ARG_ENABLE([fortress], [AS_HELP_STRING([--enable-fortress],[Enable SSL fortress build (default: disabled)])], @@ -1548,6 +1548,8 @@ then AM_CFLAGS="$AM_CFLAGS -DKEEP_PEER_CERT" AM_CFLAGS="$AM_CFLAGS -DHAVE_KEYING_MATERIAL" AM_CFLAGS="$AM_CFLAGS -DNO_SESSION_CACHE_REF" + AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_VALIDATE_ECC_IMPORT" + AM_CFLAGS="$AM_CFLAGS -DWC_CTC_NAME_SIZE=128" if test "$ENABLED_OPENSSLEXTRA" = "no" then @@ -2140,21 +2142,19 @@ then if test "$ENABLED_AESNI" = "yes" || test "$ENABLED_INTELASM" = "yes" then AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AESNI" - if test "$GCC" = "yes" + if test "$CC" != "icc" then - # clang needs these flags - if test "$CC" = "clang" - then - AM_CFLAGS="$AM_CFLAGS -maes -mpclmul" - else - # GCC needs these flags, icc doesn't - # opt levels greater than 2 may cause problems on systems w/o - # aesni - if test "$CC" != "icc" - then - AM_CFLAGS="$AM_CFLAGS -maes -msse4 -mpclmul" - fi - fi + case $host_os in + mingw*) + # Windows uses intrinsics for GCM which uses SSE4 instructions. + # MSVC has own build files. + AM_CFLAGS="$AM_CFLAGS -maes -msse4 -mpclmul" + ;; + *) + # Intrinsics used in AES_set_decrypt_key (TODO: rework) + AM_CFLAGS="$AM_CFLAGS -maes" + ;; + esac fi AS_IF([test "x$ENABLED_AESGCM" != "xno"],[AM_CCASFLAGS="$AM_CCASFLAGS -DHAVE_AESGCM"]) fi @@ -2687,6 +2687,10 @@ AC_ARG_ENABLE([certreq], [ ENABLED_CERTREQ=no ] ) +if test "$ENABLED_WPAS_DPP" = "yes" +then + ENABLED_CERTREQ="yes" +fi # CERT REQUEST EXTENSION AC_ARG_ENABLE([certext], @@ -2825,6 +2829,11 @@ AC_ARG_ENABLE([ecccustcurves], [ ENABLED_ECCCUSTCURVES=no ] ) +if test "$ENABLED_WPAS_DPP" = "yes" +then + ENABLED_ECCCUSTCURVES="all" +fi + if test "$ENABLED_ECCCUSTCURVES" != "no" then AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CUSTOM_CURVES" @@ -2868,10 +2877,6 @@ if test "$ENABLED_WPAS" = "yes" then ENABLED_COMPKEY=yes fi -if test "$ENABLED_COMPKEY" = "yes" -then - AM_CFLAGS="$AM_CFLAGS -DHAVE_COMP_KEY" -fi # for using memory optimization setting on both curve25519 and ed25519 @@ -3036,7 +3041,7 @@ fi # ECC encrypt AC_ARG_ENABLE([eccencrypt], - [AS_HELP_STRING([--enable-eccencrypt],[Enable ECC encrypt (default: disabled). yes = SEC1 standard, iso18033 = ISO 18033 standard, old = original wolfSSL algorithm])], + [AS_HELP_STRING([--enable-eccencrypt],[Enable ECC encrypt (default: disabled). yes = SEC1 standard, geniv = Generate IV, iso18033 = ISO 18033 standard, old = original wolfSSL algorithm])], [ ENABLED_ECC_ENCRYPT=$enableval ], [ ENABLED_ECC_ENCRYPT=no ] ) @@ -3060,6 +3065,10 @@ then then AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ECIES_ISO18033" fi + if test "$ENABLED_ECC_ENCRYPT" = "geniv" + then + AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ECIES_GEN_IV" + fi fi # Elliptic Curve-Based Certificateless Signatures for Identity-Based Encryption (ECCSI) @@ -3671,7 +3680,7 @@ then then AC_MSG_ERROR([cannot enable eccencrypt and hkdf without aes.]) fi - if test "$ENABLED_AESGCM" = "yes" + if test "$ENABLED_AESGCM" != "no" then AC_MSG_ERROR([AESGCM requires AES.]) fi @@ -3936,6 +3945,9 @@ AS_CASE([$FIPS_VERSION], AS_IF([test "$ENABLED_KEYGEN" != "yes" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_keygen" != "no")], [ENABLED_KEYGEN="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"]) + AS_IF([test "$ENABLED_COMPKEY" = "yes" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_compkey" != "yes")], + [ENABLED_COMPKEY="no"]) + AS_IF([test "$ENABLED_SHA224" != "yes" && (test "$FIPS_VERSION" != "v5-dev" || test "$enable_sha224" != "no")], [ENABLED_SHA224="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA224"]) @@ -4823,6 +4835,11 @@ AC_ARG_ENABLE([pkcs7], [ ENABLED_PKCS7=no ] ) +if test "x$ENABLED_WPAS_DPP" = "xyes" +then + ENABLED_PKCS7=yes +fi + # wolfSSH Options AC_ARG_ENABLE([wolfssh], [AS_HELP_STRING([--enable-wolfssh],[Enable wolfSSH options (default: disabled)])], @@ -6460,7 +6477,7 @@ if test "$ENABLED_SP_MATH" = "yes"; then if test "$ENABLED_SP" = "no"; then AC_MSG_ERROR([Must have SP enabled with SP math: --enable-sp]) fi - if test "$ENABLED_ECCCUSTCURVES" = "yes"; then + if test "$ENABLED_ECCCUSTCURVES" != "no"; then AC_MSG_ERROR([Cannot use single precision math and custom curves]) fi if test "$ENABLED_DSA" = "yes"; then @@ -7685,8 +7702,13 @@ if test "x$ENABLED_SECURE_RENEGOTIATION_INFO" = "xyes"; then fi +if test "$ENABLED_COMPKEY" = "yes" +then + AM_CFLAGS="$AM_CFLAGS -DHAVE_COMP_KEY" +fi -# Depricated Algorithm Handling + +# Deprecated Algorithm Handling if test "$ENABLED_ARC4" = "yes" then AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALLOW_RC4" @@ -7790,8 +7812,8 @@ if test "x$ENABLED_LINUXKM" = "xyes"; then AC_SUBST([ASFLAGS_FPUSIMD_DISABLE]) AC_SUBST([ASFLAGS_FPUSIMD_ENABLE]) - if test "$ENABLED_OPENSSLEXTRA" != "no"; then - AC_MSG_ERROR([--enable-opensslextra is incompatible with --enable-linuxkm.]) + if test "$ENABLED_OPENSSLEXTRA" != "no" && test "$ENABLED_CRYPTONLY" = "no"; then + AC_MSG_ERROR([--enable-opensslextra without --enable-cryptonly is incompatible with --enable-linuxkm.]) fi if test "$ENABLED_FILESYSTEM" = "yes"; then AC_MSG_ERROR([--enable-filesystem is incompatible with --enable-linuxkm.]) diff --git a/ctaocrypt/src/misc.c b/ctaocrypt/src/misc.c index 5d185c485..d8f2dcbdc 100644 --- a/ctaocrypt/src/misc.c +++ b/ctaocrypt/src/misc.c @@ -1,6 +1,6 @@ /* misc.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/ctaocrypt/src/wolfcrypt_first.c b/ctaocrypt/src/wolfcrypt_first.c index 93d0a2597..f1e2aabdd 100644 --- a/ctaocrypt/src/wolfcrypt_first.c +++ b/ctaocrypt/src/wolfcrypt_first.c @@ -1,6 +1,6 @@ /* wolfcrypt_first.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/ctaocrypt/src/wolfcrypt_last.c b/ctaocrypt/src/wolfcrypt_last.c index b6d69d01a..f69cc71e7 100644 --- a/ctaocrypt/src/wolfcrypt_last.c +++ b/ctaocrypt/src/wolfcrypt_last.c @@ -1,6 +1,6 @@ /* wolfcrypt_last.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/callbacks.h b/cyassl/callbacks.h index 7a1c1d43d..569c92a7f 100644 --- a/cyassl/callbacks.h +++ b/cyassl/callbacks.h @@ -1,6 +1,6 @@ /* callbacks.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/crl.h b/cyassl/crl.h index a883879b9..acd3b7086 100644 --- a/cyassl/crl.h +++ b/cyassl/crl.h @@ -1,6 +1,6 @@ /* crl.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/aes.h b/cyassl/ctaocrypt/aes.h index 3973c8f30..f6828965b 100644 --- a/cyassl/ctaocrypt/aes.h +++ b/cyassl/ctaocrypt/aes.h @@ -1,6 +1,6 @@ /* aes.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/arc4.h b/cyassl/ctaocrypt/arc4.h index ff7440c30..ae4d2fc1a 100644 --- a/cyassl/ctaocrypt/arc4.h +++ b/cyassl/ctaocrypt/arc4.h @@ -1,6 +1,6 @@ /* arc4.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/asn.h b/cyassl/ctaocrypt/asn.h index 5ee090fa8..e805e70a4 100644 --- a/cyassl/ctaocrypt/asn.h +++ b/cyassl/ctaocrypt/asn.h @@ -1,6 +1,6 @@ /* asn.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/asn_public.h b/cyassl/ctaocrypt/asn_public.h index 824c560e8..7d5dad63c 100644 --- a/cyassl/ctaocrypt/asn_public.h +++ b/cyassl/ctaocrypt/asn_public.h @@ -1,6 +1,6 @@ /* asn_public.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/blake2-impl.h b/cyassl/ctaocrypt/blake2-impl.h index aa34a81cb..9d000b3c9 100644 --- a/cyassl/ctaocrypt/blake2-impl.h +++ b/cyassl/ctaocrypt/blake2-impl.h @@ -12,7 +12,7 @@ */ /* blake2-impl.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/blake2-int.h b/cyassl/ctaocrypt/blake2-int.h index 062de2ff6..6f589b50e 100644 --- a/cyassl/ctaocrypt/blake2-int.h +++ b/cyassl/ctaocrypt/blake2-int.h @@ -12,7 +12,7 @@ */ /* blake2-int.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/blake2.h b/cyassl/ctaocrypt/blake2.h index 377a51577..c1092b162 100644 --- a/cyassl/ctaocrypt/blake2.h +++ b/cyassl/ctaocrypt/blake2.h @@ -1,6 +1,6 @@ /* blake2.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/camellia.h b/cyassl/ctaocrypt/camellia.h index 8db4a45e2..52bf4efaf 100644 --- a/cyassl/ctaocrypt/camellia.h +++ b/cyassl/ctaocrypt/camellia.h @@ -1,6 +1,6 @@ /* camellia.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/chacha.h b/cyassl/ctaocrypt/chacha.h index 0ad52ba35..613a874c8 100644 --- a/cyassl/ctaocrypt/chacha.h +++ b/cyassl/ctaocrypt/chacha.h @@ -1,6 +1,6 @@ /* chacha.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/coding.h b/cyassl/ctaocrypt/coding.h index 7b433c768..b8f2c2df8 100644 --- a/cyassl/ctaocrypt/coding.h +++ b/cyassl/ctaocrypt/coding.h @@ -1,6 +1,6 @@ /* coding.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/compress.h b/cyassl/ctaocrypt/compress.h index f1f8cb39b..0d424881f 100644 --- a/cyassl/ctaocrypt/compress.h +++ b/cyassl/ctaocrypt/compress.h @@ -1,6 +1,6 @@ /* compress.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/des3.h b/cyassl/ctaocrypt/des3.h index 94fd5ea35..24eb1357b 100644 --- a/cyassl/ctaocrypt/des3.h +++ b/cyassl/ctaocrypt/des3.h @@ -1,6 +1,6 @@ /* des3.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/dh.h b/cyassl/ctaocrypt/dh.h index 5cf584930..28e5ed2aa 100644 --- a/cyassl/ctaocrypt/dh.h +++ b/cyassl/ctaocrypt/dh.h @@ -1,6 +1,6 @@ /* dh.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/dsa.h b/cyassl/ctaocrypt/dsa.h index 60c815987..4b0abc85f 100644 --- a/cyassl/ctaocrypt/dsa.h +++ b/cyassl/ctaocrypt/dsa.h @@ -1,6 +1,6 @@ /* dsa.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/ecc.h b/cyassl/ctaocrypt/ecc.h index 6e1e1dcb2..96f5b75d5 100644 --- a/cyassl/ctaocrypt/ecc.h +++ b/cyassl/ctaocrypt/ecc.h @@ -1,6 +1,6 @@ /* ecc.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/error-crypt.h b/cyassl/ctaocrypt/error-crypt.h index 061de0292..c2d576779 100644 --- a/cyassl/ctaocrypt/error-crypt.h +++ b/cyassl/ctaocrypt/error-crypt.h @@ -1,6 +1,6 @@ /* error-crypt.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/fips_test.h b/cyassl/ctaocrypt/fips_test.h index 561da88cb..f8bc311ec 100644 --- a/cyassl/ctaocrypt/fips_test.h +++ b/cyassl/ctaocrypt/fips_test.h @@ -1,6 +1,6 @@ /* fips_test.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/hmac.h b/cyassl/ctaocrypt/hmac.h index 04fb6fb11..3531203e8 100644 --- a/cyassl/ctaocrypt/hmac.h +++ b/cyassl/ctaocrypt/hmac.h @@ -1,6 +1,6 @@ /* hmac.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/integer.h b/cyassl/ctaocrypt/integer.h index 2ee59a394..7caf5f6f8 100644 --- a/cyassl/ctaocrypt/integer.h +++ b/cyassl/ctaocrypt/integer.h @@ -1,6 +1,6 @@ /* integer.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/logging.h b/cyassl/ctaocrypt/logging.h index 37dc5763a..452f7c622 100644 --- a/cyassl/ctaocrypt/logging.h +++ b/cyassl/ctaocrypt/logging.h @@ -1,6 +1,6 @@ /* logging.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/md2.h b/cyassl/ctaocrypt/md2.h index b01cc6efe..ed5713f4f 100644 --- a/cyassl/ctaocrypt/md2.h +++ b/cyassl/ctaocrypt/md2.h @@ -1,6 +1,6 @@ /* md2.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/md4.h b/cyassl/ctaocrypt/md4.h index 463a68da1..d31b86d9d 100644 --- a/cyassl/ctaocrypt/md4.h +++ b/cyassl/ctaocrypt/md4.h @@ -1,6 +1,6 @@ /* md4.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/md5.h b/cyassl/ctaocrypt/md5.h index 77d99ae40..218b53b8c 100644 --- a/cyassl/ctaocrypt/md5.h +++ b/cyassl/ctaocrypt/md5.h @@ -1,6 +1,6 @@ /* md5.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/memory.h b/cyassl/ctaocrypt/memory.h index 0084be7d6..16b06c003 100644 --- a/cyassl/ctaocrypt/memory.h +++ b/cyassl/ctaocrypt/memory.h @@ -1,6 +1,6 @@ /* memory.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/misc.h b/cyassl/ctaocrypt/misc.h index f311fc916..5db2a4a54 100644 --- a/cyassl/ctaocrypt/misc.h +++ b/cyassl/ctaocrypt/misc.h @@ -1,6 +1,6 @@ /* misc.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/mpi_class.h b/cyassl/ctaocrypt/mpi_class.h index 134b71407..57720af81 100644 --- a/cyassl/ctaocrypt/mpi_class.h +++ b/cyassl/ctaocrypt/mpi_class.h @@ -1,6 +1,6 @@ /* mpi_class.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/mpi_superclass.h b/cyassl/ctaocrypt/mpi_superclass.h index 3a5d80e58..541fc01d2 100644 --- a/cyassl/ctaocrypt/mpi_superclass.h +++ b/cyassl/ctaocrypt/mpi_superclass.h @@ -1,6 +1,6 @@ /* mpi_superclass.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/pkcs7.h b/cyassl/ctaocrypt/pkcs7.h index 3760567af..67d200379 100644 --- a/cyassl/ctaocrypt/pkcs7.h +++ b/cyassl/ctaocrypt/pkcs7.h @@ -1,6 +1,6 @@ /* pkcs7.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/poly1305.h b/cyassl/ctaocrypt/poly1305.h index e44be6cde..f58e1c85d 100644 --- a/cyassl/ctaocrypt/poly1305.h +++ b/cyassl/ctaocrypt/poly1305.h @@ -1,6 +1,6 @@ /* poly1305.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/port/pic32/pic32mz-crypt.h b/cyassl/ctaocrypt/port/pic32/pic32mz-crypt.h index b6f603280..d8659c88e 100644 --- a/cyassl/ctaocrypt/port/pic32/pic32mz-crypt.h +++ b/cyassl/ctaocrypt/port/pic32/pic32mz-crypt.h @@ -1,6 +1,6 @@ /* pic32mz-crypt.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/pwdbased.h b/cyassl/ctaocrypt/pwdbased.h index 75df424e0..00a91ddaa 100644 --- a/cyassl/ctaocrypt/pwdbased.h +++ b/cyassl/ctaocrypt/pwdbased.h @@ -1,6 +1,6 @@ /* pwdbased.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/random.h b/cyassl/ctaocrypt/random.h index 44ca532c5..998083816 100644 --- a/cyassl/ctaocrypt/random.h +++ b/cyassl/ctaocrypt/random.h @@ -1,6 +1,6 @@ /* random.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/ripemd.h b/cyassl/ctaocrypt/ripemd.h index b9c2feea7..050de115a 100644 --- a/cyassl/ctaocrypt/ripemd.h +++ b/cyassl/ctaocrypt/ripemd.h @@ -1,6 +1,6 @@ /* ripemd.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/rsa.h b/cyassl/ctaocrypt/rsa.h index 6a8b643e8..5cada803f 100644 --- a/cyassl/ctaocrypt/rsa.h +++ b/cyassl/ctaocrypt/rsa.h @@ -1,6 +1,6 @@ /* rsa.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/settings.h b/cyassl/ctaocrypt/settings.h index 26487433f..ee81e3548 100644 --- a/cyassl/ctaocrypt/settings.h +++ b/cyassl/ctaocrypt/settings.h @@ -1,6 +1,6 @@ /* settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/settings_comp.h b/cyassl/ctaocrypt/settings_comp.h index 4270a57e4..857506f4e 100644 --- a/cyassl/ctaocrypt/settings_comp.h +++ b/cyassl/ctaocrypt/settings_comp.h @@ -1,6 +1,6 @@ /* settings_comp.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/sha.h b/cyassl/ctaocrypt/sha.h index 78b9342c6..5a2323c4b 100644 --- a/cyassl/ctaocrypt/sha.h +++ b/cyassl/ctaocrypt/sha.h @@ -1,6 +1,6 @@ /* sha.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/sha256.h b/cyassl/ctaocrypt/sha256.h index a2fb7c0e6..cf4873c69 100644 --- a/cyassl/ctaocrypt/sha256.h +++ b/cyassl/ctaocrypt/sha256.h @@ -1,6 +1,6 @@ /* sha256.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/sha512.h b/cyassl/ctaocrypt/sha512.h index cc679a592..2c2fc341c 100644 --- a/cyassl/ctaocrypt/sha512.h +++ b/cyassl/ctaocrypt/sha512.h @@ -1,6 +1,6 @@ /* sha512.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/tfm.h b/cyassl/ctaocrypt/tfm.h index 303793403..574e67085 100644 --- a/cyassl/ctaocrypt/tfm.h +++ b/cyassl/ctaocrypt/tfm.h @@ -1,6 +1,6 @@ /* tfm.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/types.h b/cyassl/ctaocrypt/types.h index e86506286..553b4516f 100644 --- a/cyassl/ctaocrypt/types.h +++ b/cyassl/ctaocrypt/types.h @@ -1,6 +1,6 @@ /* types.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/visibility.h b/cyassl/ctaocrypt/visibility.h index 51e2ca94f..eff6da620 100644 --- a/cyassl/ctaocrypt/visibility.h +++ b/cyassl/ctaocrypt/visibility.h @@ -1,6 +1,6 @@ /* visibility.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ctaocrypt/wc_port.h b/cyassl/ctaocrypt/wc_port.h index b330803f0..a928b9eda 100644 --- a/cyassl/ctaocrypt/wc_port.h +++ b/cyassl/ctaocrypt/wc_port.h @@ -1,6 +1,6 @@ /* port.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/error-ssl.h b/cyassl/error-ssl.h index 13fd5d600..70c2905b9 100644 --- a/cyassl/error-ssl.h +++ b/cyassl/error-ssl.h @@ -1,6 +1,6 @@ /* error-ssl.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/internal.h b/cyassl/internal.h index f7239e3f1..8e262526b 100644 --- a/cyassl/internal.h +++ b/cyassl/internal.h @@ -1,6 +1,6 @@ /* internal.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ocsp.h b/cyassl/ocsp.h index bb11e5624..2d48e9cb9 100644 --- a/cyassl/ocsp.h +++ b/cyassl/ocsp.h @@ -1,6 +1,6 @@ /* ocsp.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/openssl/des.h b/cyassl/openssl/des.h index 79a06b741..f403843cc 100644 --- a/cyassl/openssl/des.h +++ b/cyassl/openssl/des.h @@ -1,6 +1,6 @@ /* des.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/openssl/evp.h b/cyassl/openssl/evp.h index af81c100b..ce3a9056f 100644 --- a/cyassl/openssl/evp.h +++ b/cyassl/openssl/evp.h @@ -1,6 +1,6 @@ /* evp.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/openssl/hmac.h b/cyassl/openssl/hmac.h index c93ef8d92..1095a9f1d 100644 --- a/cyassl/openssl/hmac.h +++ b/cyassl/openssl/hmac.h @@ -1,6 +1,6 @@ /* hmac.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/openssl/ssl.h b/cyassl/openssl/ssl.h index 3f2f3e351..1b3354461 100644 --- a/cyassl/openssl/ssl.h +++ b/cyassl/openssl/ssl.h @@ -1,6 +1,6 @@ /* ssl.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/options.h.in b/cyassl/options.h.in index fc90ce70b..e4099c37f 100644 --- a/cyassl/options.h.in +++ b/cyassl/options.h.in @@ -1,6 +1,6 @@ /* options.h.in * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/sniffer.h b/cyassl/sniffer.h index f92eeec08..ee429763f 100644 --- a/cyassl/sniffer.h +++ b/cyassl/sniffer.h @@ -1,6 +1,6 @@ /* sniffer.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/sniffer_error.h b/cyassl/sniffer_error.h index d609f662d..1c1855ccd 100644 --- a/cyassl/sniffer_error.h +++ b/cyassl/sniffer_error.h @@ -1,6 +1,6 @@ /* sniffer_error.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/ssl.h b/cyassl/ssl.h index f907cbdec..d18aef512 100644 --- a/cyassl/ssl.h +++ b/cyassl/ssl.h @@ -1,6 +1,6 @@ /* ssl.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -700,7 +700,9 @@ * wrapper around macros until they are changed in cyassl code * needs investigation in regards to macros in fips */ -#define NO_WOLFSSL_ALLOC_ALIGN NO_CYASSL_ALLOC_ALIGN /* @TODO */ +#ifdef NO_CYASSL_ALLOC_ALIGN +#define NO_WOLFSSL_ALLOC_ALIGN NO_CYASSL_ALLOC_ALIGN +#endif /* examples/client/client.h */ diff --git a/cyassl/version.h b/cyassl/version.h index cc5da906f..33183fe58 100644 --- a/cyassl/version.h +++ b/cyassl/version.h @@ -1,6 +1,6 @@ /* cyassl/version.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/cyassl/version.h.in b/cyassl/version.h.in index 5fccf9ecb..f59cae182 100644 --- a/cyassl/version.h.in +++ b/cyassl/version.h.in @@ -1,6 +1,6 @@ /* cyassl_version.h.in * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/doc/dox_comments/header_files/asn_public.h b/doc/dox_comments/header_files/asn_public.h index 77decc8bc..e1f5d8d3d 100644 --- a/doc/dox_comments/header_files/asn_public.h +++ b/doc/dox_comments/header_files/asn_public.h @@ -1416,8 +1416,8 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx, \brief This function converts the ECC public key to DER format. It returns the size of buffer used. The public ECC key in DER format is stored - in output buffer. with_AlgCurve is a flag for when to include a header that - has the Algorithm and Curve information. + in output buffer. The with_AlgCurve flag will include a header that + has the Algorithm and Curve information \return >0 Success, size of buffer used \return BAD_FUNC_ARG Returned if output or key is null. @@ -1436,7 +1436,7 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx, wc_ecc_init(&key); WC_WC_RNG rng; wc_InitRng(&rng); - wc_ecc_make_key(&rng, 24, &key); + wc_ecc_make_key(&rng, 32, &key); int derSz = // Some appropriate size for der; byte der[derSz]; @@ -1452,6 +1452,51 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx, int wc_EccPublicKeyToDer(ecc_key* key, byte* output, word32 inLen, int with_AlgCurve); +/*! + \ingroup ASN + + \brief This function converts the ECC public key to DER format. It + returns the size of buffer used. The public ECC key in DER format is stored + in output buffer. The with_AlgCurve flag will include a header that + has the Algorithm and Curve information. The comp parameter determines if + the public key will be exported as compressed. + + \return >0 Success, size of buffer used + \return BAD_FUNC_ARG Returned if output or key is null. + \return LENGTH_ONLY_E Error in getting ECC public key size. + \return BUFFER_E Returned when output buffer is too small. + + \param key Pointer to ECC key + \param output Pointer to output buffer to write to. + \param inLen Size of buffer. + \param with_AlgCurve a flag for when to include a header that has the + Algorithm and Curve information. + \param comp If 1 (non-zero) the ECC public key will be written in + compressed form. If 0 it will be written in an uncompressed format. + + _Example_ + \code + ecc_key key; + wc_ecc_init(&key); + WC_WC_RNG rng; + wc_InitRng(&rng); + wc_ecc_make_key(&rng, 32, &key); + int derSz = // Some appropriate size for der; + byte der[derSz]; + + // Write out a compressed ECC key + if(wc_EccPublicKeyToDer_ex(&key, der, derSz, 1, 1) < 0) + { + // Error converting ECC public key to der + } + \endcode + + \sa wc_EccKeyToDer + \sa wc_EccPublicKeyDecode +*/ +int wc_EccPublicKeyToDer_ex(ecc_key* key, byte* output, + word32 inLen, int with_AlgCurve, int comp); + /*! \ingroup ASN diff --git a/doc/dox_comments/header_files/ecc.h b/doc/dox_comments/header_files/ecc.h index 953652971..f504f4118 100644 --- a/doc/dox_comments/header_files/ecc.h +++ b/doc/dox_comments/header_files/ecc.h @@ -1664,6 +1664,7 @@ int wc_ecc_ctx_set_algo(ecEncCtx* ctx, byte encAlgo, byte kdfAlgo, \sa wc_ecc_ctx_new \sa wc_ecc_ctx_set_peer_salt + \sa wc_ecc_ctx_set_kdf_salt */ const byte* wc_ecc_ctx_get_own_salt(ecEncCtx*); @@ -1702,10 +1703,46 @@ const byte* wc_ecc_ctx_get_own_salt(ecEncCtx*); \endcode \sa wc_ecc_ctx_get_own_salt + \sa wc_ecc_ctx_set_kdf_salt */ int wc_ecc_ctx_set_peer_salt(ecEncCtx* ctx, const byte* salt); +/*! + \ingroup ECC + + \brief This function sets the salt pointer and length to use with KDF + into the ecEncCtx object. + + \return 0 Returned upon successfully setting the salt for the + ecEncCtx object. + \return BAD_FUNC_ARG Returned if the given ecEncCtx object is NULL + or if the given salt is NULL and length is not NULL. + + \param ctx pointer to the ecEncCtx for which to set the salt + \param salt pointer to salt buffer + \param len length salt in bytes + + _Example_ + \code + ecEncCtx* srvCtx; + WC_WC_RNG rng; + byte cliSalt[] = { fixed salt data }; + word32 cliSaltLen = (word32)sizeof(cliSalt); + int ret; + + wc_InitRng(&rng); + cliCtx = wc_ecc_ctx_new(REQ_RESP_SERVER, &rng); + + ret = wc_ecc_ctx_set_kdf_salt(&cliCtx, cliSalt, cliSaltLen); + \endcode + + \sa wc_ecc_ctx_get_own_salt + \sa wc_ecc_ctx_get_peer_salt +*/ + +int wc_ecc_ctx_set_kdf_salt(ecEncCtx* ctx, const byte* salt, word32 len); + /*! \ingroup ECC diff --git a/doc/dox_comments/header_files/ssl.h b/doc/dox_comments/header_files/ssl.h index 729626be3..f4b867ea0 100644 --- a/doc/dox_comments/header_files/ssl.h +++ b/doc/dox_comments/header_files/ssl.h @@ -475,7 +475,163 @@ WOLFSSL_METHOD *wolfDTLSv1_client_method(void); \sa wolfSSL_CTX_new */ WOLFSSL_METHOD *wolfDTLSv1_server_method(void); +/*! + \ingroup Setup + \brief The wolfDTLSv1_3_server_method() function is used to indicate that + the application is a server and will only support the DTLS 1.3 + protocol. This function allocates memory for and initializes a new + wolfSSL_METHOD structure to be used when creating the SSL/TLS context with + wolfSSL_CTX_new(). This function is only available when wolfSSL has been + compiled with DTLSv1.3 support (--enable-dtls13, or by defining + wolfSSL_DTLS13). + + \return * If successful, the call will return a pointer to the newly + created WOLFSSL_METHOD structure. + \return FAIL If memory allocation fails when calling XMALLOC, the failure + value of the underlying malloc() implementation will be returned + (typically NULL with errno will be set to ENOMEM). + + \param none No parameters. + + _Example_ + \code + WOLFSSL_METHOD* method; + WOLFSSL_CTX* ctx; + + method = wolfDTLSv1_3_server_method(); + if (method == NULL) { + // unable to get method + } + + ctx = wolfSSL_CTX_new(method); + ... + \endcode + + + \sa wolfDTLSv1_3_client_method +*/ + +WOLFSSL_METHOD *wolfDTLSv1_3_server_method(void); +/*! + \ingroup Setup + + \brief The wolfDTLSv1_3_client_method() function is used to indicate that + the application is a client and will only support the DTLS 1.3 + protocol. This function allocates memory for and initializes a new + wolfSSL_METHOD structure to be used when creating the SSL/TLS context with + wolfSSL_CTX_new(). This function is only available when wolfSSL has been + compiled with DTLSv1.3 support (--enable-dtls13, or by defining + wolfSSL_DTLS13). + + \return * If successful, the call will return a pointer to the newly + created WOLFSSL_METHOD structure. + \return FAIL If memory allocation fails when calling XMALLOC, the failure + value of the underlying malloc() implementation will be returned + (typically NULL with errno will be set to ENOMEM). + + \param none No parameters. + + _Example_ + \code + WOLFSSL_METHOD* method; + WOLFSSL_CTX* ctx; + + method = wolfDTLSv1_3_client_method(); + if (method == NULL) { + // unable to get method + } + + ctx = wolfSSL_CTX_new(method); + ... + \endcode + + + \sa wolfDTLSv1_3_server_method +*/ +WOLFSSL_METHOD* wolfDTLSv1_3_client_method(void); +/*! + \ingroup Setup + + \brief The wolfDTLS_server_method() function is used to indicate that the + application is a server and will support the highest version of DTLS + available and all the version up to the minimum version allowed. The + default minimum version allowed is based on the define + WOLFSSL_MIN_DTLS_DOWNGRADE and can be changed at runtime using + wolfSSL_SetMinVersion(). This function allocates memory for and initializes + a new wolfSSL_METHOD structure to be used when creating the SSL/TLS context + with wolfSSL_CTX_new(). This function is only available when wolfSSL has + been compiled with DTLS support (--enable-dtls, or by defining + wolfSSL_DTLS). + + \return * If successful, the call will return a pointer to the newly + created WOLFSSL_METHOD structure. + \return FAIL If memory allocation fails when calling XMALLOC, the failure + value of the underlying malloc() implementation will be returned + (typically NULL with errno will be set to ENOMEM). + + \param none No parameters. + + _Example_ + \code + WOLFSSL_METHOD* method; + WOLFSSL_CTX* ctx; + + method = wolfDTLS_server_method(); + if (method == NULL) { + // unable to get method + } + + ctx = wolfSSL_CTX_new(method); + ... + \endcode + + + \sa wolfDTLS_client_method + \sa wolfSSL_SetMinVersion +*/ +WOLFSSL_METHOD *wolfDTLS_server_method(void); +/*! + \ingroup Setup + + \brief The wolfDTLS_client_method() function is used to indicate that the + application is a client and will support the highest version of DTLS + available and all the version up to the minimum version allowed. The + default minimum version allowed is based on the define + WOLFSSL_MIN_DTLS_DOWNGRADE and can be changed at runtime using + wolfSSL_SetMinVersion(). This function allocates memory for and initializes + a new wolfSSL_METHOD structure to be used when creating the SSL/TLS context + with wolfSSL_CTX_new(). This function is only available when wolfSSL has + been compiled with DTLS support (--enable-dtls, or by defining + wolfSSL_DTLS). + + \return * If successful, the call will return a pointer to the newly + created WOLFSSL_METHOD structure. + \return FAIL If memory allocation fails when calling XMALLOC, the failure + value of the underlying malloc() implementation will be returned + (typically NULL with errno will be set to ENOMEM). + + \param none No parameters. + + _Example_ + \code + WOLFSSL_METHOD* method; + WOLFSSL_CTX* ctx; + + method = wolfDTLS_client_method(); + if (method == NULL) { + // unable to get method + } + + ctx = wolfSSL_CTX_new(method); + ... + \endcode + + + \sa wolfDTLS_server_method + \sa wolfSSL_SetMinVersion +*/ +WOLFSSL_METHOD *wolfDTLS_client_method(void); /*! \brief This function creates and initializes a WOLFSSL_METHOD for the server side. diff --git a/examples/benchmark/tls_bench.c b/examples/benchmark/tls_bench.c index b9b7d8265..bcdb662e4 100644 --- a/examples/benchmark/tls_bench.c +++ b/examples/benchmark/tls_bench.c @@ -1,6 +1,6 @@ /* tls_bench.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -393,7 +393,7 @@ int DoneHandShake = 0; static double gettime_secs(int reset) { struct timeval tv; - gettimeofday(&tv, 0); + LIBCALL_CHECK_RET(gettimeofday(&tv, 0)); (void)reset; return (double)tv.tv_sec + (double)tv.tv_usec / 1000000; @@ -404,12 +404,12 @@ static double gettime_secs(int reset) /* server send callback */ static int ServerMemSend(info_t* info, char* buf, int sz) { - pthread_mutex_lock(&info->to_client.mutex); + PTHREAD_CHECK_RET(pthread_mutex_lock(&info->to_client.mutex)); #ifndef BENCH_USE_NONBLOCK /* check for overflow */ if (info->to_client.write_idx + sz > MEM_BUFFER_SZ) { - pthread_mutex_unlock(&info->to_client.mutex); + PTHREAD_CHECK_RET(pthread_mutex_unlock(&info->to_client.mutex)); fprintf(stderr, "ServerMemSend overflow\n"); return -1; } @@ -423,8 +423,8 @@ static int ServerMemSend(info_t* info, char* buf, int sz) info->to_client.write_idx += sz; info->to_client.write_bytes += sz; - pthread_cond_signal(&info->to_client.cond); - pthread_mutex_unlock(&info->to_client.mutex); + PTHREAD_CHECK_RET(pthread_cond_signal(&info->to_client.cond)); + PTHREAD_CHECK_RET(pthread_mutex_unlock(&info->to_client.mutex)); #ifdef BENCH_USE_NONBLOCK if (sz == 0) { @@ -437,12 +437,13 @@ static int ServerMemSend(info_t* info, char* buf, int sz) /* server recv callback */ static int ServerMemRecv(info_t* info, char* buf, int sz) { - pthread_mutex_lock(&info->to_server.mutex); + PTHREAD_CHECK_RET(pthread_mutex_lock(&info->to_server.mutex)); #ifndef BENCH_USE_NONBLOCK while (info->to_server.write_idx - info->to_server.read_idx < sz && !info->to_client.done) { - pthread_cond_wait(&info->to_server.cond, &info->to_server.mutex); + PTHREAD_CHECK_RET(pthread_cond_wait(&info->to_server.cond, + &info->to_server.mutex)); } #else if (info->to_server.write_idx - info->to_server.read_idx < sz) { @@ -460,7 +461,7 @@ static int ServerMemRecv(info_t* info, char* buf, int sz) info->to_server.write_bytes = info->to_server.write_idx = 0; } - pthread_mutex_unlock(&info->to_server.mutex); + PTHREAD_CHECK_RET(pthread_mutex_unlock(&info->to_server.mutex)); if (info->to_client.done != 0) { return -1; @@ -477,14 +478,14 @@ static int ServerMemRecv(info_t* info, char* buf, int sz) /* client send callback */ static int ClientMemSend(info_t* info, char* buf, int sz) { - pthread_mutex_lock(&info->to_server.mutex); + PTHREAD_CHECK_RET(pthread_mutex_lock(&info->to_server.mutex)); #ifndef BENCH_USE_NONBLOCK /* check for overflow */ if (info->to_server.write_idx + sz > MEM_BUFFER_SZ) { fprintf(stderr, "ClientMemSend overflow %d %d %d\n", info->to_server.write_idx, sz, MEM_BUFFER_SZ); - pthread_mutex_unlock(&info->to_server.mutex); + PTHREAD_CHECK_RET(pthread_mutex_unlock(&info->to_server.mutex)); return -1; } #else @@ -497,8 +498,8 @@ static int ClientMemSend(info_t* info, char* buf, int sz) info->to_server.write_idx += sz; info->to_server.write_bytes += sz; - pthread_cond_signal(&info->to_server.cond); - pthread_mutex_unlock(&info->to_server.mutex); + PTHREAD_CHECK_RET(pthread_cond_signal(&info->to_server.cond)); + PTHREAD_CHECK_RET(pthread_mutex_unlock(&info->to_server.mutex)); #ifdef BENCH_USE_NONBLOCK if (sz == 0) { @@ -511,12 +512,13 @@ static int ClientMemSend(info_t* info, char* buf, int sz) /* client recv callback */ static int ClientMemRecv(info_t* info, char* buf, int sz) { - pthread_mutex_lock(&info->to_client.mutex); + PTHREAD_CHECK_RET(pthread_mutex_lock(&info->to_client.mutex)); #ifndef BENCH_USE_NONBLOCK while (info->to_client.write_idx - info->to_client.read_idx < sz && !info->to_server.done) { - pthread_cond_wait(&info->to_client.cond, &info->to_client.mutex); + PTHREAD_CHECK_RET(pthread_cond_wait(&info->to_client.cond, + &info->to_client.mutex)); } #else if (info->to_client.write_idx - info->to_client.read_idx < sz) { @@ -534,7 +536,7 @@ static int ClientMemRecv(info_t* info, char* buf, int sz) info->to_client.write_bytes = info->to_client.write_idx = 0; } - pthread_mutex_unlock(&info->to_client.mutex); + PTHREAD_CHECK_RET(pthread_mutex_unlock(&info->to_client.mutex)); if (info->to_server.done != 0) { return -1; @@ -1056,13 +1058,14 @@ static int bench_tls_client(info_t* info) #if defined(HAVE_PTHREAD) && defined(WOLFSSL_DTLS) /* synchronize with server */ if (info->doDTLS && !info->clientOrserverOnly) { - pthread_mutex_lock(&info->dtls_mutex); + PTHREAD_CHECK_RET(pthread_mutex_lock(&info->dtls_mutex)); if (info->serverReady != 1) { - pthread_cond_wait(&info->dtls_cond, &info->dtls_mutex); + PTHREAD_CHECK_RET(pthread_cond_wait(&info->dtls_cond, + &info->dtls_mutex)); } /* for next loop */ info->serverReady = 0; - pthread_mutex_unlock(&info->dtls_mutex); + PTHREAD_CHECK_RET(pthread_mutex_unlock(&info->dtls_mutex)); } #endif /* perform connect */ @@ -1204,7 +1207,7 @@ static void* client_thread(void* args) ret = bench_tls_client(info); - pthread_cond_signal(&info->to_server.cond); + PTHREAD_CHECK_RET(pthread_cond_signal(&info->to_server.cond)); info->to_client.done = 1; info->client.ret = ret; @@ -1294,10 +1297,10 @@ static int SocketWaitClient(info_t* info) if (info->doDTLS) { #ifdef HAVE_PTHREAD if (!info->clientOrserverOnly) { - pthread_mutex_lock(&info->dtls_mutex); + PTHREAD_CHECK_RET(pthread_mutex_lock(&info->dtls_mutex)); info->serverReady = 1; - pthread_cond_signal(&info->dtls_cond); - pthread_mutex_unlock(&info->dtls_mutex); + PTHREAD_CHECK_RET(pthread_cond_signal(&info->dtls_cond)); + PTHREAD_CHECK_RET(pthread_mutex_unlock(&info->dtls_mutex)); } #endif connd = (int)recvfrom(info->listenFd, (char *)msg, sizeof(msg), @@ -1664,7 +1667,7 @@ static void* server_thread(void* args) } } - pthread_cond_signal(&info->to_client.cond); + PTHREAD_CHECK_RET(pthread_cond_signal(&info->to_client.cond)); info->to_server.done = 1; info->server.ret = ret; @@ -2126,23 +2129,31 @@ int bench_tls(void* args) else { #ifdef HAVE_PTHREAD info->useLocalMem = argLocalMem; - pthread_mutex_init(&info->to_server.mutex, NULL); - pthread_mutex_init(&info->to_client.mutex, NULL); + PTHREAD_CHECK_RET(pthread_mutex_init(&info->to_server.mutex, + NULL)); + PTHREAD_CHECK_RET(pthread_mutex_init(&info->to_client.mutex, + NULL)); #ifdef WOLFSSL_DTLS - pthread_mutex_init(&info->dtls_mutex, NULL); - pthread_cond_init(&info->dtls_cond, NULL); + PTHREAD_CHECK_RET(pthread_mutex_init(&info->dtls_mutex, + NULL)); + PTHREAD_CHECK_RET(pthread_cond_init(&info->dtls_cond, + NULL)); #endif - pthread_cond_init(&info->to_server.cond, NULL); - pthread_cond_init(&info->to_client.cond, NULL); + PTHREAD_CHECK_RET(pthread_cond_init(&info->to_server.cond, + NULL)); + PTHREAD_CHECK_RET(pthread_cond_init(&info->to_client.cond, + NULL)); - pthread_create(&info->to_server.tid, NULL, server_thread, - info); - pthread_create(&info->to_client.tid, NULL, client_thread, - info); + PTHREAD_CHECK_RET( + pthread_create(&info->to_server.tid, NULL, + server_thread, info)); + PTHREAD_CHECK_RET( + pthread_create(&info->to_client.tid, NULL, + client_thread, info)); /* State that we won't be joining this thread */ - pthread_detach(info->to_server.tid); - pthread_detach(info->to_client.tid); + PTHREAD_CHECK_RET(pthread_detach(info->to_server.tid)); + PTHREAD_CHECK_RET(pthread_detach(info->to_client.tid)); #endif } } diff --git a/examples/benchmark/tls_bench.h b/examples/benchmark/tls_bench.h index 62e0ba1b5..5ebbbfd04 100644 --- a/examples/benchmark/tls_bench.h +++ b/examples/benchmark/tls_bench.h @@ -1,6 +1,6 @@ /* tls_bench.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/examples/client/client.c b/examples/client/client.c index c39e6ba1d..8581a9c89 100644 --- a/examples/client/client.c +++ b/examples/client/client.c @@ -1,6 +1,6 @@ /* client.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -2802,7 +2802,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) err_sys("Bad DTLS version"); #endif /* WOLFSSL_DTLS13 */ } - else + else if (version == 2) version = -1; } } @@ -2859,7 +2859,16 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) #endif case CLIENT_DOWNGRADE_VERSION: - method = wolfSSLv23_client_method_ex; + if (!doDTLS) { + method = wolfSSLv23_client_method_ex; + } + else { +#ifdef WOLFSSL_DTLS + method = wolfDTLS_client_method_ex; +#else + err_sys("version not supported"); +#endif /* WOLFSSL_DTLS */ + } break; #if defined(OPENSSL_EXTRA) || defined(WOLFSSL_EITHER_SIDE) case EITHER_DOWNGRADE_VERSION: @@ -2934,7 +2943,27 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) } #endif if (minVersion != CLIENT_INVALID_VERSION) { - wolfSSL_CTX_SetMinVersion(ctx, minVersion); +#ifdef WOLFSSL_DTLS + if (doDTLS) { + switch (minVersion) { + case 4: +#ifdef WOLFSSL_DTLS13 + minVersion = WOLFSSL_DTLSV1_3; + break; +#else + err_sys("invalid minimum downgrade version"); +#endif /* WOLFSSL_DTLS13 */ + case 3: + minVersion = WOLFSSL_DTLSV1_2; + break; + case 2: + minVersion = WOLFSSL_DTLSV1; + break; + } + } +#endif /* WOLFSSL_DTLS */ + if (wolfSSL_CTX_SetMinVersion(ctx, minVersion) != WOLFSSL_SUCCESS) + err_sys("can't set minimum downgrade version"); } if (simulateWantWrite) { #ifdef USE_WOLFSSL_IO diff --git a/examples/client/client.h b/examples/client/client.h index bfdfe4144..9922c7a3f 100644 --- a/examples/client/client.h +++ b/examples/client/client.h @@ -1,6 +1,6 @@ /* client.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/examples/configs/user_settings_all.h b/examples/configs/user_settings_all.h index 9413f175a..695f952e4 100644 --- a/examples/configs/user_settings_all.h +++ b/examples/configs/user_settings_all.h @@ -1,6 +1,6 @@ /* user_settings_all.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/examples/configs/user_settings_fipsv2.h b/examples/configs/user_settings_fipsv2.h index 9526890a1..df1ee4fe4 100644 --- a/examples/configs/user_settings_fipsv2.h +++ b/examples/configs/user_settings_fipsv2.h @@ -1,6 +1,6 @@ /* user_settings_fipsv2.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/examples/configs/user_settings_min_ecc.h b/examples/configs/user_settings_min_ecc.h index d8ee7992a..4f2d662dd 100644 --- a/examples/configs/user_settings_min_ecc.h +++ b/examples/configs/user_settings_min_ecc.h @@ -1,6 +1,6 @@ /* user_settings_min_ecc.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/examples/configs/user_settings_stm32.h b/examples/configs/user_settings_stm32.h index 6c9194a71..bc5fb7e87 100644 --- a/examples/configs/user_settings_stm32.h +++ b/examples/configs/user_settings_stm32.h @@ -1,6 +1,6 @@ /* wolfSSL_conf.h (example of generated wolfSSL.I-CUBE-wolfSSL_conf.h) * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/examples/configs/user_settings_template.h b/examples/configs/user_settings_template.h index 01b746a26..d6950bce6 100644 --- a/examples/configs/user_settings_template.h +++ b/examples/configs/user_settings_template.h @@ -1,6 +1,6 @@ /* user_settings_template.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/examples/configs/user_settings_wolfboot_keytools.h b/examples/configs/user_settings_wolfboot_keytools.h index 3352c592a..2d26a7e21 100644 --- a/examples/configs/user_settings_wolfboot_keytools.h +++ b/examples/configs/user_settings_wolfboot_keytools.h @@ -4,7 +4,7 @@ * Enabled via WOLFSSL_USER_SETTINGS. * * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/examples/echoclient/echoclient.c b/examples/echoclient/echoclient.c index 48b11ed91..32bae5768 100644 --- a/examples/echoclient/echoclient.c +++ b/examples/echoclient/echoclient.c @@ -1,6 +1,6 @@ /* echoclient.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -285,12 +285,14 @@ void echoclient_test(void* args) } if (strncmp(msg, "quit", 4) == 0) { - fputs("sending server shutdown command: quit!\n", fout); + LIBCALL_CHECK_RET(fputs("sending server shutdown command: quit!\n", + fout)); break; } if (strncmp(msg, "break", 5) == 0) { - fputs("sending server session close: break!\n", fout); + LIBCALL_CHECK_RET(fputs("sending server session close: break!\n", + fout)); break; } @@ -313,8 +315,8 @@ void echoclient_test(void* args) } while (err == WC_PENDING_E); if (ret > 0) { reply[ret] = 0; - fputs(reply, fout); - fflush(fout) ; + LIBCALL_CHECK_RET(fputs(reply, fout)); + LIBCALL_CHECK_RET(fflush(fout)); sendSz -= ret; } #ifdef CYASSL_DTLS @@ -362,7 +364,7 @@ void echoclient_test(void* args) wolfAsync_DevClose(&devId); #endif - fflush(fout); + LIBCALL_CHECK_RET(fflush(fout)); #ifndef WOLFSSL_MDK_SHELL if (inCreated) fclose(fin); if (outCreated) fclose(fout); diff --git a/examples/echoclient/echoclient.h b/examples/echoclient/echoclient.h index b2b530956..9cf5f5901 100644 --- a/examples/echoclient/echoclient.h +++ b/examples/echoclient/echoclient.h @@ -1,6 +1,6 @@ /* echoclient.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/examples/echoserver/echoserver.c b/examples/echoserver/echoserver.c index 2df45d994..05f15de41 100644 --- a/examples/echoserver/echoserver.c +++ b/examples/echoserver/echoserver.c @@ -1,6 +1,6 @@ /* echoserver.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -71,11 +71,11 @@ static void SignalReady(void* args, word16 port) /* signal ready to tcp_accept */ func_args* server_args = (func_args*)args; tcp_ready* ready = server_args->signal; - pthread_mutex_lock(&ready->mutex); + PTHREAD_CHECK_RET(pthread_mutex_lock(&ready->mutex)); ready->ready = 1; ready->port = port; - pthread_cond_signal(&ready->cond); - pthread_mutex_unlock(&ready->mutex); + PTHREAD_CHECK_RET(pthread_cond_signal(&ready->cond)); + PTHREAD_CHECK_RET(pthread_mutex_unlock(&ready->mutex)); #endif (void)args; (void)port; @@ -456,7 +456,7 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args) command[echoSz] = 0; #ifdef ECHO_OUT - fputs(command, fout); + LIBCALL_CHECK_RET(fputs(command, fout)); #endif do { diff --git a/examples/echoserver/echoserver.h b/examples/echoserver/echoserver.h index 40bbfe684..85cf5b28b 100644 --- a/examples/echoserver/echoserver.h +++ b/examples/echoserver/echoserver.h @@ -1,6 +1,6 @@ /* echoserver.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/examples/sctp/sctp-client-dtls.c b/examples/sctp/sctp-client-dtls.c index 9647ca842..f624d8729 100644 --- a/examples/sctp/sctp-client-dtls.c +++ b/examples/sctp/sctp-client-dtls.c @@ -1,6 +1,6 @@ /* sctp-client-dtls.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/examples/sctp/sctp-client.c b/examples/sctp/sctp-client.c index fe365e3a0..98776a2a8 100644 --- a/examples/sctp/sctp-client.c +++ b/examples/sctp/sctp-client.c @@ -1,6 +1,6 @@ /* sctp-client.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/examples/sctp/sctp-server-dtls.c b/examples/sctp/sctp-server-dtls.c index 24b0ad9e9..964df625f 100644 --- a/examples/sctp/sctp-server-dtls.c +++ b/examples/sctp/sctp-server-dtls.c @@ -1,6 +1,6 @@ /* sctp-server-dtls.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/examples/sctp/sctp-server.c b/examples/sctp/sctp-server.c index a829c40aa..24c52a2ae 100644 --- a/examples/sctp/sctp-server.c +++ b/examples/sctp/sctp-server.c @@ -1,6 +1,6 @@ /* sctp-server.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/examples/server/server.c b/examples/server/server.c index 864228a99..7b6589eb6 100644 --- a/examples/server/server.c +++ b/examples/server/server.c @@ -1,6 +1,6 @@ /* server.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -2265,11 +2265,11 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args) method = wolfSSLv23_server_method_ex; } else { -#ifdef WOLFSSL_DTLS13 +#ifdef WOLFSSL_DTLS method = wolfDTLS_server_method_ex; #else err_sys_ex(runWithErrors, "version not supported"); -#endif /* WOLFSSL_DTLS13 */ +#endif /* WOLFSSL_DTLS */ } break; #if defined(OPENSSL_EXTRA) || defined(WOLFSSL_EITHER_SIDE) @@ -2341,12 +2341,14 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args) err_sys_ex(catastrophic, "unable to get ctx"); if (minVersion != SERVER_INVALID_VERSION) { -#ifdef WOLFSSL_DTLS13 +#ifdef WOLFSSL_DTLS if (doDTLS) { switch (minVersion) { +#ifdef WOLFSSL_DTLS13 case 4: minVersion = WOLFSSL_DTLSV1_3; break; +#endif /* WOLFSSL_DTLS13 */ case 3: minVersion = WOLFSSL_DTLSV1_2; break; @@ -2356,7 +2358,8 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args) } } #endif /* WOLFSSL_DTLS13 */ - wolfSSL_CTX_SetMinVersion(ctx, minVersion); + if (wolfSSL_CTX_SetMinVersion(ctx, minVersion) != WOLFSSL_SUCCESS) + err_sys_ex(catastrophic, "can't set minimum downgrade version"); } #ifdef OPENSSL_COMPATIBLE_DEFAULTS diff --git a/examples/server/server.h b/examples/server/server.h index 45b5d5c1f..1afd75aa3 100644 --- a/examples/server/server.h +++ b/examples/server/server.h @@ -1,6 +1,6 @@ /* server.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/linuxkm/Kbuild b/linuxkm/Kbuild index 02c3eab5d..f42a07fce 100644 --- a/linuxkm/Kbuild +++ b/linuxkm/Kbuild @@ -1,6 +1,6 @@ # Linux kernel-native Makefile ("Kbuild") for libwolfssl.ko # -# Copyright (C) 2006-2021 wolfSSL Inc. +# Copyright (C) 2006-2022 wolfSSL Inc. # # This file is part of wolfSSL. # @@ -17,7 +17,6 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -# SHELL=/bin/bash @@ -48,7 +47,9 @@ $(obj)/linuxkm/module_exports.o: $(WOLFSSL_OBJ_TARGETS) # this mechanism only works in kernel 5.x+ (fallback to hardcoded value) hostprogs := linuxkm/get_thread_size always-y := $(hostprogs) -HOST_EXTRACFLAGS += $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(KBUILD_CFLAGS) -static -fno-omit-frame-pointer +# "-mindirect-branch=keep -mfunction-return=keep" to avoid "undefined reference +# to `__x86_return_thunk'" on CONFIG_RETHUNK kernels (5.19.0-rc7) +HOST_EXTRACFLAGS += $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(KBUILD_CFLAGS) -static -fno-omit-frame-pointer -mindirect-branch=keep -mfunction-return=keep # this rule is needed to get build to succeed in 4.x (get_thread_size still doesn't get built) $(obj)/linuxkm/get_thread_size: $(src)/linuxkm/get_thread_size.c diff --git a/linuxkm/Makefile b/linuxkm/Makefile index c59830a7d..d0a146a9e 100644 --- a/linuxkm/Makefile +++ b/linuxkm/Makefile @@ -1,6 +1,6 @@ # libwolfssl Linux kernel module Makefile (wraps Kbuild-native makefile) # -# Copyright (C) 2006-2021 wolfSSL Inc. +# Copyright (C) 2006-2022 wolfSSL Inc. # # This file is part of wolfSSL. # @@ -17,7 +17,6 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -#/ SHELL=/bin/bash diff --git a/linuxkm/get_thread_size.c b/linuxkm/get_thread_size.c index d475c8857..868c8ff19 100644 --- a/linuxkm/get_thread_size.c +++ b/linuxkm/get_thread_size.c @@ -1,7 +1,7 @@ /* get_thread_size.c -- trivial program to determine stack frame size * for a Linux kernel thread, given a configured source tree. * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/linuxkm/linuxkm_memory.c b/linuxkm/linuxkm_memory.c index 34e2b3082..8819bca74 100644 --- a/linuxkm/linuxkm_memory.c +++ b/linuxkm/linuxkm_memory.c @@ -1,6 +1,6 @@ /* linuxkm_memory.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/linuxkm/module_exports.c.template b/linuxkm/module_exports.c.template index 9423a2dd5..ab1b1f340 100644 --- a/linuxkm/module_exports.c.template +++ b/linuxkm/module_exports.c.template @@ -1,7 +1,7 @@ /* module_exports.c.template -- static preamble for dynamically generated * module_exports.c (see Kbuild) * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/linuxkm/module_hooks.c b/linuxkm/module_hooks.c index 60c1ded7d..74df63546 100644 --- a/linuxkm/module_hooks.c +++ b/linuxkm/module_hooks.c @@ -1,6 +1,6 @@ /* module_hooks.c -- module load/unload hooks for libwolfssl.ko * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/linuxkm/pie_first.c b/linuxkm/pie_first.c index c061bcb80..21091d598 100644 --- a/linuxkm/pie_first.c +++ b/linuxkm/pie_first.c @@ -1,6 +1,6 @@ /* linuxkm/pie_first.c -- memory fenceposts for checking binary image stability * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/linuxkm/pie_last.c b/linuxkm/pie_last.c index 750c274f7..1032860b3 100644 --- a/linuxkm/pie_last.c +++ b/linuxkm/pie_last.c @@ -1,6 +1,6 @@ /* linuxkm/pie_last.c -- memory fenceposts for checking binary image stability * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/linuxkm/pie_redirect_table.c b/linuxkm/pie_redirect_table.c index 4ab1de2c0..652f9ed76 100644 --- a/linuxkm/pie_redirect_table.c +++ b/linuxkm/pie_redirect_table.c @@ -1,6 +1,6 @@ /* pie_redirect_table.c -- module load/unload hooks for libwolfssl.ko * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/m4/ax_linuxkm.m4 b/m4/ax_linuxkm.m4 index fd9ebc351..e494d0693 100644 --- a/m4/ax_linuxkm.m4 +++ b/m4/ax_linuxkm.m4 @@ -1,6 +1,6 @@ # ax_linuxkm.m4 -- macros for getting attributes of default configured kernel # -# Copyright (C) 2006-2021 wolfSSL Inc. +# Copyright (C) 2006-2022 wolfSSL Inc. # # This file is part of wolfSSL. # @@ -17,7 +17,6 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -#/ AC_DEFUN([AC_PATH_DEFAULT_KERNEL_SOURCE], [ diff --git a/mcapi/crypto.c b/mcapi/crypto.c index 30be71d7e..ea390bba4 100644 --- a/mcapi/crypto.c +++ b/mcapi/crypto.c @@ -1,6 +1,6 @@ /* crypto.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/mcapi/crypto.h b/mcapi/crypto.h index cb3aae402..6f79e2b19 100644 --- a/mcapi/crypto.h +++ b/mcapi/crypto.h @@ -1,6 +1,6 @@ /* crypto.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/mcapi/mcapi_test.c b/mcapi/mcapi_test.c index 6589dfe39..1bbce530c 100644 --- a/mcapi/mcapi_test.c +++ b/mcapi/mcapi_test.c @@ -1,6 +1,6 @@ /* mcapi_test.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/mplabx/benchmark_main.c b/mplabx/benchmark_main.c index 5a7da70c0..e71e9b9f2 100644 --- a/mplabx/benchmark_main.c +++ b/mplabx/benchmark_main.c @@ -1,6 +1,6 @@ /* benchmark_main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/mplabx/test_main.c b/mplabx/test_main.c index 101937678..24739518f 100644 --- a/mplabx/test_main.c +++ b/mplabx/test_main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/rpm/spec.in b/rpm/spec.in index f0f97ef27..47cb1031b 100644 --- a/rpm/spec.in +++ b/rpm/spec.in @@ -73,8 +73,8 @@ mkdir -p $RPM_BUILD_ROOT/ %{_docdir}/wolfssl/README.txt %{_libdir}/libwolfssl.la %{_libdir}/libwolfssl.so -%{_libdir}/libwolfssl.so.33 -%{_libdir}/libwolfssl.so.33.0.0 +%{_libdir}/libwolfssl.so.34 +%{_libdir}/libwolfssl.so.34.0.0 %files devel %defattr(-,root,root,-) @@ -299,6 +299,7 @@ mkdir -p $RPM_BUILD_ROOT/ %{_includedir}/wolfssl/wolfcrypt/sha512.h %{_includedir}/wolfssl/wolfcrypt/siphash.h %{_includedir}/wolfssl/wolfcrypt/signature.h +%{_includedir}/wolfssl/wolfcrypt/sp_int.h %{_includedir}/wolfssl/wolfcrypt/srp.h %{_includedir}/wolfssl/wolfcrypt/tfm.h %{_includedir}/wolfssl/wolfcrypt/types.h @@ -311,6 +312,8 @@ mkdir -p $RPM_BUILD_ROOT/ %{_libdir}/pkgconfig/wolfssl.pc %changelog +* Fri July 8 2022 Jacob Barthelmeh +- Add missing sp_int.h file * Mon May 2 2022 Jacob Barthelmeh - Add missing kdf.h file * Wed Feb 16 2022 John Safranek diff --git a/src/bio.c b/src/bio.c index b38bc8956..fa27b4845 100644 --- a/src/bio.c +++ b/src/bio.c @@ -1,6 +1,6 @@ /* bio.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/src/crl.c b/src/crl.c index b41bd6b34..0eab93fff 100644 --- a/src/crl.c +++ b/src/crl.c @@ -1,6 +1,6 @@ /* crl.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -174,13 +174,20 @@ void FreeCRL(WOLFSSL_CRL* crl, int dynamic) #ifdef HAVE_CRL_MONITOR if (crl->tid != 0) { WOLFSSL_MSG("stopping monitor thread"); - if (StopMonitor(crl->mfd) == 0) - pthread_join(crl->tid, NULL); + if (StopMonitor(crl->mfd) == 0) { + int _pthread_ret = pthread_join(crl->tid, NULL); + if (_pthread_ret != 0) + WOLFSSL_MSG("stop monitor failed in pthread_join"); + } else { WOLFSSL_MSG("stop monitor failed"); } } - pthread_cond_destroy(&crl->cond); + { + int _pthread_ret = pthread_cond_destroy(&crl->cond); + if (_pthread_ret != 0) + WOLFSSL_MSG("pthread_cond_destroy failed in FreeCRL()"); + } #endif wc_FreeMutex(&crl->crlLock); if (dynamic) /* free self */ @@ -1116,8 +1123,10 @@ static void* DoMonitor(void* arg) XFREE(buff, NULL, DYNAMIC_TYPE_TMP_BUFFER); #endif - if (wd > 0) - inotify_rm_watch(notifyFd, wd); + if (wd > 0) { + if (inotify_rm_watch(notifyFd, wd) < 0) + WOLFSSL_MSG("inotify_rm_watch #1 failed in DoMonitor"); + } (void)close(crl->mfd); (void)close(notifyFd); return NULL; @@ -1171,8 +1180,10 @@ static void* DoMonitor(void* arg) XFREE(buff, NULL, DYNAMIC_TYPE_TMP_BUFFER); #endif - if (wd > 0) - inotify_rm_watch(notifyFd, wd); + if (wd > 0) { + if (inotify_rm_watch(notifyFd, wd) < 0) + WOLFSSL_MSG("inotify_rm_watch #2 failed in DoMonitor"); + } (void)close(crl->mfd); (void)close(notifyFd); diff --git a/src/dtls13.c b/src/dtls13.c index e46ef3c8e..e31d2c699 100644 --- a/src/dtls13.c +++ b/src/dtls13.c @@ -234,12 +234,12 @@ static byte Dtls13TypeIsEncrypted(enum HandShakeType hs_type) case hello_request: case hello_verify_request: case client_hello: + case hello_retry_request: case server_hello: break; case encrypted_extensions: case session_ticket: case end_of_early_data: - case hello_retry_request: case certificate: case server_key_exchange: case certificate_request: @@ -269,14 +269,15 @@ static int Dtls13GetRnMask(WOLFSSL* ssl, const byte* ciphertext, byte* mask, else c = &ssl->dtlsRecordNumberDecrypt; -#ifdef HAVE_AESGCM - if (ssl->specs.bulk_cipher_algorithm == wolfssl_aes_gcm) { +#if defined(HAVE_AESGCM) || defined(HAVE_AESCCM) + if (ssl->specs.bulk_cipher_algorithm == wolfssl_aes_gcm || + ssl->specs.bulk_cipher_algorithm == wolfssl_aes_ccm) { if (c->aes == NULL) return BAD_STATE_E; return wc_AesEncryptDirect(c->aes, mask, ciphertext); } -#endif /* HAVE_AESGCM */ +#endif /* HAVE_AESGCM || HAVE_AESCCM */ #ifdef HAVE_CHACHA if (ssl->specs.bulk_cipher_algorithm == wolfssl_chacha) { @@ -426,7 +427,7 @@ static int Dtls13SendFragFromBuffer(WOLFSSL* ssl, byte* output, word16 length) static int Dtls13SendNow(WOLFSSL* ssl, enum HandShakeType handshakeType) { - if (!ssl->options.groupMessages) + if (!ssl->options.groupMessages || ssl->dtls13SendingFragments) return 1; if (handshakeType == client_hello || handshakeType == hello_retry_request || @@ -718,6 +719,35 @@ static void Dtls13RtxRemoveCurAck(WOLFSSL* ssl) } } +static void Dtls13MaybeSaveClientHello(WOLFSSL* ssl) +{ + Dtls13RtxRecord *r, **prev_next; + + r = ssl->dtls13Rtx.rtxRecords; + prev_next = &ssl->dtls13Rtx.rtxRecords; + + if (ssl->options.side == WOLFSSL_CLIENT_END && + ssl->options.connectState >= CLIENT_HELLO_SENT && + ssl->options.connectState <= HELLO_AGAIN_REPLY && + ssl->options.downgrade && ssl->options.minDowngrade >= DTLSv1_2_MINOR) { + while (r != NULL) { + if (r->handshakeType == client_hello) { + Dtls13RtxRecordUnlink(ssl, prev_next, r); + if (ssl->dtls13ClientHello != NULL) + XFREE(ssl->dtls13ClientHello, ssl->heap, + DYNAMIC_TYPE_DTLS_MSG); + ssl->dtls13ClientHello = r->data; + ssl->dtls13ClientHelloSz = r->length; + r->data = NULL; + Dtls13FreeRtxBufferRecord(ssl, r); + return; + } + prev_next = &r->next; + r = r->next; + } + } +} + static int Dtls13RtxMsgRecvd(WOLFSSL* ssl, enum HandShakeType hs, word32 fragOffset) { @@ -727,6 +757,9 @@ static int Dtls13RtxMsgRecvd(WOLFSSL* ssl, enum HandShakeType hs, ssl->keys.dtls_peer_handshake_number >= ssl->keys.dtls_expected_peer_handshake_number) { + if (hs == server_hello) + Dtls13MaybeSaveClientHello(ssl); + /* In the handshake, receiving part of the next flight, acknowledge the sent flight. The only exception is, on the server side, receiving the last client flight does not ACK any sent new_session_ticket @@ -1158,6 +1191,26 @@ int Dtls13ReconstructEpochNumber(WOLFSSL* ssl, byte epochBits, return SEQUENCE_ERROR; } +int Dtls13GetUnifiedHeaderSize(const byte input, word16* size) +{ + if (size == NULL) + return BAD_FUNC_ARG; + + if (input & DTLS13_CID_BIT) { + WOLFSSL_MSG("DTLS1.3 header with connection ID. Not supported"); + return WOLFSSL_NOT_IMPLEMENTED; + } + + /* flags (1) + seq 8bit (1) */ + *size = OPAQUE8_LEN + OPAQUE8_LEN; + if (input & DTLS13_SEQ_LEN_BIT) + *size += OPAQUE8_LEN; + if (input & DTLS13_LEN_BIT) + *size += OPAQUE16_LEN; + + return 0; +} + /** * Dtls13ParseUnifiedRecordLayer() - parse DTLS unified header * @ssl: [in] ssl object @@ -1204,10 +1257,6 @@ int Dtls13ParseUnifiedRecordLayer(WOLFSSL* ssl, const byte* input, ato16(input + idx, &hdrInfo->recordLength); idx += DTLS13_LEN_SIZE; - - /* DTLS message must fit inside a datagram */ - if (inputSize < idx + hdrInfo->recordLength) - return LENGTH_ERROR; } else { /* length not present. The size of the record is the all the remaining @@ -1227,8 +1276,6 @@ int Dtls13ParseUnifiedRecordLayer(WOLFSSL* ssl, const byte* input, if (ret != 0) return ret; - hdrInfo->headerLength = idx; - if (seqLen == DTLS13_SEQ_16_LEN) { hdrInfo->seqHiPresent = 1; hdrInfo->seqHi = seqNum[0]; @@ -1937,7 +1984,7 @@ int Dtls13SetRecordNumberKeys(WOLFSSL* ssl, enum encrypt_side side) { RecordNumberCiphers* enc = NULL; RecordNumberCiphers* dec = NULL; - byte *encKey, *decKey; + byte *encKey = NULL, *decKey = NULL; int ret; if (ssl == NULL) { diff --git a/src/include.am b/src/include.am index 361bf6a89..7a608f9ac 100644 --- a/src/include.am +++ b/src/include.am @@ -170,8 +170,7 @@ src_libwolfssl_la_SOURCES += \ src_libwolfssl_la_SOURCES += \ wolfcrypt/src/hmac.c \ - wolfcrypt/src/random.c \ - wolfcrypt/src/sha256.c + wolfcrypt/src/random.c src_libwolfssl_la_SOURCES += wolfcrypt/src/kdf.c @@ -201,13 +200,14 @@ endif if BUILD_ARMASM src_libwolfssl_la_SOURCES += wolfcrypt/src/port/arm/armv8-sha256.c -endif +else +src_libwolfssl_la_SOURCES += wolfcrypt/src/sha256.c if BUILD_INTELASM src_libwolfssl_la_SOURCES += wolfcrypt/src/sha256_asm.S endif +endif if BUILD_SHA512 -src_libwolfssl_la_SOURCES += wolfcrypt/src/sha512.c if BUILD_ARMASM src_libwolfssl_la_SOURCES += wolfcrypt/src/port/arm/armv8-sha512.c if BUILD_ARMASM_INLINE @@ -217,11 +217,13 @@ else src_libwolfssl_la_SOURCES += wolfcrypt/src/port/arm/armv8-sha512-asm.S src_libwolfssl_la_SOURCES += wolfcrypt/src/port/arm/armv8-32-sha512-asm.S endif -endif +else +src_libwolfssl_la_SOURCES += wolfcrypt/src/sha512.c if BUILD_INTELASM src_libwolfssl_la_SOURCES += wolfcrypt/src/sha512_asm.S endif endif +endif if BUILD_SHA3 src_libwolfssl_la_SOURCES += wolfcrypt/src/sha3.c diff --git a/src/internal.c b/src/internal.c index 6d5868847..8ff0b1f4f 100644 --- a/src/internal.c +++ b/src/internal.c @@ -1,6 +1,6 @@ /* internal.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -147,8 +147,6 @@ WOLFSSL_CALLBACKS needs LARGE_STATIC_BUFFERS, please add LARGE_STATIC_BUFFERS #ifndef WOLFSSL_NO_TLS12 #ifndef NO_WOLFSSL_CLIENT - static int DoHelloVerifyRequest(WOLFSSL* ssl, const byte* input, - word32* inOutIdx, word32 size); static int DoServerKeyExchange(WOLFSSL* ssl, const byte* input, word32* inOutIdx, word32 size); #ifndef NO_CERTS @@ -195,8 +193,8 @@ WOLFSSL_CALLBACKS needs LARGE_STATIC_BUFFERS, please add LARGE_STATIC_BUFFERS #ifdef WOLFSSL_DTLS - static WC_INLINE int DtlsCheckWindow(WOLFSSL* ssl); - static WC_INLINE int DtlsUpdateWindow(WOLFSSL* ssl); + static int _DtlsCheckWindow(WOLFSSL* ssl); + static int _DtlsUpdateWindow(WOLFSSL* ssl); #endif #ifdef WOLFSSL_DTLS13 @@ -6206,12 +6204,10 @@ int SetSSL_CTX(WOLFSSL* ssl, WOLFSSL_CTX* ctx, int writeDup) } } /* writeDup check */ -#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL) if (ctx->mask != 0 && wolfSSL_set_options(ssl, ctx->mask) == 0) { WOLFSSL_MSG("wolfSSL_set_options error"); return BAD_FUNC_ARG; } -#endif #ifdef WOLFSSL_SESSION_EXPORT #ifdef WOLFSSL_DTLS @@ -6546,7 +6542,7 @@ int InitSSL(WOLFSSL* ssl, WOLFSSL_CTX* ctx, int writeDup) #ifndef WOLFSSL_AEAD_ONLY #ifndef NO_OLD_TLS ssl->hmac = SSL_hmac; /* default to SSLv3 */ - #elif !defined(WOLFSSL_NO_TLS12) + #elif !defined(WOLFSSL_NO_TLS12) && !defined(NO_TLS) #if !defined(WOLFSSL_RENESAS_SCEPROTECT) && \ !defined(WOLFSSL_RENESAS_TSIP_TLS) ssl->hmac = TLS_hmac; @@ -7286,6 +7282,15 @@ void SSL_ResourceFree(WOLFSSL* ssl) XFREE(ssl->buffers.dtlsCookieSecret.buffer, ssl->heap, DYNAMIC_TYPE_COOKIE_PWD); #endif + +#ifdef WOLFSSL_DTLS13 + if (ssl->dtls13ClientHello != NULL) { + XFREE(ssl->dtls13ClientHello, ssl->heap, DYNAMIC_TYPE_DTLS_MSG); + ssl->dtls13ClientHello = NULL; + ssl->dtls13ClientHelloSz = 0; + } +#endif /* WOLFSSL_DTLS13 */ + #endif /* WOLFSSL_DTLS */ #ifdef OPENSSL_EXTRA #ifndef NO_BIO @@ -7505,12 +7510,21 @@ void FreeHandshakeResources(WOLFSSL* ssl) WOLFSSL_ENTER("FreeHandshakeResources"); #ifdef WOLFSSL_DTLS - /* DTLS_POOL (DTLSv1.3 flushes the queue autonomously) */ - if (ssl->options.dtls && !IsAtLeastTLSv1_3(ssl->version)) { - DtlsMsgPoolReset(ssl); - DtlsMsgListDelete(ssl->dtls_rx_msg_list, ssl->heap); - ssl->dtls_rx_msg_list = NULL; - ssl->dtls_rx_msg_list_sz = 0; + if (ssl->options.dtls) { + /* DTLS_POOL (DTLSv1.3 flushes the queue autonomously) */ + if(!IsAtLeastTLSv1_3(ssl->version)) { + DtlsMsgPoolReset(ssl); + DtlsMsgListDelete(ssl->dtls_rx_msg_list, ssl->heap); + ssl->dtls_rx_msg_list = NULL; + ssl->dtls_rx_msg_list_sz = 0; + } +#ifdef WOLFSSL_DTLS13 + if (ssl->dtls13ClientHello != NULL) { + XFREE(ssl->dtls13ClientHello, ssl->heap, DYNAMIC_TYPE_DTLS_MSG); + ssl->dtls13ClientHello = NULL; + ssl->dtls13ClientHelloSz = 0; + } +#endif /* WOLFSSL_DTLS13 */ } #endif @@ -9341,11 +9355,15 @@ void ShrinkOutputBuffer(WOLFSSL* ssl) /* Switch dynamic input buffer back to static, keep any remaining input */ /* forced free means cleaning up */ +/* Be *CAREFUL* where this function is called. ProcessReply relies on + * inputBuffer.idx *NOT* changing inside the ProcessReply function. ProcessReply + * calls ShrinkInputBuffer itself when it is safe to do so. Don't overuse it. */ void ShrinkInputBuffer(WOLFSSL* ssl, int forcedFree) { int usedLength = ssl->buffers.inputBuffer.length - ssl->buffers.inputBuffer.idx; - if (!forcedFree && usedLength > STATIC_BUFFER_LEN) + if (!forcedFree && (usedLength > STATIC_BUFFER_LEN || + ssl->buffers.clearOutputBuffer.length > 0)) return; WOLFSSL_MSG("Shrinking input buffer"); @@ -9661,6 +9679,7 @@ int CheckAvailableSize(WOLFSSL *ssl, int size) } #ifdef WOLFSSL_DTLS13 +static int GetInputData(WOLFSSL *ssl, word32 size); static int GetDtls13RecordHeader(WOLFSSL* ssl, const byte* input, word32* inOutIdx, RecordLayerHeader* rh, word16* size) { @@ -9673,6 +9692,9 @@ static int GetDtls13RecordHeader(WOLFSSL* ssl, const byte* input, readSize = ssl->buffers.inputBuffer.length - *inOutIdx; + if (readSize < DTLS_UNIFIED_HEADER_MIN_SZ) + return BUFFER_ERROR; + epochBits = *input & EE_MASK; ret = Dtls13ReconstructEpochNumber(ssl, epochBits, &epochNumber); if (ret != 0) @@ -9704,6 +9726,20 @@ static int GetDtls13RecordHeader(WOLFSSL* ssl, const byte* input, return SEQUENCE_ERROR; } + ret = Dtls13GetUnifiedHeaderSize( + *(input+*inOutIdx), &ssl->dtls13CurRlLength); + if (ret != 0) + return ret; + + if (readSize < ssl->dtls13CurRlLength) { + /* when using DTLS over a medium that does not guarantee that a full + * message is received in a single read, we may end up without the full + * header */ + ret = GetInputData(ssl, ssl->dtls13CurRlLength - readSize); + if (ret != 0) + return ret; + } + ret = Dtls13ParseUnifiedRecordLayer(ssl, input + *inOutIdx, readSize, &hdrInfo); @@ -9731,8 +9767,8 @@ static int GetDtls13RecordHeader(WOLFSSL* ssl, const byte* input, ssl->keys.curSeq); #endif /* WOLFSSL_DEBUG_TLS */ - *inOutIdx += hdrInfo.headerLength; - ssl->dtls13CurRlLength = hdrInfo.headerLength; + XMEMCPY(ssl->dtls13CurRL, input + *inOutIdx, ssl->dtls13CurRlLength); + *inOutIdx += ssl->dtls13CurRlLength; return 0; } @@ -9779,10 +9815,12 @@ static int GetDtlsRecordHeader(WOLFSSL* ssl, const byte* input, } /* not a unified header, check that we have at least - DTLS_RECORD_HEADER_SZ */ - if (read_size < DTLS_RECORD_HEADER_SZ) - return LENGTH_ERROR; - + * DTLS_RECORD_HEADER_SZ */ + if (read_size < DTLS_RECORD_HEADER_SZ) { + ret = GetInputData(ssl, DTLS_RECORD_HEADER_SZ - read_size); + if (ret != 0) + return LENGTH_ERROR; + } #endif /* WOLFSSL_DTLS13 */ /* type and version in same spot */ @@ -9862,7 +9900,7 @@ static int GetRecordHeader(WOLFSSL* ssl, const byte* input, word32* inOutIdx, /* DTLSv1.3 MUST check window after deprotecting to avoid timing channel (RFC9147 Section 4.5.1) */ if (IsDtlsNotSctpMode(ssl) && !IsAtLeastTLSv1_3(ssl->version)) { - if (!DtlsCheckWindow(ssl) || + if (!_DtlsCheckWindow(ssl) || (rh->type == application_data && ssl->keys.curEpoch == 0) || (rh->type == alert && ssl->options.handShakeDone && ssl->keys.curEpoch == 0 && ssl->keys.dtls_epoch != 0)) { @@ -10022,7 +10060,7 @@ int GetDtlsHandShakeHeader(WOLFSSL* ssl, const byte* input, (!IsAtLeastTLSv1_3(ssl->version) && ssl->curRL.pvMinor != ssl->version.minor) || (IsAtLeastTLSv1_3(ssl->version) && ssl->curRL.pvMinor != DTLSv1_2_MINOR) ) { - if (*type != client_hello && *type != hello_verify_request) { + if (*type != client_hello && *type != hello_verify_request && *type != server_hello) { WOLFSSL_ERROR(VERSION_ERROR); return VERSION_ERROR; } @@ -10169,6 +10207,9 @@ static int BuildFinished(WOLFSSL* ssl, Hashes* hashes, const byte* sender) if (ssl->options.tls) { ret = BuildTlsFinished(ssl, hashes, sender); } +#else + (void)hashes; + (void)sender; #endif #ifndef NO_OLD_TLS if (!ssl->options.tls) { @@ -12180,8 +12221,15 @@ int LoadCertByIssuer(WOLFSSL_X509_STORE* store, X509_NAME* issuer, int type) for (; suffix < MAX_SUFFIX; suffix++) { /* /folder-path/.(r)N[0..9] */ - XSNPRINTF(filename, len, "%s/%08lx.%s%d", entry->dir_name, - hash, post, suffix); + if (XSNPRINTF(filename, len, "%s/%08lx.%s%d", entry->dir_name, + hash, post, suffix) + >= len) + { + WOLFSSL_MSG("buffer overrun in LoadCertByIssuer"); + ret = BUFFER_E; + break; + } + if(wc_FileExists(filename) == 0/*0 file exists */) { if (type == X509_LU_X509) { @@ -13331,7 +13379,8 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx, (args->dCert->extKeyUsage & KEYUSE_KEY_ENCIPHER) == 0) { ret = KEYUSE_ENCIPHER_E; } - if ((ssl->specs.sig_algo == rsa_sa_algo || + if ((ssl->specs.kea != rsa_kea) && + (ssl->specs.sig_algo == rsa_sa_algo || (ssl->specs.sig_algo == ecc_dsa_sa_algo && !ssl->specs.static_ecdh)) && (args->dCert->extKeyUsage & KEYUSE_DIGITAL_SIG) == 0) { @@ -14781,6 +14830,32 @@ static int DoHandShakeMsgType(WOLFSSL* ssl, byte* input, word32* inOutIdx, } } + if (ssl->options.side == WOLFSSL_CLIENT_END) { + switch (type) { + case certificate: + case server_key_exchange: + case certificate_request: + case server_hello_done: + if (ssl->options.resuming) { +#ifdef WOLFSSL_WPAS + /* This can occur when ssl->sessionSecretCb is set. EAP-FAST + * (RFC 4851) allows for detecting server session resumption + * based on the msg received after the ServerHello. */ + WOLFSSL_MSG("Not resuming as thought"); + ssl->options.resuming = 0; + /* No longer resuming, reset peer authentication state. */ + ssl->options.peerAuthGood = 0; +#else + /* Fatal error. Only try to send an alert. RFC 5246 does not + * allow for reverting back to a full handshake after the + * server has indicated the intention to do a resumption. */ + (void)SendAlert(ssl, alert_fatal, unexpected_message); + return OUT_OF_ORDER_E; +#endif + } + } + } + #ifdef OPENSSL_EXTRA if (ssl->CBIS != NULL){ ssl->cbmode = SSL_CB_MODE_READ; @@ -14895,12 +14970,6 @@ static int DoHandShakeMsgType(WOLFSSL* ssl, byte* input, word32* inOutIdx, *inOutIdx += MacSize(ssl); #endif } - if (ssl->options.resuming) { - WOLFSSL_MSG("Not resuming as thought"); - ssl->options.resuming = 0; - /* CLIENT: No longer resuming, reset peer authentication state. */ - ssl->options.peerAuthGood = 0; - } break; case finished: @@ -14981,32 +15050,6 @@ static int DoHandShakeMsgType(WOLFSSL* ssl, byte* input, word32* inOutIdx, ret = DECODE_E; } - if (ret == 0 && ssl->buffers.inputBuffer.dynamicFlag - #if defined(WOLFSSL_ASYNC_CRYPT) || defined(WOLFSSL_NONBLOCK_OCSP) - /* do not shrink input for async or non-block */ - && ssl->error != WC_PENDING_E && ssl->error != OCSP_WANT_READ - #endif - ) { - if (IsEncryptionOn(ssl, 0)) { - word32 extra = ssl->keys.padSz; - - #if defined(HAVE_ENCRYPT_THEN_MAC) && !defined(WOLFSSL_AEAD_ONLY) - if (ssl->options.startedETMRead) - extra += MacSize(ssl); - #endif - - if (extra > ssl->buffers.inputBuffer.idx) - return BUFFER_E; - - ssl->buffers.inputBuffer.idx -= extra; - ShrinkInputBuffer(ssl, NO_FORCED_FREE); - ssl->buffers.inputBuffer.idx += extra; - } - else { - ShrinkInputBuffer(ssl, NO_FORCED_FREE); - } - } - #if defined(WOLFSSL_ASYNC_CRYPT) || defined(WOLFSSL_NONBLOCK_OCSP) /* if async, offset index so this msg will be processed again */ if ((ret == WC_PENDING_E || ret == OCSP_WANT_READ) && *inOutIdx > 0) { @@ -15153,7 +15196,7 @@ static int DoHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx, #ifdef WOLFSSL_DTLS -static WC_INLINE int DtlsCheckWindow(WOLFSSL* ssl) +static int _DtlsCheckWindow(WOLFSSL* ssl) { word32* window; word16 cur_hi, next_hi; @@ -15322,18 +15365,19 @@ static WC_INLINE word32 UpdateHighwaterMark(word32 cur, word32 first, } #endif /* WOLFSSL_MULTICAST */ -/* diff must be already incremented by one */ -static void DtlsUpdateWindowGTSeq(word32 diff, word32* window) +/* diff is the difference between the message sequence and the + * expected sequence number. 0 is special where it is an overflow. */ +static void _DtlsUpdateWindowGTSeq(word32 diff, word32* window) { - word32 idx, newDiff, temp, i; + word32 idx, temp, i; word32 oldWindow[WOLFSSL_DTLS_WINDOW_WORDS]; - if (diff >= DTLS_SEQ_BITS) + if (diff == 0 || diff >= DTLS_SEQ_BITS) XMEMSET(window, 0, DTLS_SEQ_SZ); else { temp = 0; idx = diff / DTLS_WORD_BITS; - newDiff = diff % DTLS_WORD_BITS; + diff %= DTLS_WORD_BITS; XMEMCPY(oldWindow, window, sizeof(oldWindow)); @@ -15341,52 +15385,101 @@ static void DtlsUpdateWindowGTSeq(word32 diff, word32* window) if (i < idx) window[i] = 0; else { - temp |= (oldWindow[i-idx] << newDiff); + temp |= (oldWindow[i-idx] << diff); window[i] = temp; - temp = oldWindow[i-idx] >> (DTLS_WORD_BITS - newDiff - 1); + if (diff > 0) + temp = oldWindow[i-idx] >> (DTLS_WORD_BITS - diff); + else + temp = 0; } } } window[0] |= 1; } -static WC_INLINE int _DtlsUpdateWindow(WOLFSSL* ssl, word16* next_hi, - word32* next_lo, word32 *window) +int wolfSSL_DtlsUpdateWindow(word16 cur_hi, word32 cur_lo, + word16* next_hi, word32* next_lo, word32 *window) { - word32 cur_lo, diff; + word32 diff; int curLT; - word16 cur_hi; - - cur_hi = ssl->keys.curSeq_hi; - cur_lo = ssl->keys.curSeq_lo; if (cur_hi == *next_hi) { curLT = cur_lo < *next_lo; - diff = curLT ? *next_lo - cur_lo - 1 : cur_lo - *next_lo + 1; + diff = curLT ? *next_lo - cur_lo : cur_lo - *next_lo; } else { - curLT = cur_hi < *next_hi; - diff = curLT ? cur_lo - *next_lo - 1 : *next_lo - cur_lo + 1; + if (cur_hi > *next_hi + 1) { + /* reset window */ + _DtlsUpdateWindowGTSeq(0, window); + *next_lo = cur_lo + 1; + if (*next_lo == 0) + *next_hi = cur_hi + 1; + else + *next_hi = cur_hi; + return 1; + } + else if (*next_hi > cur_hi + 1) { + return 1; + } + else { + curLT = cur_hi < *next_hi; + if (curLT) { + if (*next_lo < DTLS_SEQ_BITS && + cur_lo >= (((word32)0xFFFFFFFF) - DTLS_SEQ_BITS)) { + /* diff here can still result in a difference that can not + * be stored in the window. The index is checked against + * WOLFSSL_DTLS_WINDOW_WORDS later. */ + diff = *next_lo + ((word32)0xFFFFFFFF - cur_lo) + 1; + } + else { + /* Too far back to update */ + return 1; + } + } + else { + if (*next_lo >= (((word32)0xFFFFFFFF) - DTLS_SEQ_BITS) && + cur_lo < DTLS_SEQ_BITS) { + /* diff here can still result in a difference that can not + * be stored in the window. The index is checked against + * WOLFSSL_DTLS_WINDOW_WORDS later. */ + diff = cur_lo - *next_lo; + } + else { + _DtlsUpdateWindowGTSeq(0, window); + *next_lo = cur_lo + 1; + if (*next_lo == 0) + *next_hi = cur_hi + 1; + else + *next_hi = cur_hi; + return 1; + } + } + } } if (curLT) { - word32 idx = diff / DTLS_WORD_BITS; - word32 newDiff = diff % DTLS_WORD_BITS; + word32 idx; + + diff--; + idx = diff / DTLS_WORD_BITS; + diff %= DTLS_WORD_BITS; if (idx < WOLFSSL_DTLS_WINDOW_WORDS) - window[idx] |= (1 << newDiff); + window[idx] |= (1 << diff); } else { - DtlsUpdateWindowGTSeq(diff, window); + _DtlsUpdateWindowGTSeq(diff + 1, window); *next_lo = cur_lo + 1; - if (*next_lo < cur_lo) - (*next_hi)++; + if (*next_lo == 0) + *next_hi = cur_hi + 1; + else + *next_hi = cur_hi; } return 1; } -static WC_INLINE int DtlsUpdateWindow(WOLFSSL* ssl) +static int _DtlsUpdateWindow(WOLFSSL* ssl) { WOLFSSL_DTLS_PEERSEQ* peerSeq = ssl->keys.peerSeq; word16 *next_hi; @@ -15447,7 +15540,8 @@ static WC_INLINE int DtlsUpdateWindow(WOLFSSL* ssl) window = peerSeq->prevWindow; } - return _DtlsUpdateWindow(ssl, next_hi, next_lo, window); + return wolfSSL_DtlsUpdateWindow(ssl->keys.curSeq_hi, ssl->keys.curSeq_lo, + next_hi, next_lo, window); } #ifdef WOLFSSL_DTLS13 @@ -15495,7 +15589,7 @@ static WC_INLINE int Dtls13UpdateWindow(WOLFSSL* ssl) /* as we are considering nextSeq inside the window, we should add + 1 */ w64Increment(&diff64); - DtlsUpdateWindowGTSeq(w64GetLow32(diff64), window); + _DtlsUpdateWindowGTSeq(w64GetLow32(diff64), window); w64Increment(&seq); ssl->dtls13DecryptEpoch->nextPeerSeqNumber = seq; @@ -17217,6 +17311,8 @@ static WC_INLINE int GetRounds(int pLen, int padLen, int t) return ret; } #else + +#if !defined(WOLFSSL_NO_TLS12) && !defined(WOLFSSL_AEAD_ONLY) /* check all length bytes for the pad value, return 0 on success */ static int PadCheck(const byte* a, byte pad, int length) { @@ -17354,9 +17450,9 @@ int TimingPadVerify(WOLFSSL* ssl, const byte* input, int padLen, int macSz, return ret; } -#endif -#endif - +#endif /* !WOLFSSL_NO_TLS12 && !WOLFSSL_AEAD_ONLY */ +#endif /* WOLSSL_OLD_TIMINGPADVERIFY */ +#endif /* WOLFSSL_AEAD_ONLY */ int DoApplicationData(WOLFSSL* ssl, byte* input, word32* inOutIdx, int sniff) { @@ -18374,8 +18470,7 @@ int ProcessReplyEx(WOLFSSL* ssl, int allowSocketErr) #ifdef WOLFSSL_DTLS13 if (ssl->options.dtls) { /* aad now points to the record header */ - aad = in->buffer + - in->idx - ssl->dtls13CurRlLength; + aad = ssl->dtls13CurRL; aad_size = ssl->dtls13CurRlLength; } #endif /* WOLFSSL_DTLS13 */ @@ -18389,6 +18484,7 @@ int ProcessReplyEx(WOLFSSL* ssl, int allowSocketErr) ret = DECRYPT_ERROR; #endif /* WOLFSSL_TLS13 */ } + (void)in; } #ifdef WOLFSSL_ASYNC_CRYPT @@ -18620,7 +18716,7 @@ int ProcessReplyEx(WOLFSSL* ssl, int allowSocketErr) #ifdef WOLFSSL_DTLS if (IsDtlsNotSctpMode(ssl) && !IsAtLeastTLSv1_3(ssl->version)) { - DtlsUpdateWindow(ssl); + _DtlsUpdateWindow(ssl); } #endif /* WOLFSSL_DTLS */ @@ -18965,9 +19061,13 @@ int ProcessReplyEx(WOLFSSL* ssl, int allowSocketErr) * dropping any app data. */ || (ssl->options.dtls && ssl->curRL.type == application_data) #endif - ) + ) { + /* Shrink input buffer when we successfully finish record + * processing */ + if (ret == 0 && ssl->buffers.inputBuffer.dynamicFlag) + ShrinkInputBuffer(ssl, NO_FORCED_FREE); return ret; - + } /* more messages per record */ else if ((ssl->buffers.inputBuffer.idx - startIdx) < ssl->curSize) { WOLFSSL_MSG("More messages in record"); @@ -19013,6 +19113,10 @@ int ProcessReplyEx(WOLFSSL* ssl, int allowSocketErr) if (ret != 0) return ret; #endif + /* It is safe to shrink the input buffer here now. local vars will + * be reset to the new starting value. */ + if (ret == 0 && ssl->buffers.inputBuffer.dynamicFlag) + ShrinkInputBuffer(ssl, NO_FORCED_FREE); continue; default: WOLFSSL_MSG("Bad process input state, programming error"); @@ -19451,6 +19555,7 @@ int BuildMessage(WOLFSSL* ssl, byte* output, int outSz, const byte* input, (void)epochOrder; +#ifndef NO_TLS #ifdef WOLFSSL_NO_TLS12 return BuildTls13Message(ssl, output, outSz, input, inSz, type, hashOutput, sizeOnly, asyncOkay); @@ -19898,6 +20003,15 @@ exit_buildmsg: return ret; #endif /* !WOLFSSL_NO_TLS12 */ +#else + (void)outSz; + (void)inSz; + (void)type; + (void)hashOutput; + (void)asyncOkay; + return NOT_COMPILED_IN; +#endif /* NO_TLS */ + } #ifndef WOLFSSL_NO_TLS12 @@ -21476,8 +21590,7 @@ startScr: ssl->buffers.clearOutputBuffer.buffer += size; } - if (ssl->buffers.clearOutputBuffer.length == 0 && - ssl->buffers.inputBuffer.dynamicFlag) + if (ssl->buffers.inputBuffer.dynamicFlag) ShrinkInputBuffer(ssl, NO_FORCED_FREE); WOLFSSL_LEAVE("ReceiveData()", size); @@ -24242,12 +24355,11 @@ exit_dpk: ret = 1; } - #ifdef OPENSSL_EXTRA - if ((wolfSSL_get_options(ssl) & SSL_OP_NO_TLSv1_3)) { + if ((wolfSSL_get_options(ssl) & WOLFSSL_OP_NO_TLSv1_3)) { /* option set at run time to disable TLS 1.3 */ ret = 0; } - #endif + return ret; #endif } @@ -24585,8 +24697,8 @@ static int HashSkeData(WOLFSSL* ssl, enum wc_HashType hashType, /* handle processing of DTLS hello_verify_request (3) */ - static int DoHelloVerifyRequest(WOLFSSL* ssl, const byte* input, - word32* inOutIdx, word32 size) + int DoHelloVerifyRequest(WOLFSSL* ssl, const byte* input, word32* inOutIdx, + word32 size) { ProtocolVersion pv; byte cookieSz; @@ -24628,7 +24740,18 @@ static int HashSkeData(WOLFSSL* ssl, enum wc_HashType hashType, *inOutIdx += cookieSz; } +#if defined(WOLFSSL_DTLS13) && defined(WOLFSSL_TLS13) + if (IsAtLeastTLSv1_3(ssl->version) && ssl->options.dtls) { + /* we sent a TLSv1.3 ClientHello but received a + * HELLO_VERIFY_REQUEST */ + if (!ssl->options.downgrade || + ssl->options.minDowngrade < pv.minor) + return VERSION_ERROR; + } +#endif /* defined(WOLFSSL_DTLS13) && defined(WOLFSSL_TLS13) */ + ssl->options.serverState = SERVER_HELLOVERIFYREQUEST_COMPLETE; + return 0; } @@ -24639,8 +24762,12 @@ static int HashSkeData(WOLFSSL* ssl, enum wc_HashType hashType, #ifdef HAVE_SECRET_CALLBACK /* If a session secret callback exists, we are using that - * key instead of the saved session key. */ - ret = ret || (ssl->sessionSecretCb != NULL); + * key instead of the saved session key. Requires a ticket. */ + ret = ret || (ssl->sessionSecretCb != NULL +#ifdef HAVE_SESSION_TICKET + && ssl->session->ticketLen > 0 +#endif + ); #endif #ifdef HAVE_SESSION_TICKET @@ -24665,6 +24792,7 @@ static int HashSkeData(WOLFSSL* ssl, enum wc_HashType hashType, */ int CheckVersion(WOLFSSL *ssl, ProtocolVersion pv) { + byte lowerVersion, higherVersion; #ifdef WOLFSSL_TLS13_DRAFT if (pv.major == TLS_DRAFT_MAJOR) { pv.major = SSLv3_MAJOR; @@ -24678,11 +24806,24 @@ static int HashSkeData(WOLFSSL* ssl, enum wc_HashType hashType, } #endif - if (pv.minor > ssl->version.minor) { + if (ssl->options.dtls) { + if (pv.major != DTLS_MAJOR || pv.minor == DTLS_BOGUS_MINOR) + return VERSION_ERROR; + lowerVersion = pv.minor > ssl->version.minor; + higherVersion = pv.minor < ssl->version.minor; + } + else { + if (pv.major != SSLv3_MAJOR) + return VERSION_ERROR; + lowerVersion = pv.minor < ssl->version.minor; + higherVersion = pv.minor > ssl->version.minor; + } + + if (higherVersion) { WOLFSSL_MSG("Server using higher version, fatal error"); return VERSION_ERROR; } - if (pv.minor < ssl->version.minor) { + if (lowerVersion) { WOLFSSL_MSG("server using lower version"); /* Check for downgrade attack. */ @@ -24690,7 +24831,8 @@ static int HashSkeData(WOLFSSL* ssl, enum wc_HashType hashType, WOLFSSL_MSG("\tno downgrade allowed, fatal error"); return VERSION_ERROR; } - if (pv.minor < ssl->options.minDowngrade) { + if ((!ssl->options.dtls && pv.minor < ssl->options.minDowngrade) || + (ssl->options.dtls && pv.minor > ssl->options.minDowngrade)) { WOLFSSL_MSG("\tversion below minimum allowed, fatal error"); return VERSION_ERROR; } @@ -24705,54 +24847,69 @@ static int HashSkeData(WOLFSSL* ssl, enum wc_HashType hashType, #endif /* Checks made - OK to downgrade. */ - if (pv.minor == SSLv3_MINOR) { - /* turn off tls */ - WOLFSSL_MSG("\tdowngrading to SSLv3"); - ssl->options.tls = 0; - ssl->options.tls1_1 = 0; - ssl->version.minor = SSLv3_MINOR; - } - else if (pv.minor == TLSv1_MINOR) { - /* turn off tls 1.1+ */ - WOLFSSL_MSG("\tdowngrading to TLSv1"); - ssl->options.tls1_1 = 0; - ssl->version.minor = TLSv1_MINOR; - } - else if (pv.minor == TLSv1_1_MINOR) { - WOLFSSL_MSG("\tdowngrading to TLSv1.1"); - ssl->version.minor = TLSv1_1_MINOR; - } - else if (pv.minor == TLSv1_2_MINOR) { - WOLFSSL_MSG(" downgrading to TLSv1.2"); - ssl->version.minor = TLSv1_2_MINOR; - } + ssl->version.minor = pv.minor; + switch(pv.minor) { + case SSLv3_MINOR: + /* turn off tls */ + WOLFSSL_MSG("\tdowngrading to SSLv3"); + ssl->options.tls = 0; + ssl->options.tls1_1 = 0; + break; + case TLSv1_MINOR: + /* turn off tls 1.1+ */ + WOLFSSL_MSG("\tdowngrading to TLSv1"); + ssl->options.tls1_1 = 0; + break; + case TLSv1_1_MINOR: + WOLFSSL_MSG("\tdowngrading to TLSv1.1"); + break; + case DTLS_MINOR: + WOLFSSL_MSG("\tdowngrading to DTLSv1.1"); + break; + case TLSv1_2_MINOR: + WOLFSSL_MSG("\tdowngrading to TLSv1.2"); + break; + case DTLSv1_2_MINOR: + WOLFSSL_MSG("\tdowngrading to DTLSv1.2"); + break; + default: + WOLFSSL_MSG("\tbad minor version"); + return VERSION_ERROR; + } } -#ifdef OPENSSL_EXTRA /* check if option is set to not allow the current version * set from either wolfSSL_set_options or wolfSSL_CTX_set_options */ if (!ssl->options.dtls && ssl->options.downgrade && - ssl->options.mask > 0) { + ssl->options.mask > 0) { + if (ssl->version.minor == TLSv1_2_MINOR && - (ssl->options.mask & SSL_OP_NO_TLSv1_2) == SSL_OP_NO_TLSv1_2) { + (ssl->options.mask & WOLFSSL_OP_NO_TLSv1_2) == + WOLFSSL_OP_NO_TLSv1_2) { WOLFSSL_MSG("\tOption set to not allow TLSv1.2, Downgrading"); ssl->version.minor = TLSv1_1_MINOR; } + if (ssl->version.minor == TLSv1_1_MINOR && - (ssl->options.mask & SSL_OP_NO_TLSv1_1) == SSL_OP_NO_TLSv1_1) { + (ssl->options.mask & WOLFSSL_OP_NO_TLSv1_1) == + WOLFSSL_OP_NO_TLSv1_1) { WOLFSSL_MSG("\tOption set to not allow TLSv1.1, Downgrading"); ssl->options.tls1_1 = 0; ssl->version.minor = TLSv1_MINOR; } + if (ssl->version.minor == TLSv1_MINOR && - (ssl->options.mask & SSL_OP_NO_TLSv1) == SSL_OP_NO_TLSv1) { + (ssl->options.mask & WOLFSSL_OP_NO_TLSv1) == + WOLFSSL_OP_NO_TLSv1) { WOLFSSL_MSG("\tOption set to not allow TLSv1, Downgrading"); ssl->options.tls = 0; ssl->options.tls1_1 = 0; ssl->version.minor = SSLv3_MINOR; } + if (ssl->version.minor == SSLv3_MINOR && - (ssl->options.mask & SSL_OP_NO_SSLv3) == SSL_OP_NO_SSLv3) { + (ssl->options.mask & WOLFSSL_OP_NO_SSLv3) == + WOLFSSL_OP_NO_SSLv3) { WOLFSSL_MSG("\tError, option set to not allow SSLv3"); return VERSION_ERROR; } @@ -24762,7 +24919,6 @@ static int HashSkeData(WOLFSSL* ssl, enum wc_HashType hashType, return VERSION_ERROR; } } -#endif return 0; } @@ -24987,7 +25143,11 @@ static int HashSkeData(WOLFSSL* ssl, enum wc_HashType hashType, } #ifdef HAVE_SECRET_CALLBACK - if (ssl->sessionSecretCb != NULL) { + if (ssl->sessionSecretCb != NULL +#ifdef HAVE_SESSION_TICKET + && ssl->session->ticketLen > 0 +#endif + ) { int secretSz = SECRET_LEN; ret = ssl->sessionSecretCb(ssl, ssl->session->masterSecret, &secretSz, ssl->sessionSecretCtx); @@ -25027,11 +25187,8 @@ static int HashSkeData(WOLFSSL* ssl, enum wc_HashType hashType, else #endif if (ssl->ctx->method->version.major == SSLv3_MAJOR && - ssl->ctx->method->version.minor == TLSv1_2_MINOR -#ifdef OPENSSL_EXTRA - && (wolfSSL_get_options(ssl) & SSL_OP_NO_TLSv1_2) == 0 -#endif - ) { + ssl->ctx->method->version.minor == TLSv1_2_MINOR && + (wolfSSL_get_options(ssl) & WOLFSSL_OP_NO_TLSv1_2) == 0) { /* TLS v1.2 capable client not allowed to downgrade when * connecting to TLS v1.2 capable server. */ @@ -28727,11 +28884,9 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx, else #endif if (ssl->ctx->method->version.major == SSLv3_MAJOR && - ssl->ctx->method->version.minor == TLSv1_2_MINOR && -#ifdef OPENSSL_EXTRA - (wolfSSL_get_options(ssl) & SSL_OP_NO_TLSv1_2) == 0 && -#endif - !IsAtLeastTLSv1_2(ssl)) { + ssl->ctx->method->version.minor == TLSv1_2_MINOR && + (wolfSSL_get_options(ssl) & WOLFSSL_OP_NO_TLSv1_2) == 0 && + !IsAtLeastTLSv1_2(ssl)) { /* TLS v1.2 capable server downgraded. */ XMEMCPY(output + idx + RAN_LEN - (TLS13_DOWNGRADE_SZ + 1), tls13Downgrade, TLS13_DOWNGRADE_SZ); @@ -30809,14 +30964,16 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx, ssl->options.haveSessionId = 1; /* DoClientHello uses same resume code */ if (ssl->options.resuming) { /* let's try */ - WOLFSSL_SESSION* session = wolfSSL_GetSession(ssl, - ssl->arrays->masterSecret, 1); - #ifdef HAVE_SESSION_TICKET - if (ssl->options.useTicket == 1) { - session = ssl->session; - } - #endif - + WOLFSSL_SESSION* session; + #ifdef HAVE_SESSION_TICKET + if (ssl->options.useTicket == 1) { + session = ssl->session; + } + else + #endif + { + session = wolfSSL_GetSession(ssl, ssl->arrays->masterSecret, 1); + } if (!session) { WOLFSSL_MSG("Session lookup for resume failed"); ssl->options.resuming = 0; @@ -30874,10 +31031,12 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx, #ifdef HAVE_SESSION_TICKET if (ssl->options.useTicket == 1) { session = ssl->session; - } else if (bogusID == 1 && ssl->options.rejectTicket == 0) { + } + else if (bogusID == 1 && ssl->options.rejectTicket == 0) { WOLFSSL_MSG("Bogus session ID without session ticket"); return BUFFER_ERROR; - } else + } + else #endif { session = wolfSSL_GetSession(ssl, ssl->arrays->masterSecret, 1); @@ -31138,35 +31297,43 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx, ssl->options.side); } -#ifdef OPENSSL_EXTRA /* check if option is set to not allow the current version * set from either wolfSSL_set_options or wolfSSL_CTX_set_options */ if (!ssl->options.dtls && ssl->options.downgrade && - ssl->options.mask > 0) { + ssl->options.mask > 0) { + int reset = 0; + if (ssl->version.minor == TLSv1_2_MINOR && - (ssl->options.mask & SSL_OP_NO_TLSv1_2) == SSL_OP_NO_TLSv1_2) { + (ssl->options.mask & WOLFSSL_OP_NO_TLSv1_2) == + WOLFSSL_OP_NO_TLSv1_2) { WOLFSSL_MSG("\tOption set to not allow TLSv1.2, Downgrading"); ssl->version.minor = TLSv1_1_MINOR; reset = 1; } + if (ssl->version.minor == TLSv1_1_MINOR && - (ssl->options.mask & SSL_OP_NO_TLSv1_1) == SSL_OP_NO_TLSv1_1) { + (ssl->options.mask & WOLFSSL_OP_NO_TLSv1_1) == + WOLFSSL_OP_NO_TLSv1_1) { WOLFSSL_MSG("\tOption set to not allow TLSv1.1, Downgrading"); ssl->options.tls1_1 = 0; ssl->version.minor = TLSv1_MINOR; reset = 1; } + if (ssl->version.minor == TLSv1_MINOR && - (ssl->options.mask & SSL_OP_NO_TLSv1) == SSL_OP_NO_TLSv1) { + (ssl->options.mask & WOLFSSL_OP_NO_TLSv1) == + WOLFSSL_OP_NO_TLSv1) { WOLFSSL_MSG("\tOption set to not allow TLSv1, Downgrading"); ssl->options.tls = 0; ssl->options.tls1_1 = 0; ssl->version.minor = SSLv3_MINOR; reset = 1; } + if (ssl->version.minor == SSLv3_MINOR && - (ssl->options.mask & SSL_OP_NO_SSLv3) == SSL_OP_NO_SSLv3) { + (ssl->options.mask & WOLFSSL_OP_NO_SSLv3) == + WOLFSSL_OP_NO_SSLv3) { WOLFSSL_MSG("\tError, option set to not allow SSLv3"); ret = VERSION_ERROR; goto out; @@ -31201,7 +31368,6 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx, ssl->options.side); } } -#endif /* random */ XMEMCPY(ssl->arrays->clientRandom, input + i, RAN_LEN); diff --git a/src/keys.c b/src/keys.c index fa76977fd..6ecb6ad04 100644 --- a/src/keys.c +++ b/src/keys.c @@ -1,6 +1,6 @@ /* keys.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -3510,7 +3510,7 @@ int MakeMasterSecret(WOLFSSL* ssl) #ifndef NO_OLD_TLS if (ssl->options.tls) return MakeTlsMasterSecret(ssl); return MakeSslMasterSecret(ssl); -#elif !defined(WOLFSSL_NO_TLS12) +#elif !defined(WOLFSSL_NO_TLS12) && !defined(NO_TLS) return MakeTlsMasterSecret(ssl); #else (void)ssl; diff --git a/src/ocsp.c b/src/ocsp.c index 559df5377..d29cb54cc 100644 --- a/src/ocsp.c +++ b/src/ocsp.c @@ -1,6 +1,6 @@ /* ocsp.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/src/pk.c b/src/pk.c index 148a6f7ad..747f14ece 100644 --- a/src/pk.c +++ b/src/pk.c @@ -78,37 +78,72 @@ static int pk_bn_field_print_fp(XFILE fp, int indent, const char* field, if (ret == 1) { /* Print leading spaces, name and spaces before data. */ if (indent > 0) { - XFPRINTF(fp, "%*s", indent, ""); + if (XFPRINTF(fp, "%*s", indent, "") < 0) + ret = 0; } - XFPRINTF(fp, "%s:\n", field); + } + if (ret == 1) { + if (XFPRINTF(fp, "%s:\n", field) < 0) + ret = 0; + } + if (ret == 1) { if (indent > 0) { - XFPRINTF(fp, "%*s", indent, ""); + if (XFPRINTF(fp, "%*s", indent, "") < 0) + ret = 0; } - XFPRINTF(fp, "%*s", HEX_INDENT, ""); - + } + if (ret == 1) { + if (XFPRINTF(fp, "%*s", HEX_INDENT, "") < 0) + ret = 0; + } + if (ret == 1) { /* Print first byte - should always exist. */ if ((buf[i] != '\0') && (buf[i+1] != '\0')) { - XFPRINTF(fp, "%c", buf[i++]); - XFPRINTF(fp, "%c", buf[i++]); + if (XFPRINTF(fp, "%c", buf[i++]) < 0) + ret = 0; + else if (XFPRINTF(fp, "%c", buf[i++]) < 0) + ret = 0; } + } + if (ret == 1) { /* Print each hexadecimal character with byte separator. */ while ((buf[i] != '\0') && (buf[i+1] != '\0')) { /* Byte separator every two nibbles - one byte. */ - XFPRINTF(fp, ":"); + if (XFPRINTF(fp, ":") < 0) { + ret = 0; + break; + } /* New line after every 15 bytes - 30 nibbles. */ if (i % MAX_DIGITS_PER_LINE == 0) { - XFPRINTF(fp, "\n"); - if (indent > 0) { - XFPRINTF(fp, "%*s", indent, ""); + if (XFPRINTF(fp, "\n") < 0) { + ret = 0; + break; + } + if (indent > 0) { + if (XFPRINTF(fp, "%*s", indent, "") < 0) { + ret = 0; + break; + } + } + if (XFPRINTF(fp, "%*s", HEX_INDENT, "") < 0) { + ret = 0; + break; } - XFPRINTF(fp, "%*s", HEX_INDENT, ""); } /* Print two nibbles - one byte. */ - XFPRINTF(fp, "%c", buf[i++]); - XFPRINTF(fp, "%c", buf[i++]); + if (XFPRINTF(fp, "%c", buf[i++]) < 0) { + ret = 0; + break; + } + if (XFPRINTF(fp, "%c", buf[i++]) < 0) { + ret = 0; + break; + } } /* Ensure on new line after data. */ - XFPRINTF(fp, "\n"); + if (XFPRINTF(fp, "\n") < 0) { + ret = 0; + } } /* Dispose of any allocated character array. */ @@ -741,7 +776,7 @@ WOLFSSL_RSA* wolfSSL_RSAPublicKey_dup(WOLFSSL_RSA *rsa) } /* Dispose of any allocated DER buffer. */ - XFREE(derBuf, rsa->heap, DYNAMIC_TYPE_ASN1); + XFREE(derBuf, rsa ? rsa->heap : NULL, DYNAMIC_TYPE_ASN1); if (err) { /* Disposes of any created RSA key - on error. */ wolfSSL_RSA_free(ret); @@ -1052,7 +1087,7 @@ WOLFSSL_RSA* wolfSSL_d2i_RSAPrivateKey_bio(WOLFSSL_BIO *bio, WOLFSSL_RSA **out) key = NULL; } /* Dispose of allocated data. */ - XFREE(der, bio->heap, DYNAMIC_TYPE_TMP_BUFFER); + XFREE(der, bio ? bio->heap : NULL, DYNAMIC_TYPE_TMP_BUFFER); return key; } #endif /* defined(WOLFSSL_KEY_GEN) && !defined(HAVE_USER_RSA) && @@ -1381,7 +1416,7 @@ int wolfSSL_PEM_write_bio_RSAPrivateKey(WOLFSSL_BIO* bio, WOLFSSL_RSA* rsa, #if defined(WOLFSSL_KEY_GEN) && !defined(HAVE_USER_RSA) /* Dispose of DER buffer. */ - XFREE(derBuf, bio->heap, DYNAMIC_TYPE_TMP_BUFFER); + XFREE(derBuf, bio ? bio->heap : NULL, DYNAMIC_TYPE_TMP_BUFFER); if (pkey != NULL) { pkey->pkey.ptr = NULL; pkey->pkey_sz = 0; @@ -1645,7 +1680,7 @@ int wolfSSL_PEM_write_mem_RSAPrivateKey(RSA* rsa, const EVP_CIPHER* cipher, XFREE(tmp, NULL, DYNAMIC_TYPE_KEY); XFREE(cipherInfo, NULL, DYNAMIC_TYPE_STRING); - XFREE(derBuf, rsa->heap, DYNAMIC_TYPE_TMP_BUFFER); + XFREE(derBuf, rsa ? rsa->heap : NULL, DYNAMIC_TYPE_TMP_BUFFER); return ret; } @@ -1836,8 +1871,11 @@ int wolfSSL_RSA_print_fp(XFILE fp, WOLFSSL_RSA* rsa, int indent) ret = 0; } else { - XFPRINTF(fp, "%*s", indent, ""); - XFPRINTF(fp, "RSA Private-Key: (%d bit, 2 primes)\n", keySize); + if (XFPRINTF(fp, "%*s", indent, "") < 0) + ret = 0; + else if (XFPRINTF(fp, "RSA Private-Key: (%d bit, 2 primes)\n", + keySize) < 0) + ret = 0; } } /* Print out any components available. */ @@ -4184,8 +4222,10 @@ int wolfSSL_DSA_print_fp(XFILE fp, WOLFSSL_DSA* dsa, int indent) ret = 0; } else { - XFPRINTF(fp, "%*s", indent, ""); - XFPRINTF(fp, "Private-Key: (%d bit)\n", pBits); + if (XFPRINTF(fp, "%*s", indent, "") < 0) + ret = 0; + else if (XFPRINTF(fp, "Private-Key: (%d bit)\n", pBits) < 0) + ret = 0; } } if (ret == 1 && dsa->priv_key != NULL) { @@ -5077,7 +5117,7 @@ WOLFSSL_API int wolfSSL_i2d_DSAparams(const WOLFSSL_DSA* dsa, } if (ret < 0 && preAllocated == 0) { - XFREE(*out, key->heap, DYNAMIC_TYPE_OPENSSL); + XFREE(*out, key ? key->heap : NULL, DYNAMIC_TYPE_OPENSSL); } WOLFSSL_LEAVE("wolfSSL_i2d_DSAparams", ret); @@ -7673,13 +7713,18 @@ int wolfSSL_EC_KEY_print_fp(XFILE fp, WOLFSSL_EC_KEY* key, int indent) } } if (ret == 1) { - XFPRINTF(fp, "%*s", indent, ""); + if (XFPRINTF(fp, "%*s", indent, "") < 0) + ret = 0; + } + if (ret == 1) { if (key->priv_key != NULL && !wolfSSL_BN_is_zero(key->priv_key)) { - XFPRINTF(fp, "Private-Key: (%d bit)\n", bits); + if (XFPRINTF(fp, "Private-Key: (%d bit)\n", bits) < 0) + ret = 0; priv = 1; } else { - XFPRINTF(fp, "Public-Key: (%d bit)\n", bits); + if (XFPRINTF(fp, "Public-Key: (%d bit)\n", bits) < 0) + ret = 0; } if (priv) { @@ -7703,13 +7748,17 @@ int wolfSSL_EC_KEY_print_fp(XFILE fp, WOLFSSL_EC_KEY* key, int indent) if (nid > 0) { curve = wolfSSL_OBJ_nid2ln(nid); if (curve != NULL) { - XFPRINTF(fp, "%*s", indent, ""); - XFPRINTF(fp, "ASN1 OID: %s\n", curve); + if (XFPRINTF(fp, "%*s", indent, "") < 0) + ret = 0; + else if (XFPRINTF(fp, "ASN1 OID: %s\n", curve) < 0) + ret = 0; } nistName = wolfSSL_EC_curve_nid2nist(nid); if (nistName != NULL) { - XFPRINTF(fp, "%*s", indent, ""); - XFPRINTF(fp, "NIST CURVE: %s\n", nistName); + if (XFPRINTF(fp, "%*s", indent, "") < 0) + ret = 0; + else if (XFPRINTF(fp, "NIST CURVE: %s\n", nistName) < 0) + ret = 0; } } } @@ -10375,7 +10424,7 @@ WOLFSSL_ECDSA_SIG *wolfSSL_ECDSA_do_sign(const unsigned char *d, int dlen, } } else { - WOLFSSL_MSG("wc_ecc_sign_hash_ex failed"); + WOLFSSL_MSG("wc_ecc_sign_hash failed"); } } diff --git a/src/sniffer.c b/src/sniffer.c index 71bc3175e..bc68559d0 100644 --- a/src/sniffer.c +++ b/src/sniffer.c @@ -1,6 +1,6 @@ /* sniffer.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -3362,6 +3362,7 @@ static int ProcessSessionTicket(const byte* input, int* sslBytes, if (session->sslServer->arrays) { XMEMCPY(session->sslServer->arrays->sessionID, input + len - ID_LEN, ID_LEN); + session->sslServer->arrays->sessionIDSz = ID_LEN; } } @@ -3386,6 +3387,11 @@ static int DoResume(SnifferSession* session, char* error) else #endif { + #ifdef HAVE_SESSION_TICKET + /* make sure "useTicket" is not set, otherwise the session will not be + * properly retrieved */ + session->sslServer->options.useTicket = 0; + #endif resume = wolfSSL_GetSession(session->sslServer, session->sslServer->arrays->masterSecret, 0); if (resume == NULL) { @@ -3698,6 +3704,7 @@ static int ProcessServerHello(int msgSz, const byte* input, int* sslBytes, if (session->ticketID && doResume) { /* use ticketID to retrieve from session, prefer over sessionID */ XMEMCPY(session->sslServer->arrays->sessionID,session->ticketID,ID_LEN); + session->sslServer->arrays->sessionIDSz = ID_LEN; session->sslServer->options.haveSessionId = 1; /* may not have actual sessionID */ } @@ -4085,8 +4092,10 @@ static int ProcessClientHello(const byte* input, int* sslBytes, return -1; } } + #ifdef HAVE_SESSION_TICKET - ssl->options.useTicket = 1; + /* do not set "ssl->options.useTicket", since the sniffer uses + * the cache differently for retaining the master secret only */ #endif XMEMCPY(session->ticketID, input + extLen - ID_LEN, ID_LEN); } diff --git a/src/ssl.c b/src/ssl.c index ead087c95..a062e3e2f 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -1,6 +1,6 @@ /* ssl.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -522,7 +522,8 @@ WOLFSSL_CTX* wolfSSL_CTX_new_ex(WOLFSSL_METHOD* method, void* heap) wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL); wolfSSL_CTX_set_mode(ctx, SSL_MODE_AUTO_RETRY); if (wolfSSL_CTX_set_min_proto_version(ctx, - SSL3_VERSION) != WOLFSSL_SUCCESS || + (method->version.major == DTLS_MAJOR) ? + DTLS1_VERSION : SSL3_VERSION) != WOLFSSL_SUCCESS || #ifdef HAVE_ANON wolfSSL_CTX_allow_anon_cipher(ctx) != WOLFSSL_SUCCESS || #endif @@ -4426,7 +4427,8 @@ void wolfSSL_ERR_print_errors_fp(XFILE fp, int err) WOLFSSL_ENTER("wolfSSL_ERR_print_errors_fp"); SetErrorString(err, data); - XFPRINTF(fp, "%s", data); + if (XFPRINTF(fp, "%s", data) < 0) + WOLFSSL_MSG("fprintf failed in wolfSSL_ERR_print_errors_fp"); } #if defined(OPENSSL_EXTRA) || defined(DEBUG_WOLFSSL_VERBOSE) @@ -4549,17 +4551,19 @@ static int SetMinVersionHelper(byte* minVersion, int version) break; #endif -#ifdef WOLFSSL_DTLS13 +#ifdef WOLFSSL_DTLS case WOLFSSL_DTLSV1: *minVersion = DTLS_MINOR; break; case WOLFSSL_DTLSV1_2: *minVersion = DTLSv1_2_MINOR; break; +#ifdef WOLFSSL_DTLS13 case WOLFSSL_DTLSV1_3: *minVersion = DTLSv1_3_MINOR; break; #endif /* WOLFSSL_DTLS13 */ +#endif /* WOLFSSL_DTLS */ default: WOLFSSL_MSG("Bad function argument"); @@ -5476,12 +5480,14 @@ int wolfSSL_Init(void) } #ifdef HAVE_GLOBAL_RNG - if ((ret == WOLFSSL_SUCCESS) && (wc_InitMutex(&globalRNGMutex) != 0)) { - WOLFSSL_MSG("Bad Init Mutex rng"); - ret = BAD_MUTEX_E; - } - else { - globalRNGMutex_valid = 1; + if (ret == WOLFSSL_SUCCESS) { + if (wc_InitMutex(&globalRNGMutex) != 0) { + WOLFSSL_MSG("Bad Init Mutex rng"); + ret = BAD_MUTEX_E; + } + else { + globalRNGMutex_valid = 1; + } } #endif @@ -5517,33 +5523,37 @@ int wolfSSL_Init(void) } } #else - if ((ret == WOLFSSL_SUCCESS) && (wc_InitMutex(&session_mutex) != 0)) { - WOLFSSL_MSG("Bad Init Mutex session"); - ret = BAD_MUTEX_E; - } - else { - session_mutex_valid = 1; + if (ret == WOLFSSL_SUCCESS) { + if (wc_InitMutex(&session_mutex) != 0) { + WOLFSSL_MSG("Bad Init Mutex session"); + ret = BAD_MUTEX_E; + } + else { + session_mutex_valid = 1; + } } #endif #ifndef NO_CLIENT_CACHE - if ((ret == WOLFSSL_SUCCESS) && - (wc_InitMutex(&clisession_mutex) != 0)) { - WOLFSSL_MSG("Bad Init Mutex session"); - ret = BAD_MUTEX_E; - } - else { - clisession_mutex_valid = 1; + if (ret == WOLFSSL_SUCCESS) { + if (wc_InitMutex(&clisession_mutex) != 0) { + WOLFSSL_MSG("Bad Init Mutex session"); + ret = BAD_MUTEX_E; + } + else { + clisession_mutex_valid = 1; + } } #endif #endif - if ((ret == WOLFSSL_SUCCESS) && (wc_InitMutex(&count_mutex) != 0)) { - WOLFSSL_MSG("Bad Init Mutex count"); - ret = BAD_MUTEX_E; + if (ret == WOLFSSL_SUCCESS) { + if (wc_InitMutex(&count_mutex) != 0) { + WOLFSSL_MSG("Bad Init Mutex count"); + ret = BAD_MUTEX_E; + } + else { + count_mutex_valid = 1; + } } - else { - count_mutex_valid = 1; - } - #if defined(OPENSSL_EXTRA) && defined(HAVE_ATEXIT) /* OpenSSL registers cleanup using atexit */ if ((ret == WOLFSSL_SUCCESS) && (atexit(AtExitCleanup) != 0)) { @@ -5553,13 +5563,15 @@ int wolfSSL_Init(void) #endif } - if ((ret == WOLFSSL_SUCCESS) && (wc_LockMutex(&count_mutex) != 0)) { - WOLFSSL_MSG("Bad Lock Mutex count"); - ret = BAD_MUTEX_E; - } - else { - initRefCount++; - wc_UnLockMutex(&count_mutex); + if (ret == WOLFSSL_SUCCESS) { + if (wc_LockMutex(&count_mutex) != 0) { + WOLFSSL_MSG("Bad Lock Mutex count"); + ret = BAD_MUTEX_E; + } + else { + initRefCount++; + wc_UnLockMutex(&count_mutex); + } } if (ret != WOLFSSL_SUCCESS) { @@ -5571,7 +5583,6 @@ int wolfSSL_Init(void) } - #ifndef NO_CERTS /* process user cert chain to pass during the handshake */ @@ -10509,9 +10520,11 @@ int wolfSSL_set_session_secret_cb(WOLFSSL* ssl, SessionSecretCb cb, void* ctx) ssl->sessionSecretCb = cb; ssl->sessionSecretCtx = ctx; - /* If using a pre-set key, assume session resumption. */ - ssl->session->sessionIDSz = 0; - ssl->options.resuming = 1; + if (cb != NULL) { + /* If using a pre-set key, assume session resumption. */ + ssl->session->sessionIDSz = 0; + ssl->options.resuming = 1; + } return WOLFSSL_SUCCESS; } @@ -11979,7 +11992,8 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl, && ssl->error != WC_PENDING_E #endif ) { - if ( (ssl->error = SendBuffered(ssl)) == 0) { + ret = SendBuffered(ssl); + if (ret == 0) { if (ssl->fragOffset == 0 && !ssl->options.buildingMsg) { if (advanceState) { ssl->options.connectState++; @@ -12181,6 +12195,7 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl, /* CLIENT: Fail-safe for Server Authentication. */ if (!ssl->options.peerAuthGood) { WOLFSSL_MSG("Server authentication did not happen"); + ssl->error = NO_PEER_VERIFY; return WOLFSSL_FATAL_ERROR; } @@ -12496,7 +12511,8 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl, && ssl->error != WC_PENDING_E #endif ) { - if ( (ret = SendBuffered(ssl)) == 0) { + ret = SendBuffered(ssl); + if (ret == 0) { /* fragOffset is non-zero when sending fragments. On the last * fragment, fragOffset is zero again, and the state can be * advanced. */ @@ -13541,32 +13557,43 @@ ClientSession* AddSessionToClientCache(int side, int row, int idx, byte* serverI clientRow = HashSession(sessionID, ID_LEN, &error) % CLIENT_SESSION_ROWS; } - else + else { error = -1; + } if (error == 0 && wc_LockMutex(&clisession_mutex) == 0) { - clientIdx = ClientCache[clientRow].nextIdx++; - ClientCache[clientRow].Clients[clientIdx].serverRow = - (word16)row; - ClientCache[clientRow].Clients[clientIdx].serverIdx = - (word16)idx; - if (sessionID != NULL) { - sessionIDHash = HashSession(sessionID, ID_LEN, &error); - if (error == 0) { - ClientCache[clientRow].Clients[clientIdx].sessionIDHash - = sessionIDHash; + clientIdx = ClientCache[clientRow].nextIdx; + if (clientIdx < CLIENT_SESSIONS_PER_ROW) { + ClientCache[clientRow].Clients[clientIdx].serverRow = + (word16)row; + ClientCache[clientRow].Clients[clientIdx].serverIdx = + (word16)idx; + if (sessionID != NULL) { + sessionIDHash = HashSession(sessionID, ID_LEN, &error); + if (error == 0) { + ClientCache[clientRow].Clients[clientIdx].sessionIDHash + = sessionIDHash; + } } } + else { + error = -1; + ClientCache[clientRow].nextIdx = 0; /* reset index as saftey */ + WOLFSSL_MSG("Invalid client cache index! " + "Possible corrupted memory"); + } if (error == 0) { WOLFSSL_MSG("Adding client cache entry"); if (ClientCache[clientRow].totalCount < CLIENT_SESSIONS_PER_ROW) ClientCache[clientRow].totalCount++; + ClientCache[clientRow].nextIdx++; ClientCache[clientRow].nextIdx %= CLIENT_SESSIONS_PER_ROW; } wc_UnLockMutex(&clisession_mutex); } else { - WOLFSSL_MSG("Hash session failed"); + WOLFSSL_MSG("Hash session or lock failed"); + error = -1; } } else { @@ -15825,7 +15852,6 @@ cleanup: } #ifdef OPENSSL_EXTRA - void wolfSSL_CTX_set_tmp_rsa_callback(WOLFSSL_CTX* ctx, WOLFSSL_RSA*(*f)(WOLFSSL*, int, int)) { @@ -15846,7 +15872,7 @@ cleanup: ssl->options.sentNotify = (opt&WOLFSSL_SENT_SHUTDOWN) > 0; ssl->options.closeNotify = (opt&WOLFSSL_RECEIVED_SHUTDOWN) > 0; } - +#endif long wolfSSL_CTX_get_options(WOLFSSL_CTX* ctx) { @@ -15857,8 +15883,6 @@ cleanup: return ctx->mask; } -#endif - static long wolf_set_options(long old_op, long op); long wolfSSL_CTX_set_options(WOLFSSL_CTX* ctx, long opt) { @@ -15872,8 +15896,6 @@ cleanup: return ctx->mask; } -#ifdef OPENSSL_EXTRA - long wolfSSL_CTX_clear_options(WOLFSSL_CTX* ctx, long opt) { WOLFSSL_ENTER("SSL_CTX_clear_options"); @@ -15883,6 +15905,8 @@ cleanup: return ctx->mask; } +#ifdef OPENSSL_EXTRA + int wolfSSL_set_rfd(WOLFSSL* ssl, int rfd) { WOLFSSL_ENTER("SSL_set_rfd"); @@ -16197,8 +16221,13 @@ cleanup: ret = wc_PeekErrorNode(0, &file, &reason, &line); if (ret >= 0) { const char* r = wolfSSL_ERR_reason_error_string(0 - ret); - XSNPRINTF(buf, sizeof(buf), "error:%d:wolfSSL library:%s:%s:%d\n", - ret, r, file, line); + if (XSNPRINTF(buf, sizeof(buf), + "error:%d:wolfSSL library:%s:%s:%d\n", + ret, r, file, line) + >= (int)sizeof(buf)) + { + WOLFSSL_MSG("Buffer overrun formatting error message"); + } wolfSSL_BIO_write(bio, buf, (int)XSTRLEN(buf)); wc_RemoveErrorNode(0); } @@ -16894,6 +16923,7 @@ WOLFSSL_API int wolfSSL_CTX_get_min_proto_version(WOLFSSL_CTX* ctx) * returns WOLFSSL_FATAL_ERROR on no match */ static int GetMaxProtoVersion(long options) { +#ifndef NO_TLS #ifdef WOLFSSL_TLS13 if (!(options & WOLFSSL_OP_NO_TLSv1_3)) return TLS1_3_VERSION; @@ -16914,7 +16944,9 @@ static int GetMaxProtoVersion(long options) return SSL3_VERSION; #endif #endif - +#else + (void)options; +#endif /* NO_TLS */ return WOLFSSL_FATAL_ERROR; } @@ -19446,10 +19478,23 @@ char* wolfSSL_i2s_ASN1_STRING(WOLFSSL_v3_ext_method *method, XMEMSET(tmp, 0, tmpSz); for (i = 0; i < tmpSz && i < (s->length - 1); i++) { - XSNPRINTF(val, valSz - 1, "%02X:", str[i]); + if (XSNPRINTF(val, valSz, "%02X:", str[i]) + >= valSz) + { + WOLFSSL_MSG("Buffer overrun"); + XFREE(str, NULL, DYNAMIC_TYPE_TMP_BUFFER); + return NULL; + } XSTRNCAT(tmp, val, valSz); } - XSNPRINTF(val, valSz - 1, "%02X", str[i]); + if (XSNPRINTF(val, valSz, "%02X", str[i]) + >= valSz) + { + WOLFSSL_MSG("Buffer overrun"); + XFREE(str, NULL, DYNAMIC_TYPE_TMP_BUFFER); + return NULL; + } + XSTRNCAT(tmp, val, valSz); XFREE(str, NULL, DYNAMIC_TYPE_TMP_BUFFER); @@ -22547,7 +22592,6 @@ static long wolf_set_options(long old_op, long op) return old_op | op; } -#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL) long wolfSSL_set_options(WOLFSSL* ssl, long op) { word16 haveRSA = 1; @@ -22562,29 +22606,28 @@ long wolfSSL_set_options(WOLFSSL* ssl, long op) ssl->options.mask = wolf_set_options(ssl->options.mask, op); -#ifdef SSL_OP_NO_TLSv1_3 - if ((ssl->options.mask & SSL_OP_NO_TLSv1_3) == SSL_OP_NO_TLSv1_3) { + if ((ssl->options.mask & WOLFSSL_OP_NO_TLSv1_3) == WOLFSSL_OP_NO_TLSv1_3) { if (ssl->version.minor == TLSv1_3_MINOR) ssl->version.minor = TLSv1_2_MINOR; } -#endif - if ((ssl->options.mask & SSL_OP_NO_TLSv1_2) == SSL_OP_NO_TLSv1_2) { + if ((ssl->options.mask & WOLFSSL_OP_NO_TLSv1_2) == WOLFSSL_OP_NO_TLSv1_2) { if (ssl->version.minor == TLSv1_2_MINOR) ssl->version.minor = TLSv1_1_MINOR; } - if ((ssl->options.mask & SSL_OP_NO_TLSv1_1) == SSL_OP_NO_TLSv1_1) { + if ((ssl->options.mask & WOLFSSL_OP_NO_TLSv1_1) == WOLFSSL_OP_NO_TLSv1_1) { if (ssl->version.minor == TLSv1_1_MINOR) ssl->version.minor = TLSv1_MINOR; } - if ((ssl->options.mask & SSL_OP_NO_TLSv1) == SSL_OP_NO_TLSv1) { + if ((ssl->options.mask & WOLFSSL_OP_NO_TLSv1) == WOLFSSL_OP_NO_TLSv1) { if (ssl->version.minor == TLSv1_MINOR) ssl->version.minor = SSLv3_MINOR; } - if ((ssl->options.mask & WOLFSSL_OP_NO_COMPRESSION) == WOLFSSL_OP_NO_COMPRESSION) { + if ((ssl->options.mask & WOLFSSL_OP_NO_COMPRESSION) + == WOLFSSL_OP_NO_COMPRESSION) { #ifdef HAVE_LIBZ ssl->options.usingCompression = 0; #endif @@ -22620,8 +22663,6 @@ long wolfSSL_get_options(const WOLFSSL* ssl) return ssl->options.mask; } -#endif /* OPENSSL_EXTRA || WOLFSSL_WPAS_SMALL */ - #if defined(HAVE_SECURE_RENEGOTIATION) \ || defined(HAVE_SERVER_RENEGOTIATION_INFO) /* clears the counter for number of renegotiations done @@ -35983,6 +36024,7 @@ char *wolfSSL_BN_bn2hex(const WOLFSSL_BIGNUM *bn) int wolfSSL_BN_print_fp(XFILE fp, const WOLFSSL_BIGNUM *bn) { char *buf; + int ret; WOLFSSL_ENTER("wolfSSL_BN_print_fp"); @@ -35997,10 +36039,14 @@ int wolfSSL_BN_print_fp(XFILE fp, const WOLFSSL_BIGNUM *bn) return WOLFSSL_FAILURE; } - XFPRINTF(fp, "%s", buf); + if (XFPRINTF(fp, "%s", buf) < 0) + ret = WOLFSSL_FAILURE; + else + ret = WOLFSSL_SUCCESS; + XFREE(buf, NULL, DYNAMIC_TYPE_OPENSSL); - return WOLFSSL_SUCCESS; + return ret; } #endif /* !NO_FILESYSTEM */ @@ -36173,7 +36219,12 @@ int wolfSSL_ASN1_STRING_print_ex(WOLFSSL_BIO *out, WOLFSSL_ASN1_STRING *str, return WOLFSSL_FAILURE; } XMEMSET(typebuf, 0, type_len); - XSNPRINTF((char*)typebuf, (size_t)type_len , "%s:", tag); + if (XSNPRINTF((char*)typebuf, (size_t)type_len , "%s:", tag) + >= (int)type_len) + { + WOLFSSL_MSG("Buffer overrun."); + return WOLFSSL_FAILURE; + } type_len--; } @@ -37910,7 +37961,8 @@ int wolfSSL_RAND_write_file(const char* fname) bytes = 0; } else { - XFWRITE(buf, 1, bytes, f); + size_t bytes_written = XFWRITE(buf, 1, bytes, f); + bytes = (int)bytes_written; XFCLOSE(f); } } diff --git a/src/tls.c b/src/tls.c index 682b2908b..2f10e4b90 100644 --- a/src/tls.c +++ b/src/tls.c @@ -1,6 +1,6 @@ /* tls.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -64,6 +64,8 @@ #include #endif +#ifndef NO_TLS + #if defined(WOLFSSL_TLS13) && defined(HAVE_SUPPORTED_CURVES) static int TLSX_KeyShare_IsSupported(int namedGroup); static void TLSX_KeyShare_FreeAll(KeyShareEntry* list, void* heap); @@ -73,8 +75,6 @@ static void TLSX_KeyShare_FreeAll(KeyShareEntry* list, void* heap); static int TLSX_PopulateSupportedGroups(WOLFSSL* ssl, TLSX** extensions); #endif -#ifndef NO_TLS - /* Digest enable checks */ #ifdef NO_OLD_TLS /* TLS 1.2 only */ #if defined(NO_SHA256) && !defined(WOLFSSL_SHA384) && \ diff --git a/src/tls13.c b/src/tls13.c index 413ffe3cd..fe09fdba3 100644 --- a/src/tls13.c +++ b/src/tls13.c @@ -1,6 +1,6 @@ /* tls13.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -3339,6 +3339,11 @@ int SendTls13ClientHello(WOLFSSL* ssl) WOLFSSL_START(WC_FUNC_CLIENT_HELLO_SEND); WOLFSSL_ENTER("SendTls13ClientHello"); + if (ssl == NULL) { + return BAD_FUNC_ARG; + } + + ssl->options.buildingMsg = 1; major = SSLv3_MAJOR; tls12minor = TLSv1_2_MINOR; @@ -3349,10 +3354,6 @@ int SendTls13ClientHello(WOLFSSL* ssl) } #endif /* WOLFSSL_DTLS */ - if (ssl == NULL) { - return BAD_FUNC_ARG; - } - #ifdef HAVE_SESSION_TICKET if (ssl->options.resuming && (ssl->session->version.major != ssl->version.major || @@ -3424,9 +3425,14 @@ int SendTls13ClientHello(WOLFSSL* ssl) #endif #ifdef WOLFSSL_DTLS13 - /* legacy_cookie_id (always 0 length) */ - if (ssl->options.dtls) - args->length += OPAQUE8_LEN; + if (ssl->options.dtls) { + /* legacy_cookie_id len */ + args->length += ENUM_LEN; + + /* server sent us an HelloVerifyRequest and we allow downgrade */ + if (ssl->arrays->cookieSz > 0 && ssl->options.downgrade) + args->length += ssl->arrays->cookieSz; + } #endif /* WOLFSSL_DTLS13 */ /* Advance state and proceed */ @@ -3532,9 +3538,19 @@ int SendTls13ClientHello(WOLFSSL* ssl) } #ifdef WOLFSSL_DTLS13 - /* legacy_cookie_id. always 0 length vector */ - if (ssl->options.dtls) - args->output[args->idx++] = 0; + if (ssl->options.dtls) { + args->output[args->idx++] = ssl->arrays->cookieSz; + + if (ssl->arrays->cookieSz > 0) { + /* We have a cookie saved, so the server sent us an + * HelloVerifyRequest, it means it is a v1.2 server */ + if (!ssl->options.downgrade) + return VERSION_ERROR; + XMEMCPY(args->output + args->idx, ssl->arrays->cookie, + ssl->arrays->cookieSz); + args->idx += ssl->arrays->cookieSz; + } + } #endif /* WOLFSSL_DTLS13 */ /* Cipher suites */ @@ -3598,6 +3614,7 @@ int SendTls13ClientHello(WOLFSSL* ssl) } #endif + ssl->options.buildingMsg = 0; #ifdef WOLFSSL_DTLS13 if (ssl->options.dtls) { ret = Dtls13HandshakeSend(ssl, args->output, args->sendSz, @@ -3639,6 +3656,32 @@ int SendTls13ClientHello(WOLFSSL* ssl) return ret; } +#if defined(WOLFSSL_DTLS13) && !defined(WOLFSSL_NO_CLIENT) +static int Dtls13DoDowngrade(WOLFSSL* ssl) +{ + int ret; + if (ssl->dtls13ClientHello == NULL) + return BAD_STATE_E; + + /* v1.3 and v1.2 hash messages to compute the transcript hash. When we are + * using DTLSv1.3 we hash the first clientHello following v1.3 but the + * server can negotiate a lower version. So we need to re-hash the + * clientHello to adhere to DTLS <= v1.2 rules. */ + ret = InitHandshakeHashes(ssl); + if (ret != 0) + return ret; + ret = HashRaw(ssl, ssl->dtls13ClientHello, ssl->dtls13ClientHelloSz); + XFREE(ssl->dtls13ClientHello, ssl->heap, DYNAMIC_TYPE_DTLS_MSG); + ssl->dtls13ClientHello = NULL; + ssl->dtls13ClientHelloSz = 0; + ssl->keys.dtls_sequence_number_hi = + w64GetHigh32(ssl->dtls13EncryptEpoch->nextSeqNumber); + ssl->keys.dtls_sequence_number_lo = + w64GetLow32(ssl->dtls13EncryptEpoch->nextSeqNumber); + return ret; +} +#endif /* WOLFSSL_DTLS13 && !WOLFSSL_NO_CLIENT*/ + /* handle processing of TLS 1.3 server_hello (2) and hello_retry_request (6) */ /* Handle the ServerHello message from the server. * Only a client will receive this message. @@ -3738,6 +3781,12 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx, XMEMCPY(&args->pv, input + args->idx, OPAQUE16_LEN); args->idx += OPAQUE16_LEN; +#ifdef WOLFSSL_DTLS + if (ssl->options.dtls && + (args->pv.major != DTLS_MAJOR || args->pv.minor == DTLS_BOGUS_MINOR)) + return VERSION_ERROR; +#endif /* WOLFSSL_DTLS */ + #ifndef WOLFSSL_NO_TLS12 { byte wantDowngrade; @@ -3760,6 +3809,9 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx, if (ssl->options.dtls) { ssl->chVersion.minor = DTLSv1_2_MINOR; ssl->version.minor = DTLSv1_2_MINOR; + ret = Dtls13DoDowngrade(ssl); + if (ret != 0) + return ret; } #endif /* WOLFSSL_DTLS13 */ @@ -3837,6 +3889,9 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx, if (ssl->options.dtls) { ssl->chVersion.minor = DTLSv1_2_MINOR; ssl->version.minor = DTLSv1_2_MINOR; + ret = Dtls13DoDowngrade(ssl); + if (ret != 0) + return ret; } #endif /* WOLFSSL_DTLS13 */ @@ -3891,9 +3946,28 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx, return VERSION_ERROR; ssl->version.minor = args->pv.minor; + +#ifdef WOLFSSL_DTLS13 + if (ssl->options.dtls) { + ret = Dtls13DoDowngrade(ssl); + if (ret != 0) + return ret; + } +#endif /* WOLFSSL_DTLS13 */ } } +#ifdef WOLFSSL_DTLS13 + /* we are sure that version is >= v1.3 now, we can get rid of buffered + * ClientHello that was buffered to re-compute the hash in case of + * downgrade */ + if (ssl->options.dtls && ssl->dtls13ClientHello != NULL) { + XFREE(ssl->dtls13ClientHello, ssl->heap, DYNAMIC_TYPE_DTLS_MSG); + ssl->dtls13ClientHello = NULL; + ssl->dtls13ClientHelloSz = 0; + } +#endif /* WOLFSSL_DTLS13 */ + /* Advance state and proceed */ ssl->options.asyncState = TLS_ASYNC_BUILD; } /* case TLS_ASYNC_BEGIN */ @@ -3934,7 +4008,11 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx, ssl->options.serverState = SERVER_HELLO_COMPLETE; #ifdef HAVE_SECRET_CALLBACK - if (ssl->sessionSecretCb != NULL) { + if (ssl->sessionSecretCb != NULL +#ifdef HAVE_SESSION_TICKET + && ssl->session->ticketLen > 0 +#endif + ) { int secretSz = SECRET_LEN; ret = ssl->sessionSecretCb(ssl, ssl->session->masterSecret, &secretSz, ssl->sessionSecretCtx); @@ -5539,6 +5617,7 @@ int SendTls13ServerHello(WOLFSSL* ssl, byte extMsgType) return ret; } + ssl->options.buildingMsg = 1; #ifdef WOLFSSL_DTLS13 if (ssl->options.dtls) idx = DTLS_RECORD_HEADER_SZ + DTLS_HANDSHAKE_HEADER_SZ; @@ -5648,10 +5727,11 @@ int SendTls13ServerHello(WOLFSSL* ssl, byte extMsgType) if (extMsgType == server_hello) ssl->options.serverState = SERVER_HELLO_COMPLETE; + ssl->options.buildingMsg = 0; #ifdef WOLFSSL_DTLS13 if (ssl->options.dtls) { ret = Dtls13HandshakeSend(ssl, output, sendSz, sendSz, - server_hello, 0); + extMsgType, 0); WOLFSSL_LEAVE("SendTls13ServerHello", ret); WOLFSSL_END(WC_FUNC_SERVER_HELLO_SEND); @@ -5689,6 +5769,7 @@ static int SendTls13EncryptedExtensions(WOLFSSL* ssl) WOLFSSL_START(WC_FUNC_ENCRYPTED_EXTENSIONS_SEND); WOLFSSL_ENTER("SendTls13EncryptedExtensions"); + ssl->options.buildingMsg = 1; ssl->keys.encryptionOn = 1; #ifdef WOLFSSL_DTLS13 @@ -5782,6 +5863,7 @@ static int SendTls13EncryptedExtensions(WOLFSSL* ssl) #ifdef WOLFSSL_DTLS13 if (ssl->options.dtls) { + ssl->options.buildingMsg = 0; ret = Dtls13HandshakeSend(ssl, output, sendSz, idx, encrypted_extensions, 1); @@ -5802,7 +5884,7 @@ static int SendTls13EncryptedExtensions(WOLFSSL* ssl) return sendSz; ssl->buffers.outputBuffer.length += sendSz; - + ssl->options.buildingMsg = 0; ssl->options.serverState = SERVER_ENCRYPTED_EXTENSIONS_COMPLETE; if (!ssl->options.groupMessages) @@ -5839,6 +5921,8 @@ static int SendTls13CertificateRequest(WOLFSSL* ssl, byte* reqCtx, WOLFSSL_START(WC_FUNC_CERTIFICATE_REQUEST_SEND); WOLFSSL_ENTER("SendTls13CertificateRequest"); + ssl->options.buildingMsg = 1; + if (ssl->options.side == WOLFSSL_SERVER_END) InitSuitesHashSigAlgo(ssl->suites, 1, 1, 1, 0, 1, ssl->buffers.keySz); @@ -5890,6 +5974,7 @@ static int SendTls13CertificateRequest(WOLFSSL* ssl, byte* reqCtx, #ifdef WOLFSSL_DTLS13 if (ssl->options.dtls) { + ssl->options.buildingMsg = 0; ret = Dtls13HandshakeSend(ssl, output, sendSz, i, certificate_request, 1); @@ -5917,6 +6002,7 @@ static int SendTls13CertificateRequest(WOLFSSL* ssl, byte* reqCtx, #endif ssl->buffers.outputBuffer.length += sendSz; + ssl->options.buildingMsg = 0; if (!ssl->options.groupMessages) ret = SendBuffered(ssl); @@ -6422,6 +6508,8 @@ static int SendTls13Certificate(WOLFSSL* ssl) WOLFSSL_START(WC_FUNC_CERTIFICATE_SEND); WOLFSSL_ENTER("SendTls13Certificate"); + ssl->options.buildingMsg = 1; + #ifdef WOLFSSL_POST_HANDSHAKE_AUTH if (ssl->options.side == WOLFSSL_CLIENT_END && ssl->certReqCtx != NULL) { certReqCtxLen = ssl->certReqCtx->len; @@ -6523,8 +6611,6 @@ static int SendTls13Certificate(WOLFSSL* ssl) } #endif /* WOLFSSL_DTLS13 */ - ssl->options.buildingMsg = 1; - if (ssl->fragOffset == 0) { if (headerSz + certSz + extSz + certChainSz <= maxFragment - HANDSHAKE_HEADER_SZ) { @@ -6640,6 +6726,7 @@ static int SendTls13Certificate(WOLFSSL* ssl) #ifdef WOLFSSL_DTLS13 if (ssl->options.dtls) { /* DTLS1.3 uses a separate variable and logic for fragments */ + ssl->options.buildingMsg = 0; ssl->fragOffset = 0; ret = Dtls13HandshakeSend(ssl, output, sendSz, i, certificate, 1); } @@ -6663,6 +6750,7 @@ static int SendTls13Certificate(WOLFSSL* ssl) #endif ssl->buffers.outputBuffer.length += sendSz; + ssl->options.buildingMsg = 0; if (!ssl->options.groupMessages) ret = SendBuffered(ssl); } @@ -6746,6 +6834,8 @@ static int SendTls13CertificateVerify(WOLFSSL* ssl) WOLFSSL_START(WC_FUNC_CERTIFICATE_VERIFY_SEND); WOLFSSL_ENTER("SendTls13CertificateVerify"); + ssl->options.buildingMsg = 1; + #if defined(WOLFSSL_RENESAS_TSIP_TLS) && (WOLFSSL_RENESAS_TSIP_VER >= 115) ret = tsip_Tls13SendCertVerify(ssl); if (ret != CRYPTOCB_UNAVAILABLE) { @@ -7108,6 +7198,7 @@ static int SendTls13CertificateVerify(WOLFSSL* ssl) { #ifdef WOLFSSL_DTLS13 if (ssl->options.dtls) { + ssl->options.buildingMsg = 0; ret = Dtls13HandshakeSend(ssl, args->output, MAX_CERT_VERIFY_SZ + MAX_MSG_EXTRA + MAX_MSG_EXTRA, args->sendSz, certificate_verify, 1); @@ -7143,7 +7234,7 @@ static int SendTls13CertificateVerify(WOLFSSL* ssl) #endif ssl->buffers.outputBuffer.length += args->sendSz; - + ssl->options.buildingMsg = 0; if (!ssl->options.groupMessages) ret = SendBuffered(ssl); break; @@ -7879,6 +7970,7 @@ static int SendTls13Finished(WOLFSSL* ssl) WOLFSSL_START(WC_FUNC_FINISHED_SEND); WOLFSSL_ENTER("SendTls13Finished"); + ssl->options.buildingMsg = 1; #ifdef WOLFSSL_DTLS13 if (ssl->options.dtls) { headerSz = DTLS_HANDSHAKE_HEADER_SZ; @@ -7981,6 +8073,7 @@ static int SendTls13Finished(WOLFSSL* ssl) #endif ssl->buffers.outputBuffer.length += sendSz; + ssl->options.buildingMsg = 0; } if (ssl->options.side == WOLFSSL_SERVER_END) { @@ -8326,6 +8419,7 @@ static int SendTls13EndOfEarlyData(WOLFSSL* ssl) length = 0; sendSz = idx + length + MAX_MSG_EXTRA; + ssl->options.buildingMsg = 1; /* Check buffers are big enough and grow if needed. */ if ((ret = CheckAvailableSize(ssl, sendSz)) != 0) @@ -8349,6 +8443,7 @@ static int SendTls13EndOfEarlyData(WOLFSSL* ssl) if ((ret = SetKeysSide(ssl, ENCRYPT_SIDE_ONLY)) != 0) return ret; + ssl->options.buildingMsg = 0; if (!ssl->options.groupMessages) ret = SendBuffered(ssl); @@ -9174,6 +9269,40 @@ static int SanityCheckTls13MsgReceived(WOLFSSL* ssl, byte type) } /* Multiple KeyUpdates can be sent. */ break; +#if defined(WOLFSSL_DTLS13) && !defined(WOLFSSL_NO_TLS12) + case hello_verify_request: + if (!ssl->options.dtls) { + WOLFSSL_MSG("HelloVerifyRequest when not in DTLS"); + return OUT_OF_ORDER_E; + } + if (ssl->msgsReceived.got_hello_verify_request) { + WOLFSSL_MSG("Duplicate HelloVerifyRequest received"); + return DUPLICATE_MSG_E; + } + ssl->msgsReceived.got_hello_verify_request = 1; + if (ssl->msgsReceived.got_hello_retry_request) { + WOLFSSL_MSG( + "Both HelloVerifyRequest and HelloRetryRequest received"); + return DUPLICATE_MSG_E; + } + if (ssl->options.serverState >= + SERVER_HELLO_RETRY_REQUEST_COMPLETE || + ssl->options.connectState != CLIENT_HELLO_SENT) { + WOLFSSL_MSG("HelloVerifyRequest received out of order"); + return OUT_OF_ORDER_E; + } + if (ssl->options.side == WOLFSSL_SERVER_END) { + WOLFSSL_MSG("HelloVerifyRequest recevied on the server"); + return SIDE_ERROR; + } + if (!ssl->options.downgrade || + ssl->options.minDowngrade < DTLSv1_2_MINOR) { + WOLFSSL_MSG( + "HelloVerifyRequest recevied but not DTLSv1.2 allowed"); + return VERSION_ERROR; + } + break; +#endif /* WOLFSSL_DTLS13 && !WOLFSSL_NO_TLS12*/ default: WOLFSSL_MSG("Unknown message type"); @@ -9234,7 +9363,11 @@ int DoTls13HandShakeMsgType(WOLFSSL* ssl, byte* input, word32* inOutIdx, if (ssl->options.side == WOLFSSL_CLIENT_END && ssl->options.serverState == NULL_STATE && - type != server_hello && type != hello_retry_request) { + type != server_hello && type != hello_retry_request +#if defined(WOLFSSL_DTLS13) && !defined(WOLFSSL_NO_TLS12) + && (!ssl->options.dtls || type != hello_verify_request) +#endif /* defined(WOLFSSL_DTLS13) && !defined(WOLFSSL_NO_TLS12) */ + ) { WOLFSSL_MSG("First server message not server hello"); SendAlert(ssl, alert_fatal, unexpected_message); return OUT_OF_ORDER_E; @@ -9328,6 +9461,12 @@ int DoTls13HandShakeMsgType(WOLFSSL* ssl, byte* input, word32* inOutIdx, ret = DoTls13KeyUpdate(ssl, input, inOutIdx, size); break; +#if defined(WOLFSSL_DTLS13) && !defined(WOLFSSL_NO_TLS12) + case hello_verify_request: + WOLFSSL_MSG("processing hello verify request"); + ret = DoHelloVerifyRequest(ssl, input, inOutIdx, size); + break; +#endif default: WOLFSSL_MSG("Unknown handshake message type"); ret = UNKNOWN_HANDSHAKE_TYPE; @@ -9342,9 +9481,6 @@ int DoTls13HandShakeMsgType(WOLFSSL* ssl, byte* input, word32* inOutIdx, type != key_update) { ret = HashInput(ssl, input + inIdx, size); } - if (ret == 0 && ssl->buffers.inputBuffer.dynamicFlag) { - ShrinkInputBuffer(ssl, NO_FORCED_FREE); - } if (ret == BUFFER_ERROR || ret == MISSING_HANDSHAKE_DATA) SendAlert(ssl, alert_fatal, decode_error); diff --git a/src/wolfio.c b/src/wolfio.c index b860f3d6f..7a958d0ab 100644 --- a/src/wolfio.c +++ b/src/wolfio.c @@ -1,6 +1,6 @@ /* wolfio.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -514,12 +514,24 @@ int EmbedSendTo(WOLFSSL* ssl, char *buf, int sz, void *ctx) WOLFSSL_DTLS_CTX* dtlsCtx = (WOLFSSL_DTLS_CTX*)ctx; int sd = dtlsCtx->wfd; int sent; + const SOCKADDR_S* peer = NULL; + XSOCKLENT peerSz = 0; + int type; + XSOCKLENT length = sizeof(int); /* optvalue 'type' is of size int */ WOLFSSL_ENTER("EmbedSendTo()"); + if (getsockopt(sd, SOL_SOCKET, SO_TYPE, &type, &length) == 0 && + type != SOCK_DGRAM) { + /* Probably a TCP socket. peer and peerSz MUST be NULL and 0 */ + } + else if (!dtlsCtx->connected) { + peer = (const SOCKADDR_S*)dtlsCtx->peer.sa; + peerSz = dtlsCtx->peer.sz; + } + sent = (int)DTLS_SENDTO_FUNCTION(sd, buf, sz, ssl->wflags, - !dtlsCtx->connected ? (const SOCKADDR*)dtlsCtx->peer.sa : NULL, - !dtlsCtx->connected ? dtlsCtx->peer.sz : 0); + (const SOCKADDR*)peer, peerSz); sent = TranslateReturnCode(sent, sd); diff --git a/src/x509.c b/src/x509.c index 3655369d7..4bc4cd95d 100644 --- a/src/x509.c +++ b/src/x509.c @@ -1,6 +1,6 @@ /* x509.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -1193,8 +1193,10 @@ int wolfSSL_X509V3_EXT_print(WOLFSSL_BIO *out, WOLFSSL_X509_EXTENSION *ext, { char isCa[] = "TRUE"; char notCa[] = "FALSE"; - XSNPRINTF(tmp, sz, "%*sCA:%s", indent, "", - obj->ca ? isCa : notCa); + if (XSNPRINTF(tmp, sz, "%*sCA:%s", indent, "", + obj->ca ? isCa : notCa) + >= sz) + return rc; break; } case ALT_NAMES_OID: @@ -1221,11 +1223,17 @@ int wolfSSL_X509V3_EXT_print(WOLFSSL_BIO *out, WOLFSSL_X509_EXTENSION *ext, WOLFSSL_MSG("Memory error"); return rc; } - if (sk->next) - XSNPRINTF(val, len, "%*s%s,", indent, "", str->strData); - else - XSNPRINTF(val, len, "%*s%s", indent, "", str->strData); - + if (sk->next) { + if (XSNPRINTF(val, len, "%*s%s,", + indent, "", str->strData) + >= len) + return rc; + } else { + if (XSNPRINTF(val, len, "%*s%s", + indent, "", str->strData) + >= len) + return rc; + } XSTRNCAT(tmp, val, len); XFREE(val, NULL, DYNAMIC_TYPE_TMP_BUFFER); } @@ -1238,7 +1246,9 @@ int wolfSSL_X509V3_EXT_print(WOLFSSL_BIO *out, WOLFSSL_X509_EXTENSION *ext, { char* asn1str; asn1str = wolfSSL_i2s_ASN1_STRING(NULL, str); - XSNPRINTF(tmp, sz, "%*s%s", indent, "", asn1str); + if (XSNPRINTF(tmp, sz, "%*s%s", indent, "", asn1str) + >= sz) + return rc; XFREE(asn1str, NULL, DYNAMIC_TYPE_TMP_BUFFER); break; } @@ -1250,7 +1260,9 @@ int wolfSSL_X509V3_EXT_print(WOLFSSL_BIO *out, WOLFSSL_X509_EXTENSION *ext, break; default: - XSNPRINTF(tmp, sz, "%*s%s", indent, "", str->strData); + if (XSNPRINTF(tmp, sz, "%*s%s", indent, "", str->strData) + >= sz) + return rc; } if (wolfSSL_BIO_write(out, tmp, (int)XSTRLEN(tmp)) == (int)XSTRLEN(tmp)) { @@ -3051,7 +3063,10 @@ char* wolfSSL_X509_get_name_oneline(WOLFSSL_X509_NAME* name, char* in, int sz) WOLFSSL_MSG("Memory error"); return NULL; } - XSNPRINTF(str, strSz, "%s=%s, ", sn, buf); + if (XSNPRINTF(str, strSz, "%s=%s, ", sn, buf) >= strSz) { + WOLFSSL_MSG("buffer overrun"); + return NULL; + } } else { /* Copy last name entry @@ -3064,7 +3079,10 @@ char* wolfSSL_X509_get_name_oneline(WOLFSSL_X509_NAME* name, char* in, int sz) WOLFSSL_MSG("Memory error"); return NULL; } - XSNPRINTF(str, strSz, "%s=%s", sn, buf); + if (XSNPRINTF(str, strSz, "%s=%s", sn, buf) >= strSz) { + WOLFSSL_MSG("buffer overrun"); + return NULL; + } } /* Copy string to tmpBuf */ XSTRNCAT(tmpBuf, str, strSz); @@ -5478,7 +5496,13 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, (int)XSTRLEN(" Version:")) <= 0) { return WOLFSSL_FAILURE; } - XSNPRINTF(tmp, sizeof(tmp), " %d (0x%x)\n", version, (byte)version-1); + if (XSNPRINTF(tmp, sizeof(tmp), " %d (0x%x)\n", + version, (byte)version-1) + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } if (wolfSSL_BIO_write(bio, tmp, (int)XSTRLEN(tmp)) <= 0) { return WOLFSSL_FAILURE; } @@ -5503,7 +5527,12 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, /* if serial can fit into byte than print on the same line */ if (sz <= (int)sizeof(byte)) { char tmp[17]; - XSNPRINTF(tmp, sizeof(tmp), " %d (0x%x)\n", serial[0],serial[0]); + if (XSNPRINTF(tmp, sizeof(tmp), " %d (0x%x)\n", serial[0],serial[0]) + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } if (wolfSSL_BIO_write(bio, tmp, (int)XSTRLEN(tmp)) <= 0) { return WOLFSSL_FAILURE; } @@ -5522,11 +5551,21 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, } tmp[0] = '\0'; for (i = 0; i < sz - 1 && (3 * i) < tmpSz - valSz; i++) { - XSNPRINTF(val, sizeof(val) - 1, "%02x:", serial[i]); + if (XSNPRINTF(val, sizeof(val), "%02x:", serial[i]) + >= (int)sizeof(val)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } val[3] = '\0'; /* make sure is null terminated */ XSTRNCAT(tmp, val, valSz); } - XSNPRINTF(val, sizeof(val) - 1, "%02x\n", serial[i]); + if (XSNPRINTF(val, sizeof(val), "%02x\n", serial[i]) + >= (int)sizeof(val)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } val[3] = '\0'; /* make sure is null terminated */ XSTRNCAT(tmp, val, valSz); if (wolfSSL_BIO_write(bio, tmp, (int)XSTRLEN(tmp)) <= 0) { @@ -5748,9 +5787,14 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, #endif return WOLFSSL_FAILURE; } - XSNPRINTF(tmp, sizeof(tmp) - 1, "%s%s: (%d bit)\n%s\n", + if (XSNPRINTF(tmp, sizeof(tmp), "%s%s: (%d bit)\n%s\n", " ", "Public-Key", 8 * sz, - " Modulus:"); + " Modulus:") + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } tmp[sizeof(tmp) - 1] = '\0'; if (wolfSSL_BIO_write(bio, tmp, (int)XSTRLEN(tmp)) <= 0) { @@ -5762,7 +5806,12 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, } /* print out modulus */ - XSNPRINTF(tmp, sizeof(tmp) - 1," "); + if (XSNPRINTF(tmp, sizeof(tmp), " ") + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } tmp[sizeof(tmp) - 1] = '\0'; if (mp_leading_bit(&rsa->n)) { lbit = 1; @@ -5783,10 +5832,15 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, mp_to_unsigned_bin(&rsa->n, rawKey); for (idx = 0; idx < (word32)rawLen; idx++) { char val[5]; - int valSz = 5; + int valSz = (int)sizeof(val); if ((idx == 0) && !lbit) { - XSNPRINTF(val, valSz - 1, "%02x", rawKey[idx]); + if (XSNPRINTF(val, valSz, "%02x", rawKey[idx]) + >= valSz) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } } else if ((idx != 0) && (((idx + lbit) % 15) == 0)) { tmp[sizeof(tmp) - 1] = '\0'; @@ -5800,12 +5854,27 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, #endif return WOLFSSL_FAILURE; } - XSNPRINTF(tmp, sizeof(tmp) - 1, - ":\n "); - XSNPRINTF(val, valSz - 1, "%02x", rawKey[idx]); + if (XSNPRINTF(tmp, sizeof(tmp), + ":\n ") + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } + if (XSNPRINTF(val, valSz, "%02x", rawKey[idx]) + >= valSz) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } } else { - XSNPRINTF(val, valSz - 1, ":%02x", rawKey[idx]); + if (XSNPRINTF(val, valSz, ":%02x", rawKey[idx]) + >= valSz) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } } XSTRNCAT(tmp, val, valSz); } @@ -5856,8 +5925,13 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, idx = ByteReverseWord32(idx); #endif } - XSNPRINTF(tmp, sizeof(tmp) - 1, - "\n Exponent: %u (0x%x)\n",idx, idx); + if (XSNPRINTF(tmp, sizeof(tmp), + "\n Exponent: %u (0x%x)\n",idx, idx) + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } if (wolfSSL_BIO_write(bio, tmp, (int)XSTRLEN(tmp)) <= 0) { XFREE(rawKey, NULL, DYNAMIC_TYPE_TMP_BUFFER); @@ -5915,10 +5989,15 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, #endif return WOLFSSL_FAILURE; } - XSNPRINTF(tmp, sizeof(tmp) - 1, "%s%s: (%d bit)\n%s\n", + if (XSNPRINTF(tmp, sizeof(tmp), "%s%s: (%d bit)\n%s\n", " ", "Public-Key", 8 * wc_ecc_size(ecc), - " pub:"); + " pub:") + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } tmp[sizeof(tmp) - 1] = '\0'; if (wolfSSL_BIO_write(bio, tmp, (int)XSTRLEN(tmp)) <= 0) { @@ -5928,7 +6007,12 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, #endif return WOLFSSL_FAILURE; } - XSNPRINTF(tmp, sizeof(tmp) - 1," "); + if (XSNPRINTF(tmp, sizeof(tmp)," ") + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } { word32 derSz; byte* der; @@ -5959,7 +6043,12 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int valSz = 5; if (i == 0) { - XSNPRINTF(val, valSz - 1, "%02x", der[i]); + if (XSNPRINTF(val, valSz, "%02x", der[i]) + >= valSz) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } } else if ((i % 15) == 0) { tmp[sizeof(tmp) - 1] = '\0'; @@ -5973,12 +6062,27 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, DYNAMIC_TYPE_TMP_BUFFER); return WOLFSSL_FAILURE; } - XSNPRINTF(tmp, sizeof(tmp) - 1, - ":\n "); - XSNPRINTF(val, valSz - 1, "%02x", der[i]); + if (XSNPRINTF(tmp, sizeof(tmp), + ":\n ") + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } + if (XSNPRINTF(val, valSz, "%02x", der[i]) + >= valSz) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } } else { - XSNPRINTF(val, valSz - 1, ":%02x", der[i]); + if (XSNPRINTF(val, valSz, ":%02x", der[i]) + >= valSz) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } } XSTRNCAT(tmp, val, valSz); } @@ -6000,9 +6104,14 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, XFREE(der, x509->heap, DYNAMIC_TYPE_TMP_BUFFER); } - XSNPRINTF(tmp, sizeof(tmp) - 1, "\n%s%s: %s\n", + if (XSNPRINTF(tmp, sizeof(tmp), "\n%s%s: %s\n", " ", "ASN1 OID", - ecc->dp->name); + ecc->dp->name) + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } if (wolfSSL_BIO_write(bio, tmp, (int)XSTRLEN(tmp)) <= 0) { wc_ecc_free(ecc); @@ -6038,8 +6147,13 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, char val[5]; int valSz = 5; - XSNPRINTF(tmp, sizeof(tmp), - " X509v3 Subject Key Identifier: "); + if (XSNPRINTF(tmp, sizeof(tmp), + " X509v3 Subject Key Identifier: ") + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } if (x509->subjKeyIdCrit) { XSTRNCAT(tmp, "critical", sizeof(tmp) - XSTRLEN(tmp) - 1); } @@ -6050,12 +6164,27 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, } XMEMSET(tmp, 0, sizeof(tmp)); - XSNPRINTF(tmp, sizeof(tmp) - 1, " "); + if (XSNPRINTF(tmp, sizeof(tmp), " ") + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } for (i = 0; i < sizeof(tmp) && i < (x509->subjKeyIdSz - 1); i++) { - XSNPRINTF(val, valSz - 1, "%02X:", x509->subjKeyId[i]); + if (XSNPRINTF(val, valSz, "%02X:", x509->subjKeyId[i]) + >= valSz) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } XSTRNCAT(tmp, val, valSz); } - XSNPRINTF(val, valSz - 1, "%02X\n", x509->subjKeyId[i]); + if (XSNPRINTF(val, valSz, "%02X\n", x509->subjKeyId[i]) + >= valSz) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } XSTRNCAT(tmp, val, valSz); if (wolfSSL_BIO_write(bio, tmp, (int)XSTRLEN(tmp)) <= 0) { return WOLFSSL_FAILURE; @@ -6071,8 +6200,13 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int valSz = 5; int len = 0; - XSNPRINTF(tmp, sizeof(tmp), - " X509v3 Authority Key Identifier: "); + if (XSNPRINTF(tmp, sizeof(tmp), + " X509v3 Authority Key Identifier: ") + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } if (x509->authKeyIdCrit) { XSTRNCAT(tmp, "critical", sizeof(tmp) - XSTRLEN(tmp) - 1); } @@ -6083,7 +6217,12 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, } XMEMSET(tmp, 0, sizeof(tmp)); - XSNPRINTF(tmp, sizeof(tmp) - 1, " keyid"); + if (XSNPRINTF(tmp, sizeof(tmp), " keyid") + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } for (i = 0; i < x509->authKeyIdSz; i++) { /* check if buffer is almost full */ if (XSTRLEN(tmp) >= sizeof(tmp) - valSz) { @@ -6092,7 +6231,12 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, } tmp[0] = '\0'; } - XSNPRINTF(val, valSz - 1, ":%02X", x509->authKeyId[i]); + if (XSNPRINTF(val, valSz, ":%02X", x509->authKeyId[i]) + >= valSz) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } XSTRNCAT(tmp, val, valSz); } len = (int)XSTRLEN("\n"); @@ -6106,8 +6250,13 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, if (x509->basicConstSet) { char tmp[100]; - XSNPRINTF(tmp, sizeof(tmp), - "\n X509v3 Basic Constraints: "); + if (XSNPRINTF(tmp, sizeof(tmp), + "\n X509v3 Basic Constraints: ") + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } if (x509->basicConstCrit) { XSTRNCAT(tmp, "critical", sizeof(tmp) - XSTRLEN(tmp) - 1); } @@ -6118,9 +6267,14 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, } XMEMSET(tmp, 0, sizeof(tmp)); - XSNPRINTF(tmp, sizeof(tmp), + if (XSNPRINTF(tmp, sizeof(tmp), " CA:%s\n", - (x509->isCa)? "TRUE": "FALSE"); + (x509->isCa)? "TRUE": "FALSE") + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } if (wolfSSL_BIO_write(bio, tmp, (int)XSTRLEN(tmp)) <= 0) { return WOLFSSL_FAILURE; } @@ -6143,7 +6297,12 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, (int)XSTRLEN(" Signature Algorithm: ")) <= 0) { return WOLFSSL_FAILURE; } - XSNPRINTF(tmp, sizeof(tmp) - 1,"%s\n", GetSigName(sigOid)); + if (XSNPRINTF(tmp, sizeof(tmp),"%s\n", GetSigName(sigOid)) + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } tmp[sizeof(tmp) - 1] = '\0'; if (wolfSSL_BIO_write(bio, tmp, (int)XSTRLEN(tmp)) <= 0) { return WOLFSSL_FAILURE; @@ -6159,14 +6318,24 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, XFREE(sig, NULL, DYNAMIC_TYPE_TMP_BUFFER); return WOLFSSL_FAILURE; } - XSNPRINTF(tmp, sizeof(tmp) - 1," "); + if (XSNPRINTF(tmp, sizeof(tmp)," ") + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } tmp[sizeof(tmp) - 1] = '\0'; for (i = 0; i < sigSz; i++) { char val[5]; int valSz = 5; if (i == 0) { - XSNPRINTF(val, valSz - 1, "%02x", sig[i]); + if (XSNPRINTF(val, valSz, "%02x", sig[i]) + >= valSz - 1) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } } else if (((i % 18) == 0)) { tmp[sizeof(tmp) - 1] = '\0'; @@ -6175,12 +6344,27 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, XFREE(sig, NULL, DYNAMIC_TYPE_TMP_BUFFER); return WOLFSSL_FAILURE; } - XSNPRINTF(tmp, sizeof(tmp) - 1, - ":\n "); - XSNPRINTF(val, valSz - 1, "%02x", sig[i]); + if (XSNPRINTF(tmp, sizeof(tmp), + ":\n ") + >= (int)sizeof(tmp)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } + if (XSNPRINTF(val, valSz, "%02x", sig[i]) + >= valSz) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } } else { - XSNPRINTF(val, valSz - 1, ":%02x", sig[i]); + if (XSNPRINTF(val, valSz, ":%02x", sig[i]) + >= valSz) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } } XSTRNCAT(tmp, val, valSz); } @@ -6278,8 +6462,13 @@ int wolfSSL_X509_signature_print(WOLFSSL_BIO *bp, for (i = 0; i < length; ++i) { char hex_digits[4]; #ifdef XSNPRINTF - XSNPRINTF(hex_digits, sizeof(hex_digits), "%c%02X", i>0 ? ':' : ' ', - (unsigned int)sigalg->algorithm->obj[idx+i]); + if (XSNPRINTF(hex_digits, sizeof(hex_digits), "%c%02X", i>0 ? ':' : ' ', + (unsigned int)sigalg->algorithm->obj[idx+i]) + >= (int)sizeof(hex_digits)) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } #else XSPRINTF(hex_digits, "%c%02X", i>0 ? ':' : ' ', (unsigned int)sigalg->algorithm->obj[idx+i]); @@ -11422,11 +11611,21 @@ int wolfSSL_X509_NAME_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509_NAME* name, } if (i < count - 1) { - XSNPRINTF(tmp, tmpSz, "%s=%s,", buf, nameStr); + if (XSNPRINTF(tmp, tmpSz, "%s=%s,", buf, nameStr) + >= tmpSz) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } tmpSz = len + nameStrSz + 2; /* 2 for '=', comma */ } else { - XSNPRINTF(tmp, tmpSz, "%s=%s", buf, nameStr); + if (XSNPRINTF(tmp, tmpSz, "%s=%s", buf, nameStr) + >= tmpSz) + { + WOLFSSL_MSG("buffer overrun"); + return WOLFSSL_FAILURE; + } tmpSz = len + nameStrSz + 1; /* 1 for '=' */ if (bio->type != WOLFSSL_BIO_FILE) ++tmpSz; /* include the terminating null when not writing to a diff --git a/src/x509_str.c b/src/x509_str.c index fc35572fa..8a498a87a 100644 --- a/src/x509_str.c +++ b/src/x509_str.c @@ -1,6 +1,6 @@ /* x509_str.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/sslSniffer/sslSnifferTest/snifftest.c b/sslSniffer/sslSnifferTest/snifftest.c index aaadee048..6c7060c5e 100644 --- a/sslSniffer/sslSnifferTest/snifftest.c +++ b/sslSniffer/sslSnifferTest/snifftest.c @@ -1,6 +1,6 @@ /* snifftest.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -330,7 +330,7 @@ static int myStoreDataCb(const unsigned char* decryptBuf, /* try and load as both static ephemeral and private key */ /* only fail if no key is loaded */ -/* Allow comma seperated list of files */ +/* Allow comma separated list of files */ static int load_key(const char* name, const char* server, int port, const char* keyFiles, const char* passwd, char* err) { diff --git a/tests/api.c b/tests/api.c index 7e2e14ddc..d02c496a1 100644 --- a/tests/api.c +++ b/tests/api.c @@ -1,6 +1,6 @@ /* api.c API unit tests * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -338,9 +338,10 @@ #if (defined(SESSION_CERTS) && defined(TEST_PEER_CERT_CHAIN)) || \ defined(HAVE_SESSION_TICKET) || (defined(OPENSSL_EXTRA) && \ defined(WOLFSSL_CERT_EXT) && defined(WOLFSSL_CERT_GEN)) || \ - defined(WOLFSSL_TEST_STATIC_BUILD) + defined(WOLFSSL_TEST_STATIC_BUILD) || defined(WOLFSSL_DTLS) /* for testing SSL_get_peer_cert_chain, or SESSION_TICKET_HINT_DEFAULT, - * or for setting authKeyIdSrc in WOLFSSL_X509 */ + * for setting authKeyIdSrc in WOLFSSL_X509, or testing DTLS sequence + * number tracking */ #include "wolfssl/internal.h" #endif @@ -21803,20 +21804,20 @@ static int test_wc_curve25519_export_key_raw (void) if(0 != wc_InitRng(&rng)){ printf(testingFmt, "failed due to wc_InitRng"); - fflush( stdout ); + fflush(stdout); return 1; } if(0 != wc_curve25519_init(&key)){ printf(testingFmt, "failed due to wc_curve25519_init"); - fflush( stdout ); + fflush(stdout); wc_FreeRng(&rng); return 1; } if(0 != wc_curve25519_make_key(&rng, CURVE25519_KEYSIZE, &key)){ printf(testingFmt, "failed due to wc_curve25519_make_key"); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -21833,7 +21834,7 @@ static int test_wc_curve25519_export_key_raw (void) NULL , privateKey, &prvkSz, publicKey, &pubkSz)){ printf(testingFmt,"failed at bad-arg-case-1."); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -21847,7 +21848,7 @@ static int test_wc_curve25519_export_key_raw (void) &key , NULL, &prvkSz, publicKey, &pubkSz)){ printf(testingFmt,"failed at bad-arg-case-2."); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -21861,7 +21862,7 @@ static int test_wc_curve25519_export_key_raw (void) &key , privateKey, NULL, publicKey, &pubkSz)){ printf(testingFmt,"failed at bad-arg-case-3."); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -21875,7 +21876,7 @@ static int test_wc_curve25519_export_key_raw (void) &key , privateKey, &prvkSz, NULL, &pubkSz)){ printf(testingFmt,"failed at bad-arg-case-4."); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -21889,7 +21890,7 @@ static int test_wc_curve25519_export_key_raw (void) &key , privateKey, &prvkSz, publicKey, NULL )){ printf(testingFmt,"failed at bad-arg-case-5."); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -21904,7 +21905,7 @@ static int test_wc_curve25519_export_key_raw (void) if( 0 != wc_curve25519_export_private_raw(&key, prik, &prksz)){ printf(testingFmt,"failed due to wc_curve25519_export_private_raw"); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -21916,7 +21917,7 @@ static int test_wc_curve25519_export_key_raw (void) if(0 != wc_curve25519_export_public(&key, pubk, &pbksz)){ printf(testingFmt,"failed due to wc_curve25519_export_public"); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -21930,7 +21931,7 @@ static int test_wc_curve25519_export_key_raw (void) publicKey, &pubkSz)){ printf(testingFmt,"failed due to wc_curve25519_export_key_raw"); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -21946,7 +21947,7 @@ static int test_wc_curve25519_export_key_raw (void) 0 == XMEMCMP(publicKey, pubk, CURVE25519_KEYSIZE)){ printf(resultFmt,passed); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 0; @@ -21955,7 +21956,7 @@ static int test_wc_curve25519_export_key_raw (void) else{ printf(testingFmt,"failed due to key-contents-inconsistency."); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -21964,14 +21965,14 @@ static int test_wc_curve25519_export_key_raw (void) else{ printf(testingFmt,"failed due to bad-key-size."); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; } #endif - fflush( stdout ); + fflush(stdout); return 0; } /* end of test_wc_curve25519_export_key_raw */ @@ -22001,20 +22002,20 @@ static int test_wc_curve25519_export_key_raw_ex (void) if(0 != wc_InitRng(&rng)){ printf(testingFmt, "failed due to wc_InitRng"); - fflush( stdout ); + fflush(stdout); return 1; } if(0 != wc_curve25519_init(&key)){ printf(testingFmt, "failed due to wc_curve25519_init"); - fflush( stdout ); + fflush(stdout); wc_FreeRng(&rng); return 1; } if(0 != wc_curve25519_make_key(&rng, CURVE25519_KEYSIZE, &key)){ printf(testingFmt, "failed due to wc_curve25519_make_key"); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22031,7 +22032,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) &prvkSz, publicKey, &pubkSz, EC25519_LITTLE_ENDIAN)){ printf(testingFmt,"failed at bad-arg-case-1."); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22045,7 +22046,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) &prvkSz, publicKey, &pubkSz, EC25519_LITTLE_ENDIAN)){ printf(testingFmt,"failed at bad-arg-case-2."); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22058,7 +22059,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) NULL,publicKey, &pubkSz,EC25519_LITTLE_ENDIAN)){ printf(testingFmt,"failed at bad-arg-case-3."); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22071,7 +22072,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) &prvkSz, NULL, &pubkSz, EC25519_LITTLE_ENDIAN)){ printf(testingFmt,"failed at bad-arg-case-4."); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22084,7 +22085,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) &prvkSz, publicKey, NULL, EC25519_LITTLE_ENDIAN)){ printf(testingFmt,"failed at bad-arg-case-5."); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22097,7 +22098,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) &prvkSz, publicKey, &pubkSz, EC25519_BIG_ENDIAN)){ printf(testingFmt,"failed at bad-arg-case-6."); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22110,7 +22111,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) publicKey, &pubkSz, EC25519_BIG_ENDIAN)){ printf(testingFmt,"failed at bad-arg-case-7."); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22123,7 +22124,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) NULL, publicKey, &pubkSz, EC25519_BIG_ENDIAN)){ printf(testingFmt,"failed at bad-arg-case-8."); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22136,7 +22137,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) &prvkSz, NULL, &pubkSz, EC25519_BIG_ENDIAN)){ printf(testingFmt,"failed at bad-arg-case-9."); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22149,7 +22150,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) &prvkSz, publicKey, NULL, EC25519_BIG_ENDIAN)){ printf(testingFmt,"failed at bad-arg-case-10."); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22164,7 +22165,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) &prvkSz, publicKey, NULL, EC25519_BIG_ENDIAN + 10 )){ printf(testingFmt,"failed at bad-arg-case-11."); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22178,7 +22179,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) if(0 != wc_curve25519_export_private_raw( &key, prik, &prksz )){ printf(testingFmt,"failed due to wc_curve25519_export_private_raw"); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22189,7 +22190,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) if(0 != wc_curve25519_export_public( &key, pubk, &pbksz )){ printf(testingFmt,"failed due to wc_curve25519_export_public"); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22203,7 +22204,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) publicKey, &pubkSz, EC25519_BIG_ENDIAN)) { printf(testingFmt,"failed due to wc_curve25519_export_key_raw_ex"); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22228,7 +22229,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) else{ printf(testingFmt,"failed due to key-size-inconsistency"); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22238,7 +22239,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) printf(testingFmt, "failed due to wc_curve25519_export_key_raw_ex"); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22248,7 +22249,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) else{ printf(testingFmt,"failed due to key-contents-inconsistency"); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22258,7 +22259,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) else{ printf(testingFmt,"failed due to bad-key-size"); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22279,7 +22280,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) /* no more test*/ printf(resultFmt, passed ); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 0; @@ -22287,7 +22288,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) else{ printf(testingFmt,"failed due to key-size-inconsistency"); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22297,7 +22298,7 @@ static int test_wc_curve25519_export_key_raw_ex (void) printf(testingFmt, "failed due to wc_curve25519_export_key_raw_ex(BIGENDIAN)"); - fflush( stdout ); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); return 1; @@ -22481,6 +22482,7 @@ static int test_wc_curve25519_shared_secret_ex(void) printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_curve25519_free(&private_key); wc_curve25519_free(&public_key); wc_FreeRng(&rng); @@ -22550,6 +22552,7 @@ static int test_wc_curve25519_make_pub(void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); #endif @@ -22619,6 +22622,7 @@ static int test_wc_curve25519_export_public_ex (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); #endif @@ -22711,6 +22715,7 @@ static int test_wc_curve25519_import_private_raw_ex (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); @@ -22747,6 +22752,7 @@ static int test_wc_curve25519_import_private (void) ret = wc_curve25519_import_private(priv, privSz, &key); } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_curve25519_free(&key); wc_FreeRng(&rng); #endif @@ -22810,6 +22816,7 @@ static int test_wc_curve25519_export_private_raw_ex (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_curve25519_free(&key); #endif return ret; @@ -22856,6 +22863,7 @@ static int test_wc_ed448_make_key (void) printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -22894,6 +22902,7 @@ static int test_wc_ed448_init (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_ed448_free(&key); @@ -22963,6 +22972,7 @@ static int test_wc_ed448_sign_msg (void) } /* END sign */ printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #ifdef HAVE_ED448_VERIFY printf(testingFmt, "wc_ed448_verify_msg()"); @@ -23015,6 +23025,7 @@ static int test_wc_ed448_sign_msg (void) } /* END verify. */ printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif /* Verify. */ if (wc_FreeRng(&rng) && ret == 0) { @@ -23078,6 +23089,7 @@ static int test_wc_ed448_import_public (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -23179,6 +23191,7 @@ static int test_wc_ed448_import_private_key (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -23245,6 +23258,7 @@ static int test_wc_ed448_export (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); printf(testingFmt, "wc_ed448_export_private_only()"); if (ret == 0) { @@ -23270,6 +23284,7 @@ static int test_wc_ed448_export (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -23318,6 +23333,7 @@ static int test_wc_ed448_size (void) } } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (ret == 0) { printf(testingFmt, "wc_ed448_sig_size()"); @@ -23335,6 +23351,7 @@ static int test_wc_ed448_size (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); } /* END wc_ed448_sig_size() */ if (ret == 0) { @@ -23350,6 +23367,7 @@ static int test_wc_ed448_size (void) } } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); } /* END wc_ed448_pub_size */ if (ret == 0) { @@ -23365,6 +23383,7 @@ static int test_wc_ed448_size (void) } } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); } /* END wc_ed448_pub_size */ if (wc_FreeRng(&rng) && ret == 0) { @@ -23429,6 +23448,7 @@ static int test_wc_ed448_exportKey (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (ret == 0) { printf(testingFmt, "wc_ed448_export_key()"); @@ -23455,6 +23475,7 @@ static int test_wc_ed448_exportKey (void) } } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); } /* END wc_ed448_export_key() */ /* Cross check output. */ @@ -23531,6 +23552,7 @@ static int test_wc_Ed448PublicKeyToDer (void) wc_ed448_free(&key); } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif return ret; @@ -23561,6 +23583,7 @@ static int test_wc_curve448_init (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); /* Test good args for wc_curve_448_free */ wc_curve448_free(&key); @@ -23633,6 +23656,7 @@ static int test_wc_curve448_make_key (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_curve448_free(&key); #endif return ret; @@ -23718,6 +23742,7 @@ static int test_wc_curve448_shared_secret_ex (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_curve448_free(&private_key); wc_curve448_free(&public_key); wc_FreeRng(&rng); @@ -23788,6 +23813,7 @@ static int test_wc_curve448_export_public_ex (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_curve448_free(&key); wc_FreeRng(&rng); #endif @@ -23851,6 +23877,7 @@ static int test_wc_curve448_export_private_raw_ex (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_curve448_free(&key); #endif return ret; @@ -23944,6 +23971,7 @@ static int test_wc_curve448_import_private_raw_ex (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_curve448_free(&key); #endif @@ -23984,6 +24012,7 @@ static int test_wc_curve448_export_key_raw (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_curve448_free(&key); wc_FreeRng(&rng); #endif @@ -24022,6 +24051,7 @@ static int test_wc_curve448_import_private (void) ret = wc_curve448_import_private(priv, privSz, &key); } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_curve448_free(&key); wc_FreeRng(&rng); #endif @@ -24054,6 +24084,7 @@ static int test_wc_curve448_size (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_curve448_free(&key); #endif return ret; @@ -24108,6 +24139,7 @@ static int test_wc_ecc_make_key (void) #endif printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif return ret; @@ -24139,6 +24171,7 @@ static int test_wc_ecc_init (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_ecc_free(&key); @@ -24189,6 +24222,7 @@ static int test_wc_ecc_check_key (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -24242,6 +24276,7 @@ static int test_wc_ecc_get_generator(void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_ecc_del_point(pt); #endif @@ -24290,6 +24325,7 @@ static int test_wc_ecc_size (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -24571,6 +24607,7 @@ static int test_wc_ecc_shared_secret (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -24642,6 +24679,7 @@ static int test_wc_ecc_export_x963 (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -24715,7 +24753,12 @@ static int test_wc_ecc_export_x963_ex (void) if (ret == BAD_FUNC_ARG) { ret = wc_ecc_export_x963_ex(&key, out, &badOutLen, COMP); } - if (ret == BUFFER_E) { +#if defined(HAVE_FIPS) && (!defined(FIPS_VERSION_LT) || FIPS_VERSION_LT(5,3)) + if (ret == BUFFER_E) +#else + if (ret == LENGTH_ONLY_E) +#endif + { key.idx = -4; ret = wc_ecc_export_x963_ex(&key, out, &outlen, COMP); } @@ -24750,6 +24793,7 @@ static int test_wc_ecc_export_x963_ex (void) #endif printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -24826,6 +24870,7 @@ static int test_wc_ecc_import_x963 (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -24909,6 +24954,7 @@ static int ecc_import_private_key (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -24976,6 +25022,7 @@ static int test_wc_ecc_export_private_only (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -25048,6 +25095,7 @@ static int test_wc_ecc_rs_to_sig (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); printf(testingFmt, "wc_ecc_sig_to_rs()"); if (ret == 0) { ret = wc_ecc_sig_to_rs(sig, siglen, r, &rlen, s, &slen); @@ -25075,6 +25123,7 @@ static int test_wc_ecc_rs_to_sig (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif return ret; @@ -25147,6 +25196,7 @@ static int test_wc_ecc_import_raw(void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_ecc_free(&key); @@ -25221,6 +25271,7 @@ static int test_wc_ecc_import_unsigned(void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_ecc_free(&key); @@ -25266,6 +25317,7 @@ static int test_wc_ecc_sig_size (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -25317,6 +25369,7 @@ static int test_wc_ecc_ctx_new (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -25366,6 +25419,7 @@ static int test_wc_ecc_ctx_reset (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -25418,6 +25472,7 @@ static int test_wc_ecc_ctx_set_peer_salt (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); printf(testingFmt, "wc_ecc_ctx_set_peer_salt()"); if (ret == 0) { @@ -25437,6 +25492,7 @@ static int test_wc_ecc_ctx_set_peer_salt (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -25490,6 +25546,7 @@ static int test_wc_ecc_ctx_set_info (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -25516,6 +25573,9 @@ static int test_wc_ecc_encryptDecrypt (void) word32 msgSz = (word32)XSTRLEN("EccBlock Size 16"); #ifdef WOLFSSL_ECIES_OLD byte out[(sizeof("EccBlock Size 16") - 1) + WC_SHA256_DIGEST_SIZE]; +#elif defined(WOLFSSL_ECIES_GEN_IV) + byte out[KEY20 * 2 + 1 + AES_BLOCK_SIZE + + (sizeof("EccBlock Size 16") - 1) + WC_SHA256_DIGEST_SIZE]; #else byte out[KEY20 * 2 + 1 + (sizeof("EccBlock Size 16") - 1) + WC_SHA256_DIGEST_SIZE]; #endif @@ -25598,6 +25658,7 @@ static int test_wc_ecc_encryptDecrypt (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); printf(testingFmt, "wc_ecc_decrypt()"); #ifdef WOLFSSL_ECIES_OLD @@ -25646,6 +25707,7 @@ static int test_wc_ecc_encryptDecrypt (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -25677,6 +25739,7 @@ static int test_wc_ecc_del_point (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_ecc_del_point(pt); @@ -25766,6 +25829,7 @@ static int test_wc_ecc_pointFns (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); /* Import */ printf(testingFmt, "wc_ecc_import_point_der()"); @@ -25797,6 +25861,7 @@ static int test_wc_ecc_pointFns (void) } } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); /* Copy */ printf(testingFmt, "wc_ecc_copy_point()"); @@ -25818,6 +25883,7 @@ static int test_wc_ecc_pointFns (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); printf(testingFmt, "wc_ecc_cmp_point()"); /* Compare point */ @@ -25837,6 +25903,7 @@ static int test_wc_ecc_pointFns (void) } } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); printf(testingFmt, "wc_ecc_point_is_at_infinity()"); /* At infinity if return == 1, otherwise return == 0. */ @@ -25854,6 +25921,7 @@ static int test_wc_ecc_pointFns (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION>2)) #ifdef USE_ECC_B_PARAM @@ -25875,6 +25943,7 @@ static int test_wc_ecc_pointFns (void) } } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif /* USE_ECC_B_PARAM */ #endif /* !HAVE_FIPS || HAVE_FIPS_VERSION > 2 */ @@ -25980,6 +26049,7 @@ static int test_wc_ecc_shared_secret_ssh (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -26212,6 +26282,7 @@ static int test_wc_ecc_mulmod (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_ecc_free(&key1); wc_ecc_free(&key2); @@ -26275,6 +26346,7 @@ static int test_wc_ecc_is_valid_idx (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); if (wc_FreeRng(&rng) && ret == 0) { ret = WOLFSSL_FATAL_ERROR; @@ -26316,12 +26388,13 @@ static int test_wc_ecc_get_curve_id_from_oid (void) /* Good Case */ if (ret == 0) { ret = wc_ecc_get_curve_id_from_oid(oid, len); - if (ret == 7) { + if (ret == ECC_SECP256R1) { ret = 0; } } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif return ret; @@ -26356,7 +26429,8 @@ static int test_wc_ecc_sig_size_calc (void) ret = 0; } } - printf(resultFmt, ret == 0 ? passed : failed); + printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_ecc_free(&key); wc_FreeRng(&rng); #endif @@ -26409,6 +26483,7 @@ static int test_ToTraditional (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif return ret; }/* End test_ToTraditional*/ @@ -26490,6 +26565,7 @@ static int test_wc_EccPrivateKeyToDer (void) wc_FreeRng(&rng); printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif return ret; }/* End test_wc_EccPrivateKeyToDer*/ @@ -26573,19 +26649,20 @@ static int test_wc_Ed25519KeyToDer (void) ret = 0; } } - if (ret == 0) { - ret = wc_Ed25519KeyToDer(&ed25519Key, NULL, inLen); - if (ret == BAD_FUNC_ARG) { - ret = 0; - } - } if (ret == 0) { ret = wc_Ed25519KeyToDer(&ed25519Key, output, 0); if (ret == BAD_FUNC_ARG) { ret = 0; } } - /* Good Case */ + /* Good Cases */ + if (ret == 0) { + /* length only */ + ret = wc_Ed25519KeyToDer(&ed25519Key, NULL, inLen); + if (ret > 0) { + ret = 0; + } + } if (ret == 0) { ret = wc_Ed25519KeyToDer(&ed25519Key, output, inLen); if (ret > 0) { @@ -26597,6 +26674,7 @@ static int test_wc_Ed25519KeyToDer (void) wc_FreeRng(&rng); printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif return ret; }/* End test_wc_Ed25519KeyToDer*/ @@ -26639,19 +26717,20 @@ static int test_wc_Ed25519PrivateKeyToDer (void) ret = 0; } } - if (ret == 0) { - ret = wc_Ed25519PrivateKeyToDer(&ed25519PrivKey, NULL, inLen); - if (ret == BAD_FUNC_ARG) { - ret = 0; - } - } if (ret == 0) { ret = wc_Ed25519PrivateKeyToDer(&ed25519PrivKey, output, 0); if (ret == BAD_FUNC_ARG) { ret = 0; } } - /* Good Case */ + /* Good Cases */ + if (ret == 0) { + /* length only */ + ret = wc_Ed25519PrivateKeyToDer(&ed25519PrivKey, NULL, inLen); + if (ret > 0) { + ret = 0; + } + } if (ret == 0) { ret = wc_Ed25519PrivateKeyToDer(&ed25519PrivKey, output, inLen); if (ret > 0) { @@ -26663,6 +26742,7 @@ static int test_wc_Ed25519PrivateKeyToDer (void) wc_FreeRng(&rng); printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif return ret; }/* End test_wc_Ed25519PrivateKeyToDer*/ @@ -26704,19 +26784,20 @@ static int test_wc_Ed448KeyToDer (void) ret = 0; } } - if (ret == 0) { - ret = wc_Ed448KeyToDer(&ed448Key, NULL, inLen); - if (ret == BAD_FUNC_ARG) { - ret = 0; - } - } if (ret == 0) { ret = wc_Ed448KeyToDer(&ed448Key, output, 0); if (ret == BAD_FUNC_ARG) { ret = 0; } } - /* Good Case */ + /* Good Cases */ + if (ret == 0) { + /* length only */ + ret = wc_Ed448KeyToDer(&ed448Key, NULL, inLen); + if (ret > 0) { + ret = 0; + } + } if (ret == 0) { ret = wc_Ed448KeyToDer(&ed448Key, output, inLen); if (ret > 0) { @@ -26728,6 +26809,7 @@ static int test_wc_Ed448KeyToDer (void) wc_FreeRng(&rng); printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif return ret; }/* End test_wc_Ed448KeyToDer*/ @@ -26769,19 +26851,20 @@ static int test_wc_Ed448PrivateKeyToDer (void) ret = 0; } } - if (ret == 0) { - ret = wc_Ed448PrivateKeyToDer(&ed448PrivKey, NULL, inLen); - if (ret == BAD_FUNC_ARG) { - ret = 0; - } - } if (ret == 0) { ret = wc_Ed448PrivateKeyToDer(&ed448PrivKey, output, 0); if (ret == BAD_FUNC_ARG) { ret = 0; } } - /* Good case */ + /* Good cases */ + if (ret == 0) { + /* length only */ + ret = wc_Ed448PrivateKeyToDer(&ed448PrivKey, NULL, inLen); + if (ret > 0) { + ret = 0; + } + } if (ret == 0) { ret = wc_Ed448PrivateKeyToDer(&ed448PrivKey, output, inLen); if (ret > 0) { @@ -26793,6 +26876,7 @@ static int test_wc_Ed448PrivateKeyToDer (void) wc_FreeRng(&rng); printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif return ret; }/* End test_wc_Ed448PrivateKeyToDer*/ @@ -26841,6 +26925,7 @@ static int test_wc_SetSubjectBuffer (void) } XFREE(der, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER); printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif return ret; }/* End test_wc_SetSubjectBuffer*/ @@ -26932,6 +27017,7 @@ static int test_wc_SetSubjectKeyIdFromPublicKey_ex (void) #endif printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_FreeRng(&rng); #endif @@ -27024,6 +27110,7 @@ static int test_wc_SetAuthKeyIdFromPublicKey_ex (void) #endif printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); wc_FreeRng(&rng); #endif /*defined(WOLFSSL_CERT_EXT) && defined(WOLFSSL_CERT_GEN)*/ @@ -29359,6 +29446,7 @@ static int test_wc_SignatureGetSize_ecc(void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif /* NO_SIG_WRAPPER */ return ret; }/* END test_wc_SignatureGetSize_ecc() */ @@ -29627,6 +29715,7 @@ static int test_wc_HashSetFlags(void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif return ret; @@ -29729,6 +29818,7 @@ static int test_wc_HashGetFlags(void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif return ret; @@ -30578,7 +30668,7 @@ static void test_wc_GetPubKeyDerFromCert(void) XFCLOSE(fp); wc_InitDecodedCert(&decoded, certBuf, certBufSz, NULL); - ret = wc_ParseCert(&decoded, CERTREQ_TYPE, NO_VERIFY, NULL); + ret = wc_ParseCert(&decoded, CERTREQ_TYPE, VERIFY, NULL); AssertIntEQ(ret, 0); /* good test case - RSA DER certificate request */ @@ -32029,7 +32119,7 @@ static void test_wolfSSL_PEM_PUBKEY(void) file = XFOPEN(fname, "rb"); AssertTrue((file != XBADFILE)); - XFSEEK(file, 0, XSEEK_END); + AssertIntGE(XFSEEK(file, 0, XSEEK_END), 0); sz = XFTELL(file); XREWIND(file); AssertNotNull(buf = (byte*)XMALLOC(sz, NULL, DYNAMIC_TYPE_FILE)); @@ -35396,90 +35486,110 @@ static void test_generate_cookie(void) static void test_wolfSSL_set_options(void) { -#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS) && \ - !defined(NO_FILESYSTEM) && !defined(NO_RSA) - SSL* ssl; - SSL_CTX* ctx; +#if !defined(NO_CERTS) && !defined(NO_FILESYSTEM) && !defined(NO_RSA) + WOLFSSL* ssl; + WOLFSSL_CTX* ctx; +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) char appData[] = "extra msg"; - +#endif +#ifdef OPENSSL_EXTRA unsigned char protos[] = { 7, 't', 'l', 's', '/', '1', '.', '2', 8, 'h', 't', 't', 'p', '/', '1', '.', '1' }; unsigned int len = sizeof(protos); - void *arg = (void *)TEST_ARG; +#endif printf(testingFmt, "wolfSSL_set_options()"); #ifndef NO_WOLFSSL_SERVER - AssertNotNull(ctx = SSL_CTX_new(wolfSSLv23_server_method())); + AssertNotNull(ctx = wolfSSL_CTX_new(wolfSSLv23_server_method())); #else - AssertNotNull(ctx = SSL_CTX_new(wolfSSLv23_client_method())); + AssertNotNull(ctx = wolfSSL_CTX_new(wolfSSLv23_client_method())); #endif - AssertTrue(SSL_CTX_use_certificate_file(ctx, svrCertFile, SSL_FILETYPE_PEM)); - AssertTrue(SSL_CTX_use_PrivateKey_file(ctx, svrKeyFile, SSL_FILETYPE_PEM)); + AssertTrue(wolfSSL_CTX_use_certificate_file(ctx, svrCertFile, + WOLFSSL_FILETYPE_PEM)); + AssertTrue(wolfSSL_CTX_use_PrivateKey_file(ctx, svrKeyFile, + WOLFSSL_FILETYPE_PEM)); - AssertTrue(SSL_CTX_set_options(ctx, SSL_OP_NO_TLSv1) == SSL_OP_NO_TLSv1); - AssertTrue(SSL_CTX_get_options(ctx) == SSL_OP_NO_TLSv1); + AssertTrue(wolfSSL_CTX_set_options(ctx, WOLFSSL_OP_NO_TLSv1) + == WOLFSSL_OP_NO_TLSv1); + AssertTrue(wolfSSL_CTX_get_options(ctx) == WOLFSSL_OP_NO_TLSv1); - AssertIntGT((int)SSL_CTX_set_options(ctx, (SSL_OP_COOKIE_EXCHANGE | - SSL_OP_NO_SSLv2)), 0); - AssertTrue((SSL_CTX_set_options(ctx, SSL_OP_COOKIE_EXCHANGE) & - SSL_OP_COOKIE_EXCHANGE) == SSL_OP_COOKIE_EXCHANGE); - AssertTrue((SSL_CTX_set_options(ctx, SSL_OP_NO_TLSv1_2) & - SSL_OP_NO_TLSv1_2) == SSL_OP_NO_TLSv1_2); - AssertTrue((SSL_CTX_set_options(ctx, SSL_OP_NO_COMPRESSION) & - SSL_OP_NO_COMPRESSION) == SSL_OP_NO_COMPRESSION); - AssertNull((SSL_CTX_clear_options(ctx, SSL_OP_NO_COMPRESSION) & - SSL_OP_NO_COMPRESSION)); + AssertIntGT((int)wolfSSL_CTX_set_options(ctx, (WOLFSSL_OP_COOKIE_EXCHANGE | + WOLFSSL_OP_NO_SSLv2)), 0); + AssertTrue((wolfSSL_CTX_set_options(ctx, WOLFSSL_OP_COOKIE_EXCHANGE) & + WOLFSSL_OP_COOKIE_EXCHANGE) == WOLFSSL_OP_COOKIE_EXCHANGE); + AssertTrue((wolfSSL_CTX_set_options(ctx, WOLFSSL_OP_NO_TLSv1_2) & + WOLFSSL_OP_NO_TLSv1_2) == WOLFSSL_OP_NO_TLSv1_2); + AssertTrue((wolfSSL_CTX_set_options(ctx, WOLFSSL_OP_NO_COMPRESSION) & + WOLFSSL_OP_NO_COMPRESSION) == WOLFSSL_OP_NO_COMPRESSION); + AssertFalse((wolfSSL_CTX_clear_options(ctx, WOLFSSL_OP_NO_COMPRESSION) & + WOLFSSL_OP_NO_COMPRESSION)); - SSL_CTX_free(ctx); + wolfSSL_CTX_free(ctx); #ifndef NO_WOLFSSL_SERVER - ctx = SSL_CTX_new(wolfSSLv23_server_method()); + ctx = wolfSSL_CTX_new(wolfSSLv23_server_method()); AssertNotNull(ctx); #else - ctx = SSL_CTX_new(wolfSSLv23_client_method()); + ctx = wolfSSL_CTX_new(wolfSSLv23_client_method()); AssertNotNull(ctx); #endif - AssertTrue(SSL_CTX_use_certificate_file(ctx, svrCertFile, SSL_FILETYPE_PEM)); - AssertTrue(SSL_CTX_use_PrivateKey_file(ctx, svrKeyFile, SSL_FILETYPE_PEM)); - AssertTrue(SSL_CTX_set_msg_callback(ctx, msg_cb) == SSL_SUCCESS); + AssertTrue(wolfSSL_CTX_use_certificate_file(ctx, svrCertFile, + WOLFSSL_FILETYPE_PEM)); + AssertTrue(wolfSSL_CTX_use_PrivateKey_file(ctx, svrKeyFile, + WOLFSSL_FILETYPE_PEM)); +#ifdef OPENSSL_EXTRA + AssertTrue(wolfSSL_CTX_set_msg_callback(ctx, msg_cb) == WOLFSSL_SUCCESS); +#endif - AssertNotNull(ssl = SSL_new(ctx)); + AssertNotNull(ssl = wolfSSL_new(ctx)); +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) #ifdef HAVE_EX_DATA - AssertIntEQ(SSL_set_app_data(ssl, (void*)appData), SSL_SUCCESS); - AssertNotNull(SSL_get_app_data((const WOLFSSL*)ssl)); + AssertIntEQ(wolfSSL_set_app_data(ssl, (void*)appData), WOLFSSL_SUCCESS); + AssertNotNull(wolfSSL_get_app_data((const WOLFSSL*)ssl)); if (ssl) { - AssertIntEQ(XMEMCMP(SSL_get_app_data((const WOLFSSL*)ssl), + AssertIntEQ(XMEMCMP(wolfSSL_get_app_data((const WOLFSSL*)ssl), appData, sizeof(appData)), 0); } #else - AssertIntEQ(SSL_set_app_data(ssl, (void*)appData), SSL_FAILURE); - AssertNull(SSL_get_app_data((const WOLFSSL*)ssl)); + AssertIntEQ(wolfSSL_set_app_data(ssl, (void*)appData), WOLFSSL_FAILURE); + AssertNull(wolfSSL_get_app_data((const WOLFSSL*)ssl)); +#endif #endif - AssertTrue(SSL_set_options(ssl, SSL_OP_NO_TLSv1) == SSL_OP_NO_TLSv1); - AssertTrue(SSL_get_options(ssl) == SSL_OP_NO_TLSv1); + AssertTrue(wolfSSL_set_options(ssl, WOLFSSL_OP_NO_TLSv1) == + WOLFSSL_OP_NO_TLSv1); - AssertIntGT((int)SSL_set_options(ssl, (SSL_OP_COOKIE_EXCHANGE | - WOLFSSL_OP_NO_SSLv2)), 0); - AssertTrue((SSL_set_options(ssl, SSL_OP_COOKIE_EXCHANGE) & - SSL_OP_COOKIE_EXCHANGE) == SSL_OP_COOKIE_EXCHANGE); - AssertTrue((SSL_set_options(ssl, SSL_OP_NO_TLSv1_2) & - SSL_OP_NO_TLSv1_2) == SSL_OP_NO_TLSv1_2); - AssertTrue((SSL_set_options(ssl, SSL_OP_NO_COMPRESSION) & - SSL_OP_NO_COMPRESSION) == SSL_OP_NO_COMPRESSION); - AssertNull((SSL_clear_options(ssl, SSL_OP_NO_COMPRESSION) & - SSL_OP_NO_COMPRESSION)); + AssertTrue(wolfSSL_get_options(ssl) == WOLFSSL_OP_NO_TLSv1); - AssertTrue(SSL_set_msg_callback(ssl, msg_cb) == SSL_SUCCESS); - SSL_set_msg_callback_arg(ssl, arg); + AssertIntGT((int)wolfSSL_set_options(ssl, (WOLFSSL_OP_COOKIE_EXCHANGE | + WOLFSSL_OP_NO_SSLv2)), 0); + + AssertTrue((wolfSSL_set_options(ssl, WOLFSSL_OP_COOKIE_EXCHANGE) & + WOLFSSL_OP_COOKIE_EXCHANGE) == WOLFSSL_OP_COOKIE_EXCHANGE); + + AssertTrue((wolfSSL_set_options(ssl, WOLFSSL_OP_NO_TLSv1_2) & + WOLFSSL_OP_NO_TLSv1_2) == WOLFSSL_OP_NO_TLSv1_2); + + AssertTrue((wolfSSL_set_options(ssl, WOLFSSL_OP_NO_COMPRESSION) & + WOLFSSL_OP_NO_COMPRESSION) == WOLFSSL_OP_NO_COMPRESSION); + +#ifdef OPENSSL_EXTRA + AssertNull((wolfSSL_clear_options(ssl, WOLFSSL_OP_NO_COMPRESSION) & + WOLFSSL_OP_NO_COMPRESSION)); +#endif + +#ifdef OPENSSL_EXTRA + AssertTrue(wolfSSL_set_msg_callback(ssl, msg_cb) == WOLFSSL_SUCCESS); + wolfSSL_set_msg_callback_arg(ssl, arg); #ifdef WOLFSSL_ERROR_CODE_OPENSSL - AssertTrue(SSL_CTX_set_alpn_protos(ctx, protos, len) == 0); + AssertTrue(wolfSSL_CTX_set_alpn_protos(ctx, protos, len) == 0); #else - AssertTrue(SSL_CTX_set_alpn_protos(ctx, protos, len) == SSL_SUCCESS); + AssertTrue(wolfSSL_CTX_set_alpn_protos(ctx, protos, len) == WOLFSSL_SUCCESS); +#endif #endif #if defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) || \ @@ -35489,20 +35599,19 @@ static void test_wolfSSL_set_options(void) #if defined(HAVE_ALPN) && !defined(NO_BIO) #ifdef WOLFSSL_ERROR_CODE_OPENSSL - AssertTrue(SSL_set_alpn_protos(ssl, protos, len) == 0); + AssertTrue(wolfSSL_set_alpn_protos(ssl, protos, len) == 0); #else - AssertTrue(SSL_set_alpn_protos(ssl, protos, len) == SSL_SUCCESS); + AssertTrue(wolfSSL_set_alpn_protos(ssl, protos, len) == WOLFSSL_SUCCESS); #endif #endif /* HAVE_ALPN && !NO_BIO */ #endif - SSL_free(ssl); - SSL_CTX_free(ctx); + wolfSSL_free(ssl); + wolfSSL_CTX_free(ctx); printf(resultFmt, passed); -#endif /* defined(OPENSSL_EXTRA) && !defined(NO_CERTS) && \ - !defined(NO_FILESYSTEM) && !defined(NO_RSA) */ +#endif /* !defined(NO_CERTS) && !defined(NO_FILESYSTEM) && !defined(NO_RSA) */ } static void test_wolfSSL_sk_SSL_CIPHER(void) @@ -38062,6 +38171,7 @@ static int test_WOLFSSL_ERROR_MSG (void) WOLFSSL_ERROR_MSG(msg); printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif return ret; @@ -38079,6 +38189,7 @@ static int test_wc_ERR_remove_state (void) wc_ERR_remove_state(); printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif return ret; @@ -38114,6 +38225,7 @@ static int test_wc_ERR_print_errors_fp (void) #endif #endif printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); XFCLOSE(fp); (void)sz; #endif @@ -38169,6 +38281,7 @@ static int test_wolfSSL_GetLoggingCb (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); return ret; }/*End test_wolfSSL_GetLoggingCb*/ @@ -46151,6 +46264,7 @@ static void test_wolfSSL_X509_cmp(void) ret = wolfSSL_X509_cmp(cert1, cert1); AssertIntEQ(0, wolfSSL_X509_cmp(cert1, cert1)); printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); printf(testingFmt, "wolfSSL_X509_cmp() testing mismatched certs"); ret = wolfSSL_X509_cmp(cert1, cert2); @@ -47067,12 +47181,69 @@ static void test_wc_ParseCert(void) wc_InitDecodedCert(&decodedCert, rawCert, rawCertSize, NULL); AssertIntEQ(wc_ParseCert(&decodedCert, CERT_TYPE, NO_VERIFY, NULL), 0); +#ifndef IGNORE_NAME_CONSTRAINTS + /* check that the subjects emailAddress was not put in the alt name list */ + AssertNotNull(decodedCert.subjectEmail); + AssertNull(decodedCert.altEmailNames); +#endif wc_FreeDecodedCert(&decodedCert); printf(resultFmt, passed); #endif } +static void test_MakeCertWithPathLen(void) +{ +#if defined(WOLFSSL_CERT_REQ) && defined(WOLFSSL_CERT_GEN) && defined(HAVE_ECC) + const byte expectedPathLen = 7; + Cert cert; + DecodedCert decodedCert; + byte der[FOURK_BUF]; + int derSize = 0; + WC_RNG rng; + ecc_key key; + + printf(testingFmt, "test_MakeCertWithPathLen"); + + AssertIntEQ(wc_InitRng(&rng), 0); + AssertIntEQ(wc_ecc_init(&key), 0); + AssertIntEQ(wc_ecc_make_key(&rng, 32, &key), 0); + AssertIntEQ(wc_InitCert(&cert), 0); + + (void)XSTRNCPY(cert.subject.country, "US", CTC_NAME_SIZE); + (void)XSTRNCPY(cert.subject.state, "state", CTC_NAME_SIZE); + (void)XSTRNCPY(cert.subject.locality, "Bozeman", CTC_NAME_SIZE); + (void)XSTRNCPY(cert.subject.org, "yourOrgNameHere", CTC_NAME_SIZE); + (void)XSTRNCPY(cert.subject.unit, "yourUnitNameHere", CTC_NAME_SIZE); + (void)XSTRNCPY(cert.subject.commonName, "www.yourDomain.com", CTC_NAME_SIZE); + (void)XSTRNCPY(cert.subject.email, "yourEmail@yourDomain.com", CTC_NAME_SIZE); + + cert.selfSigned = 1; + cert.isCA = 1; + cert.pathLen = expectedPathLen; + cert.sigType = CTC_SHA256wECDSA; + +#ifdef WOLFSSL_CERT_EXT + cert.keyUsage |= KEYUSE_KEY_CERT_SIGN; +#endif + + AssertIntGE(wc_MakeCert(&cert, der, FOURK_BUF, NULL, &key, &rng), 0); + derSize = wc_SignCert(cert.bodySz, cert.sigType, der, FOURK_BUF, NULL, + &key, &rng); + AssertIntGE(derSize, 0); + + wc_InitDecodedCert(&decodedCert, der, derSize, NULL); + AssertIntEQ(wc_ParseCert(&decodedCert, CERT_TYPE, NO_VERIFY, NULL), 0); + AssertIntEQ(decodedCert.pathLength, expectedPathLen); + + wc_FreeDecodedCert(&decodedCert); + AssertIntEQ(wc_ecc_free(&key), 0); + AssertIntEQ(wc_FreeRng(&rng), 0); + + printf(resultFmt, passed); +#endif +} + /*----------------------------------------------------------------------------* | wolfCrypt ECC *----------------------------------------------------------------------------*/ @@ -49522,6 +49693,7 @@ static int test_get_rand_digit (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif return ret; @@ -49548,6 +49720,7 @@ static int test_get_digit_count (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); mp_clear(&a); #endif return ret; @@ -49598,6 +49771,7 @@ static int test_mp_cond_copy (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); mp_clear(&a); mp_clear(&b); #endif @@ -49647,6 +49821,7 @@ static int test_mp_rand (void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); mp_clear(&a); wc_FreeRng(&rng); #endif @@ -49690,6 +49865,7 @@ static int test_get_digit (void) printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); mp_clear(&a); #endif return ret; @@ -49749,6 +49925,7 @@ static int test_wc_export_int(void) } printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); mp_clear(&mp); #endif return ret; @@ -49774,6 +49951,7 @@ static int test_wc_InitRngNonce(void) wc_FreeRng(&rng); printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif return ret; }/* End test_wc_InitRngNonce*/ @@ -49799,6 +49977,7 @@ static int test_wc_InitRngNonce_ex(void) wc_FreeRng(&rng); printf(resultFmt, ret == 0 ? passed : failed); + fflush(stdout); #endif return ret; }/*End test_wc_InitRngNonce_ex*/ @@ -49878,6 +50057,7 @@ static void test_wolfSSL_X509_CRL(void) #endif printf(resultFmt, passed); + fflush(stdout); #endif return; } @@ -51976,7 +52156,7 @@ static void test_wolfSSL_RSA_verify(void) /* read privete key file */ fp = XFOPEN(svrKeyFile, "rb"); AssertTrue((fp != XBADFILE)); - XFSEEK(fp, 0, XSEEK_END); + AssertIntGE(XFSEEK(fp, 0, XSEEK_END), 0); sz = XFTELL(fp); XREWIND(fp); AssertNotNull(buf = (byte*)XMALLOC(sz, NULL, DYNAMIC_TYPE_FILE)); @@ -52753,7 +52933,7 @@ static void test_wolfSSL_RSA_To_Der(void) AssertIntEQ(wolfSSL_RSA_To_Der(rsa, &outDer, 0, HEAP_HINT), privDerSz); AssertNotNull(outDer); AssertIntEQ(XMEMCMP(outDer, privDer, privDerSz), 0); - XFREE(outDer, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER.); + XFREE(outDer, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER); AssertIntEQ(wolfSSL_RSA_To_Der(rsa, NULL, 1, HEAP_HINT), pubDerSz); outDer = out; @@ -55536,6 +55716,101 @@ static void test_wolfSSL_FIPS_mode(void) #endif } +#ifdef WOLFSSL_DTLS + +/* Prints out the current window */ +static void DUW_TEST_print_window_binary(word32 h, word32 l, word32* w) { +#ifdef WOLFSSL_DEBUG_DTLS_WINDOW + int i; + for (i = WOLFSSL_DTLS_WINDOW_WORDS - 1; i >= 0; i--) { + word32 b = w[i]; + int j; + /* Prints out a 32 bit binary number in big endian order */ + for (j = 0; j < 32; j++, b <<= 1) { + if (b & (((word32)1) << 31)) + printf("1"); + else + printf("0"); + } + printf(" "); + } + printf("cur_hi %u cur_lo %u\n", h, l); +#else + (void)h; + (void)l; + (void)w; +#endif +} + +/* a - cur_hi + * b - cur_lo + * c - next_hi + * d - next_lo + * e - window + * f - expected next_hi + * g - expected next_lo + * h - expected window[1] + * i - expected window[0] + */ +#define DUW_TEST(a,b,c,d,e,f,g,h,i) do { \ + wolfSSL_DtlsUpdateWindow((a), (b), &(c), &(d), (e)); \ + DUW_TEST_print_window_binary((a), (b), (e)); \ + AssertIntEQ((c), (f)); \ + AssertIntEQ((d), (g)); \ + AssertIntEQ((e)[1], (h)); \ + AssertIntEQ((e)[0], (i)); \ +} while (0) + +static void test_wolfSSL_DtlsUpdateWindow(void) +{ + word32 window[WOLFSSL_DTLS_WINDOW_WORDS]; + word32 next_lo = 0; + word16 next_hi = 0; + + printf(testingFmt, "wolfSSL_DtlsUpdateWindow()"); +#ifdef WOLFSSL_DEBUG_DTLS_WINDOW + printf("\n"); +#endif + + XMEMSET(window, 0, sizeof window); + DUW_TEST(0, 0, next_hi, next_lo, window, 0, 1, 0, 0x01); + DUW_TEST(0, 1, next_hi, next_lo, window, 0, 2, 0, 0x03); + DUW_TEST(0, 5, next_hi, next_lo, window, 0, 6, 0, 0x31); + DUW_TEST(0, 4, next_hi, next_lo, window, 0, 6, 0, 0x33); + DUW_TEST(0, 100, next_hi, next_lo, window, 0, 101, 0, 0x01); + DUW_TEST(0, 101, next_hi, next_lo, window, 0, 102, 0, 0x03); + DUW_TEST(0, 133, next_hi, next_lo, window, 0, 134, 0x03, 0x01); + DUW_TEST(0, 200, next_hi, next_lo, window, 0, 201, 0, 0x01); + DUW_TEST(0, 264, next_hi, next_lo, window, 0, 265, 0, 0x01); + DUW_TEST(0, 0xFFFFFFFF, next_hi, next_lo, window, 1, 0, 0, 0x01); + DUW_TEST(0, 0xFFFFFFFD, next_hi, next_lo, window, 1, 0, 0, 0x05); + DUW_TEST(0, 0xFFFFFFFE, next_hi, next_lo, window, 1, 0, 0, 0x07); + DUW_TEST(1, 3, next_hi, next_lo, window, 1, 4, 0, 0x71); + DUW_TEST(1, 0, next_hi, next_lo, window, 1, 4, 0, 0x79); + DUW_TEST(1, 0xFFFFFFFF, next_hi, next_lo, window, 2, 0, 0, 0x01); + DUW_TEST(2, 3, next_hi, next_lo, window, 2, 4, 0, 0x11); + DUW_TEST(2, 0, next_hi, next_lo, window, 2, 4, 0, 0x19); + DUW_TEST(2, 25, next_hi, next_lo, window, 2, 26, 0, 0x6400001); + DUW_TEST(2, 27, next_hi, next_lo, window, 2, 28, 0, 0x19000005); + DUW_TEST(2, 29, next_hi, next_lo, window, 2, 30, 0, 0x64000015); + DUW_TEST(2, 33, next_hi, next_lo, window, 2, 34, 6, 0x40000151); + DUW_TEST(2, 60, next_hi, next_lo, window, 2, 61, 0x3200000A, 0x88000001); + DUW_TEST(1, 0xFFFFFFF0, next_hi, next_lo, window, 2, 61, 0x3200000A, 0x88000001); + DUW_TEST(2, 0xFFFFFFFD, next_hi, next_lo, window, 2, 0xFFFFFFFE, 0, 0x01); + DUW_TEST(3, 1, next_hi, next_lo, window, 3, 2, 0, 0x11); + DUW_TEST(99, 66, next_hi, next_lo, window, 99, 67, 0, 0x01); + DUW_TEST(50, 66, next_hi, next_lo, window, 99, 67, 0, 0x01); + DUW_TEST(100, 68, next_hi, next_lo, window, 100, 69, 0, 0x01); + DUW_TEST(99, 50, next_hi, next_lo, window, 100, 69, 0, 0x01); + DUW_TEST(99, 0xFFFFFFFF, next_hi, next_lo, window, 100, 69, 0, 0x01); + DUW_TEST(150, 0xFFFFFFFF, next_hi, next_lo, window, 151, 0, 0, 0x01); + DUW_TEST(152, 0xFFFFFFFF, next_hi, next_lo, window, 153, 0, 0, 0x01); + + printf(resultFmt, passed); + fflush(stdout); +} +#endif /* WOLFSSL_DTLS */ + /*----------------------------------------------------------------------------* | Main *----------------------------------------------------------------------------*/ @@ -55546,6 +55821,7 @@ void ApiTest(void) AssertTrue(test_fileAccess()); printf(" Begin API Tests\n"); + fflush(stdout); AssertIntEQ(test_wolfSSL_Init(), WOLFSSL_SUCCESS); /* wolfcrypt initialization tests */ test_wolfSSL_Method_Allocators(); @@ -56065,6 +56341,7 @@ void ApiTest(void) test_wc_SetSubject(); test_CheckCertSignature(); test_wc_ParseCert(); + test_MakeCertWithPathLen(); /* wolfCrypt ECC tests */ test_wc_ecc_get_curve_size_from_name(); @@ -56425,6 +56702,9 @@ void ApiTest(void) test_wc_CryptoCb(); test_wolfSSL_CTX_StaticMemory(); test_wolfSSL_FIPS_mode(); +#ifdef WOLFSSL_DTLS + test_wolfSSL_DtlsUpdateWindow(); +#endif AssertIntEQ(test_ForceZero(), 0); @@ -56449,5 +56729,5 @@ void ApiTest(void) (void)devId; printf(" End API Tests\n"); - + fflush(stdout); } diff --git a/tests/hash.c b/tests/hash.c index de62bd1bf..ba538cae6 100644 --- a/tests/hash.c +++ b/tests/hash.c @@ -1,6 +1,6 @@ /* hash.c has unit tests * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/tests/include.am b/tests/include.am index c4b6b7af4..b4a0aef15 100644 --- a/tests/include.am +++ b/tests/include.am @@ -30,6 +30,7 @@ EXTRA_DIST += tests/unit.h \ tests/test-psk-no-id.conf \ tests/test-psk-no-id-sha2.conf \ tests/test-dtls.conf \ + tests/test-dtls-downgrade.conf \ tests/test-dtls-fails.conf \ tests/test-dtls-fails-cipher.conf \ tests/test-dtls-group.conf \ diff --git a/tests/srp.c b/tests/srp.c index 7cd13326d..9eb96ba6f 100644 --- a/tests/srp.c +++ b/tests/srp.c @@ -1,6 +1,6 @@ /* srp.c SRP unit tests * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/tests/suites.c b/tests/suites.c index 5f1a1fb62..fa31b98b7 100644 --- a/tests/suites.c +++ b/tests/suites.c @@ -1,6 +1,6 @@ /* suites.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -494,7 +494,8 @@ static int execute_test_case(int svr_argc, char** svr_argv, if (cliArgs.argc + 2 > MAX_ARGS) printf("cannot add the magic port number flag to client\n"); else { - snprintf(portNumber, sizeof(portNumber), "%d", (int)ready.port); + (void)snprintf(portNumber, sizeof(portNumber), "%d", + (int)ready.port); cli_argv[cliArgs.argc++] = portFlag; cli_argv[cliArgs.argc++] = portNumber; } @@ -633,15 +634,20 @@ static void test_harness(void* vargs) args->return_code = 1; return; } - fseek(file, 0, SEEK_END); + if (fseek(file, 0, SEEK_END) < 0) { + fprintf(stderr, "error %d fseeking %s\n", errno, fname); + fclose(file); + args->return_code = 1; + return; + } sz = ftell(file); - rewind(file); if (sz <= 0) { fprintf(stderr, "%s is empty\n", fname); fclose(file); args->return_code = 1; return; } + rewind(file); script = (char*)malloc(sz+1); if (script == 0) { @@ -1023,6 +1029,17 @@ int SuiteTest(int argc, char** argv) goto exit; } #endif + + /* Add dtls downgrade test */ + XSTRLCPY(argv0[1], "tests/test-dtls-downgrade.conf", sizeof(argv0[1])); + printf("starting dtls downgrade tests\n"); + test_harness(&args); + if (args.return_code != 0) { + printf("error from script %d\n", args.return_code); + args.return_code = EXIT_FAILURE; + goto exit; + } + #ifdef WOLFSSL_OLDTLS_SHA2_CIPHERSUITES /* add dtls extra suites */ XSTRLCPY(argv0[1], "tests/test-dtls-sha2.conf", sizeof(argv0[1])); diff --git a/tests/test-dtls-downgrade.conf b/tests/test-dtls-downgrade.conf new file mode 100644 index 000000000..067ff47a6 --- /dev/null +++ b/tests/test-dtls-downgrade.conf @@ -0,0 +1,21 @@ +# server DTLS multiversion allow downgrading +-vd +-7 2 +-u +-l TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA + +# client DTLSv1.0 +-v 2 +-u +-l TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA + +# server DTLSv1.0 +-v 2 +-u +-l TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA + +# client DTLS multiversion allow downgrading +-vd +-7 2 +-u +-l TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA diff --git a/tests/test-dtls13-downgrade.conf b/tests/test-dtls13-downgrade.conf index 4bde3259f..bda26666c 100644 --- a/tests/test-dtls13-downgrade.conf +++ b/tests/test-dtls13-downgrade.conf @@ -1,11 +1,43 @@ -# server DTLSv1.3 allow downgrading +# server DTLS multiversion allow downgrade -vd -7 2 -u --l TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 +-l TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA -# client TLSv1.2 group message +# client DTLSv1.2 -v 3 -u --l TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 --f +-l TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA + +# server DTLS multiversion allow downgrade +-vd +-7 2 +-u +-l TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA + +# client DTLSv1.0 +-v 2 +-u +-l TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA + +# server DTLSv1.0 +-v 2 +-u +-l TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA + +# client DTLS multiversion, allow downgrade +-vd +-7 2 +-u +-l TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA + +# server DTLSv1.2 +-v 3 +-u +-l TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA + +# client DTLS multiversion, allow downgrade +-vd +-7 2 +-u +-l TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA diff --git a/tests/unit.c b/tests/unit.c index 59bcd8b1e..e464e656d 100644 --- a/tests/unit.c +++ b/tests/unit.c @@ -1,6 +1,6 @@ /* unit.c API unit tests driver * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -54,12 +54,13 @@ int unit_test(int argc, char** argv) #ifdef WOLFSSL_FORCE_MALLOC_FAIL_TEST if (argc > 1) { int memFailCount = atoi(argv[1]); - printf("\n--- SET RNG MALLOC FAIL AT %d---\n", memFailCount); + fprintf(stderr, "\n--- SET RNG MALLOC FAIL AT %d---\n", memFailCount); wolfSSL_SetMemFailCount(memFailCount); } #endif printf("starting unit tests...\n"); + fflush(stdout); #if defined(DEBUG_WOLFSSL) && !defined(HAVE_VALGRIND) wolfSSL_Debugging_ON(); @@ -160,13 +161,13 @@ int unit_test(int argc, char** argv) ApiTest(); if ( (ret = HashTest()) != 0){ - printf("hash test failed with %d\n", ret); + fprintf(stderr, "hash test failed with %d\n", ret); goto exit; } #ifdef WOLFSSL_W64_WRAPPER if ((ret = w64wrapper_test()) != 0) { - printf("w64wrapper test failed with %d\n", ret); + fprintf(stderr, "w64wrapper test failed with %d\n", ret); goto exit; } #endif /* WOLFSSL_W64_WRAPPER */ @@ -177,7 +178,7 @@ int unit_test(int argc, char** argv) #if !defined(NO_WOLFSSL_CLIENT) && !defined(NO_WOLFSSL_SERVER) #ifndef SINGLE_THREADED if ( (ret = SuiteTest(argc, argv)) != 0){ - printf("suite test failed with %d\n", ret); + fprintf(stderr, "suite test failed with %d\n", ret); goto exit; } #endif @@ -192,6 +193,11 @@ exit: err_sys("Failed to free netRandom context"); #endif /* HAVE_WNR */ + if (ret == 0) { + puts("\nunit_test: Success for all configured tests."); + fflush(stdout); + } + return ret; } @@ -202,13 +208,14 @@ void wait_tcp_ready(func_args* args) #ifdef SINGLE_THREADED (void)args; #elif defined(_POSIX_THREADS) && !defined(__MINGW32__) - pthread_mutex_lock(&args->signal->mutex); + PTHREAD_CHECK_RET(pthread_mutex_lock(&args->signal->mutex)); if (!args->signal->ready) - pthread_cond_wait(&args->signal->cond, &args->signal->mutex); + PTHREAD_CHECK_RET(pthread_cond_wait(&args->signal->cond, + &args->signal->mutex)); args->signal->ready = 0; /* reset */ - pthread_mutex_unlock(&args->signal->mutex); + PTHREAD_CHECK_RET(pthread_mutex_unlock(&args->signal->mutex)); #else (void)args; #endif @@ -222,7 +229,7 @@ void start_thread(THREAD_FUNC fun, func_args* args, THREAD_TYPE* thread) (void)args; (void)thread; #elif defined(_POSIX_THREADS) && !defined(__MINGW32__) - pthread_create(thread, 0, fun, args); + PTHREAD_CHECK_RET(pthread_create(thread, 0, fun, args)); return; #elif defined (WOLFSSL_TIRTOS) /* Initialize the defaults and set the parameters. */ @@ -232,7 +239,7 @@ void start_thread(THREAD_FUNC fun, func_args* args, THREAD_TYPE* thread) taskParams.stackSize = 65535; *thread = Task_create((Task_FuncPtr)fun, &taskParams, NULL); if (*thread == NULL) { - printf("Failed to create new Task\n"); + fprintf(stderr, "Failed to create new Task\n"); } Task_yield(); #else @@ -246,7 +253,7 @@ void join_thread(THREAD_TYPE thread) #ifdef SINGLE_THREADED (void)thread; #elif defined(_POSIX_THREADS) && !defined(__MINGW32__) - pthread_join(thread, 0); + PTHREAD_CHECK_RET(pthread_join(thread, 0)); #elif defined (WOLFSSL_TIRTOS) while(1) { if (Task_getMode(thread) == Task_Mode_TERMINATED) { diff --git a/tests/unit.h b/tests/unit.h index afb3225ae..aa9e59e4a 100644 --- a/tests/unit.h +++ b/tests/unit.h @@ -1,6 +1,6 @@ /* unit.c API unit tests driver * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -35,15 +35,17 @@ #ifndef WOLFSSL_PASSTHRU_ERR #define Fail(description, result) do { \ printf("\nERROR - %s line %d failed with:", __FILE__, __LINE__); \ - printf("\n expected: "); printf description; \ - printf("\n result: "); printf result; printf("\n\n"); \ + fputs("\n expected: ", stdout); printf description; \ + fputs("\n result: ", stdout); printf result; fputs("\n\n", stdout); \ + fflush(stdout); \ XABORT(); \ } while(0) #else -#define Fail(description, result) do { \ - printf("\nERROR - %s line %d failed with:", __FILE__, __LINE__); \ - printf("\n expected: ");printf description; \ - printf("\n result: "); printf result; printf("\n\n"); \ +#define Fail(description, result) do { \ + printf("\nERROR - %s line %d failed with:", __FILE__, __LINE__); \ + fputs("\n expected: ", stdout); printf description; \ + fputs("\n result: ", stdout); printf result; fputs("\n\n", stdout); \ + fflush(stdout); \ } while (0) #endif @@ -90,9 +92,17 @@ #define AssertStrLE(x, y) AssertStr(x, y, <=, >) #define AssertPtr(x, y, op, er) do { \ + PRAGMA_GCC_DIAG_PUSH; \ + /* remarkably, without this inhibition, */ \ + /* the _Pragma()s make the declarations warn. */ \ + PRAGMA_GCC("GCC diagnostic ignored \"-Wdeclaration-after-statement\""); \ + /* inhibit "ISO C forbids conversion of function pointer */ \ + /* to object pointer type [-Werror=pedantic]" */ \ + PRAGMA_GCC("GCC diagnostic ignored \"-Wpedantic\""); \ void* _x = (void*)(x); \ void* _y = (void*)(y); \ Assert(_x op _y, ("%s " #op " %s", #x, #y), ("%p " #er " %p", _x, _y)); \ + PRAGMA_GCC_DIAG_POP; \ } while(0) #define AssertPtrEq(x, y) AssertPtr(x, y, ==, !=) diff --git a/tests/w64wrapper.c b/tests/w64wrapper.c index 6a06a4446..606916026 100644 --- a/tests/w64wrapper.c +++ b/tests/w64wrapper.c @@ -1,6 +1,6 @@ /* w64wrapper.c w64wrapper unit tests * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c index d99c0694e..d83854d85 100644 --- a/testsuite/testsuite.c +++ b/testsuite/testsuite.c @@ -1,6 +1,6 @@ /* testsuite.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -402,7 +402,7 @@ static void simple_test(func_args* args) #ifndef USE_WINDOWS_API cliArgs.argc = NUMARGS; XSTRLCPY(argvc[1], "-p", sizeof(argvc[1])); - snprintf(argvc[2], sizeof(argvc[2]), "%d", (int)svrArgs.signal->port); + (void)snprintf(argvc[2], sizeof(argvc[2]), "%d", (int)svrArgs.signal->port); #else cliArgs.argc = 1; #endif @@ -432,13 +432,14 @@ static void simple_test(func_args* args) void wait_tcp_ready(func_args* args) { #if defined(_POSIX_THREADS) && !defined(__MINGW32__) - pthread_mutex_lock(&args->signal->mutex); + PTHREAD_CHECK_RET(pthread_mutex_lock(&args->signal->mutex)); if (!args->signal->ready) - pthread_cond_wait(&args->signal->cond, &args->signal->mutex); + PTHREAD_CHECK_RET(pthread_cond_wait(&args->signal->cond, + &args->signal->mutex)); args->signal->ready = 0; /* reset */ - pthread_mutex_unlock(&args->signal->mutex); + PTHREAD_CHECK_RET(pthread_mutex_unlock(&args->signal->mutex)); #elif defined(NETOS) (void)tx_mutex_get(&args->signal->mutex, TX_WAIT_FOREVER); @@ -464,7 +465,7 @@ void wait_tcp_ready(func_args* args) void start_thread(THREAD_FUNC fun, func_args* args, THREAD_TYPE* thread) { #if defined(_POSIX_THREADS) && !defined(__MINGW32__) - pthread_create(thread, 0, fun, args); + PTHREAD_CHECK_RET(pthread_create(thread, 0, fun, args)); return; #elif defined(WOLFSSL_TIRTOS) /* Initialize the defaults and set the parameters. */ @@ -533,7 +534,7 @@ void start_thread(THREAD_FUNC fun, func_args* args, THREAD_TYPE* thread) void join_thread(THREAD_TYPE thread) { #if defined(_POSIX_THREADS) && !defined(__MINGW32__) - pthread_join(thread, 0); + PTHREAD_CHECK_RET(pthread_join(thread, 0)); #elif defined(WOLFSSL_TIRTOS) while(1) { if (Task_getMode(thread) == Task_Mode_TERMINATED) { diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index 837b0f37c..fd6c8e395 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -1,6 +1,6 @@ /* benchmark.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -39,6 +39,11 @@ #ifdef HAVE_PTHREAD #include #endif +#if defined(HAVE_PTHREAD) || \ + (!defined(NO_STDIO_FILESYSTEM) && !defined(NO_ERROR_STRINGS)) + #include + #include +#endif /* Macro to disable benchmark */ #ifndef NO_CRYPT_BENCHMARK @@ -314,6 +319,31 @@ #define EXIT_FAILURE 1 #endif +#undef LIBCALL_CHECK_RET +#if defined(NO_STDIO_FILESYSTEM) || defined(NO_ERROR_STRINGS) +#define LIBCALL_CHECK_RET(...) __VA_ARGS__ +#else +#define LIBCALL_CHECK_RET(...) do { \ + int _libcall_ret = (__VA_ARGS__); \ + if (_libcall_ret < 0) { \ + fprintf(stderr, "%s L%d error %d for \"%s\"\n", \ + __FILE__, __LINE__, errno, #__VA_ARGS__); \ + _exit(1); \ + } \ + } while(0) +#endif + +#undef PTHREAD_CHECK_RET +#define PTHREAD_CHECK_RET(...) do { \ + int _pthread_ret = (__VA_ARGS__); \ + if (_pthread_ret != 0) { \ + errno = _pthread_ret; \ + fprintf(stderr, "%s L%d error %d for \"%s\"\n", \ + __FILE__, __LINE__, _pthread_ret, #__VA_ARGS__); \ + _exit(1); \ + } \ + } while(0) + /* optional macro to add sleep between tests */ #ifndef TEST_SLEEP /* stub the sleep macro */ @@ -854,11 +884,11 @@ static const char* bench_desc_words[][14] = { #define END_INTEL_CYCLES total_cycles = get_intel_cycles() - total_cycles; /* s == size in bytes that 1 count represents, normally BENCH_SIZE */ #define SHOW_INTEL_CYCLES(b, n, s) \ - XSNPRINTF((b) + XSTRLEN(b), (n) - XSTRLEN(b), " %s = %6.2f\n", \ + (void)XSNPRINTF((b) + XSTRLEN(b), (n) - XSTRLEN(b), " %s = %6.2f\n", \ bench_result_words1[lng_index][2], \ count == 0 ? 0 : (float)total_cycles / ((word64)count*(s))) #define SHOW_INTEL_CYCLES_CSV(b, n, s) \ - XSNPRINTF((b) + XSTRLEN(b), (n) - XSTRLEN(b), "%.2f,\n", \ + (void)XSNPRINTF((b) + XSTRLEN(b), (n) - XSTRLEN(b), "%.2f,\n", \ count == 0 ? 0 : (float)total_cycles / ((word64)count*(s))) #elif defined(LINUX_CYCLE_COUNT) #include @@ -884,11 +914,11 @@ static const char* bench_desc_words[][14] = { /* s == size in bytes that 1 count represents, normally BENCH_SIZE */ #define SHOW_INTEL_CYCLES(b, n, s) \ - XSNPRINTF(b + XSTRLEN(b), n - XSTRLEN(b), " %s = %6.2f\n", \ + (void)XSNPRINTF(b + XSTRLEN(b), n - XSTRLEN(b), " %s = %6.2f\n", \ bench_result_words1[lng_index][2], \ (float)total_cycles / (count*s)) #define SHOW_INTEL_CYCLES_CSV(b, n, s) \ - XSNPRINTF(b + XSTRLEN(b), n - XSTRLEN(b), "%.2f,\n", \ + (void)XSNPRINTF(b + XSTRLEN(b), n - XSTRLEN(b), "%.2f,\n", \ (float)total_cycles / (count*s)) #elif defined(SYNERGY_CYCLE_COUNT) @@ -902,11 +932,11 @@ static const char* bench_desc_words[][14] = { /* s == size in bytes that 1 count represents, normally BENCH_SIZE */ #define SHOW_INTEL_CYCLES(b, n, s) \ - XSNPRINTF(b + XSTRLEN(b), n - XSTRLEN(b), " %s = %6.2f\n", \ + (void)XSNPRINTF(b + XSTRLEN(b), n - XSTRLEN(b), " %s = %6.2f\n", \ bench_result_words1[lng_index][2], \ (float)total_cycles / (count*s)) #define SHOW_INTEL_CYCLES_CSV(b, n, s) \ - XSNPRINTF(b + XSTRLEN(b), n - XSTRLEN(b), "%.2f,\n", \ + (void)XSNPRINTF(b + XSTRLEN(b), n - XSTRLEN(b), "%.2f,\n", \ (float)total_cycles / (count*s)) #else @@ -1305,7 +1335,7 @@ typedef enum bench_stat_type { bench_stats_t* bstat = NULL; /* protect bench_stats_head and bench_stats_tail access */ - pthread_mutex_lock(&bench_lock); + PTHREAD_CHECK_RET(pthread_mutex_lock(&bench_lock)); if (algo != NULL) { /* locate existing in list */ @@ -1352,7 +1382,7 @@ typedef enum bench_stat_type { if (bstat->lastRet > ret) bstat->lastRet = ret; /* track last error */ } - pthread_mutex_unlock(&bench_lock); + PTHREAD_CHECK_RET(pthread_mutex_unlock(&bench_lock)); return bstat; } @@ -1362,7 +1392,7 @@ typedef enum bench_stat_type { bench_stats_t* bstat; /* protect bench_stats_head and bench_stats_tail access */ - pthread_mutex_lock(&bench_lock); + PTHREAD_CHECK_RET(pthread_mutex_lock(&bench_lock)); for (bstat = bench_stats_head; bstat != NULL; ) { if (bstat->type == BENCH_STAT_SYM) { @@ -1379,7 +1409,7 @@ typedef enum bench_stat_type { bstat = bstat->next; } - pthread_mutex_unlock(&bench_lock); + PTHREAD_CHECK_RET(pthread_mutex_unlock(&bench_lock)); } #else /* !WC_ENABLE_BENCH_THREADING */ @@ -1513,12 +1543,12 @@ static void bench_stats_sym_finish(const char* desc, int useDeviceID, int count, /* format and print to terminal */ if (csv_format == 1) { - XSNPRINTF(msg, sizeof(msg), "%s,%.3f,", desc, persec); + (void)XSNPRINTF(msg, sizeof(msg), "%s,%.3f,", desc, persec); SHOW_INTEL_CYCLES_CSV(msg, sizeof(msg), countSz); } else { - XSNPRINTF(msg, sizeof(msg), "%-16s%s %5.0f %s %s %5.3f %s, %8.3f %s/s", - desc, BENCH_ASYNC_GET_NAME(useDeviceID), blocks, blockType, word[0], - total, word[1], persec, blockType); + (void)XSNPRINTF(msg, sizeof(msg), "%-16s%s %5.0f %s %s %5.3f %s, %8.3f %s/s", + desc, BENCH_ASYNC_GET_NAME(useDeviceID), blocks, blockType, word[0], + total, word[1], persec, blockType); SHOW_INTEL_CYCLES(msg, sizeof(msg), countSz); } printf("%s", msg); @@ -1564,9 +1594,9 @@ static void bench_stats_asym_finish(const char* algo, int strength, printf("Algorithm,avg ms,ops/sec,\n"); csv_header_count++; } - XSNPRINTF(msg, sizeof(msg), "%s %d %s,%.3f,%.3f,\n", algo, strength, desc, milliEach, opsSec); + (void)XSNPRINTF(msg, sizeof(msg), "%s %d %s,%.3f,%.3f,\n", algo, strength, desc, milliEach, opsSec); } else { - XSNPRINTF(msg, sizeof(msg), "%-6s %5d %-9s %s %6d %s %5.3f %s, %s %5.3f ms," + (void)XSNPRINTF(msg, sizeof(msg), "%-6s %5d %-9s %s %6d %s %5.3f %s, %s %5.3f ms," " %.3f %s\n", algo, strength, desc, BENCH_ASYNC_GET_NAME(useDeviceID), count, word[0], total, word[1], word[2], milliEach, opsSec, word[3]); } @@ -1610,9 +1640,9 @@ static void bench_stats_pq_asym_finish(const char* algo, int useDeviceID, int co printf("Algorithm,avg ms,ops/sec,\n"); csv_header_count++; } - XSNPRINTF(msg, sizeof(msg), "%s %.3f,%.3f,\n", algo, milliEach, opsSec); + (void)XSNPRINTF(msg, sizeof(msg), "%s %.3f,%.3f,\n", algo, milliEach, opsSec); } else { - XSNPRINTF(msg, sizeof(msg), "%-18s %s %6d %s %5.3f %s, %s %5.3f ms," + (void)XSNPRINTF(msg, sizeof(msg), "%-18s %s %6d %s %5.3f %s, %s %5.3f ms," " %.3f %s\n", algo, BENCH_ASYNC_GET_NAME(useDeviceID), count, word[0], total, word[1], word[2], milliEach, opsSec, word[3]); } @@ -2490,11 +2520,11 @@ static int benchmark_test_threaded(void* args) } for (i = 0; i < g_threadCount; i++) { - pthread_create(&g_threadData[i].thread_id, NULL, run_bench, args); + PTHREAD_CHECK_RET(pthread_create(&g_threadData[i].thread_id, NULL, run_bench, args)); } for (i = 0; i < g_threadCount; i++) { - pthread_join(g_threadData[i].thread_id, 0); + PTHREAD_CHECK_RET(pthread_join(g_threadData[i].thread_id, 0)); } printf("\n"); @@ -5890,7 +5920,7 @@ void bench_eccMakeKey(int useDeviceID, int curveId) count += times; } while (bench_stats_sym_check(start)); exit: - XSNPRINTF(name, BENCH_ECC_NAME_SZ, "ECC [%15s]", + (void)XSNPRINTF(name, BENCH_ECC_NAME_SZ, "ECC [%15s]", wc_ecc_get_name(curveId)); bench_stats_asym_finish(name, keySize * 8, desc[2], useDeviceID, count, start, ret); @@ -6010,7 +6040,7 @@ void bench_ecc(int useDeviceID, int curveId) } while (bench_stats_sym_check(start)); PRIVATE_KEY_UNLOCK(); exit_ecdhe: - XSNPRINTF(name, BENCH_ECC_NAME_SZ, "ECDHE [%15s]", wc_ecc_get_name(curveId)); + (void)XSNPRINTF(name, BENCH_ECC_NAME_SZ, "ECDHE [%15s]", wc_ecc_get_name(curveId)); bench_stats_asym_finish(name, keySize * 8, desc[3], useDeviceID, count, start, ret); @@ -6054,7 +6084,7 @@ exit_ecdhe: count += times; } while (bench_stats_sym_check(start)); exit_ecdsa_sign: - XSNPRINTF(name, BENCH_ECC_NAME_SZ, "ECDSA [%15s]", wc_ecc_get_name(curveId)); + (void)XSNPRINTF(name, BENCH_ECC_NAME_SZ, "ECDSA [%15s]", wc_ecc_get_name(curveId)); bench_stats_asym_finish(name, keySize * 8, desc[4], useDeviceID, count, start, ret); @@ -6090,7 +6120,7 @@ exit_ecdsa_sign: count += times; } while (bench_stats_sym_check(start)); exit_ecdsa_verify: - XSNPRINTF(name, BENCH_ECC_NAME_SZ, "ECDSA [%15s]", wc_ecc_get_name(curveId)); + (void)XSNPRINTF(name, BENCH_ECC_NAME_SZ, "ECDSA [%15s]", wc_ecc_get_name(curveId)); bench_stats_asym_finish(name, keySize * 8, desc[5], useDeviceID, count, start, ret); @@ -6197,7 +6227,7 @@ void bench_eccEncrypt(int curveId) count += i; } while (bench_stats_sym_check(start)); exit_enc: - XSNPRINTF(name, BENCH_ECC_NAME_SZ, "ECC [%15s]", wc_ecc_get_name(curveId)); + (void)XSNPRINTF(name, BENCH_ECC_NAME_SZ, "ECC [%15s]", wc_ecc_get_name(curveId)); bench_stats_asym_finish(name, keySize * 8, desc[6], 0, count, start, ret); bench_stats_start(&count, &start); @@ -7477,7 +7507,7 @@ void bench_falconKeySign(byte level) (void)reset; - gettimeofday(&tv, 0); + LIBCALL_CHECK_RET(gettimeofday(&tv, 0)); return (double)tv.tv_sec + (double)tv.tv_usec / 1000000; } diff --git a/wolfcrypt/benchmark/benchmark.h b/wolfcrypt/benchmark/benchmark.h index aeab85876..0481e9679 100644 --- a/wolfcrypt/benchmark/benchmark.h +++ b/wolfcrypt/benchmark/benchmark.h @@ -1,6 +1,6 @@ /* wolfcrypt/benchmark/benchmark.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index 38b786b67..e9ddd474b 100644 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -1,6 +1,6 @@ /* aes.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -4470,30 +4470,54 @@ int wc_AesSetIV(Aes* aes, const byte* iv) #ifdef WOLFSSL_CHECK_MEM_ZERO wc_MemZero_Add("wc_AesCtrEncrypt scratch", scratch, AES_BLOCK_SIZE); #endif - /* do as many block size ops as possible */ - while (sz >= AES_BLOCK_SIZE) { - #ifdef XTRANSFORM_AESCTRBLOCK - XTRANSFORM_AESCTRBLOCK(aes, out, in); - #else - ret = wc_AesEncrypt(aes, (byte*)aes->reg, scratch); - if (ret != 0) { - ForceZero(scratch, AES_BLOCK_SIZE); - #ifdef WOLFSSL_CHECK_MEM_ZERO - wc_MemZero_Check(scratch, AES_BLOCK_SIZE); - #endif - return ret; + #if defined(HAVE_AES_ECB) && !defined(WOLFSSL_PIC32MZ_CRYPT) && \ + !defined(XTRANSFORM_AESCTRBLOCK) + if (in != out && sz >= AES_BLOCK_SIZE) { + int blocks = sz / AES_BLOCK_SIZE; + byte* counter = (byte*)aes->reg; + byte* c = out; + while (blocks--) { + XMEMCPY(c, counter, AES_BLOCK_SIZE); + c += AES_BLOCK_SIZE; + IncrementAesCounter(counter); } - xorbuf(scratch, in, AES_BLOCK_SIZE); - XMEMCPY(out, scratch, AES_BLOCK_SIZE); - #endif - IncrementAesCounter((byte*)aes->reg); - out += AES_BLOCK_SIZE; - in += AES_BLOCK_SIZE; - sz -= AES_BLOCK_SIZE; - aes->left = 0; + /* reset number of blocks and then do encryption */ + blocks = sz / AES_BLOCK_SIZE; + wc_AesEcbEncrypt(aes, out, out, AES_BLOCK_SIZE * blocks); + xorbuf(out, in, AES_BLOCK_SIZE * blocks); + in += AES_BLOCK_SIZE * blocks; + out += AES_BLOCK_SIZE * blocks; + sz -= blocks * AES_BLOCK_SIZE; + } + else + #endif + { + /* do as many block size ops as possible */ + while (sz >= AES_BLOCK_SIZE) { + #ifdef XTRANSFORM_AESCTRBLOCK + XTRANSFORM_AESCTRBLOCK(aes, out, in); + #else + ret = wc_AesEncrypt(aes, (byte*)aes->reg, scratch); + if (ret != 0) { + ForceZero(scratch, AES_BLOCK_SIZE); + #ifdef WOLFSSL_CHECK_MEM_ZERO + wc_MemZero_Check(scratch, AES_BLOCK_SIZE); + #endif + return ret; + } + xorbuf(scratch, in, AES_BLOCK_SIZE); + XMEMCPY(out, scratch, AES_BLOCK_SIZE); + #endif + IncrementAesCounter((byte*)aes->reg); + + out += AES_BLOCK_SIZE; + in += AES_BLOCK_SIZE; + sz -= AES_BLOCK_SIZE; + aes->left = 0; + } + ForceZero(scratch, AES_BLOCK_SIZE); } - ForceZero(scratch, AES_BLOCK_SIZE); /* handle non block size remaining and store unused byte count in left */ if (sz) { diff --git a/wolfcrypt/src/aes_asm.S b/wolfcrypt/src/aes_asm.S index 0246c0ffc..e12f4d27c 100644 --- a/wolfcrypt/src/aes_asm.S +++ b/wolfcrypt/src/aes_asm.S @@ -1,6 +1,6 @@ /* aes_asm.S * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/aes_asm.asm b/wolfcrypt/src/aes_asm.asm index 8f071b352..bef99b201 100644 --- a/wolfcrypt/src/aes_asm.asm +++ b/wolfcrypt/src/aes_asm.asm @@ -1,6 +1,6 @@ ; /* aes_asm.asm ; * -; * Copyright (C) 2006-2021 wolfSSL Inc. +; * Copyright (C) 2006-2022 wolfSSL Inc. ; * ; * This file is part of wolfSSL. ; * @@ -20,6 +20,7 @@ ; */ + ; ; ; /* See Intel Advanced Encryption Standard (AES) Instructions Set White Paper diff --git a/wolfcrypt/src/aes_gcm_asm.S b/wolfcrypt/src/aes_gcm_asm.S index 5d4f27b1c..8b9423810 100644 --- a/wolfcrypt/src/aes_gcm_asm.S +++ b/wolfcrypt/src/aes_gcm_asm.S @@ -1,6 +1,6 @@ /* aes_gcm_asm * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/arc4.c b/wolfcrypt/src/arc4.c index 05c91dce3..479e38185 100644 --- a/wolfcrypt/src/arc4.c +++ b/wolfcrypt/src/arc4.c @@ -1,6 +1,6 @@ /* arc4.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/asm.c b/wolfcrypt/src/asm.c index b5cfcf3c5..344dff006 100644 --- a/wolfcrypt/src/asm.c +++ b/wolfcrypt/src/asm.c @@ -1,6 +1,6 @@ /* asm.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index ea212c2fe..e058272e0 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -1,6 +1,6 @@ /* asn.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -5216,7 +5216,7 @@ int EncodeObjectId(const word16* in, word32 inSz, byte* out, word32* outSz) * @param [in] in Byte array containing OID. * @param [in] inSz Size of OID in bytes. * @param [in] out Array to hold dotted form of OID. - * @param [in, out] outSz On in, number of elemnts in array. + * @param [in, out] outSz On in, number of elements in array. * On out, count of numbers in dotted form. * @return 0 on success * @return BAD_FUNC_ARG when in or outSz is NULL. @@ -11108,16 +11108,26 @@ static int GenerateDNSEntryIPString(DNS_entry* entry, void* heap) /* store IP addresses as a string */ if (entry->len == WOLFSSL_IP4_ADDR_LEN) { - XSNPRINTF(tmpName, sizeof(tmpName), "%u.%u.%u.%u", 0xFFU & ip[0], - 0xFFU & ip[1], 0xFFU & ip[2], 0xFFU & ip[3]); + if (XSNPRINTF(tmpName, sizeof(tmpName), "%u.%u.%u.%u", 0xFFU & ip[0], + 0xFFU & ip[1], 0xFFU & ip[2], 0xFFU & ip[3]) + >= (int)sizeof(tmpName)) + { + WOLFSSL_MSG("IP buffer overrun"); + return BUFFER_E; + } } if (entry->len == WOLFSSL_IP6_ADDR_LEN) { int i; for (i = 0; i < 8; i++) { - XSNPRINTF(tmpName + i * 5, sizeof(tmpName) - i * 5, + if (XSNPRINTF(tmpName + i * 5, sizeof(tmpName) - i * 5, "%02X%02X%s", 0xFF & ip[2 * i], 0xFF & ip[2 * i + 1], - (i < 7) ? ":" : ""); + (i < 7) ? ":" : "") + >= (int)sizeof(tmpName)) + { + WOLFSSL_MSG("IPv6 buffer overrun"); + return BUFFER_E; + } } } @@ -11132,6 +11142,8 @@ static int GenerateDNSEntryIPString(DNS_entry* entry, void* heap) entry->ipString[nameSz] = '\0'; } + (void)heap; + return ret; } #endif /* OPENSSL_ALL || WOLFSSL_IP_ALT_NAME */ @@ -11261,14 +11273,14 @@ static int SetSubject(DecodedCert* cert, int id, byte* str, word32 strLen, SetCertNameSubjectLen(cert, id, strLen); SetCertNameSubjectEnc(cert, id, tag); } +#endif +#if !defined(IGNORE_NAME_CONSTRAINTS) || \ + defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT) else if (id == ASN_EMAIL) { cert->subjectEmail = (char*)str; cert->subjectEmailLen = strLen; - #if !defined(IGNORE_NAME_CONSTRAINTS) - ret = SetDNSEntry(cert, cert->subjectEmail, strLen, 0, - &cert->altEmailNames); - #endif } +#endif #ifdef WOLFSSL_CERT_EXT /* TODO: consider mapping id to an index and using SetCertNameSubect*(). */ else if (id == ASN_JURIS_C) { @@ -11281,7 +11293,6 @@ static int SetSubject(DecodedCert* cert, int id, byte* str, word32 strLen, cert->subjectJSLen = strLen; cert->subjectJSEnc = tag; } -#endif #endif return ret; @@ -11904,7 +11915,8 @@ static int GetCertName(DecodedCert* cert, char* full, byte* hash, int nameType, copy = WOLFSSL_EMAIL_ADDR; } - #if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT) + #if !defined(IGNORE_NAME_CONSTRAINTS) || \ + defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT) if (nameType == SUBJECT) { cert->subjectEmail = (char*)&input[srcIdx]; cert->subjectEmailLen = strLen; @@ -11921,41 +11933,6 @@ static int GetCertName(DecodedCert* cert, char* full, byte* hash, int nameType, && !defined(WOLFCRYPT_ONLY) nid = NID_emailAddress; #endif /* OPENSSL_EXTRA */ - #ifndef IGNORE_NAME_CONSTRAINTS - { - DNS_entry* emailName; - - emailName = AltNameNew(cert->heap); - if (emailName == NULL) { - WOLFSSL_MSG("\tOut of Memory"); - #if (defined(OPENSSL_EXTRA) || \ - defined(OPENSSL_EXTRA_X509_SMALL)) && \ - !defined(WOLFCRYPT_ONLY) - wolfSSL_X509_NAME_free(dName); - #endif /* OPENSSL_EXTRA */ - return MEMORY_E; - } - emailName->type = 0; - emailName->name = (char*)XMALLOC(strLen + 1, - cert->heap, DYNAMIC_TYPE_ALTNAME); - if (emailName->name == NULL) { - WOLFSSL_MSG("\tOut of Memory"); - XFREE(emailName, cert->heap, DYNAMIC_TYPE_ALTNAME); - #if (defined(OPENSSL_EXTRA) || \ - defined(OPENSSL_EXTRA_X509_SMALL)) && \ - !defined(WOLFCRYPT_ONLY) - wolfSSL_X509_NAME_free(dName); - #endif /* OPENSSL_EXTRA */ - return MEMORY_E; - } - emailName->len = strLen; - XMEMCPY(emailName->name, &input[srcIdx], strLen); - emailName->name[strLen] = '\0'; - - emailName->next = cert->altEmailNames; - cert->altEmailNames = emailName; - } - #endif /* IGNORE_NAME_CONSTRAINTS */ } if (pilot) { @@ -12459,8 +12436,13 @@ int GetTimeString(byte* date, int format, char* buf, int len) } idx = 4; /* use idx now for char buffer */ - XSNPRINTF(buf + idx, len - idx, "%2d %02d:%02d:%02d %d GMT", - t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec, (int)t.tm_year + 1900); + if (XSNPRINTF(buf + idx, len - idx, "%2d %02d:%02d:%02d %d GMT", + t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec, (int)t.tm_year + 1900) + >= len - idx) + { + WOLFSSL_MSG("buffer overrun in GetTimeString"); + return 0; + } return 1; } @@ -13090,9 +13072,16 @@ int DecodeToKey(DecodedCert* cert, int verify) return ret; /* Determine if self signed */ - cert->selfSigned = XMEMCMP(cert->issuerHash, - cert->subjectHash, - KEYID_SIZE) == 0 ? 1 : 0; +#ifdef WOLFSSL_CERT_REQ + if (cert->isCSR) + cert->selfSigned = 1; + else +#endif + { + cert->selfSigned = XMEMCMP(cert->issuerHash, + cert->subjectHash, + KEYID_SIZE) == 0 ? 1 : 0; + } ret = GetCertKey(cert, cert->source, &cert->srcIdx, cert->maxIdx); if (ret != 0) @@ -13317,14 +13306,16 @@ static int SetCurve(ecc_key* key, byte* output, size_t outSz) return idx + oidSz; } + /* verify output buffer has room */ + if (oidSz > outSz) + return BUFFER_E; + #ifdef HAVE_OID_ENCODING ret = EncodeObjectId(key->dp->oid, key->dp->oidSz, output+idx, &oidSz); if (ret != 0) { return ret; } #else - if (oidSz > outSz) - return BUFFER_E; XMEMCPY(output+idx, key->dp->oid, oidSz); #endif idx += oidSz; @@ -14525,6 +14516,68 @@ static int MatchBaseName(int type, const char* name, int nameSz, } +/* Search through the list to find if the name is permitted. + * name The DNS name to search for + * dnsList The list to search through + * nameType Type of DNS name to currently searching + * return 1 if found in list or if not needed + * return 0 if not found in the list but is needed + */ +static int PermittedListOk(DNS_entry* name, Base_entry* dnsList, byte nameType) +{ + Base_entry* current = dnsList; + int match = 0; + int need = 0; + int ret = 1; /* is ok unless needed and no match found */ + + while (current != NULL) { + if (current->type == nameType) { + need = 1; /* restriction on permitted names is set for this type */ + if (name->len >= current->nameSz && + MatchBaseName(nameType, name->name, name->len, + current->name, current->nameSz)) { + match = 1; /* found the current name in the permitted list*/ + break; + } + } + current = current->next; + } + + /* check if permitted name restriction was set and no matching name found */ + if (need && !match) + ret = 0; + + return ret; +} + + +/* Search through the list to find if the name is excluded. + * name The DNS name to search for + * dnsList The list to search through + * nameType Type of DNS name to currently searching + * return 1 if found in list and 0 if not found in the list + */ +static int IsInExcludedList(DNS_entry* name, Base_entry* dnsList, byte nameType) +{ + int ret = 0; /* default of not found in the list */ + Base_entry* current = dnsList; + + while (current != NULL) { + if (current->type == nameType) { + if (name->len >= current->nameSz && + MatchBaseName(nameType, name->name, name->len, + current->name, current->nameSz)) { + ret = 1; + break; + } + } + current = current->next; + } + + return ret; +} + + static int ConfirmNameConstraints(Signer* signer, DecodedCert* cert) { const byte nameTypes[] = {ASN_RFC822_TYPE, ASN_DNS_TYPE, ASN_DIR_TYPE}; @@ -14539,9 +14592,9 @@ static int ConfirmNameConstraints(Signer* signer, DecodedCert* cert) for (i=0; i < (int)sizeof(nameTypes); i++) { byte nameType = nameTypes[i]; DNS_entry* name = NULL; - DNS_entry subjectDnsName; - Base_entry* base; + DNS_entry subjectDnsName; /* temporary node used for subject name */ + XMEMSET(&subjectDnsName, 0, sizeof(DNS_entry)); switch (nameType) { case ASN_DNS_TYPE: /* Should it also consider CN in subject? It could use @@ -14551,28 +14604,38 @@ static int ConfirmNameConstraints(Signer* signer, DecodedCert* cert) case ASN_RFC822_TYPE: /* Shouldn't it validade E= in subject as well? */ name = cert->altEmailNames; + + /* Add subject email for checking. */ + if (cert->subjectEmail != NULL) { + /* RFC 5280 section 4.2.1.10 + * "When constraints are imposed on the rfc822Name name + * form, but the certificate does not include a subject + * alternative name, the rfc822Name constraint MUST be + * applied to the attribute of type emailAddress in the + * subject distinguished name" */ + subjectDnsName.next = NULL; + subjectDnsName.type = ASN_RFC822_TYPE; + subjectDnsName.len = cert->subjectEmailLen; + subjectDnsName.name = (char *)cert->subjectEmail; + } break; case ASN_DIR_TYPE: - if (cert->subjectRaw != NULL) { - subjectDnsName.next = NULL; - subjectDnsName.type = ASN_DIR_TYPE; - subjectDnsName.len = cert->subjectRawLen; - subjectDnsName.name = (char *)cert->subjectRaw; - name = &subjectDnsName; - } + name = cert->altDirNames; - #ifndef WOLFSSL_NO_ASN_STRICT + #ifndef WOLFSSL_NO_ASN_STRICT /* RFC 5280 section 4.2.1.10 "Restrictions of the form directoryName MUST be applied to the subject field .... and to any names of type directoryName in the subjectAltName extension" */ - if (name != NULL) - name->next = cert->altDirNames; - else - name = cert->altDirNames; - #endif + if (cert->subjectRaw != NULL) { + subjectDnsName.next = NULL; + subjectDnsName.type = ASN_DIR_TYPE; + subjectDnsName.len = cert->subjectRawLen; + subjectDnsName.name = (char *)cert->subjectRaw; + } + #endif break; default: /* Other types of names are ignored for now. @@ -14582,44 +14645,35 @@ static int ConfirmNameConstraints(Signer* signer, DecodedCert* cert) } while (name != NULL) { - int match = 0; - int need = 0; - - base = signer->excludedNames; - /* Check against the excluded list */ - while (base != NULL) { - if (base->type == nameType) { - if (name->len >= base->nameSz && - MatchBaseName(nameType, - name->name, name->len, - base->name, base->nameSz)) { - return 0; - } - } - base = base->next; + if (IsInExcludedList(name, signer->excludedNames, nameType) == 1) { + WOLFSSL_MSG("Excluded name was found!"); + return 0; } /* Check against the permitted list */ - base = signer->permittedNames; - while (base != NULL) { - if (base->type == nameType) { - need = 1; - if (name->len >= base->nameSz && - MatchBaseName(nameType, - name->name, name->len, - base->name, base->nameSz)) { - match = 1; - break; - } - } - base = base->next; + if (PermittedListOk(name, signer->permittedNames, nameType) != 1) { + WOLFSSL_MSG("Permitted name was not found!"); + return 0; } - if (need && !match) - return 0; - name = name->next; } + + /* handle comparing against subject name too */ + if (subjectDnsName.len > 0 && subjectDnsName.name != NULL) { + if (IsInExcludedList(&subjectDnsName, signer->excludedNames, + nameType) == 1) { + WOLFSSL_MSG("Excluded name was found!"); + return 0; + } + + /* Check against the permitted list */ + if (PermittedListOk(&subjectDnsName, signer->permittedNames, + nameType) != 1) { + WOLFSSL_MSG("Permitted name was not found!"); + return 0; + } + } } return 1; @@ -18092,8 +18146,15 @@ static int DecodeCertInternal(DecodedCert* cert, int verify, int* criticalExt, } if (ret == 0) { /* Determine if self signed by comparing issuer and subject hashes. */ - cert->selfSigned = XMEMCMP(cert->issuerHash, cert->subjectHash, - KEYID_SIZE) == 0 ? 1 : 0; + #ifdef WOLFSSL_CERT_REQ + if (cert->isCSR) + cert->selfSigned = 1; + else + #endif + { + cert->selfSigned = XMEMCMP(cert->issuerHash, cert->subjectHash, + KEYID_SIZE) == 0 ? 1 : 0; + } if (stopAtPubKey) { /* Return any bad date error through badDateRet and return offset of @@ -19755,6 +19816,22 @@ int ParseCertRelative(DecodedCert* cert, int type, int verify, void* cm) } #endif /* IGNORE_NAME_CONSTRAINTS */ } +#ifdef WOLFSSL_CERT_REQ + else if (type == CERTREQ_TYPE) { + if ((ret = ConfirmSignature(&cert->sigCtx, + cert->source + cert->certBegin, + cert->sigIndex - cert->certBegin, + cert->publicKey, cert->pubKeySize, + cert->keyOID, cert->signature, + cert->sigLength, cert->signatureOID, + sce_tsip_encRsaKeyIdx)) != 0) { + if (ret != WC_PENDING_E) { + WOLFSSL_MSG("Confirm signature failed"); + } + return ret; + } + } +#endif else { /* no signer */ WOLFSSL_MSG("No CA signer to verify with"); @@ -22091,7 +22168,7 @@ enum { * @return MEMORY_E when dynamic memory allocation failed. */ static int SetEccPublicKey(byte* output, ecc_key* key, int outLen, - int with_header) + int with_header, int comp) { #ifndef WOLFSSL_ASN_TEMPLATE int ret, idx = 0, algoSz, curveSz, bitStringSz; @@ -22101,7 +22178,10 @@ static int SetEccPublicKey(byte* output, ecc_key* key, int outLen, /* public size */ pubSz = key->dp ? key->dp->size : MAX_ECC_BYTES; - pubSz = 1 + 2 * pubSz; + if (comp) + pubSz = 1 + pubSz; + else + pubSz = 1 + 2 * pubSz; /* check for buffer overflow */ if (output != NULL && pubSz > (word32)outLen) { @@ -22144,7 +22224,7 @@ static int SetEccPublicKey(byte* output, ecc_key* key, int outLen, /* pub */ if (output) { PRIVATE_KEY_UNLOCK(); - ret = wc_ecc_export_x963(key, output + idx, &pubSz); + ret = wc_ecc_export_x963_ex(key, output + idx, &pubSz, comp); PRIVATE_KEY_LOCK(); if (ret != 0) { return ret; @@ -22168,7 +22248,7 @@ static int SetEccPublicKey(byte* output, ecc_key* key, int outLen, if (ret == 0) { /* Calculate the size of the encoded public point. */ PRIVATE_KEY_UNLOCK(); - ret = wc_ecc_export_x963(key, NULL, &pubSz); + ret = wc_ecc_export_x963_ex(key, NULL, &pubSz, comp); PRIVATE_KEY_LOCK(); /* LENGTH_ONLY_E on success. */ if (ret == LENGTH_ONLY_E) { @@ -22238,7 +22318,7 @@ static int SetEccPublicKey(byte* output, ecc_key* key, int outLen, if ((ret == 0) && (output != NULL)) { /* Encode public point. */ PRIVATE_KEY_UNLOCK(); - ret = wc_ecc_export_x963(key, output, &pubSz); + ret = wc_ecc_export_x963_ex(key, output, &pubSz, comp); PRIVATE_KEY_LOCK(); } if (ret == 0) { @@ -22266,12 +22346,18 @@ static int SetEccPublicKey(byte* output, ecc_key* key, int outLen, int wc_EccPublicKeyToDer(ecc_key* key, byte* output, word32 inLen, int with_AlgCurve) { - return SetEccPublicKey(output, key, inLen, with_AlgCurve); + return SetEccPublicKey(output, key, inLen, with_AlgCurve, 0); +} + +int wc_EccPublicKeyToDer_ex(ecc_key* key, byte* output, word32 inLen, + int with_AlgCurve, int comp) +{ + return SetEccPublicKey(output, key, inLen, with_AlgCurve, comp); } int wc_EccPublicKeyDerSize(ecc_key* key, int with_AlgCurve) { - return SetEccPublicKey(NULL, key, 0, with_AlgCurve); + return SetEccPublicKey(NULL, key, 0, with_AlgCurve, 0); } #endif /* HAVE_ECC && HAVE_ECC_KEY_EXPORT */ @@ -22319,7 +22405,7 @@ enum { * @return BAD_FUNC_ARG when key is NULL. * @return MEMORY_E when dynamic memory allocation failed. */ -static int SetAsymKeyDerPublic(const byte* pubKey, word32 pubKeyLen, +int SetAsymKeyDerPublic(const byte* pubKey, word32 pubKeyLen, byte* output, word32 outLen, int keyType, int withHeader) { int ret = 0; @@ -22770,6 +22856,31 @@ static int SetExtensionsHeader(byte* out, word32 outSz, int extSz) } +/* encode CA basic constraints true with path length + * return total bytes written */ +static int SetCaWithPathLen(byte* out, word32 outSz, byte pathLen) +{ + /* ASN1->DER sequence for Basic Constraints True and path length */ + const byte caPathLenBasicConstASN1[] = { + 0x30, 0x0F, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, + 0x08, 0x30, 0x06, 0x01, 0x01, 0xFF, 0x02, 0x01, + 0x00 + }; + + if (out == NULL) + return BAD_FUNC_ARG; + + if (outSz < sizeof(caPathLenBasicConstASN1)) + return BUFFER_E; + + XMEMCPY(out, caPathLenBasicConstASN1, sizeof(caPathLenBasicConstASN1)); + + out[sizeof(caPathLenBasicConstASN1)-1] = pathLen; + + return (int)sizeof(caPathLenBasicConstASN1); +} + + /* encode CA basic constraints true * return total bytes written */ static int SetCa(byte* out, word32 outSz) @@ -24131,7 +24242,7 @@ static int EncodePublicKey(int keyType, byte* output, int outLen, #endif #ifdef HAVE_ECC case ECC_KEY: - ret = SetEccPublicKey(output, eccKey, outLen, 1); + ret = SetEccPublicKey(output, eccKey, outLen, 1, 0); if (ret <= 0) { ret = PUBLIC_KEY_E; } @@ -24340,8 +24451,17 @@ static int EncodeExtensions(Cert* cert, byte* output, word32 maxSz, /* Set Basic Constraints to be a Certificate Authority. */ SetASN_Boolean(&dataASN[CERTEXTSASN_IDX_BC_CA], 1); SetASN_Buffer(&dataASN[CERTEXTSASN_IDX_BC_OID], bcOID, sizeof(bcOID)); - /* TODO: consider adding path length field in Cert. */ - dataASN[CERTEXTSASN_IDX_BC_PATHLEN].noOut = 1; + if (cert->pathLen + #ifdef WOLFSSL_CERT_EXT + && ((cert->keyUsage & KEYUSE_KEY_CERT_SIGN) || (!cert->keyUsage)) + #endif + ) { + SetASN_Int8Bit(&dataASN[CERTEXTSASN_IDX_BC_PATHLEN], + cert->pathLen); + } + else { + dataASN[CERTEXTSASN_IDX_BC_PATHLEN].noOut = 1; + } } else if (cert->basicConstSet) { /* Set Basic Constraints to be a non Certificate Authority. */ @@ -24811,7 +24931,7 @@ static int EncodeCert(Cert* cert, DerCert* der, RsaKey* rsaKey, ecc_key* eccKey, if (eccKey == NULL) return PUBLIC_KEY_E; der->publicKeySz = SetEccPublicKey(der->publicKey, eccKey, - sizeof(der->publicKey), 1); + sizeof(der->publicKey), 1, 0); } #endif @@ -24932,8 +25052,24 @@ static int EncodeCert(Cert* cert, DerCert* der, RsaKey* rsaKey, ecc_key* eccKey, /* set the extensions */ der->extensionsSz = 0; + /* RFC 5280 : 4.2.1.9. Basic Constraints + * The pathLenConstraint field is meaningful only if the CA boolean is + * asserted and the key usage extension, if present, asserts the + * keyCertSign bit */ + /* Set CA and path length */ + if ((cert->isCA) && (cert->pathLen) +#ifdef WOLFSSL_CERT_EXT + && ((cert->keyUsage & KEYUSE_KEY_CERT_SIGN) || (!cert->keyUsage)) +#endif + ) { + der->caSz = SetCaWithPathLen(der->ca, sizeof(der->ca), cert->pathLen); + if (der->caSz <= 0) + return CA_TRUE_E; + + der->extensionsSz += der->caSz; + } /* Set CA */ - if (cert->isCA) { + else if (cert->isCA) { der->caSz = SetCa(der->ca, sizeof(der->ca)); if (der->caSz <= 0) return CA_TRUE_E; @@ -26066,7 +26202,7 @@ static int EncodeCertReq(Cert* cert, DerCert* der, RsaKey* rsaKey, if (eccKey == NULL) return PUBLIC_KEY_E; der->publicKeySz = SetEccPublicKey(der->publicKey, eccKey, - sizeof(der->publicKey), 1); + sizeof(der->publicKey), 1, 0); } #endif @@ -26103,8 +26239,24 @@ static int EncodeCertReq(Cert* cert, DerCert* der, RsaKey* rsaKey, /* set the extensions */ der->extensionsSz = 0; + /* RFC 5280 : 4.2.1.9. Basic Constraints + * The pathLenConstraint field is meaningful only if the CA boolean is + * asserted and the key usage extension, if present, asserts the + * keyCertSign bit */ + /* Set CA and path length */ + if ((cert->isCA) && (cert->pathLen) +#ifdef WOLFSSL_CERT_EXT + && ((cert->keyUsage & KEYUSE_KEY_CERT_SIGN) || (!cert->keyUsage)) +#endif + ) { + der->caSz = SetCaWithPathLen(der->ca, sizeof(der->ca), cert->pathLen); + if (der->caSz <= 0) + return CA_TRUE_E; + + der->extensionsSz += der->caSz; + } /* Set CA */ - if (cert->isCA) { + else if (cert->isCA) { der->caSz = SetCa(der->ca, sizeof(der->ca)); if (der->caSz <= 0) return CA_TRUE_E; @@ -26549,7 +26701,7 @@ static int MakeCertReq(Cert* cert, byte* derBuffer, word32 derSz, if ((ret == 0) && (sz > (int)derSz)) { ret = BUFFER_E; } - if (ret == 0) { + if (ret == 0 && derBuffer != NULL) { /* Encode certificate request body into buffer. */ SetASN_Items(certReqBodyASN, dataASN, certReqBodyASN_Length, derBuffer); @@ -26565,14 +26717,15 @@ static int MakeCertReq(Cert* cert, byte* derBuffer, word32 derSz, &cert->subject, cert->heap); } } - if (ret >= 0) { + if (ret >= 0 && derBuffer != NULL) { /* Encode public key into space in buffer. */ ret = EncodePublicKey(cert->keyType, (byte*)dataASN[CERTREQBODYASN_IDX_SPUBKEYINFO_SEQ].data.buffer.data, dataASN[CERTREQBODYASN_IDX_SPUBKEYINFO_SEQ].data.buffer.length, rsaKey, eccKey, ed25519Key, ed448Key, dsaKey); } - if ((ret >= 0) && (!dataASN[CERTREQBODYASN_IDX_EXT_BODY].noOut)) { + if ((ret >= 0 && derBuffer != NULL) && + (!dataASN[CERTREQBODYASN_IDX_EXT_BODY].noOut)) { /* Encode extensions into space in buffer. */ ret = EncodeExtensions(cert, (byte*)dataASN[CERTREQBODYASN_IDX_EXT_BODY].data.buffer.data, @@ -26798,7 +26951,7 @@ static int SetKeyIdFromPublicKey(Cert *cert, RsaKey *rsakey, ecc_key *eckey, #ifdef HAVE_ECC /* ECC public key */ if (eckey != NULL) - bufferSz = SetEccPublicKey(buf, eckey, MAX_PUBLIC_KEY_SZ, 0); + bufferSz = SetEccPublicKey(buf, eckey, MAX_PUBLIC_KEY_SZ, 0, 0); #endif #if defined(HAVE_ED25519) && defined(HAVE_ED25519_KEY_EXPORT) /* ED25519 public key */ @@ -28208,8 +28361,8 @@ int DecodeECC_DSA_Sig(const byte* sig, word32 sigLen, mp_int* r, mp_int* s) ret = ASN_ECC_KEY_E; } - return ret; #endif + return ret; #endif /* WOLFSSL_ASN_TEMPLATE */ } #endif @@ -29576,9 +29729,7 @@ static const ASNItem edKeyASN[] = { /* attributes */ /* ATTRS */ { 1, ASN_CONTEXT_SPECIFIC | ASN_ASYMKEY_ATTRS, 1, 1, 1 }, /* publicKey */ -/* PUBKEY */ { 1, ASN_CONTEXT_SPECIFIC | ASN_ASYMKEY_PUBKEY, 1, 1, 1 }, - /* Public value */ -/* PUBKEY_VAL */ { 2, ASN_OCTET_STRING, 0, 0, 0 } +/* PUBKEY */ { 1, ASN_CONTEXT_SPECIFIC | ASN_ASYMKEY_PUBKEY, 0, 0, 1 }, }; enum { EDKEYASN_IDX_SEQ = 0, @@ -29589,7 +29740,6 @@ enum { EDKEYASN_IDX_PKEY_CURVEPKEY, EDKEYASN_IDX_ATTRS, EDKEYASN_IDX_PUBKEY, - EDKEYASN_IDX_PUBKEY_VAL, }; /* Number of items in ASN.1 template for Ed25519 and Ed448 private key. */ @@ -29670,11 +29820,8 @@ static int DecodeAsymKey(const byte* input, word32* inOutIdx, word32 inSz, return BAD_FUNC_ARG; } - if (GetASNHeader(input, ASN_CONTEXT_SPECIFIC | ASN_CONSTRUCTED | 1, - inOutIdx, &length, inSz) < 0) { - return ASN_PARSE_E; - } - if (GetOctetString(input, inOutIdx, &pubSz, inSz) < 0) { + if (GetASNHeader(input, ASN_CONTEXT_SPECIFIC | ASN_ASYMKEY_PUBKEY | 1, + inOutIdx, &pubSz, inSz) < 0) { return ASN_PARSE_E; } @@ -29726,7 +29873,7 @@ static int DecodeAsymKey(const byte* input, word32* inOutIdx, word32 inSz, } else if ((ret == 0) && (pubKeyLen != NULL) && - (dataASN[EDKEYASN_IDX_PUBKEY_VAL].data.ref.length > *pubKeyLen)) { + (dataASN[EDKEYASN_IDX_PUBKEY].data.ref.length > *pubKeyLen)) { ret = ASN_PARSE_E; } else if (ret == 0) { @@ -29735,9 +29882,9 @@ static int DecodeAsymKey(const byte* input, word32* inOutIdx, word32 inSz, XMEMCPY(privKey, dataASN[EDKEYASN_IDX_PKEY_CURVEPKEY].data.ref.data, *privKeyLen); if (pubKeyLen != NULL) - *pubKeyLen = dataASN[EDKEYASN_IDX_PUBKEY_VAL].data.ref.length; + *pubKeyLen = dataASN[EDKEYASN_IDX_PUBKEY].data.ref.length; if (pubKey != NULL && pubKeyLen != NULL) - XMEMCPY(pubKey, dataASN[EDKEYASN_IDX_PUBKEY_VAL].data.ref.data, + XMEMCPY(pubKey, dataASN[EDKEYASN_IDX_PUBKEY].data.ref.data, *pubKeyLen); } @@ -29746,7 +29893,7 @@ static int DecodeAsymKey(const byte* input, word32* inOutIdx, word32 inSz, #endif /* WOLFSSL_ASN_TEMPLATE */ } -static int DecodeAsymKeyPublic(const byte* input, word32* inOutIdx, word32 inSz, +int DecodeAsymKeyPublic(const byte* input, word32* inOutIdx, word32 inSz, byte* pubKey, word32* pubKeyLen, int keyType) { int ret = 0; @@ -29938,7 +30085,6 @@ int wc_Curve25519PublicKeyDecode(const byte* input, word32* inOutIdx, * @return Size of encoded data in bytes on success * @return BAD_FUNC_ARG when key is NULL. * @return MEMORY_E when dynamic memory allocation failed. - * @return LENGTH_ONLY_E return length only. */ static int SetAsymKeyDer(const byte* privKey, word32 privKeyLen, const byte* pubKey, word32 pubKeyLen, @@ -29960,7 +30106,7 @@ static int SetAsymKeyDer(const byte* privKey, word32 privKeyLen, #ifndef WOLFSSL_ASN_TEMPLATE /* calculate size */ if (pubKey) { - pubSz = 2 + 2 + pubKeyLen; + pubSz = 2 + pubKeyLen; } privSz = 2 + 2 + privKeyLen; algoSz = SetAlgoID(keyType, NULL, oidKeyType, 0); @@ -29976,7 +30122,7 @@ static int SetAsymKeyDer(const byte* privKey, word32 privKeyLen, if (ret == 0 && output != NULL) { /* write out */ /* seq */ - seqSz = SetSequence(verSz + algoSz + privSz + pubSz, output); + seqSz = SetSequence(verSz + algoSz + privSz + pubSz, output); idx = seqSz; /* ver */ SetMyVersion(0, output + idx, FALSE); @@ -29991,13 +30137,16 @@ static int SetAsymKeyDer(const byte* privKey, word32 privKeyLen, idx += privKeyLen; /* pubKey */ if (pubKey) { - idx += SetExplicit(1, 2 + pubKeyLen, output + idx); - idx += SetOctetString(pubKeyLen, output + idx); + idx += SetHeader(ASN_CONTEXT_SPECIFIC | ASN_ASYMKEY_PUBKEY | + 1, pubKeyLen, output + idx); XMEMCPY(output + idx, pubKey, pubKeyLen); idx += pubKeyLen; } - - ret = idx; + sz = idx; + } + if (ret == 0) { + /* Return size of encoding. */ + ret = sz; } #else @@ -30014,7 +30163,7 @@ static int SetAsymKeyDer(const byte* privKey, word32 privKeyLen, dataASN[EDKEYASN_IDX_ATTRS].noOut = 1; if (pubKey) { /* Leave space for public key. */ - SetASN_Buffer(&dataASN[EDKEYASN_IDX_PUBKEY_VAL], NULL, pubKeyLen); + SetASN_Buffer(&dataASN[EDKEYASN_IDX_PUBKEY], NULL, pubKeyLen); } else { /* Don't put out public part. */ @@ -30040,10 +30189,11 @@ static int SetAsymKeyDer(const byte* privKey, word32 privKeyLen, if (pubKey != NULL) { /* Put public value into space provided. */ - XMEMCPY((byte*)dataASN[EDKEYASN_IDX_PUBKEY_VAL].data.buffer.data, + XMEMCPY((byte*)dataASN[EDKEYASN_IDX_PUBKEY].data.buffer.data, pubKey, pubKeyLen); } - + } + if (ret == 0) { /* Return size of encoding. */ ret = sz; } @@ -30105,7 +30255,7 @@ int wc_Curve25519PublicKeyToDer(curve25519_key* key, byte* output, word32 inLen, int withAlg) { int ret; - byte pubKey[CURVE25519_KEYSIZE]; + byte pubKey[CURVE25519_PUB_KEY_SIZE]; word32 pubKeyLen = (word32)sizeof(pubKey); if (key == NULL || output == NULL) { diff --git a/wolfcrypt/src/blake2b.c b/wolfcrypt/src/blake2b.c index 9ed1fe70e..45fe2aade 100644 --- a/wolfcrypt/src/blake2b.c +++ b/wolfcrypt/src/blake2b.c @@ -12,7 +12,7 @@ */ /* blake2b.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/blake2s.c b/wolfcrypt/src/blake2s.c index f6478dd0e..95539a2d9 100644 --- a/wolfcrypt/src/blake2s.c +++ b/wolfcrypt/src/blake2s.c @@ -12,7 +12,7 @@ */ /* blake2s.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/camellia.c b/wolfcrypt/src/camellia.c index 3cdee6f03..719e92cb3 100644 --- a/wolfcrypt/src/camellia.c +++ b/wolfcrypt/src/camellia.c @@ -27,7 +27,7 @@ /* camellia.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/chacha.c b/wolfcrypt/src/chacha.c index f3019577b..f53fa4a3d 100644 --- a/wolfcrypt/src/chacha.c +++ b/wolfcrypt/src/chacha.c @@ -1,6 +1,6 @@ /* chacha.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/chacha20_poly1305.c b/wolfcrypt/src/chacha20_poly1305.c index 26b75f74f..c8ae19d47 100644 --- a/wolfcrypt/src/chacha20_poly1305.c +++ b/wolfcrypt/src/chacha20_poly1305.c @@ -1,6 +1,6 @@ /* chacha.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/chacha_asm.S b/wolfcrypt/src/chacha_asm.S index 61ac921ac..8485f4565 100644 --- a/wolfcrypt/src/chacha_asm.S +++ b/wolfcrypt/src/chacha_asm.S @@ -1,6 +1,6 @@ /* chacha_asm * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/cmac.c b/wolfcrypt/src/cmac.c index aa80fef6d..9338c146c 100644 --- a/wolfcrypt/src/cmac.c +++ b/wolfcrypt/src/cmac.c @@ -1,6 +1,6 @@ /* cmac.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/coding.c b/wolfcrypt/src/coding.c index 30ce6ea10..bc9262ccb 100644 --- a/wolfcrypt/src/coding.c +++ b/wolfcrypt/src/coding.c @@ -1,6 +1,6 @@ /* coding.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/compress.c b/wolfcrypt/src/compress.c index 36f2931ca..8ca798f8c 100644 --- a/wolfcrypt/src/compress.c +++ b/wolfcrypt/src/compress.c @@ -1,6 +1,6 @@ /* compress.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/cpuid.c b/wolfcrypt/src/cpuid.c index 814352f98..5f5b05a99 100644 --- a/wolfcrypt/src/cpuid.c +++ b/wolfcrypt/src/cpuid.c @@ -1,6 +1,6 @@ /* cpuid.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/cryptocb.c b/wolfcrypt/src/cryptocb.c index a5411d381..091c55872 100644 --- a/wolfcrypt/src/cryptocb.c +++ b/wolfcrypt/src/cryptocb.c @@ -1,6 +1,6 @@ /* cryptocb.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/curve25519.c b/wolfcrypt/src/curve25519.c index 9f6423499..120f7cfde 100644 --- a/wolfcrypt/src/curve25519.c +++ b/wolfcrypt/src/curve25519.c @@ -1,6 +1,6 @@ /* curve25519.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/curve448.c b/wolfcrypt/src/curve448.c index 19d45fdc8..076387568 100644 --- a/wolfcrypt/src/curve448.c +++ b/wolfcrypt/src/curve448.c @@ -1,6 +1,6 @@ /* curve448.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/des3.c b/wolfcrypt/src/des3.c index c84851abb..98945cc8f 100644 --- a/wolfcrypt/src/des3.c +++ b/wolfcrypt/src/des3.c @@ -1,6 +1,6 @@ /* des3.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/dh.c b/wolfcrypt/src/dh.c index 24cd6d2bc..685691266 100644 --- a/wolfcrypt/src/dh.c +++ b/wolfcrypt/src/dh.c @@ -1,6 +1,6 @@ /* dh.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/dsa.c b/wolfcrypt/src/dsa.c index 15a1d5b0a..ccd9dda8a 100644 --- a/wolfcrypt/src/dsa.c +++ b/wolfcrypt/src/dsa.c @@ -1,6 +1,6 @@ /* dsa.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index ca70c217b..b5c789d58 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -1,6 +1,6 @@ /* ecc.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -4096,16 +4096,21 @@ int wc_ecc_get_curve_id_from_dp_params(const ecc_set_type* dp) int wc_ecc_get_curve_id_from_oid(const byte* oid, word32 len) { int curve_idx; -#ifdef HAVE_OID_DECODING +#if defined(HAVE_OID_DECODING) || defined(HAVE_OID_ENCODING) int ret; - word16 decOid[MAX_OID_SZ]; - word32 decOidSz = sizeof(decOid); + #ifdef HAVE_OID_DECODING + word16 decOid[MAX_OID_SZ/sizeof(word16)]; + #else + byte decOid[MAX_OID_SZ]; + #endif + word32 decOidSz; #endif if (oid == NULL) return BAD_FUNC_ARG; #ifdef HAVE_OID_DECODING + decOidSz = (word32)sizeof(decOid); ret = DecodeObjectId(oid, len, decOid, &decOidSz); if (ret != 0) { return ret; @@ -4113,18 +4118,29 @@ int wc_ecc_get_curve_id_from_oid(const byte* oid, word32 len) #endif for (curve_idx = 0; ecc_sets[curve_idx].size != 0; curve_idx++) { + #if defined(HAVE_OID_ENCODING) && !defined(HAVE_OID_DECODING) + decOidSz = (word32)sizeof(decOid); + ret = EncodeObjectId(ecc_sets[curve_idx].oid, ecc_sets[curve_idx].oidSz, + decOid, &decOidSz); + if (ret != 0) { + continue; + } + #endif + if ( #ifndef WOLFSSL_ECC_CURVE_STATIC ecc_sets[curve_idx].oid && #endif - #ifdef HAVE_OID_DECODING + #if defined(HAVE_OID_ENCODING) && !defined(HAVE_OID_DECODING) + decOidSz == len && + XMEMCMP(decOid, oid, len) == 0 + #elif defined(HAVE_OID_ENCODING) && defined(HAVE_OID_DECODING) /* We double because decOidSz is a count of word16 elements. */ ecc_sets[curve_idx].oidSz == decOidSz && - XMEMCMP(ecc_sets[curve_idx].oid, decOid, - decOidSz * 2) == 0 + XMEMCMP(ecc_sets[curve_idx].oid, decOid, decOidSz * 2) == 0 #else ecc_sets[curve_idx].oidSz == len && - XMEMCMP(ecc_sets[curve_idx].oid, oid, len) == 0 + XMEMCMP(ecc_sets[curve_idx].oid, oid, len) == 0 #endif ) { break; @@ -4206,7 +4222,7 @@ static void wc_ecc_free_async(ecc_key* key) int wc_ecc_shared_secret(ecc_key* private_key, ecc_key* public_key, byte* out, word32* outlen) { - int err; + int err = 0; #if defined(WOLFSSL_CRYPTOCELL) && !defined(WOLFSSL_ATECC508A) && \ !defined(WOLFSSL_ATECC608A) @@ -4308,8 +4324,6 @@ static int wc_ecc_shared_secret_gen_sync(ecc_key* private_key, ecc_point* point, #endif #endif - WOLFSSL_ENTER("wc_ecc_shared_secret_gen_sync"); - #ifdef HAVE_ECC_CDH /* if cofactor flag has been set */ if (private_key->flags & WC_ECC_FLAG_COFACTOR) { @@ -4464,8 +4478,6 @@ static int wc_ecc_shared_secret_gen_sync(ecc_key* private_key, ecc_point* point, #endif #endif - WOLFSSL_LEAVE("wc_ecc_shared_secret_gen_sync", err); - return err; } @@ -4650,8 +4662,6 @@ int wc_ecc_shared_secret_ex(ecc_key* private_key, ecc_point* point, RESTORE_VECTOR_REGISTERS(); - WOLFSSL_LEAVE("wc_ecc_shared_secret_ex", err); - /* if async pending then return and skip done cleanup below */ if (err == WC_PENDING_E) { private_key->state++; @@ -10125,6 +10135,9 @@ static int wc_ecc_import_raw_private(ecc_key* key, const char* qx, WOLFSSL_MSG("Invalid Qx"); err = BAD_FUNC_ARG; } + if (mp_unsigned_bin_size(key->pubkey.y) > key->dp->size) { + err = BAD_FUNC_ARG; + } } /* read Qy */ @@ -10139,6 +10152,9 @@ static int wc_ecc_import_raw_private(ecc_key* key, const char* qx, WOLFSSL_MSG("Invalid Qy"); err = BAD_FUNC_ARG; } + if (mp_unsigned_bin_size(key->pubkey.y) > key->dp->size) { + err = BAD_FUNC_ARG; + } } if (err == MP_OKAY) { @@ -12436,6 +12452,31 @@ int wc_ecc_ctx_set_peer_salt(ecEncCtx* ctx, const byte* salt) return 0; } +/* Set the salt pointer into context. + * + * @param [in, out] ctx ECIES context object. + * @param [in] salt Salt to use with KDF. + * @param [in] len Length of salt in bytes. + * @return 0 on success. + * @return BAD_FUNC_ARG when ctx is NULL or salt is NULL and len is not 0. + */ +int wc_ecc_ctx_set_kdf_salt(ecEncCtx* ctx, const byte* salt, word32 len) +{ + if (ctx == NULL || (salt == NULL && len != 0)) + return BAD_FUNC_ARG; + + ctx->kdfSalt = salt; + ctx->kdfSaltSz = len; + + if (ctx->protocol == REQ_RESP_CLIENT) { + ctx->srvSt = ecSRV_SALT_SET; + } + else if (ctx->protocol == REQ_RESP_SERVER) { + ctx->srvSt = ecSRV_SALT_SET; + } + + return 0; +} static int ecc_ctx_set_salt(ecEncCtx* ctx, int flags) { @@ -12553,12 +12594,12 @@ static int ecc_get_key_sizes(ecEncCtx* ctx, int* encKeySz, int* ivSz, #if !defined(NO_AES) && defined(WOLFSSL_AES_COUNTER) case ecAES_128_CTR: *encKeySz = KEY_SIZE_128; - *ivSz = IV_SIZE_128; + *ivSz = 12; *blockSz = 1; break; case ecAES_256_CTR: *encKeySz = KEY_SIZE_256; - *ivSz = IV_SIZE_128; + *ivSz = 12; *blockSz = 1; break; #endif @@ -12596,7 +12637,9 @@ int wc_ecc_encrypt_ex(ecc_key* privKey, ecc_key* pubKey, const byte* msg, int ret = 0; word32 blockSz = 0; #ifndef WOLFSSL_ECIES_OLD +#ifndef WOLFSSL_ECIES_GEN_IV byte iv[ECC_MAX_IV_SIZE]; +#endif word32 pubKeySz = 0; #endif word32 digestSz = 0; @@ -12676,6 +12719,9 @@ int wc_ecc_encrypt_ex(ecc_key* privKey, ecc_key* pubKey, const byte* msg, #ifdef WOLFSSL_ECIES_OLD if (*outSz < (msgSz + digestSz)) return BUFFER_E; +#elif defined(WOLFSSL_ECIES_GEN_IV) + if (*outSz < (pubKeySz + ivSz + msgSz + digestSz)) + return BUFFER_E; #else if (*outSz < (pubKeySz + msgSz + digestSz)) return BUFFER_E; @@ -12757,13 +12803,21 @@ int wc_ecc_encrypt_ex(ecc_key* privKey, ecc_key* pubKey, const byte* msg, encKey = keys + offset; encIv = encKey + encKeySz; macKey = encKey + encKeySz + ivSz; + #elif defined(WOLFSSL_ECIES_GEN_IV) + encKey = keys + offset; + encIv = out; + out += ivSz; + macKey = encKey + encKeySz; + ret = wc_RNG_GenerateBlock(privKey->rng, encIv, ivSz); #else XMEMSET(iv, 0, ivSz); encKey = keys + offset; encIv = iv; macKey = encKey + encKeySz; #endif + } + if (ret == 0) { switch (ctx->encAlgo) { case ecAES_128_CBC: case ecAES_256_CBC: @@ -12805,19 +12859,26 @@ int wc_ecc_encrypt_ex(ecc_key* privKey, ecc_key* pubKey, const byte* msg, case ecAES_256_CTR: { #if !defined(NO_AES) && defined(WOLFSSL_AES_COUNTER) - #ifdef WOLFSSL_SMALL_STACK + byte ctr_iv[AES_BLOCK_SIZE]; + #ifndef WOLFSSL_SMALL_STACK + Aes aes[1]; + #else Aes *aes = (Aes *)XMALLOC(sizeof *aes, ctx->heap, DYNAMIC_TYPE_AES); if (aes == NULL) { ret = MEMORY_E; break; } - #else - Aes aes[1]; #endif + + /* Include 4 byte counter starting at all zeros. */ + XMEMCPY(ctr_iv, encIv, WOLFSSL_ECIES_GEN_IV_SIZE); + XMEMSET(ctr_iv + WOLFSSL_ECIES_GEN_IV_SIZE, 0, + AES_BLOCK_SIZE - WOLFSSL_ECIES_GEN_IV_SIZE); + ret = wc_AesInit(aes, NULL, INVALID_DEVID); if (ret == 0) { - ret = wc_AesSetKey(aes, encKey, encKeySz, encIv, + ret = wc_AesSetKey(aes, encKey, encKeySz, ctr_iv, AES_ENCRYPTION); if (ret == 0) { ret = wc_AesCtrEncrypt(aes, out, msg, msgSz); @@ -12861,8 +12922,14 @@ int wc_ecc_encrypt_ex(ecc_key* privKey, ecc_key* pubKey, const byte* msg, if (ret == 0) { ret = wc_HmacSetKey(hmac, WC_SHA256, macKey, WC_SHA256_DIGEST_SIZE); - if (ret == 0) + if (ret == 0) { + #if !defined(WOLFSSL_ECIES_GEN_IV) ret = wc_HmacUpdate(hmac, out, msgSz); + #else + /* IV is before encrypted message. */ + ret = wc_HmacUpdate(hmac, encIv, ivSz + msgSz); + #endif + } if (ret == 0) ret = wc_HmacUpdate(hmac, ctx->macSalt, ctx->macSaltSz); if (ret == 0) @@ -12884,6 +12951,8 @@ int wc_ecc_encrypt_ex(ecc_key* privKey, ecc_key* pubKey, const byte* msg, if (ret == 0) { #ifdef WOLFSSL_ECIES_OLD *outSz = msgSz + digestSz; +#elif defined(WOLFSSL_ECIES_GEN_IV) + *outSz = pubKeySz + ivSz + msgSz + digestSz; #else *outSz = pubKeySz + msgSz + digestSz; #endif @@ -12918,7 +12987,9 @@ int wc_ecc_decrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg, int ret = 0; word32 blockSz = 0; #ifndef WOLFSSL_ECIES_OLD +#ifndef WOLFSSL_ECIES_GEN_IV byte iv[ECC_MAX_IV_SIZE]; +#endif word32 pubKeySz = 0; #ifdef WOLFSSL_SMALL_STACK ecc_key* peerKey = NULL; @@ -12949,7 +13020,7 @@ int wc_ecc_decrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg, int ivSz = 0; int offset = 0; /* in case using msg exchange */ byte* encKey = NULL; - byte* encIv = NULL; + const byte* encIv = NULL; byte* macKey = NULL; @@ -13006,6 +13077,14 @@ int wc_ecc_decrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg, if (*outSz < (msgSz - digestSz)) return BUFFER_E; +#elif defined(WOLFSSL_ECIES_GEN_IV) + if (((msgSz - ivSz - digestSz - pubKeySz) % blockSz) != 0) + return BAD_PADDING_E; + + if (msgSz < pubKeySz + ivSz + blockSz + digestSz) + return BAD_FUNC_ARG; + if (*outSz < (msgSz - ivSz - digestSz - pubKeySz)) + return BUFFER_E; #else if (((msgSz - digestSz - pubKeySz) % blockSz) != 0) return BAD_PADDING_E; @@ -13117,6 +13196,12 @@ int wc_ecc_decrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg, encKey = keys + offset; encIv = encKey + encKeySz; macKey = encKey + encKeySz + ivSz; + #elif defined(WOLFSSL_ECIES_GEN_IV) + encKey = keys + offset; + encIv = msg; + msg += ivSz; + msgSz -= ivSz; + macKey = encKey + encKeySz; #else XMEMSET(iv, 0, ivSz); encKey = keys + offset; @@ -13143,7 +13228,12 @@ int wc_ecc_decrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg, ret = wc_HmacSetKey(hmac, WC_SHA256, macKey, WC_SHA256_DIGEST_SIZE); if (ret == 0) + #if !defined(WOLFSSL_ECIES_GEN_IV) ret = wc_HmacUpdate(hmac, msg, msgSz-digestSz); + #else + /* IV is before encrypted message. */ + ret = wc_HmacUpdate(hmac, encIv, ivSz+msgSz-digestSz); + #endif if (ret == 0) ret = wc_HmacUpdate(hmac, ctx->macSalt, ctx->macSaltSz); @@ -13220,7 +13310,12 @@ int wc_ecc_decrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg, #endif ret = wc_AesInit(aes, NULL, INVALID_DEVID); if (ret == 0) { - ret = wc_AesSetKey(aes, encKey, encKeySz, encIv, + byte ctr_iv[AES_BLOCK_SIZE]; + /* Make a 16 byte IV from the bytes passed in. */ + XMEMCPY(ctr_iv, encIv, WOLFSSL_ECIES_GEN_IV_SIZE); + XMEMSET(ctr_iv + WOLFSSL_ECIES_GEN_IV_SIZE, 0, + AES_BLOCK_SIZE - WOLFSSL_ECIES_GEN_IV_SIZE); + ret = wc_AesSetKey(aes, encKey, encKeySz, ctr_iv, AES_ENCRYPTION); if (ret == 0) { ret = wc_AesCtrEncrypt(aes, out, msg, msgSz-digestSz); @@ -13715,7 +13810,7 @@ static int wc_ecc_export_x963_compressed(ecc_key* key, byte* out, word32* outLen word32 numlen; int ret = MP_OKAY; - if (key == NULL || out == NULL || outLen == NULL) + if (key == NULL || outLen == NULL) return BAD_FUNC_ARG; if (key->type == ECC_PRIVATEKEY_ONLY) @@ -13729,9 +13824,15 @@ static int wc_ecc_export_x963_compressed(ecc_key* key, byte* out, word32* outLen if (*outLen < (1 + numlen)) { *outLen = 1 + numlen; - return BUFFER_E; + return LENGTH_ONLY_E; } + if (out == NULL) + return BAD_FUNC_ARG; + + if (mp_unsigned_bin_size(key->pubkey.x) > (int)numlen) + return ECC_BAD_ARG_E; + /* store first byte */ out[0] = mp_isodd(key->pubkey.y) == MP_YES ? ECC_POINT_COMP_ODD : ECC_POINT_COMP_EVEN; diff --git a/wolfcrypt/src/eccsi.c b/wolfcrypt/src/eccsi.c index 0f292f0fa..eea8dfa86 100644 --- a/wolfcrypt/src/eccsi.c +++ b/wolfcrypt/src/eccsi.c @@ -1,6 +1,6 @@ /* eccsi.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/ed25519.c b/wolfcrypt/src/ed25519.c index 436997668..8529ac135 100644 --- a/wolfcrypt/src/ed25519.c +++ b/wolfcrypt/src/ed25519.c @@ -1,6 +1,6 @@ /* ed25519.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/ed448.c b/wolfcrypt/src/ed448.c index 0423b2b2b..51f53c46b 100644 --- a/wolfcrypt/src/ed448.c +++ b/wolfcrypt/src/ed448.c @@ -1,6 +1,6 @@ /* ed448.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/error.c b/wolfcrypt/src/error.c index b083bf717..49ae1bcc7 100644 --- a/wolfcrypt/src/error.c +++ b/wolfcrypt/src/error.c @@ -1,6 +1,6 @@ /* error.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -567,6 +567,12 @@ const char* wc_GetErrorString(int error) case NO_VALID_DEVID: return "No valid device ID set"; + case IO_FAILED_E: + return "Input/output failure"; + + case SYSLIB_FAILED_E: + return "System/library call failed"; + default: return "unknown error number"; diff --git a/wolfcrypt/src/evp.c b/wolfcrypt/src/evp.c index 37d49bc28..95aa4e442 100644 --- a/wolfcrypt/src/evp.c +++ b/wolfcrypt/src/evp.c @@ -1,6 +1,6 @@ /* evp.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/falcon.c b/wolfcrypt/src/falcon.c index 165aa5ac9..8bcbf436d 100644 --- a/wolfcrypt/src/falcon.c +++ b/wolfcrypt/src/falcon.c @@ -1,6 +1,6 @@ /* falcon.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fe_low_mem.c b/wolfcrypt/src/fe_low_mem.c index 2eb512f4c..ad5ad8729 100644 --- a/wolfcrypt/src/fe_low_mem.c +++ b/wolfcrypt/src/fe_low_mem.c @@ -1,6 +1,6 @@ /* fe_low_mem.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fe_operations.c b/wolfcrypt/src/fe_operations.c index f11b183aa..a4c66edf8 100644 --- a/wolfcrypt/src/fe_operations.c +++ b/wolfcrypt/src/fe_operations.c @@ -1,6 +1,6 @@ /* fe_operations.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fe_x25519_asm.S b/wolfcrypt/src/fe_x25519_asm.S index 71fa4360e..b468f997f 100644 --- a/wolfcrypt/src/fe_x25519_asm.S +++ b/wolfcrypt/src/fe_x25519_asm.S @@ -1,6 +1,6 @@ /* fe_x25519_asm * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_mont_small.i b/wolfcrypt/src/fp_mont_small.i index 4cfe411f0..8b76ecbd9 100644 --- a/wolfcrypt/src/fp_mont_small.i +++ b/wolfcrypt/src/fp_mont_small.i @@ -1,6 +1,6 @@ /* fp_mont_small.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_mul_comba_12.i b/wolfcrypt/src/fp_mul_comba_12.i index 8d29a06fd..22927c4bc 100644 --- a/wolfcrypt/src/fp_mul_comba_12.i +++ b/wolfcrypt/src/fp_mul_comba_12.i @@ -1,6 +1,6 @@ /* fp_mul_comba_12.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_mul_comba_17.i b/wolfcrypt/src/fp_mul_comba_17.i index c5e1a7203..2e495645a 100644 --- a/wolfcrypt/src/fp_mul_comba_17.i +++ b/wolfcrypt/src/fp_mul_comba_17.i @@ -1,6 +1,6 @@ /* fp_mul_comba_17.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_mul_comba_20.i b/wolfcrypt/src/fp_mul_comba_20.i index 599d3e516..ac65a33b5 100644 --- a/wolfcrypt/src/fp_mul_comba_20.i +++ b/wolfcrypt/src/fp_mul_comba_20.i @@ -1,6 +1,6 @@ /* fp_mul_comba_20.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_mul_comba_24.i b/wolfcrypt/src/fp_mul_comba_24.i index 561dda2db..092788833 100644 --- a/wolfcrypt/src/fp_mul_comba_24.i +++ b/wolfcrypt/src/fp_mul_comba_24.i @@ -1,6 +1,6 @@ /* fp_mul_comba_24.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_mul_comba_28.i b/wolfcrypt/src/fp_mul_comba_28.i index a2ae5606d..05d67d573 100644 --- a/wolfcrypt/src/fp_mul_comba_28.i +++ b/wolfcrypt/src/fp_mul_comba_28.i @@ -1,6 +1,6 @@ /* fp_mul_comba_28.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_mul_comba_3.i b/wolfcrypt/src/fp_mul_comba_3.i index a4981726a..303bca958 100644 --- a/wolfcrypt/src/fp_mul_comba_3.i +++ b/wolfcrypt/src/fp_mul_comba_3.i @@ -1,6 +1,6 @@ /* fp_mul_comba_3.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_mul_comba_32.i b/wolfcrypt/src/fp_mul_comba_32.i index 63543435d..8b7dc8f75 100644 --- a/wolfcrypt/src/fp_mul_comba_32.i +++ b/wolfcrypt/src/fp_mul_comba_32.i @@ -1,6 +1,6 @@ /* fp_mul_comba_32.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_mul_comba_4.i b/wolfcrypt/src/fp_mul_comba_4.i index 6f6f542bb..5ec9945f6 100644 --- a/wolfcrypt/src/fp_mul_comba_4.i +++ b/wolfcrypt/src/fp_mul_comba_4.i @@ -1,6 +1,6 @@ /* fp_mul_comba_4.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_mul_comba_48.i b/wolfcrypt/src/fp_mul_comba_48.i index c1f307f76..287fc7573 100644 --- a/wolfcrypt/src/fp_mul_comba_48.i +++ b/wolfcrypt/src/fp_mul_comba_48.i @@ -1,6 +1,6 @@ /* fp_mul_comba_48.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_mul_comba_6.i b/wolfcrypt/src/fp_mul_comba_6.i index a076e47ab..20b3954a8 100644 --- a/wolfcrypt/src/fp_mul_comba_6.i +++ b/wolfcrypt/src/fp_mul_comba_6.i @@ -1,6 +1,6 @@ /* fp_mul_comba_6.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_mul_comba_64.i b/wolfcrypt/src/fp_mul_comba_64.i index ba6a21a4a..653535171 100644 --- a/wolfcrypt/src/fp_mul_comba_64.i +++ b/wolfcrypt/src/fp_mul_comba_64.i @@ -1,6 +1,6 @@ /* fp_mul_comba_64.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_mul_comba_7.i b/wolfcrypt/src/fp_mul_comba_7.i index bc07b24ab..ae05086ff 100644 --- a/wolfcrypt/src/fp_mul_comba_7.i +++ b/wolfcrypt/src/fp_mul_comba_7.i @@ -1,6 +1,6 @@ /* fp_mul_comba_7.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_mul_comba_8.i b/wolfcrypt/src/fp_mul_comba_8.i index f8fc01ea9..73cd5f152 100644 --- a/wolfcrypt/src/fp_mul_comba_8.i +++ b/wolfcrypt/src/fp_mul_comba_8.i @@ -1,6 +1,6 @@ /* fp_mul_comba_8.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_mul_comba_9.i b/wolfcrypt/src/fp_mul_comba_9.i index 87eef030b..23636ac33 100644 --- a/wolfcrypt/src/fp_mul_comba_9.i +++ b/wolfcrypt/src/fp_mul_comba_9.i @@ -1,6 +1,6 @@ /* fp_mul_comba_9.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_mul_comba_small_set.i b/wolfcrypt/src/fp_mul_comba_small_set.i index d2d12d31e..bf1089c0d 100644 --- a/wolfcrypt/src/fp_mul_comba_small_set.i +++ b/wolfcrypt/src/fp_mul_comba_small_set.i @@ -1,6 +1,6 @@ /* fp_mul_comba_small_set.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_sqr_comba_12.i b/wolfcrypt/src/fp_sqr_comba_12.i index 5aa809e4e..639eacac8 100644 --- a/wolfcrypt/src/fp_sqr_comba_12.i +++ b/wolfcrypt/src/fp_sqr_comba_12.i @@ -1,6 +1,6 @@ /* fp_sqr_comba_12.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_sqr_comba_17.i b/wolfcrypt/src/fp_sqr_comba_17.i index c669683ed..08476f735 100644 --- a/wolfcrypt/src/fp_sqr_comba_17.i +++ b/wolfcrypt/src/fp_sqr_comba_17.i @@ -1,6 +1,6 @@ /* fp_sqr_comba_17.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_sqr_comba_20.i b/wolfcrypt/src/fp_sqr_comba_20.i index 0d965a81b..f4bbc0956 100644 --- a/wolfcrypt/src/fp_sqr_comba_20.i +++ b/wolfcrypt/src/fp_sqr_comba_20.i @@ -1,6 +1,6 @@ /* fp_sqr_comba_20.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_sqr_comba_24.i b/wolfcrypt/src/fp_sqr_comba_24.i index 971ddd2b9..18d309bad 100644 --- a/wolfcrypt/src/fp_sqr_comba_24.i +++ b/wolfcrypt/src/fp_sqr_comba_24.i @@ -1,6 +1,6 @@ /* fp_sqr_comba_24.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_sqr_comba_28.i b/wolfcrypt/src/fp_sqr_comba_28.i index 7c4c78850..a26c44f55 100644 --- a/wolfcrypt/src/fp_sqr_comba_28.i +++ b/wolfcrypt/src/fp_sqr_comba_28.i @@ -1,6 +1,6 @@ /* fp_sqr_comba_28.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_sqr_comba_3.i b/wolfcrypt/src/fp_sqr_comba_3.i index 3b47cba8c..5bdfe85f4 100644 --- a/wolfcrypt/src/fp_sqr_comba_3.i +++ b/wolfcrypt/src/fp_sqr_comba_3.i @@ -1,6 +1,6 @@ /* fp_sqr_comba_3.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_sqr_comba_32.i b/wolfcrypt/src/fp_sqr_comba_32.i index 02b027385..627746af4 100644 --- a/wolfcrypt/src/fp_sqr_comba_32.i +++ b/wolfcrypt/src/fp_sqr_comba_32.i @@ -1,6 +1,6 @@ /* fp_sqr_comba_32.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_sqr_comba_4.i b/wolfcrypt/src/fp_sqr_comba_4.i index 13935083c..3fc5f8194 100644 --- a/wolfcrypt/src/fp_sqr_comba_4.i +++ b/wolfcrypt/src/fp_sqr_comba_4.i @@ -1,6 +1,6 @@ /* fp_sqr_comba_4.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_sqr_comba_48.i b/wolfcrypt/src/fp_sqr_comba_48.i index d817aa9b5..16b712f97 100644 --- a/wolfcrypt/src/fp_sqr_comba_48.i +++ b/wolfcrypt/src/fp_sqr_comba_48.i @@ -1,6 +1,6 @@ /* fp_sqr_comba_48.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_sqr_comba_6.i b/wolfcrypt/src/fp_sqr_comba_6.i index 1e4651a9d..4ef67cea1 100644 --- a/wolfcrypt/src/fp_sqr_comba_6.i +++ b/wolfcrypt/src/fp_sqr_comba_6.i @@ -1,6 +1,6 @@ /* fp_sqr_comba_6.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_sqr_comba_64.i b/wolfcrypt/src/fp_sqr_comba_64.i index f8af68dc7..ddd25fbdf 100644 --- a/wolfcrypt/src/fp_sqr_comba_64.i +++ b/wolfcrypt/src/fp_sqr_comba_64.i @@ -1,6 +1,6 @@ /* fp_sqr_comba_64.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_sqr_comba_7.i b/wolfcrypt/src/fp_sqr_comba_7.i index 807ef5920..7b891ad81 100644 --- a/wolfcrypt/src/fp_sqr_comba_7.i +++ b/wolfcrypt/src/fp_sqr_comba_7.i @@ -1,6 +1,6 @@ /* fp_sqr_comba_7.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_sqr_comba_8.i b/wolfcrypt/src/fp_sqr_comba_8.i index 53054689b..7f9f53865 100644 --- a/wolfcrypt/src/fp_sqr_comba_8.i +++ b/wolfcrypt/src/fp_sqr_comba_8.i @@ -1,6 +1,6 @@ /* fp_sqr_comba_8.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_sqr_comba_9.i b/wolfcrypt/src/fp_sqr_comba_9.i index c405c954f..a251b1a35 100644 --- a/wolfcrypt/src/fp_sqr_comba_9.i +++ b/wolfcrypt/src/fp_sqr_comba_9.i @@ -1,6 +1,6 @@ /* fp_sqr_comba_9.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/fp_sqr_comba_small_set.i b/wolfcrypt/src/fp_sqr_comba_small_set.i index 64ae83c3d..e30eb6581 100644 --- a/wolfcrypt/src/fp_sqr_comba_small_set.i +++ b/wolfcrypt/src/fp_sqr_comba_small_set.i @@ -1,6 +1,6 @@ /* fp_sqr_comba_small_set.i * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/ge_low_mem.c b/wolfcrypt/src/ge_low_mem.c index a7b793842..34ac45e46 100644 --- a/wolfcrypt/src/ge_low_mem.c +++ b/wolfcrypt/src/ge_low_mem.c @@ -1,6 +1,6 @@ /* ge_low_mem.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/ge_operations.c b/wolfcrypt/src/ge_operations.c index 379bd8fd7..e09a1cb5e 100644 --- a/wolfcrypt/src/ge_operations.c +++ b/wolfcrypt/src/ge_operations.c @@ -1,6 +1,6 @@ /* ge_operations.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/hash.c b/wolfcrypt/src/hash.c index 282c39f86..1a856c5ef 100644 --- a/wolfcrypt/src/hash.c +++ b/wolfcrypt/src/hash.c @@ -1,6 +1,6 @@ /* hash.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/hmac.c b/wolfcrypt/src/hmac.c index 7cb64e3b6..69dffb6a0 100644 --- a/wolfcrypt/src/hmac.c +++ b/wolfcrypt/src/hmac.c @@ -1,6 +1,6 @@ /* hmac.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -57,6 +57,7 @@ #ifdef WOLFSSL_KCAPI_HMAC #include + /* map the _Software calls used by kcapi_hmac.c */ #define wc_HmacSetKey wc_HmacSetKey_Software #define wc_HmacUpdate wc_HmacUpdate_Software #define wc_HmacFinal wc_HmacFinal_Software @@ -994,6 +995,11 @@ int wc_HmacFinal(Hmac* hmac, byte* hash) #ifdef WOLFSSL_KCAPI_HMAC /* implemented in wolfcrypt/src/port/kcapi/kcapi_hmac.c */ + /* unmap the _Software calls used by kcapi_hmac.c */ + #undef wc_HmacSetKey + #undef wc_HmacUpdate + #undef wc_HmacFinal + #else /* Initialize Hmac for use with async device */ int wc_HmacInit(Hmac* hmac, void* heap, int devId) diff --git a/wolfcrypt/src/integer.c b/wolfcrypt/src/integer.c index 9fbd64bb8..f54d16da1 100644 --- a/wolfcrypt/src/integer.c +++ b/wolfcrypt/src/integer.c @@ -1,6 +1,6 @@ /* integer.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/kdf.c b/wolfcrypt/src/kdf.c index 2960b3acc..6de02ac5b 100644 --- a/wolfcrypt/src/kdf.c +++ b/wolfcrypt/src/kdf.c @@ -1,6 +1,6 @@ /* kdf.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/logging.c b/wolfcrypt/src/logging.c index 7a6f58b1a..b002323c2 100644 --- a/wolfcrypt/src/logging.c +++ b/wolfcrypt/src/logging.c @@ -1,6 +1,6 @@ /* logging.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -502,7 +502,7 @@ void WOLFSSL_ERROR(int error) if (wc_LockMutex(&debug_mutex) != 0) { WOLFSSL_MSG("Lock debug mutex failed"); - XSNPRINTF(buffer, sizeof(buffer), + (void)XSNPRINTF(buffer, sizeof(buffer), "wolfSSL error occurred, error = %d", error); } else { @@ -513,7 +513,7 @@ void WOLFSSL_ERROR(int error) #endif if (error < 0) error = error - (2 * error); /* get absolute value */ - XSNPRINTF(buffer, sizeof(buffer), + (void)XSNPRINTF(buffer, sizeof(buffer), "wolfSSL error occurred, error = %d line:%u file:%s", error, line, file); @@ -525,7 +525,7 @@ void WOLFSSL_ERROR(int error) #if defined(OPENSSL_EXTRA) && !defined(WOLFCRYPT_ONLY) } else { - XSNPRINTF(buffer, sizeof(buffer), + (void)XSNPRINTF(buffer, sizeof(buffer), "wolfSSL error occurred, error = %d", error); } #endif @@ -533,7 +533,7 @@ void WOLFSSL_ERROR(int error) wc_UnLockMutex(&debug_mutex); } #else - XSNPRINTF(buffer, sizeof(buffer), + (void)XSNPRINTF(buffer, sizeof(buffer), "wolfSSL error occurred, error = %d", error); #endif @@ -929,7 +929,8 @@ int wc_ERR_remove_state(void) static int wc_ERR_dump_to_file (const char *str, size_t len, void *u) { XFILE fp = (XFILE ) u; - fprintf(fp, "%-*.*s\n", (int)len, (int)len, str); + if (fprintf(fp, "%-*.*s\n", (int)len, (int)len, str) < 0) + return IO_FAILED_E; return 0; } diff --git a/wolfcrypt/src/md2.c b/wolfcrypt/src/md2.c index d4f16859f..47873cd46 100644 --- a/wolfcrypt/src/md2.c +++ b/wolfcrypt/src/md2.c @@ -1,6 +1,6 @@ /* md2.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/md4.c b/wolfcrypt/src/md4.c index 8969d0078..76910a17a 100644 --- a/wolfcrypt/src/md4.c +++ b/wolfcrypt/src/md4.c @@ -1,6 +1,6 @@ /* md4.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/md5.c b/wolfcrypt/src/md5.c index d01542aa6..7b849f048 100644 --- a/wolfcrypt/src/md5.c +++ b/wolfcrypt/src/md5.c @@ -1,6 +1,6 @@ /* md5.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/memory.c b/wolfcrypt/src/memory.c index b4d77a70b..6ec10203b 100644 --- a/wolfcrypt/src/memory.c +++ b/wolfcrypt/src/memory.c @@ -1,6 +1,6 @@ /* memory.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -1283,12 +1283,12 @@ void *xrealloc(void *p, size_t n, void* heap, int type, const char* func, p32[0] = (word32)n; newp = (void*)(p32 + 4); - fprintf(stderr, "Alloc: %p -> %u (%d) at %s:%s:%u\n", newp, (word32)n, - type, func, file, line); if (p != NULL) { fprintf(stderr, "Free: %p -> %u (%d) at %s:%s:%u\n", p, oldLen, type, func, file, line); } + fprintf(stderr, "Alloc: %p -> %u (%d) at %s:%s:%u\n", newp, (word32)n, + type, func, file, line); } (void)heap; diff --git a/wolfcrypt/src/misc.c b/wolfcrypt/src/misc.c index ac9620d21..da2778ea9 100644 --- a/wolfcrypt/src/misc.c +++ b/wolfcrypt/src/misc.c @@ -1,6 +1,6 @@ /* misc.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/pkcs12.c b/wolfcrypt/src/pkcs12.c index dad96fe54..ac9e1030d 100644 --- a/wolfcrypt/src/pkcs12.c +++ b/wolfcrypt/src/pkcs12.c @@ -1,6 +1,6 @@ /* pkcs12.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/pkcs7.c b/wolfcrypt/src/pkcs7.c index a360c20c9..6ec1ef04b 100644 --- a/wolfcrypt/src/pkcs7.c +++ b/wolfcrypt/src/pkcs7.c @@ -1,6 +1,6 @@ /* pkcs7.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/poly1305.c b/wolfcrypt/src/poly1305.c index a08a097d2..0bdfc447f 100644 --- a/wolfcrypt/src/poly1305.c +++ b/wolfcrypt/src/poly1305.c @@ -1,6 +1,6 @@ /* poly1305.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/poly1305_asm.S b/wolfcrypt/src/poly1305_asm.S index 7b2265fe6..fcdfcca89 100644 --- a/wolfcrypt/src/poly1305_asm.S +++ b/wolfcrypt/src/poly1305_asm.S @@ -1,6 +1,6 @@ /* poly1305_asm * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/Espressif/esp32_sha.c b/wolfcrypt/src/port/Espressif/esp32_sha.c index 63967da00..bcdded9dd 100644 --- a/wolfcrypt/src/port/Espressif/esp32_sha.c +++ b/wolfcrypt/src/port/Espressif/esp32_sha.c @@ -1,6 +1,6 @@ /* esp32_sha.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/Renesas/renesas_common.c b/wolfcrypt/src/port/Renesas/renesas_common.c index 4950130e0..6d9edb803 100644 --- a/wolfcrypt/src/port/Renesas/renesas_common.c +++ b/wolfcrypt/src/port/Renesas/renesas_common.c @@ -370,9 +370,16 @@ int wc_CryptoCb_CryptInitRenesasCmn(WOLFSSL* ssl, void* ctx) if (cbInfo == NULL || ssl == NULL) { return INVALID_DEVID; } - - cbInfo->devId = gdevId++; - + /* need exclusive control because of static variable */ + if ((tsip_hw_lock()) == 0) { + cbInfo->devId = gdevId++; + tsip_hw_unlock(); + } + else { + WOLFSSL_MSG("Failed to lock tsip hw"); + return INVALID_DEVID; + } + if (wc_CryptoCb_RegisterDevice(cbInfo->devId, Renesas_cmn_CryptoDevCb, cbInfo) < 0) { /* undo devId number */ @@ -584,18 +591,17 @@ WOLFSSL_LOCAL int Renesas_cmn_TlsFinished(WOLFSSL* ssl, const byte *side, WOLFSSL_ENTER("Renesas_cmn_TlsFinished"); - + if (Renesas_cmn_usable(ssl, 1)) { #if defined(WOLFSSL_RENESAS_TSIP_TLS) - ret = wc_tsip_generateVerifyData(ssl->arrays->tsip_masterSecret, + ret = wc_tsip_generateVerifyData(ssl->arrays->tsip_masterSecret, side, handshake_hash, hashes); #elif defined(WOLFSSL_RENESAS_SCEPROTECT) - if (Renesas_cmn_usable(ssl, 1)) { ret = wc_sce_generateVerifyData(ssl->arrays->sce_masterSecret, side, handshake_hash, hashes); + #endif } else ret = PROTOCOLCB_UNAVAILABLE; - #endif return ret; } @@ -659,14 +665,17 @@ WOLFSSL_LOCAL int Renesas_cmn_generateSessionKey(WOLFSSL* ssl, void* ctx) (void)ctx; WOLFSSL_ENTER("Renesas_cmn_generateSessionKey"); + if (Renesas_cmn_usable(ssl, 0)) { #if defined(WOLFSSL_RENESAS_TSIP_TLS) ret = wc_tsip_generateSessionKey(ssl, (TsipUserCtx*)ctx, cbInfo->devId); #elif defined(WOLFSSL_RENESAS_SCEPROTECT) - if (Renesas_cmn_usable(ssl, 0)) { - ret = wc_sce_generateSessionKey(ssl, ctx, cbInfo->devId); - } else - ret = PROTOCOLCB_UNAVAILABLE; + ret = wc_sce_generateSessionKey(ssl, ctx, devId); #endif + } + else { + ret = PROTOCOLCB_UNAVAILABLE; + } + if (ret == 0) { wolfSSL_CTX_SetEncryptKeysCb(ssl->ctx, Renesas_cmn_EncryptKeys); wolfSSL_SetEncryptKeysCtx(ssl, ctx); diff --git a/wolfcrypt/src/port/Renesas/renesas_sce_sha.c b/wolfcrypt/src/port/Renesas/renesas_sce_sha.c index e34d6b397..c2c97aab9 100644 --- a/wolfcrypt/src/port/Renesas/renesas_sce_sha.c +++ b/wolfcrypt/src/port/Renesas/renesas_sce_sha.c @@ -1,6 +1,6 @@ /* renesas_sce_sha.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/Renesas/renesas_sce_util.c b/wolfcrypt/src/port/Renesas/renesas_sce_util.c index b54fec88c..442fdb759 100644 --- a/wolfcrypt/src/port/Renesas/renesas_sce_util.c +++ b/wolfcrypt/src/port/Renesas/renesas_sce_util.c @@ -471,7 +471,7 @@ static uint32_t GetSceCipherSuite( /* ssl : a pointer to WOLFSSL object */ /* session_key_generated : if session key has been generated */ /* return 1 for usable, 0 for unusable */ -WOLFSSL_LOCAL int wc_sce_usable(const struct WOLFSSL *ssl, +WOLFSSL_LOCAL int wc_sce_usable(const WOLFSSL *ssl, uint8_t session_key_generated) { WOLFSSL_ENTER("sce_usable"); @@ -523,7 +523,7 @@ WOLFSSL_LOCAL int wc_sce_usable(const struct WOLFSSL *ssl, } /* Generate Hmac by sha256*/ -WOLFSSL_LOCAL int wc_sce_Sha256GenerateHmac(const struct WOLFSSL *ssl,const uint8_t* myInner, +WOLFSSL_LOCAL int wc_sce_Sha256GenerateHmac(const WOLFSSL *ssl,const uint8_t* myInner, uint32_t innerSz,const uint8_t* in, uint32_t sz, byte* digest) { WOLFSSL_ENTER("sce_Sha256HmacGenerate"); @@ -574,7 +574,7 @@ WOLFSSL_LOCAL int wc_sce_Sha256GenerateHmac(const struct WOLFSSL *ssl,const uint } /* Verify hmac */ -WOLFSSL_LOCAL int wc_sce_Sha256VerifyHmac(const struct WOLFSSL *ssl, +WOLFSSL_LOCAL int wc_sce_Sha256VerifyHmac(const WOLFSSL *ssl, const uint8_t* message, uint32_t messageSz, uint32_t macSz, uint32_t content) { @@ -595,7 +595,7 @@ WOLFSSL_LOCAL int wc_sce_Sha256VerifyHmac(const struct WOLFSSL *ssl, return ret; } - wolfSSL_SetTlsHmacInner((struct WOLFSSL*)ssl, myInner, + wolfSSL_SetTlsHmacInner((WOLFSSL*)ssl, myInner, (word32)messageSz, (int)content, 1); ret = R_SCE_SHA256HMAC_VerifyInit( @@ -663,7 +663,7 @@ WOLFSSL_LOCAL int wc_sce_generateVerifyData(const uint8_t *ms, /* master secret } /* generate keys for TLS communication */ -WOLFSSL_LOCAL int wc_sce_generateSessionKey(struct WOLFSSL *ssl, +WOLFSSL_LOCAL int wc_sce_generateSessionKey(WOLFSSL *ssl, User_SCEPKCbInfo* cbInfo, int devId) { WOLFSSL_MSG("sce_generateSessionKey()"); @@ -1056,7 +1056,7 @@ WOLFSSL_LOCAL int wc_sce_tls_RootCertVerify( /* store elements for session key generation into ssl->keys. * return 0 on success, negative value on failure */ -WOLFSSL_LOCAL int wc_sce_storeKeyCtx(struct WOLFSSL* ssl, User_SCEPKCbInfo* info) +WOLFSSL_LOCAL int wc_sce_storeKeyCtx(WOLFSSL* ssl, User_SCEPKCbInfo* info) { int ret = 0; diff --git a/wolfcrypt/src/port/Renesas/renesas_tsip_aes.c b/wolfcrypt/src/port/Renesas/renesas_tsip_aes.c index 2af7c2fa2..5215b3a4a 100644 --- a/wolfcrypt/src/port/Renesas/renesas_tsip_aes.c +++ b/wolfcrypt/src/port/Renesas/renesas_tsip_aes.c @@ -618,18 +618,18 @@ int wc_tsip_AesGcmEncrypt( uint8_t* cipherBuf = NULL; uint8_t* aTagBuf = NULL; uint8_t* aadBuf = NULL; - + const uint8_t* iv_l = NULL; + uint32_t ivSz_l = 0; + tsip_aes_key_index_t key_client_aes; TsipUserCtx *userCtx; WOLFSSL_ENTER("wc_tsip_AesGcmEncrypt"); - if (aes == NULL || ctx == NULL || - (sz != 0 && (in == NULL || out == NULL)) || + if (aes == NULL || ctx == NULL || (ivSz == 0) || + (sz != 0 && (in == NULL || out == NULL)) || (ivSz != 0 && iv == NULL) || - (ivSz < AESGCM_NONCE_SZ && iv != NULL) || /* Requires 12 bytes of iv */ - (authInSz != 0 && authIn == NULL) || - (authTagSz < AES_BLOCK_SIZE)) { + (authInSz != 0 && authIn == NULL)) { WOLFSSL_LEAVE("wc_tsip_AesGcmEncrypt", BAD_FUNC_ARG); return BAD_FUNC_ARG; } @@ -665,7 +665,7 @@ int wc_tsip_AesGcmEncrypt( cipherBuf = XMALLOC(cipherBufSz, aes->heap, DYNAMIC_TYPE_AES); aTagBuf = XMALLOC(TSIP_AES_GCM_AUTH_TAG_SIZE, aes->heap, DYNAMIC_TYPE_AES); - aadBuf = XMALLOC(authTagSz, aes->heap, DYNAMIC_TYPE_AES); + aadBuf = XMALLOC(authInSz, aes->heap, DYNAMIC_TYPE_AES); if (plainBuf == NULL || cipherBuf == NULL || aTagBuf == NULL || aadBuf == NULL ) { @@ -677,10 +677,11 @@ int wc_tsip_AesGcmEncrypt( XMEMCPY(plainBuf, in, sz); ForceZero(cipherBuf, cipherBufSz); ForceZero(authTag, authTagSz); - XMEMCPY(aadBuf, authIn, min(authInSz, TSIP_AES_GCM_AUTH_TAG_SIZE)); + XMEMCPY(aadBuf, authIn, authInSz); } - if (ret == 0) { + if (ret == 0 && + userCtx->session_key_set == 1) { /* generate AES-GCM session key. The key stored in * Aes.ctx.tsip_keyIdx is not used here. */ @@ -700,18 +701,32 @@ int wc_tsip_AesGcmEncrypt( WOLFSSL_MSG("R_TSIP_TlsGenerateSessionKey failed"); ret = -1; } + } else if (userCtx->user_aes128_key_set == 1 || + userCtx->user_aes256_key_set == 1) { + if (aes->ctx.keySize == 32) { + XMEMCPY(&key_client_aes, &userCtx->user_aes256_key_index, + sizeof(tsip_aes_key_index_t)); + } + else { + XMEMCPY(&key_client_aes, &userCtx->user_aes128_key_index, + sizeof(tsip_aes_key_index_t)); + } + + iv_l = iv; + ivSz_l = ivSz; + } if (ret == 0) { - /* since generated session key is coupled to iv, no need to pass + /* Since generated session key is coupled to iv, no need to pass * iv init func. + * It expects to pass iv when users create their own key. */ - err = initFn(&hdl, &key_client_aes, NULL, 0UL); + err = initFn(&hdl, &key_client_aes, iv_l, ivSz_l); if (err == TSIP_SUCCESS) { - err = updateFn(&hdl, NULL, NULL, 0UL, (uint8_t*)aadBuf, - min(authInSz, TSIP_AES_GCM_AUTH_TAG_SIZE)); + err = updateFn(&hdl, NULL, NULL, 0UL, (uint8_t*)aadBuf, authInSz); } if (err == TSIP_SUCCESS) { err = updateFn(&hdl, plainBuf, cipherBuf, sz, NULL, 0UL); @@ -786,7 +801,7 @@ int wc_tsip_AesGcmDecrypt( e_tsip_err_t err; tsip_gcm_handle_t hdl; - uint32_t dataLen = sz; + uint32_t dataLen; uint32_t plainBufSz; aesGcmDecInitFn initFn; @@ -797,14 +812,16 @@ int wc_tsip_AesGcmDecrypt( uint8_t* plainBuf = NULL; uint8_t* aTagBuf = NULL; uint8_t* aadBuf = NULL; - + const uint8_t* iv_l = NULL; + uint32_t ivSz_l = 0; + tsip_aes_key_index_t key_server_aes; TsipUserCtx *userCtx; WOLFSSL_ENTER("wc_tsip_AesGcmDecrypt"); if (aes == NULL || in == NULL || out == NULL || sz == 0 || ctx == NULL || - (ivSz < AESGCM_NONCE_SZ && iv != NULL) || /* Requires 12 bytes of iv */ + iv == 0 || (authInSz != 0 && authIn == NULL) || (authInSz == 0 && authIn != NULL) || (authTagSz != 0 && authTag == NULL) || @@ -858,7 +875,8 @@ int wc_tsip_AesGcmDecrypt( XMEMCPY(aadBuf, authIn, authInSz); } - if (ret == 0) { + if (ret == 0 && + userCtx->session_key_set == 1) { /* generate AES-GCM session key. The key stored in * Aes.ctx.tsip_keyIdx is not used here. */ @@ -877,13 +895,29 @@ int wc_tsip_AesGcmDecrypt( WOLFSSL_MSG("R_TSIP_TlsGenerateSessionKey failed"); ret = -1; } + } else if (userCtx->user_aes128_key_set == 1 || + userCtx->user_aes256_key_set == 1) { + if (aes->ctx.keySize == 32) { + XMEMCPY(&key_server_aes, &userCtx->user_aes256_key_index, + sizeof(tsip_aes_key_index_t)); + } + else { + XMEMCPY(&key_server_aes, &userCtx->user_aes128_key_index, + sizeof(tsip_aes_key_index_t)); + } + + iv_l = iv; + ivSz_l = ivSz; + } if (ret == 0) { /* since key_index has iv and ivSz in it, no need to pass them init * func. Pass NULL and 0 as 3rd and 4th parameter respectively. + * + * It expects to pass iv when users create their own key. */ - err = initFn(&hdl, &key_server_aes, NULL, 0UL); + err = initFn(&hdl, &key_server_aes, iv_l, ivSz_l); if (err == TSIP_SUCCESS) { /* pass only AAD and it's size before passing cipher text */ diff --git a/wolfcrypt/src/port/Renesas/renesas_tsip_util.c b/wolfcrypt/src/port/Renesas/renesas_tsip_util.c index 9fee94749..30b2d5341 100644 --- a/wolfcrypt/src/port/Renesas/renesas_tsip_util.c +++ b/wolfcrypt/src/port/Renesas/renesas_tsip_util.c @@ -2120,7 +2120,7 @@ int wc_tsip_EccVerify( * output 64 bytes premaster secret to "out" buffer. */ int wc_tsip_EccSharedSecret( - struct WOLFSSL* ssl, + WOLFSSL* ssl, ecc_key* otherKey, unsigned char* pubKeyDer, unsigned int* pubKeySz, unsigned char* out, unsigned int* outlen, @@ -2177,7 +2177,7 @@ int wc_tsip_EccSharedSecret( } -WOLFSSL_API void tsip_set_callbacks(struct WOLFSSL_CTX* ctx) +WOLFSSL_API void tsip_set_callbacks(WOLFSSL_CTX* ctx) { WOLFSSL_ENTER("tsip_set_callbacks"); wolfSSL_CTX_SetEccVerifyCb(ctx, (CallbackEccVerify)Renesas_cmn_EccVerify); @@ -2210,7 +2210,7 @@ WOLFSSL_API void tsip_set_callbacks(struct WOLFSSL_CTX* ctx) WOLFSSL_LEAVE("tsip_set_callbacks", 0); } -WOLFSSL_API int tsip_set_callback_ctx(struct WOLFSSL* ssl, void* user_ctx) +WOLFSSL_API int tsip_set_callback_ctx(WOLFSSL* ssl, void* user_ctx) { WOLFSSL_ENTER("tsip_set_callback_ctx"); @@ -2302,7 +2302,7 @@ WOLFSSL_LOCAL void tsip_hw_unlock(void) /* check if tsip tls functions can be used for the cipher */ /* return :1 when tsip can be used , 0 not be used. */ -int tsip_usable(const struct WOLFSSL *ssl, uint8_t session_key_generated) +int tsip_usable(const WOLFSSL *ssl, uint8_t session_key_generated) { byte cipher0 = ssl->options.cipherSuite0; byte cipher = ssl->options.cipherSuite; @@ -2582,7 +2582,7 @@ void tsip_inform_user_keys( /* Sha1Hmac */ int wc_tsip_Sha1HmacGenerate( - const struct WOLFSSL *ssl, + const WOLFSSL *ssl, const byte* myInner, word32 innerSz, const byte* in, @@ -2639,7 +2639,7 @@ int wc_tsip_Sha1HmacGenerate( /* Sha256Hmac */ int wc_tsip_Sha256HmacGenerate( - const struct WOLFSSL *ssl, + const WOLFSSL *ssl, const byte* myInner, word32 innerSz, const byte* in, @@ -2708,7 +2708,7 @@ int wc_tsip_Sha256HmacGenerate( * Perform SHA1 and SHA256 Hmac verification */ int wc_tsip_ShaXHmacVerify( - const struct WOLFSSL *ssl, + const WOLFSSL *ssl, const byte* message, word32 messageSz, word32 macSz, @@ -2756,7 +2756,7 @@ int wc_tsip_ShaXHmacVerify( return ret; } - wolfSSL_SetTlsHmacInner((struct WOLFSSL*)ssl, (byte*)myInner, + wolfSSL_SetTlsHmacInner((WOLFSSL*)ssl, (byte*)myInner, messageSz, content, 1); ret = initFn(&handle, &wrapped_key); @@ -2818,7 +2818,7 @@ int wc_tsip_generateVerifyData( /* generate keys for TLS communication */ int wc_tsip_generateSessionKey( - struct WOLFSSL *ssl, + WOLFSSL *ssl, TsipUserCtx* ctx, int devId) { @@ -3051,7 +3051,7 @@ int wc_tsip_generateMasterSecret( /* store elements for session key generation into ssl->keys. * return 0 on success, negative value on failure */ -int wc_tsip_storeKeyCtx(struct WOLFSSL* ssl, TsipUserCtx* userCtx) +int wc_tsip_storeKeyCtx(WOLFSSL* ssl, TsipUserCtx* userCtx) { int ret = 0; diff --git a/wolfcrypt/src/port/af_alg/afalg_aes.c b/wolfcrypt/src/port/af_alg/afalg_aes.c index be6f1f653..ff597827b 100644 --- a/wolfcrypt/src/port/af_alg/afalg_aes.c +++ b/wolfcrypt/src/port/af_alg/afalg_aes.c @@ -1,6 +1,6 @@ /* afalg_aes.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/af_alg/afalg_hash.c b/wolfcrypt/src/port/af_alg/afalg_hash.c index ca2ef5b98..bde024960 100644 --- a/wolfcrypt/src/port/af_alg/afalg_hash.c +++ b/wolfcrypt/src/port/af_alg/afalg_hash.c @@ -1,6 +1,6 @@ /* afalg_hash.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/af_alg/wc_afalg.c b/wolfcrypt/src/port/af_alg/wc_afalg.c index 264e712b7..08fb76ea4 100644 --- a/wolfcrypt/src/port/af_alg/wc_afalg.c +++ b/wolfcrypt/src/port/af_alg/wc_afalg.c @@ -1,6 +1,6 @@ /* wc_afalg.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/arm/armv8-32-curve25519.S b/wolfcrypt/src/port/arm/armv8-32-curve25519.S index a089d3170..b9382c7c3 100644 --- a/wolfcrypt/src/port/arm/armv8-32-curve25519.S +++ b/wolfcrypt/src/port/arm/armv8-32-curve25519.S @@ -1,6 +1,6 @@ /* armv8-32-curve25519 * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/arm/armv8-32-curve25519_c.c b/wolfcrypt/src/port/arm/armv8-32-curve25519_c.c index 813ec21f8..3967f1836 100644 --- a/wolfcrypt/src/port/arm/armv8-32-curve25519_c.c +++ b/wolfcrypt/src/port/arm/armv8-32-curve25519_c.c @@ -1,6 +1,6 @@ /* armv8-32-curve25519 * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/arm/armv8-32-sha512-asm.S b/wolfcrypt/src/port/arm/armv8-32-sha512-asm.S index 14342ac96..69067bea1 100644 --- a/wolfcrypt/src/port/arm/armv8-32-sha512-asm.S +++ b/wolfcrypt/src/port/arm/armv8-32-sha512-asm.S @@ -1,6 +1,6 @@ /* armv8-32-sha512-asm * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/arm/armv8-32-sha512-asm_c.c b/wolfcrypt/src/port/arm/armv8-32-sha512-asm_c.c index 1511233d8..b67dae8bd 100644 --- a/wolfcrypt/src/port/arm/armv8-32-sha512-asm_c.c +++ b/wolfcrypt/src/port/arm/armv8-32-sha512-asm_c.c @@ -1,6 +1,6 @@ /* armv8-32-sha512-asm * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/arm/armv8-aes.c b/wolfcrypt/src/port/arm/armv8-aes.c index e1ea701de..59a61f616 100644 --- a/wolfcrypt/src/port/arm/armv8-aes.c +++ b/wolfcrypt/src/port/arm/armv8-aes.c @@ -1,6 +1,6 @@ /* armv8-aes.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/arm/armv8-chacha.c b/wolfcrypt/src/port/arm/armv8-chacha.c index 4bbc9ee65..7b0bd1a6c 100644 --- a/wolfcrypt/src/port/arm/armv8-chacha.c +++ b/wolfcrypt/src/port/arm/armv8-chacha.c @@ -1,6 +1,6 @@ /* armv8-chacha.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/arm/armv8-curve25519.S b/wolfcrypt/src/port/arm/armv8-curve25519.S index 432493bc0..b7646f743 100644 --- a/wolfcrypt/src/port/arm/armv8-curve25519.S +++ b/wolfcrypt/src/port/arm/armv8-curve25519.S @@ -1,6 +1,6 @@ /* armv8-curve25519 * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/arm/armv8-curve25519_c.c b/wolfcrypt/src/port/arm/armv8-curve25519_c.c index 6477225e5..b49d7bec5 100644 --- a/wolfcrypt/src/port/arm/armv8-curve25519_c.c +++ b/wolfcrypt/src/port/arm/armv8-curve25519_c.c @@ -1,6 +1,6 @@ /* armv8-curve25519 * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/arm/armv8-poly1305.c b/wolfcrypt/src/port/arm/armv8-poly1305.c index 18f255952..637599827 100644 --- a/wolfcrypt/src/port/arm/armv8-poly1305.c +++ b/wolfcrypt/src/port/arm/armv8-poly1305.c @@ -1,6 +1,6 @@ /* armv8-poly1305.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/arm/armv8-sha256.c b/wolfcrypt/src/port/arm/armv8-sha256.c index 05da4cd91..139d3a734 100644 --- a/wolfcrypt/src/port/arm/armv8-sha256.c +++ b/wolfcrypt/src/port/arm/armv8-sha256.c @@ -1,6 +1,6 @@ /* armv8-sha256.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/arm/armv8-sha3-asm.S b/wolfcrypt/src/port/arm/armv8-sha3-asm.S index ec9c1cc4a..516dc18f6 100644 --- a/wolfcrypt/src/port/arm/armv8-sha3-asm.S +++ b/wolfcrypt/src/port/arm/armv8-sha3-asm.S @@ -1,6 +1,6 @@ /* armv8-sha3-asm * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/arm/armv8-sha3-asm_c.c b/wolfcrypt/src/port/arm/armv8-sha3-asm_c.c index 54c04451d..360e8d4d2 100644 --- a/wolfcrypt/src/port/arm/armv8-sha3-asm_c.c +++ b/wolfcrypt/src/port/arm/armv8-sha3-asm_c.c @@ -1,6 +1,6 @@ /* armv8-sha3-asm * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/arm/armv8-sha512-asm.S b/wolfcrypt/src/port/arm/armv8-sha512-asm.S index 452998b0f..088171254 100644 --- a/wolfcrypt/src/port/arm/armv8-sha512-asm.S +++ b/wolfcrypt/src/port/arm/armv8-sha512-asm.S @@ -1,6 +1,6 @@ /* armv8-sha512-asm * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/arm/armv8-sha512-asm_c.c b/wolfcrypt/src/port/arm/armv8-sha512-asm_c.c index c3b9fda24..aa76798ee 100644 --- a/wolfcrypt/src/port/arm/armv8-sha512-asm_c.c +++ b/wolfcrypt/src/port/arm/armv8-sha512-asm_c.c @@ -1,6 +1,6 @@ /* armv8-sha512-asm * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/arm/armv8-sha512.c b/wolfcrypt/src/port/arm/armv8-sha512.c index 358cf06ab..a09058c96 100644 --- a/wolfcrypt/src/port/arm/armv8-sha512.c +++ b/wolfcrypt/src/port/arm/armv8-sha512.c @@ -1,6 +1,6 @@ /* sha512.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -472,7 +472,25 @@ static WC_INLINE int Sha512Update(wc_Sha512* sha512, const byte* data, word32 le blocksLen = len & ~(WC_SHA512_BLOCK_SIZE-1); if (blocksLen > 0) { /* Byte reversal performed in function if required. */ - Transform_Sha512_Len(sha512, data, blocksLen); + #ifndef WOLFSSL_ARMASM_NO_NEON + /* Data must be 64-bit aligned to be passed to Transform_Sha512_Len(). + * 64 bits is 8 bytes. + */ + if (((size_t)data & 0x7) != 0) { + word32 i; + + for (i = 0; i < blocksLen; i += WC_SHA512_BLOCK_SIZE) { + word64 buffer[WC_SHA512_BLOCK_SIZE / sizeof(word64)]; + XMEMCPY(buffer, data + i, WC_SHA512_BLOCK_SIZE); + Transform_Sha512_Len(sha512, (const byte*)buffer, + WC_SHA512_BLOCK_SIZE); + } + } + else + #endif + { + Transform_Sha512_Len(sha512, data, blocksLen); + } data += blocksLen; len -= blocksLen; } @@ -797,6 +815,8 @@ void wc_Sha384Free(wc_Sha384* sha384) #ifdef WOLFSSL_SHA512 +#if !defined(WOLFSSL_NOSHA512_224) || !defined(WOLFSSL_NOSHA512_256) + static int Sha512_Family_GetHash(wc_Sha512* sha512, byte* hash, enum wc_HashType type ) { @@ -833,6 +853,8 @@ static int Sha512_Family_GetHash(wc_Sha512* sha512, byte* hash, return ret; } +#endif /* !WOLFSSL_NOSHA512_224 || !WOLFSSL_NOSHA512_256 */ + int wc_Sha512GetHash(wc_Sha512* sha512, byte* hash) { int ret; diff --git a/wolfcrypt/src/port/arm/cryptoCell.c b/wolfcrypt/src/port/arm/cryptoCell.c index 4297b50fc..3e7b8cec6 100644 --- a/wolfcrypt/src/port/arm/cryptoCell.c +++ b/wolfcrypt/src/port/arm/cryptoCell.c @@ -1,6 +1,6 @@ /* cryptoCell.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/arm/cryptoCellHash.c b/wolfcrypt/src/port/arm/cryptoCellHash.c index 9e0497ef8..f5ec41ca6 100644 --- a/wolfcrypt/src/port/arm/cryptoCellHash.c +++ b/wolfcrypt/src/port/arm/cryptoCellHash.c @@ -1,6 +1,6 @@ /* cryptoCellHash.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/atmel/atmel.c b/wolfcrypt/src/port/atmel/atmel.c index 62268d52d..f46a3957c 100644 --- a/wolfcrypt/src/port/atmel/atmel.c +++ b/wolfcrypt/src/port/atmel/atmel.c @@ -1,6 +1,6 @@ /* atmel.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/caam/caam_aes.c b/wolfcrypt/src/port/caam/caam_aes.c index 0efd481ac..394404912 100644 --- a/wolfcrypt/src/port/caam/caam_aes.c +++ b/wolfcrypt/src/port/caam/caam_aes.c @@ -1,6 +1,6 @@ /* caam_aes.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/caam/caam_driver.c b/wolfcrypt/src/port/caam/caam_driver.c index 3e3a2f947..72f556296 100644 --- a/wolfcrypt/src/port/caam/caam_driver.c +++ b/wolfcrypt/src/port/caam/caam_driver.c @@ -1,6 +1,6 @@ /* caam_driver.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/caam/caam_error.c b/wolfcrypt/src/port/caam/caam_error.c index f88283ebe..35d51eab7 100644 --- a/wolfcrypt/src/port/caam/caam_error.c +++ b/wolfcrypt/src/port/caam/caam_error.c @@ -1,6 +1,6 @@ /* caam_error.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/caam/caam_integrity.c b/wolfcrypt/src/port/caam/caam_integrity.c index 0e80da7b7..5d46e666d 100644 --- a/wolfcrypt/src/port/caam/caam_integrity.c +++ b/wolfcrypt/src/port/caam/caam_integrity.c @@ -1,6 +1,6 @@ /* caam_integrity.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/caam/caam_qnx.c b/wolfcrypt/src/port/caam/caam_qnx.c index 65ea7c303..e5216780a 100644 --- a/wolfcrypt/src/port/caam/caam_qnx.c +++ b/wolfcrypt/src/port/caam/caam_qnx.c @@ -1,6 +1,6 @@ /* caam_qnx.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/caam/caam_sha.c b/wolfcrypt/src/port/caam/caam_sha.c index f7e1ceb2a..58c0d7afd 100644 --- a/wolfcrypt/src/port/caam/caam_sha.c +++ b/wolfcrypt/src/port/caam/caam_sha.c @@ -1,6 +1,6 @@ /* caam_sha.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/caam/wolfcaam_aes.c b/wolfcrypt/src/port/caam/wolfcaam_aes.c index 07581d9d7..b52184a15 100644 --- a/wolfcrypt/src/port/caam/wolfcaam_aes.c +++ b/wolfcrypt/src/port/caam/wolfcaam_aes.c @@ -1,6 +1,6 @@ /* wolfcaam_aes.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/caam/wolfcaam_cmac.c b/wolfcrypt/src/port/caam/wolfcaam_cmac.c index b5c56059a..d23c14b0b 100644 --- a/wolfcrypt/src/port/caam/wolfcaam_cmac.c +++ b/wolfcrypt/src/port/caam/wolfcaam_cmac.c @@ -1,6 +1,6 @@ /* wolfcaam_cmac.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/caam/wolfcaam_ecdsa.c b/wolfcrypt/src/port/caam/wolfcaam_ecdsa.c index 970175567..39181e675 100644 --- a/wolfcrypt/src/port/caam/wolfcaam_ecdsa.c +++ b/wolfcrypt/src/port/caam/wolfcaam_ecdsa.c @@ -1,6 +1,6 @@ /* wolfcaam_ecdsa.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/caam/wolfcaam_hash.c b/wolfcrypt/src/port/caam/wolfcaam_hash.c index a6fd72172..d0b613196 100644 --- a/wolfcrypt/src/port/caam/wolfcaam_hash.c +++ b/wolfcrypt/src/port/caam/wolfcaam_hash.c @@ -1,6 +1,6 @@ /* wolfcaam_hash.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/caam/wolfcaam_hmac.c b/wolfcrypt/src/port/caam/wolfcaam_hmac.c index a45639dd0..49784ce30 100644 --- a/wolfcrypt/src/port/caam/wolfcaam_hmac.c +++ b/wolfcrypt/src/port/caam/wolfcaam_hmac.c @@ -1,6 +1,6 @@ /* wolfcaam_hmac.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/caam/wolfcaam_init.c b/wolfcrypt/src/port/caam/wolfcaam_init.c index 61835cae8..8f87b5f8d 100644 --- a/wolfcrypt/src/port/caam/wolfcaam_init.c +++ b/wolfcrypt/src/port/caam/wolfcaam_init.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/caam/wolfcaam_qnx.c b/wolfcrypt/src/port/caam/wolfcaam_qnx.c index 0bcef42d1..522f62ddc 100644 --- a/wolfcrypt/src/port/caam/wolfcaam_qnx.c +++ b/wolfcrypt/src/port/caam/wolfcaam_qnx.c @@ -1,6 +1,6 @@ /* wolfcaam_qnx.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/caam/wolfcaam_rsa.c b/wolfcrypt/src/port/caam/wolfcaam_rsa.c index 339cd295c..c343749f2 100644 --- a/wolfcrypt/src/port/caam/wolfcaam_rsa.c +++ b/wolfcrypt/src/port/caam/wolfcaam_rsa.c @@ -1,6 +1,6 @@ /* wolfcaam_rsa.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/caam/wolfcaam_seco.c b/wolfcrypt/src/port/caam/wolfcaam_seco.c index 63d7003ee..f9915cfbd 100644 --- a/wolfcrypt/src/port/caam/wolfcaam_seco.c +++ b/wolfcrypt/src/port/caam/wolfcaam_seco.c @@ -1,6 +1,6 @@ /* wolfcaam_seco.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/caam/wolfcaam_x25519.c b/wolfcrypt/src/port/caam/wolfcaam_x25519.c index d6a785c4a..6080608ab 100644 --- a/wolfcrypt/src/port/caam/wolfcaam_x25519.c +++ b/wolfcrypt/src/port/caam/wolfcaam_x25519.c @@ -1,6 +1,6 @@ /* wolfcaam_x25519.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/cavium/cavium_octeon_sync.c b/wolfcrypt/src/port/cavium/cavium_octeon_sync.c index 8329e5c77..f1e6cbe46 100644 --- a/wolfcrypt/src/port/cavium/cavium_octeon_sync.c +++ b/wolfcrypt/src/port/cavium/cavium_octeon_sync.c @@ -1,6 +1,6 @@ /* cavium_octeon_sync.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/cypress/psoc6_crypto.c b/wolfcrypt/src/port/cypress/psoc6_crypto.c index 1e48071aa..c94a23f59 100644 --- a/wolfcrypt/src/port/cypress/psoc6_crypto.c +++ b/wolfcrypt/src/port/cypress/psoc6_crypto.c @@ -1,6 +1,6 @@ /* psoc6_crypto.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/devcrypto/devcrypto_aes.c b/wolfcrypt/src/port/devcrypto/devcrypto_aes.c index 28e145e27..4b72f7c8f 100644 --- a/wolfcrypt/src/port/devcrypto/devcrypto_aes.c +++ b/wolfcrypt/src/port/devcrypto/devcrypto_aes.c @@ -1,6 +1,6 @@ /* devcrypto_aes.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/devcrypto/devcrypto_ecdsa.c b/wolfcrypt/src/port/devcrypto/devcrypto_ecdsa.c index b9e3f0db0..0b31cbb50 100644 --- a/wolfcrypt/src/port/devcrypto/devcrypto_ecdsa.c +++ b/wolfcrypt/src/port/devcrypto/devcrypto_ecdsa.c @@ -1,6 +1,6 @@ /* devcrypto_ecdsa.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/devcrypto/devcrypto_hash.c b/wolfcrypt/src/port/devcrypto/devcrypto_hash.c index 465686759..c6dedf0c1 100644 --- a/wolfcrypt/src/port/devcrypto/devcrypto_hash.c +++ b/wolfcrypt/src/port/devcrypto/devcrypto_hash.c @@ -1,6 +1,6 @@ /* devcrypto_hash.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/devcrypto/devcrypto_hmac.c b/wolfcrypt/src/port/devcrypto/devcrypto_hmac.c index f1ff58a73..1afc4508f 100644 --- a/wolfcrypt/src/port/devcrypto/devcrypto_hmac.c +++ b/wolfcrypt/src/port/devcrypto/devcrypto_hmac.c @@ -1,6 +1,6 @@ /* devcrypto_hmac.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/devcrypto/devcrypto_rsa.c b/wolfcrypt/src/port/devcrypto/devcrypto_rsa.c index 11ff6436e..fddeee875 100644 --- a/wolfcrypt/src/port/devcrypto/devcrypto_rsa.c +++ b/wolfcrypt/src/port/devcrypto/devcrypto_rsa.c @@ -1,6 +1,6 @@ /* devcrypto_rsa.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/devcrypto/devcrypto_x25519.c b/wolfcrypt/src/port/devcrypto/devcrypto_x25519.c index dc27eee0e..693bc72bf 100644 --- a/wolfcrypt/src/port/devcrypto/devcrypto_x25519.c +++ b/wolfcrypt/src/port/devcrypto/devcrypto_x25519.c @@ -1,6 +1,6 @@ /* devcrypto_x25519.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/devcrypto/wc_devcrypto.c b/wolfcrypt/src/port/devcrypto/wc_devcrypto.c index 9315a1546..5c8d99217 100644 --- a/wolfcrypt/src/port/devcrypto/wc_devcrypto.c +++ b/wolfcrypt/src/port/devcrypto/wc_devcrypto.c @@ -1,6 +1,6 @@ /* wc_devcrypto.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/intel/quickassist_sync.c b/wolfcrypt/src/port/intel/quickassist_sync.c index 1cb780310..211617d17 100644 --- a/wolfcrypt/src/port/intel/quickassist_sync.c +++ b/wolfcrypt/src/port/intel/quickassist_sync.c @@ -1,6 +1,6 @@ /* quickassist_sync.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/kcapi/kcapi_aes.c b/wolfcrypt/src/port/kcapi/kcapi_aes.c index cac93ef92..83c2ffb28 100644 --- a/wolfcrypt/src/port/kcapi/kcapi_aes.c +++ b/wolfcrypt/src/port/kcapi/kcapi_aes.c @@ -1,6 +1,6 @@ /* kcapi_aes.c * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/kcapi/kcapi_dh.c b/wolfcrypt/src/port/kcapi/kcapi_dh.c index 72c65ead5..77f170b26 100644 --- a/wolfcrypt/src/port/kcapi/kcapi_dh.c +++ b/wolfcrypt/src/port/kcapi/kcapi_dh.c @@ -1,6 +1,6 @@ /* kcapi_dh.c * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/kcapi/kcapi_ecc.c b/wolfcrypt/src/port/kcapi/kcapi_ecc.c index 4cb0a1c66..7844852b0 100644 --- a/wolfcrypt/src/port/kcapi/kcapi_ecc.c +++ b/wolfcrypt/src/port/kcapi/kcapi_ecc.c @@ -1,6 +1,6 @@ /* kcapi_ecc.c * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/kcapi/kcapi_hash.c b/wolfcrypt/src/port/kcapi/kcapi_hash.c index a14957b40..1a3fd1512 100644 --- a/wolfcrypt/src/port/kcapi/kcapi_hash.c +++ b/wolfcrypt/src/port/kcapi/kcapi_hash.c @@ -1,6 +1,6 @@ /* kcapi_hash.c * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/kcapi/kcapi_hmac.c b/wolfcrypt/src/port/kcapi/kcapi_hmac.c index 525001536..505fd2a04 100644 --- a/wolfcrypt/src/port/kcapi/kcapi_hmac.c +++ b/wolfcrypt/src/port/kcapi/kcapi_hmac.c @@ -1,6 +1,6 @@ /* kcapi_hmac.c * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/kcapi/kcapi_rsa.c b/wolfcrypt/src/port/kcapi/kcapi_rsa.c index f11ee2fb7..2b57753df 100644 --- a/wolfcrypt/src/port/kcapi/kcapi_rsa.c +++ b/wolfcrypt/src/port/kcapi/kcapi_rsa.c @@ -1,6 +1,6 @@ /* kcapi_rsa.c * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/mynewt/mynewt_port.c b/wolfcrypt/src/port/mynewt/mynewt_port.c index ee284d76b..fb1584bae 100644 --- a/wolfcrypt/src/port/mynewt/mynewt_port.c +++ b/wolfcrypt/src/port/mynewt/mynewt_port.c @@ -1,6 +1,6 @@ /* mynewt_port.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/nrf51.c b/wolfcrypt/src/port/nrf51.c index 4a2eda0bb..ade80b9be 100644 --- a/wolfcrypt/src/port/nrf51.c +++ b/wolfcrypt/src/port/nrf51.c @@ -1,6 +1,6 @@ /* nrf51.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/nxp/dcp_port.c b/wolfcrypt/src/port/nxp/dcp_port.c index fab43607f..e6bc7cac4 100644 --- a/wolfcrypt/src/port/nxp/dcp_port.c +++ b/wolfcrypt/src/port/nxp/dcp_port.c @@ -1,6 +1,6 @@ /* dcp_port.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/nxp/ksdk_port.c b/wolfcrypt/src/port/nxp/ksdk_port.c index 805d86f0e..5014145a3 100644 --- a/wolfcrypt/src/port/nxp/ksdk_port.c +++ b/wolfcrypt/src/port/nxp/ksdk_port.c @@ -1,6 +1,6 @@ /* ksdk_port.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/nxp/se050_port.c b/wolfcrypt/src/port/nxp/se050_port.c index f568aa67a..4de2c81d0 100644 --- a/wolfcrypt/src/port/nxp/se050_port.c +++ b/wolfcrypt/src/port/nxp/se050_port.c @@ -1,6 +1,6 @@ /* se050_port.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -65,6 +65,10 @@ struct ecc_key; #define SE050_ECC_DER_MAX 256 #endif +#ifndef SE050_KEYID_START +#define SE050_KEYID_START 100 +#endif + /* enable for debugging */ /* #define SE050_DEBUG*/ /* enable to factory erase chip */ @@ -122,7 +126,7 @@ int wc_se050_init(const char* portName) int se050_allocate_key(int keyType) { int keyId = -1; - static int keyId_allocator = 100; + static int keyId_allocator = SE050_KEYID_START; switch (keyType) { case SE050_AES_KEY: case SE050_ECC_KEY: @@ -258,7 +262,8 @@ int se050_hash_final(SE050_HASH_Context* se050Ctx, byte* hash, size_t digestLen, void se050_hash_free(SE050_HASH_Context* se050Ctx) { - (void)se050Ctx; + XFREE(se050Ctx->msg, se050Ctx->heap, DYNAMIC_TYPE_TMP_BUFFER); + se050Ctx->msg = NULL; } #ifndef NO_AES @@ -436,7 +441,7 @@ static int se050_map_curve(int curve_id, int keySize, sss_cipher_type_t curve_type; *keySizeBits = keySize * 8; /* set default */ switch (curve_id) { - case ECC_SECP160K1: + case ECC_SECP160K1: case ECC_SECP192K1: case ECC_SECP224K1: case ECC_SECP256K1: @@ -500,6 +505,70 @@ static sss_algorithm_t se050_map_hash_alg(int hashLen) return algorithm; } +int se050_ecc_insert_private_key(int keyId, const byte* eccDer, + word32 eccDerSize) +{ + int ret = 0; + struct ecc_key key; + sss_object_t newKey; + sss_key_store_t host_keystore; + sss_status_t status = kStatus_SSS_Success; + int keySizeBits; + int keySize; + word32 idx = 0; + sss_cipher_type_t curveType; + + if (wolfSSL_CryptHwMutexLock() != 0) { + return BAD_MUTEX_E; + } + + /* Avoid key ID conflicts with temporary key storage */ + if (keyId >= SE050_KEYID_START) { + return BAD_FUNC_ARG; + } + + ret = wc_ecc_init(&key); + if (ret != 0) { + status = kStatus_SSS_Fail; + } else { + ret = wc_EccPrivateKeyDecode(eccDer, &idx, &key, eccDerSize); + if (ret != 0) { + status = kStatus_SSS_Fail; + } + } + + if (status == kStatus_SSS_Success) { + keySize = key.dp->size; + ret = se050_map_curve(key.dp->id, keySize, &keySizeBits, &curveType); + if (ret != 0) { + status = kStatus_SSS_Fail; + } + } + status = sss_key_store_context_init(&host_keystore, cfg_se050_i2c_pi); + if (status == kStatus_SSS_Success) { + status = sss_key_object_init(&newKey, &host_keystore); + } + if (status == kStatus_SSS_Success) { + status = sss_key_object_allocate_handle(&newKey, keyId, + kSSS_KeyPart_Pair, curveType, MAX_ECC_BYTES, + kKeyObject_Mode_Persistent); + } + if (status == kStatus_SSS_Success) { + status = sss_key_store_set_key(&host_keystore, &newKey, eccDer, + eccDerSize, keySizeBits, + NULL, 0); + } + wolfSSL_CryptHwMutexUnLock(); + + wc_ecc_free(&key); + if (status != kStatus_SSS_Success) { + if (ret == 0) + ret = WC_HW_E; + } + + return ret; +} + int se050_ecc_sign_hash_ex(const byte* in, word32 inLen, byte* out, word32 *outLen, struct ecc_key* key) { @@ -511,6 +580,9 @@ int se050_ecc_sign_hash_ex(const byte* in, word32 inLen, byte* out, sss_algorithm_t algorithm; int keySize; int keySizeBits; + int keyCreated = 0; + int keyId; + sss_cipher_type_t curveType; #ifdef SE050_DEBUG printf("se050_ecc_sign_hash_ex: key %p, in %p (%d), out %p (%d), keyId %d\n", @@ -520,12 +592,9 @@ int se050_ecc_sign_hash_ex(const byte* in, word32 inLen, byte* out, if (cfg_se050_i2c_pi == NULL) { return WC_HW_E; } - if (key->keyId <= 0) { - return BAD_FUNC_ARG; - } keySize = key->dp->size; - ret = se050_map_curve(key->dp->id, keySize, &keySizeBits, NULL); + ret = se050_map_curve(key->dp->id, keySize, &keySizeBits, &curveType); if (ret != 0) { return ret; } @@ -547,9 +616,6 @@ int se050_ecc_sign_hash_ex(const byte* in, word32 inLen, byte* out, return BAD_MUTEX_E; } - /* mark that key was used for signing */ - key->flags |= WC_ECC_FLAG_DEC_SIGN; - status = sss_key_store_context_init(&host_keystore, cfg_se050_i2c_pi); if (status == kStatus_SSS_Success) { status = sss_key_store_allocate(&host_keystore, SE050_KEYSTOREID_ECC); @@ -557,9 +623,41 @@ int se050_ecc_sign_hash_ex(const byte* in, word32 inLen, byte* out, if (status == kStatus_SSS_Success) { status = sss_key_object_init(&newKey, &host_keystore); } + /* this is run when a key was not generated and was instead passed in */ if (status == kStatus_SSS_Success) { - status = sss_key_object_get_handle(&newKey, key->keyId); + keyId = key->keyId; + if (keyId <= 0) { + byte derBuf[SE050_ECC_DER_MAX]; + word32 derSz; + + ret = wc_EccKeyToDer(key, derBuf, (word32)sizeof(derBuf)); + if (ret >= 0) { + derSz = ret; + ret = 0; + } + else { + status = kStatus_SSS_Fail; + } + if (status == kStatus_SSS_Success) { + keyId = se050_allocate_key(SE050_ECC_KEY); + status = sss_key_object_allocate_handle(&newKey, keyId, + kSSS_KeyPart_Pair, curveType, keySize, + kKeyObject_Mode_Transient); + } + if (status == kStatus_SSS_Success) { + keyCreated = 1; + status = sss_key_store_set_key(&host_keystore, &newKey, derBuf, + derSz, keySizeBits, NULL, 0); + } + } + else { + status = sss_key_object_get_handle(&newKey, keyId); + + /* mark that key was used for signing, don't free */ + key->flags |= WC_ECC_FLAG_DEC_SIGN; + } } + if (status == kStatus_SSS_Success) { status = sss_asymmetric_context_init(&ctx_asymm, cfg_se050_i2c_pi, &newKey, algorithm, kMode_SSS_Sign); @@ -583,9 +681,14 @@ int se050_ecc_sign_hash_ex(const byte* in, word32 inLen, byte* out, } if (status == kStatus_SSS_Success) { + key->keyId = keyId; ret = 0; } else { + if (keyCreated) { + sss_key_store_erase_key(&host_keystore, &newKey); + sss_key_object_free(&newKey); + } if (ret == 0) ret = WC_HW_E; } @@ -974,8 +1077,8 @@ int se050_ecc_shared_secret(ecc_key* private_key, ecc_key* public_key, size_t outlenSz = (size_t)*outlen; size_t outlenSzBits = outlenSz * 8; /* derived key export */ - status = sss_key_store_get_key(&host_keystore, &deriveKey, out, - &outlenSz, &outlenSzBits); + status = sss_key_store_get_key(&host_keystore, &deriveKey, + out, &outlenSz, &outlenSzBits); *outlen = (word32)outlenSz; (void)outlenSzBits; /* not used */ } @@ -993,8 +1096,8 @@ int se050_ecc_shared_secret(ecc_key* private_key, ecc_key* public_key, } else { if (keyCreated) { - sss_key_store_erase_key(&host_keystore, &public_key); - sss_key_object_free(&public_key); + sss_key_store_erase_key(&host_keystore, &ref_public_key); + sss_key_object_free(&ref_public_key); } if (ret == 0) ret = WC_HW_E; @@ -1125,6 +1228,9 @@ int se050_ed25519_sign_msg(const byte* in, word32 inLen, byte* out, sss_asymmetric_t ctx_asymm; sss_key_store_t host_keystore; sss_object_t newKey; + int keySize = ED25519_KEY_SIZE; + int keyCreated = 0; + int keyId; #ifdef SE050_DEBUG printf("se050_ed25519_sign_msg: key %p, in %p (%d), out %p (%d), keyId %d\n", @@ -1134,17 +1240,11 @@ int se050_ed25519_sign_msg(const byte* in, word32 inLen, byte* out, if (cfg_se050_i2c_pi == NULL) { return WC_HW_E; } - if (key->keyId <= 0) { - return BAD_FUNC_ARG; - } if (wolfSSL_CryptHwMutexLock() != 0) { return BAD_MUTEX_E; } - /* mark that key was used for signing */ - key->flags |= WC_ED25519_FLAG_DEC_SIGN; - status = sss_key_store_context_init(&host_keystore, cfg_se050_i2c_pi); if (status == kStatus_SSS_Success) { status = sss_key_store_allocate(&host_keystore, SE050_KEYSTOREID_ED25519); @@ -1152,8 +1252,39 @@ int se050_ed25519_sign_msg(const byte* in, word32 inLen, byte* out, if (status == kStatus_SSS_Success) { status = sss_key_object_init(&newKey, &host_keystore); } + /* this is run when a key was not generated and was instead passed in */ if (status == kStatus_SSS_Success) { - status = sss_key_object_get_handle(&newKey, key->keyId); + keyId = key->keyId; + if (keyId <= 0) { + byte derBuf[SE050_ECC_DER_MAX]; + word32 derSz; + + ret = wc_Ed25519KeyToDer(key, derBuf, (word32)sizeof(derBuf)); + if (ret >= 0) { + derSz = ret; + ret = 0; + } + else { + status = kStatus_SSS_Fail; + } + if (status == kStatus_SSS_Success) { + keyId = se050_allocate_key(SE050_ED25519_KEY); + status = sss_key_object_allocate_handle(&newKey, keyId, + kSSS_KeyPart_Pair, kSSS_CipherType_EC_TWISTED_ED, keySize, + kKeyObject_Mode_Transient); + } + if (status == kStatus_SSS_Success) { + keyCreated = 1; + status = sss_key_store_set_key(&host_keystore, &newKey, derBuf, + derSz, keySize * 8, NULL, 0); + } + } + else { + status = sss_key_object_get_handle(&newKey, keyId); + + /* mark that key was used for signing, don't free */ + key->flags |= WC_ED25519_FLAG_DEC_SIGN; + } } if (status == kStatus_SSS_Success) { status = sss_asymmetric_context_init(&ctx_asymm, cfg_se050_i2c_pi, @@ -1169,7 +1300,13 @@ int se050_ed25519_sign_msg(const byte* in, word32 inLen, byte* out, } if (status != kStatus_SSS_Success) { + if (keyCreated) { + sss_key_store_erase_key(&host_keystore, &newKey); + sss_key_object_free(&newKey); + } ret = WC_HW_E; + } else { + key->keyId = keyId; } wolfSSL_CryptHwMutexUnLock(); @@ -1218,7 +1355,7 @@ int se050_ed25519_verify_msg(const byte* signature, word32 signatureLen, if (keyId <= 0) { byte derBuf[ED25519_PUB_KEY_SIZE + 12]; /* seq + algo + bitstring */ word32 derSz = 0; - + ret = wc_Ed25519PublicKeyToDer(key, derBuf, (word32)sizeof(derBuf), 1); if (ret >= 0) { derSz = ret; @@ -1333,11 +1470,16 @@ int se050_curve25519_create_key(curve25519_key* key, int keySize) } if (status == kStatus_SSS_Success) { word32 idx = 0; - ret = wc_Curve25519PublicKeyDecode(derBuf, &idx, key, (word32)derSz); + byte pubKey[CURVE25519_KEYSIZE]; + word32 pubKeyLen = (word32)sizeof(pubKey); + + ret = DecodeAsymKeyPublic(derBuf, &idx, (word32)derSz, + pubKey, &pubKeyLen, X25519k); if (ret == 0) { - key->p.point[CURVE25519_KEYSIZE-1] &= ~0x80; /* clear MSB */ + ret = wc_curve25519_import_public_ex(pubKey, pubKeyLen, key, + EC25519_LITTLE_ENDIAN); } - else { + if (ret != 0) { status = kStatus_SSS_Fail; } } @@ -1411,16 +1553,22 @@ int se050_curve25519_shared_secret(curve25519_key* private_key, if (status == kStatus_SSS_Success) { keyId = public_key->keyId; if (keyId <= 0) { - byte derBuf[CURVE25519_PUB_KEY_SIZE + 12]; /* seq + algo + bitstring */ + byte derBuf[CURVE25519_PUB_KEY_SIZE + 12]; /* seq + algo + bitstring */ word32 derSz; + byte pubKey[CURVE25519_PUB_KEY_SIZE]; + word32 pubKeyLen = (word32)sizeof(pubKey); - ret = wc_Curve25519PublicKeyToDer(public_key, derBuf, - (word32)sizeof(derBuf), 1); - if (ret >= 0) { - derSz = ret; - ret = 0; + ret = wc_curve25519_export_public_ex(public_key, pubKey, &pubKeyLen, + EC25519_LITTLE_ENDIAN); + if (ret == 0) { + ret = SetAsymKeyDerPublic(pubKey, pubKeyLen, derBuf, + (word32)sizeof(derBuf), X25519k, 1); + if (ret >= 0) { + derSz = ret; + ret = 0; + } } - else { + if (ret != 0) { status = kStatus_SSS_Fail; } if (status == kStatus_SSS_Success) { @@ -1483,8 +1631,8 @@ int se050_curve25519_shared_secret(curve25519_key* private_key, } else { if (keyCreated) { - sss_key_store_erase_key(&host_keystore, &public_key); - sss_key_object_free(&public_key); + sss_key_store_erase_key(&host_keystore, &ref_public_key); + sss_key_object_free(&ref_public_key); } if (ret == 0) ret = WC_HW_E; diff --git a/wolfcrypt/src/port/pic32/pic32mz-crypt.c b/wolfcrypt/src/port/pic32/pic32mz-crypt.c index 5db1e4ad4..258682539 100644 --- a/wolfcrypt/src/port/pic32/pic32mz-crypt.c +++ b/wolfcrypt/src/port/pic32/pic32mz-crypt.c @@ -1,6 +1,6 @@ /* pic32mz-crypt.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/psa/psa.c b/wolfcrypt/src/port/psa/psa.c index a019d3a5d..ceee8fec0 100644 --- a/wolfcrypt/src/port/psa/psa.c +++ b/wolfcrypt/src/port/psa/psa.c @@ -1,6 +1,6 @@ /* psa.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/psa/psa_aes.c b/wolfcrypt/src/port/psa/psa_aes.c index e69ea9969..132a5ca6e 100644 --- a/wolfcrypt/src/port/psa/psa_aes.c +++ b/wolfcrypt/src/port/psa/psa_aes.c @@ -1,6 +1,6 @@ /* psa_aes.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/psa/psa_hash.c b/wolfcrypt/src/port/psa/psa_hash.c index 9d3e678ea..d2603ae63 100644 --- a/wolfcrypt/src/port/psa/psa_hash.c +++ b/wolfcrypt/src/port/psa/psa_hash.c @@ -1,6 +1,6 @@ /* psa_hash.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/psa/psa_pkcbs.c b/wolfcrypt/src/port/psa/psa_pkcbs.c index 12a69a667..fdb593ce5 100644 --- a/wolfcrypt/src/port/psa/psa_pkcbs.c +++ b/wolfcrypt/src/port/psa/psa_pkcbs.c @@ -1,6 +1,6 @@ /* psa_pkcbs.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/silabs/silabs_aes.c b/wolfcrypt/src/port/silabs/silabs_aes.c index ccc759b4d..808eb3309 100644 --- a/wolfcrypt/src/port/silabs/silabs_aes.c +++ b/wolfcrypt/src/port/silabs/silabs_aes.c @@ -1,6 +1,6 @@ /* silabs_aes.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/silabs/silabs_ecc.c b/wolfcrypt/src/port/silabs/silabs_ecc.c index b41c9ec80..3c4a7ad04 100644 --- a/wolfcrypt/src/port/silabs/silabs_ecc.c +++ b/wolfcrypt/src/port/silabs/silabs_ecc.c @@ -1,6 +1,6 @@ /* silabs_ecc.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/silabs/silabs_hash.c b/wolfcrypt/src/port/silabs/silabs_hash.c index afb48a0af..65a74bca5 100644 --- a/wolfcrypt/src/port/silabs/silabs_hash.c +++ b/wolfcrypt/src/port/silabs/silabs_hash.c @@ -1,6 +1,6 @@ /* silabs_se_hash.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/silabs/silabs_random.c b/wolfcrypt/src/port/silabs/silabs_random.c index c4a35d167..16f6e1720 100644 --- a/wolfcrypt/src/port/silabs/silabs_random.c +++ b/wolfcrypt/src/port/silabs/silabs_random.c @@ -1,6 +1,6 @@ /* silabs_random.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/st/stm32.c b/wolfcrypt/src/port/st/stm32.c index c2f0dbcb4..be417bfcd 100644 --- a/wolfcrypt/src/port/st/stm32.c +++ b/wolfcrypt/src/port/st/stm32.c @@ -1,6 +1,6 @@ /* stm32.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/st/stsafe.c b/wolfcrypt/src/port/st/stsafe.c index 1151e7430..ba2a6f5e7 100644 --- a/wolfcrypt/src/port/st/stsafe.c +++ b/wolfcrypt/src/port/st/stsafe.c @@ -1,6 +1,6 @@ /* stsafe.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/ti/ti-aes.c b/wolfcrypt/src/port/ti/ti-aes.c index 88286b329..c3ff1e9e1 100644 --- a/wolfcrypt/src/port/ti/ti-aes.c +++ b/wolfcrypt/src/port/ti/ti-aes.c @@ -1,6 +1,6 @@ /* port/ti/ti-aes.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/ti/ti-ccm.c b/wolfcrypt/src/port/ti/ti-ccm.c index 9af5ede2e..a38f02714 100644 --- a/wolfcrypt/src/port/ti/ti-ccm.c +++ b/wolfcrypt/src/port/ti/ti-ccm.c @@ -1,6 +1,6 @@ /* port/ti/ti_ccm.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/ti/ti-des3.c b/wolfcrypt/src/port/ti/ti-des3.c index 788ec8b4e..212e797d2 100644 --- a/wolfcrypt/src/port/ti/ti-des3.c +++ b/wolfcrypt/src/port/ti/ti-des3.c @@ -1,6 +1,6 @@ /* port/ti/ti-des.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/ti/ti-hash.c b/wolfcrypt/src/port/ti/ti-hash.c index 09ec8aa5a..acaed452d 100644 --- a/wolfcrypt/src/port/ti/ti-hash.c +++ b/wolfcrypt/src/port/ti/ti-hash.c @@ -1,6 +1,6 @@ /* port/ti/ti-hash.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/xilinx/xil-aesgcm.c b/wolfcrypt/src/port/xilinx/xil-aesgcm.c index 4b7a75589..0ee0fbffd 100644 --- a/wolfcrypt/src/port/xilinx/xil-aesgcm.c +++ b/wolfcrypt/src/port/xilinx/xil-aesgcm.c @@ -1,6 +1,6 @@ /* xil-aesgcm.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/port/xilinx/xil-sha3.c b/wolfcrypt/src/port/xilinx/xil-sha3.c index f116c1b96..d43441893 100644 --- a/wolfcrypt/src/port/xilinx/xil-sha3.c +++ b/wolfcrypt/src/port/xilinx/xil-sha3.c @@ -1,6 +1,6 @@ /* xil-sha3.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/pwdbased.c b/wolfcrypt/src/pwdbased.c index b4f516062..312c7bba9 100644 --- a/wolfcrypt/src/pwdbased.c +++ b/wolfcrypt/src/pwdbased.c @@ -1,6 +1,6 @@ /* pwdbased.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/random.c b/wolfcrypt/src/random.c index 8933dd042..2407e805b 100644 --- a/wolfcrypt/src/random.c +++ b/wolfcrypt/src/random.c @@ -1,6 +1,6 @@ /* random.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/rc2.c b/wolfcrypt/src/rc2.c index 9051c5f5e..0a3e5f08c 100644 --- a/wolfcrypt/src/rc2.c +++ b/wolfcrypt/src/rc2.c @@ -1,6 +1,6 @@ /* rc2.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/ripemd.c b/wolfcrypt/src/ripemd.c index dbd8b8980..19e7eb1a1 100644 --- a/wolfcrypt/src/ripemd.c +++ b/wolfcrypt/src/ripemd.c @@ -1,6 +1,6 @@ /* ripemd.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/rsa.c b/wolfcrypt/src/rsa.c index 77932e7a2..9406bfac4 100644 --- a/wolfcrypt/src/rsa.c +++ b/wolfcrypt/src/rsa.c @@ -1,6 +1,6 @@ /* rsa.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/sakke.c b/wolfcrypt/src/sakke.c index d09b9562a..174b69bc0 100644 --- a/wolfcrypt/src/sakke.c +++ b/wolfcrypt/src/sakke.c @@ -1,6 +1,6 @@ /* sakke.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/sha.c b/wolfcrypt/src/sha.c index 8a2cece1f..c592b0072 100644 --- a/wolfcrypt/src/sha.c +++ b/wolfcrypt/src/sha.c @@ -359,7 +359,6 @@ int ret = 0; ret = se050_hash_final(&sha->se050Ctx, hash, WC_SHA_DIGEST_SIZE, kAlgorithm_SSS_SHA1); - (void)wc_InitSha(sha); return ret; } int wc_ShaFinalRaw(wc_Sha* sha, byte* hash) @@ -367,7 +366,6 @@ int ret = 0; ret = se050_hash_final(&sha->se050Ctx, hash, WC_SHA_DIGEST_SIZE, kAlgorithm_SSS_SHA1); - (void)wc_InitSha(sha); return ret; } @@ -855,7 +853,7 @@ void wc_ShaFree(wc_Sha* sha) wc_ShaPic32Free(sha); #endif #if defined(WOLFSSL_SE050) && defined(WOLFSSL_SE050_HASH) - se050_hash_free(&sha->se050Ctx); + se050_hash_free(&sha->se050Ctx); #endif #if (defined(WOLFSSL_RENESAS_TSIP_CRYPT) && \ !defined(NO_WOLFSSL_RENESAS_TSIP_CRYPT_HASH)) diff --git a/wolfcrypt/src/sha256.c b/wolfcrypt/src/sha256.c index 5a1946645..0186588df 100644 --- a/wolfcrypt/src/sha256.c +++ b/wolfcrypt/src/sha256.c @@ -641,7 +641,6 @@ static int InitSha256(wc_Sha256* sha256) int ret = 0; ret = se050_hash_final(&sha256->se050Ctx, hash, WC_SHA256_DIGEST_SIZE, kAlgorithm_SSS_SHA256); - (void)wc_InitSha256(sha256); return ret; } int wc_Sha256FinalRaw(wc_Sha256* sha256, byte* hash) @@ -649,7 +648,6 @@ static int InitSha256(wc_Sha256* sha256) int ret = 0; ret = se050_hash_final(&sha256->se050Ctx, hash, WC_SHA256_DIGEST_SIZE, kAlgorithm_SSS_SHA256); - (void)wc_InitSha256(sha256); return ret; } @@ -1727,6 +1725,9 @@ void wc_Sha256Free(wc_Sha256* sha256) sha256->msg = NULL; } #endif +#if defined(WOLFSSL_SE050) && defined(WOLFSSL_SE050_HASH) + se050_hash_free(&sha256->se050Ctx); +#endif #if defined(WOLFSSL_KCAPI_HASH) KcapiHashFree(&sha256->kcapi); #endif diff --git a/wolfcrypt/src/sha256_asm.S b/wolfcrypt/src/sha256_asm.S index 8d1e469e1..a6c51d348 100644 --- a/wolfcrypt/src/sha256_asm.S +++ b/wolfcrypt/src/sha256_asm.S @@ -1,6 +1,6 @@ /* sha256_asm * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/sha3.c b/wolfcrypt/src/sha3.c index 9007b28bc..ee3883ef4 100644 --- a/wolfcrypt/src/sha3.c +++ b/wolfcrypt/src/sha3.c @@ -1,6 +1,6 @@ /* sha3.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/sha512.c b/wolfcrypt/src/sha512.c index 94164334a..a0cf26e28 100644 --- a/wolfcrypt/src/sha512.c +++ b/wolfcrypt/src/sha512.c @@ -1,6 +1,6 @@ /* sha512.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -232,7 +232,6 @@ #endif ret = se050_hash_final(&sha512->se050Ctx, hash, WC_SHA512_DIGEST_SIZE, kAlgorithm_SSS_SHA512); - (void)wc_InitSha512_ex(sha512, sha512->heap, devId); return ret; } int wc_Sha512FinalRaw(wc_Sha512* sha512, byte* hash) @@ -247,12 +246,11 @@ #endif ret = se050_hash_final(&sha512->se050Ctx, hash, WC_SHA512_DIGEST_SIZE, kAlgorithm_SSS_SHA512); - (void)wc_InitSha512_ex(sha512, sha512->heap, devId); return ret; } void wc_Sha512Free(wc_Sha512* sha512) { - (void)sha512; + se050_hash_free(&sha512->se050Ctx); } #else @@ -1264,7 +1262,6 @@ int wc_Sha512Transform(wc_Sha512* sha, const unsigned char* data) int ret = 0; ret = se050_hash_final(&sha384->se050Ctx, hash, WC_SHA384_DIGEST_SIZE, kAlgorithm_SSS_SHA384); - (void)wc_InitSha384(sha384); return ret; } int wc_Sha384FinalRaw(wc_Sha384* sha384, byte* hash) @@ -1272,7 +1269,6 @@ int wc_Sha512Transform(wc_Sha512* sha, const unsigned char* data) int ret = 0; ret = se050_hash_final(&sha384->se050Ctx, hash, WC_SHA384_DIGEST_SIZE, kAlgorithm_SSS_SHA384); - (void)wc_InitSha384(sha384); return ret; } @@ -1482,6 +1478,10 @@ void wc_Sha384Free(wc_Sha384* sha384) } #endif +#if defined(WOLFSSL_SE050) && defined(WOLFSSL_SE050_HASH) + se050_hash_free(&sha384->se050Ctx); +#endif + #if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_SHA384) wolfAsync_DevCtxFree(&sha384->asyncDev, WOLFSSL_ASYNC_MARKER_SHA384); #endif /* WOLFSSL_ASYNC_CRYPT */ diff --git a/wolfcrypt/src/sha512_asm.S b/wolfcrypt/src/sha512_asm.S index 12fc4bb45..6ec4dc2e5 100644 --- a/wolfcrypt/src/sha512_asm.S +++ b/wolfcrypt/src/sha512_asm.S @@ -1,6 +1,6 @@ /* sha512_asm * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/signature.c b/wolfcrypt/src/signature.c index a86947892..fe2229029 100644 --- a/wolfcrypt/src/signature.c +++ b/wolfcrypt/src/signature.c @@ -1,6 +1,6 @@ /* signature.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/siphash.c b/wolfcrypt/src/siphash.c index ef1f6179a..20dd9a4d8 100644 --- a/wolfcrypt/src/siphash.c +++ b/wolfcrypt/src/siphash.c @@ -1,6 +1,6 @@ /* siphash.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/sp_arm32.c b/wolfcrypt/src/sp_arm32.c index 5f4014107..4ef6f7b74 100644 --- a/wolfcrypt/src/sp_arm32.c +++ b/wolfcrypt/src/sp_arm32.c @@ -1,6 +1,6 @@ /* sp.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/sp_arm64.c b/wolfcrypt/src/sp_arm64.c index c4e1d95d3..5d0c579b4 100644 --- a/wolfcrypt/src/sp_arm64.c +++ b/wolfcrypt/src/sp_arm64.c @@ -1,6 +1,6 @@ /* sp.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/sp_armthumb.c b/wolfcrypt/src/sp_armthumb.c index 36a800786..0401d9a66 100644 --- a/wolfcrypt/src/sp_armthumb.c +++ b/wolfcrypt/src/sp_armthumb.c @@ -1,6 +1,6 @@ /* sp.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/sp_c32.c b/wolfcrypt/src/sp_c32.c index 7cfaab93e..7737c6bd9 100644 --- a/wolfcrypt/src/sp_c32.c +++ b/wolfcrypt/src/sp_c32.c @@ -1,6 +1,6 @@ /* sp.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/sp_c64.c b/wolfcrypt/src/sp_c64.c index f2473cb46..43245a51e 100644 --- a/wolfcrypt/src/sp_c64.c +++ b/wolfcrypt/src/sp_c64.c @@ -1,6 +1,6 @@ /* sp.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/sp_cortexm.c b/wolfcrypt/src/sp_cortexm.c index 28ea6ab6b..5601e0fcc 100644 --- a/wolfcrypt/src/sp_cortexm.c +++ b/wolfcrypt/src/sp_cortexm.c @@ -1,6 +1,6 @@ /* sp.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/sp_dsp32.c b/wolfcrypt/src/sp_dsp32.c index 5747e4b11..acfaf31d9 100644 --- a/wolfcrypt/src/sp_dsp32.c +++ b/wolfcrypt/src/sp_dsp32.c @@ -1,6 +1,6 @@ /* sp_cdsp_signed.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/sp_int.c b/wolfcrypt/src/sp_int.c index bf161265a..66b40969f 100644 --- a/wolfcrypt/src/sp_int.c +++ b/wolfcrypt/src/sp_int.c @@ -1,6 +1,6 @@ /* sp_int.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -1022,13 +1022,31 @@ static WC_INLINE sp_int_digit sp_div_word(sp_int_digit hi, sp_int_digit lo, sp_int_digit d) { sp_int_digit r = 0; +#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) + static const char debruijn32[32] = { + 0, 31, 9, 30, 3, 8, 13, 29, 2, 5, 7, 21, 12, 24, 28, 19, + 1, 10, 4, 14, 6, 22, 25, 20, 11, 15, 23, 26, 16, 27, 17, 18 + }; + static const sp_uint32 debruijn32_mul = 0x076be629; +#endif __asm__ __volatile__ ( - "lsrs r5, %[d], #24\n\t" - "it eq\n\t" - "moveq r5, #8\n\t" - "it ne\n\t" - "movne r5, #0\n\t" + /* Shift d so that top bit is set. */ +#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) + "ldr r4, %[m]\n\t" + "mov r5, %[d]\n\t" + "orr r5, r5, r5, lsr #1\n\t" + "orr r5, r5, r5, lsr #2\n\t" + "orr r5, r5, r5, lsr #4\n\t" + "orr r5, r5, r5, lsr #8\n\t" + "orr r5, r5, r5, lsr #16\n\t" + "add r5, r5, #1\n\t" + "mul r5, r5, r4\n\t" + "lsr r5, r5, #27\n\t" + "ldrb r5, [%[t], r5]\n\t" +#else + "clz r5, %[d]\n\t" +#endif "rsb r6, r5, #31\n\t" "lsl %[d], %[d], r5\n\t" "lsl %[hi], %[hi], r5\n\t" @@ -1060,8 +1078,11 @@ static WC_INLINE sp_int_digit sp_div_word(sp_int_digit hi, sp_int_digit lo, "subs r9, r9, r8\n\t" "subs r4, r4, #1\n\t" "bpl 1b\n\t" + "add %[r], %[r], %[r]\n\t" "add %[r], %[r], #1\n\t" + + /* Handle difference has hi word > 0. */ "umull r4, r5, %[r], %[d]\n\t" "subs r4, %[lo], r4\n\t" "sbc r5, %[hi], r5\n\t" @@ -1070,15 +1091,22 @@ static WC_INLINE sp_int_digit sp_div_word(sp_int_digit hi, sp_int_digit lo, "subs r4, %[lo], r4\n\t" "sbc r5, %[hi], r5\n\t" "add %[r], %[r], r5\n\t" - "umull r4, r5, %[r], %[d]\n\t" + + /* Add 1 to result if bottom half of difference is >= d. */ + "mul r4, %[r], %[d]\n\t" "subs r4, %[lo], r4\n\t" - "sbc r5, %[hi], r5\n\t" - "add %[r], %[r], r5\n\t" - "subs r8, %[d], r4\n\t" + "subs r9, %[d], r4\n\t" + "sbc r8, r8, r8\n\t" + "sub %[r], %[r], r8\n\t" + "subs r9, r9, #1\n\t" "sbc r8, r8, r8\n\t" "sub %[r], %[r], r8\n\t" : [r] "+r" (r), [hi] "+r" (hi), [lo] "+r" (lo), [d] "+r" (d) +#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) + : [t] "r" (debruijn32), [m] "m" (debruijn32_mul) +#else : +#endif : "r4", "r5", "r6", "r8", "r9" ); @@ -6602,11 +6630,11 @@ int sp_addmod_ct(sp_int* a, sp_int* b, sp_int* m, sp_int* r) } if (err == MP_OKAY) { - if (0) { - sp_print(a, "a"); - sp_print(b, "b"); - sp_print(m, "m"); - } +#if 0 + sp_print(a, "a"); + sp_print(b, "b"); + sp_print(m, "m"); +#endif /* Add a to b into r. Do the subtract of modulus but don't store result. * When subtract result is negative, the overflow will be negative. @@ -6691,9 +6719,9 @@ int sp_addmod_ct(sp_int* a, sp_int* b, sp_int* m, sp_int* r) #endif /* WOLFSSL_SP_INT_NEGATIVE */ sp_clamp(r); - if (0) { - sp_print(r, "rma"); - } +#if 0 + sp_print(r, "rma"); +#endif } return err; @@ -6737,11 +6765,11 @@ int sp_submod_ct(sp_int* a, sp_int* b, sp_int* m, sp_int* r) } if (err == MP_OKAY) { - if (0) { - sp_print(a, "a"); - sp_print(b, "b"); - sp_print(m, "m"); - } +#if 0 + sp_print(a, "a"); + sp_print(b, "b"); + sp_print(m, "m"); +#endif /* In constant time, subtract b from a putting result in r. */ #ifndef SQR_MUL_ASM @@ -6806,9 +6834,9 @@ int sp_submod_ct(sp_int* a, sp_int* b, sp_int* m, sp_int* r) #endif /* WOLFSSL_SP_INT_NEGATIVE */ sp_clamp(r); - if (0) { - sp_print(r, "rms"); - } +#if 0 + sp_print(r, "rms"); +#endif } return err; @@ -10397,27 +10425,28 @@ int sp_mulmod(sp_int* a, sp_int* b, sp_int* m, sp_int* r) err = MP_VAL; } - if ((r == m) || (r->size < a->used + b->used)) { - DECL_SP_INT(t, ((a == NULL) || (b == NULL)) ? 1 : a->used + b->used); - ALLOC_SP_INT(t, a->used + b->used, err, NULL); - if (err == MP_OKAY) { - err = sp_init_size(t, a->used + b->used); - } - if (err == MP_OKAY) { - err = sp_mul(a, b, t); - } - if (err == MP_OKAY) { - err = sp_mod(t, m, r); - } + if (err == MP_OKAY) { + if ((r == m) || (r->size < a->used + b->used)) { + DECL_SP_INT(t, ((a == NULL) || (b == NULL)) ? 1 : + a->used + b->used); + ALLOC_SP_INT(t, a->used + b->used, err, NULL); + if (err == MP_OKAY) { + err = sp_init_size(t, a->used + b->used); + } + if (err == MP_OKAY) { + err = sp_mul(a, b, t); + } + if (err == MP_OKAY) { + err = sp_mod(t, m, r); + } - FREE_SP_INT(t, NULL); - } - else { - if (err == MP_OKAY) { - err = sp_mul(a, b, r); + FREE_SP_INT(t, NULL); } - if (err == MP_OKAY) { - err = sp_mod(r, m, r); + else { + err = sp_mul(a, b, r); + if (err == MP_OKAY) { + err = sp_mod(r, m, r); + } } } return err; @@ -11113,11 +11142,11 @@ static int _sp_exptmod_base_2(sp_int* e, int digits, sp_int* m, sp_int* r) sp_int_digit mp = 0, n = 0; DECL_SP_INT_ARRAY(d, m->used * 2 + 1, 2); - if (0) { - sp_print_int(2, "a"); - sp_print(e, "b"); - sp_print(m, "m"); - } +#if 0 + sp_print_int(2, "a"); + sp_print(e, "b"); + sp_print(m, "m"); +#endif ALLOC_SP_INT_ARRAY(d, m->used * 2 + 1, 2, err, NULL); if (err == MP_OKAY) { @@ -11236,9 +11265,9 @@ static int _sp_exptmod_base_2(sp_int* e, int digits, sp_int* m, sp_int* r) err = sp_copy(tr, r); } - if (0) { - sp_print(r, "rme"); - } +#if 0 + sp_print(r, "rme"); +#endif FREE_SP_INT_ARRAY(d, NULL); return err; @@ -11991,14 +12020,14 @@ int sp_mul_2d(sp_int* a, int e, sp_int* r) } if (err == MP_OKAY) { - if (0) { - sp_print(a, "a"); - sp_print_int(e, "n"); - } +#if 0 + sp_print(a, "a"); + sp_print_int(e, "n"); +#endif err = sp_lshb(r, e); - if (0) { - sp_print(r, "rsl"); - } +#if 0 + sp_print(r, "rsl"); +#endif } return err; @@ -14491,10 +14520,10 @@ static int _sp_mont_red(sp_int* a, sp_int* m, sp_int_digit mp) sp_int_word w; sp_int_digit mu; - if (0) { - sp_print(a, "a"); - sp_print(m, "m"); - } +#if 0 + sp_print(a, "a"); + sp_print(m, "m"); +#endif bits = sp_count_bits(m); @@ -14559,9 +14588,9 @@ static int _sp_mont_red(sp_int* a, sp_int* m, sp_int_digit mp) _sp_sub_off(a, m, a, 0); } - if (0) { - sp_print(a, "rr"); - } +#if 0 + sp_print(a, "rr"); +#endif return MP_OKAY; #else /* !SQR_MUL_ASM */ diff --git a/wolfcrypt/src/sp_x86_64.c b/wolfcrypt/src/sp_x86_64.c index 1245a6ff6..1a1442708 100644 --- a/wolfcrypt/src/sp_x86_64.c +++ b/wolfcrypt/src/sp_x86_64.c @@ -1,6 +1,6 @@ /* sp.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/sp_x86_64_asm.S b/wolfcrypt/src/sp_x86_64_asm.S index 63afab613..c47433b67 100644 --- a/wolfcrypt/src/sp_x86_64_asm.S +++ b/wolfcrypt/src/sp_x86_64_asm.S @@ -1,6 +1,6 @@ /* sp_x86_64_asm * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/sp_x86_64_asm.asm b/wolfcrypt/src/sp_x86_64_asm.asm index 20a02a1a7..4a1f53398 100644 --- a/wolfcrypt/src/sp_x86_64_asm.asm +++ b/wolfcrypt/src/sp_x86_64_asm.asm @@ -1,6 +1,6 @@ ; /* sp_x86_64_asm ; * -; * Copyright (C) 2006-2021 wolfSSL Inc. +; * Copyright (C) 2006-2022 wolfSSL Inc. ; * ; * This file is part of wolfSSL. ; * diff --git a/wolfcrypt/src/srp.c b/wolfcrypt/src/srp.c index 4b7e51337..83e09f5ca 100644 --- a/wolfcrypt/src/srp.c +++ b/wolfcrypt/src/srp.c @@ -1,6 +1,6 @@ /* srp.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/tfm.c b/wolfcrypt/src/tfm.c index 6a3b8aad5..cbb28b6e5 100644 --- a/wolfcrypt/src/tfm.c +++ b/wolfcrypt/src/tfm.c @@ -1,6 +1,6 @@ /* tfm.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/wc_dsp.c b/wolfcrypt/src/wc_dsp.c index 2056bd794..a351f00c0 100644 --- a/wolfcrypt/src/wc_dsp.c +++ b/wolfcrypt/src/wc_dsp.c @@ -1,6 +1,6 @@ /* wc_dsp.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/wc_encrypt.c b/wolfcrypt/src/wc_encrypt.c index f1ea3b923..91707f317 100644 --- a/wolfcrypt/src/wc_encrypt.c +++ b/wolfcrypt/src/wc_encrypt.c @@ -1,6 +1,6 @@ /* wc_encrypt.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/wc_pkcs11.c b/wolfcrypt/src/wc_pkcs11.c index 627932209..e0a04b5e5 100644 --- a/wolfcrypt/src/wc_pkcs11.c +++ b/wolfcrypt/src/wc_pkcs11.c @@ -1,6 +1,6 @@ /* wc_pkcs11.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/wc_port.c b/wolfcrypt/src/wc_port.c index 1be78de15..6764cd7ac 100644 --- a/wolfcrypt/src/wc_port.c +++ b/wolfcrypt/src/wc_port.c @@ -1,6 +1,6 @@ /* port.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -854,7 +854,8 @@ void wc_ReadDirClose(ReadDirCtx* ctx) } #else if (ctx->dir) { - closedir(ctx->dir); + if (closedir(ctx->dir) < 0) + WOLFSSL_MSG("closedir() failed"); ctx->dir = NULL; } #endif diff --git a/wolfcrypt/src/wolfevent.c b/wolfcrypt/src/wolfevent.c index 2356ae406..5238bf8e6 100644 --- a/wolfcrypt/src/wolfevent.c +++ b/wolfcrypt/src/wolfevent.c @@ -1,6 +1,6 @@ /* wolfevent.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/src/wolfmath.c b/wolfcrypt/src/wolfmath.c index d6772ea1f..b46d759a5 100644 --- a/wolfcrypt/src/wolfmath.c +++ b/wolfcrypt/src/wolfmath.c @@ -1,6 +1,6 @@ /* wolfmath.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index fe3e0918a..428884c32 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -1,6 +1,6 @@ /* test.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -203,6 +203,13 @@ #ifdef XPRINTF #undef printf #define printf XPRINTF + #elif !defined(printf) + /* arrange for printf() to flush after every message -- this assures + * redirected output (to a log file) records progress right up to the + * moment of a crash/abort(); otherwise anything queued in stdout would + * be lost. + */ + #define printf(...) ( printf(__VA_ARGS__), fflush(stdout) ) #endif #endif @@ -11995,7 +12002,7 @@ WOLFSSL_TEST_SUBROUTINE int memory_test(void) static const char* certDerFile = CERT_WRITE_TEMP_DIR "cert.der"; static const char* otherCertPemFile = CERT_WRITE_TEMP_DIR "othercert.pem"; static const char* certPemFile = CERT_WRITE_TEMP_DIR "cert.pem"; - #if defined(WOLFSSL_CERT_REQ) && defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC) + #if defined(WOLFSSL_CERT_REQ) && !defined(WOLFSSL_NO_MALLOC) static const char* certReqDerFile = CERT_WRITE_TEMP_DIR "certreq.der"; static const char* certReqPemFile = CERT_WRITE_TEMP_DIR "certreq.pem"; #endif @@ -15559,10 +15566,13 @@ WOLFSSL_TEST_SUBROUTINE int rsa_test(void) goto exit_rsa; #endif -#if defined(WOLFSSL_CERT_REQ) && defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC) +#if defined(WOLFSSL_CERT_REQ) && !defined(WOLFSSL_NO_MALLOC) { Cert *req; int derSz; +#ifndef WOLFSSL_SMALL_STACK + byte* der = NULL; +#endif req = (Cert *)XMALLOC(sizeof *req, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER); if (! req) @@ -15656,6 +15666,13 @@ WOLFSSL_TEST_SUBROUTINE int rsa_test(void) ERROR_OUT(-7974, exit_rsa); } + /* Test getting the size of the buffer without providing the buffer. + * derSz is set to the "largest buffer" we are willing to allocate. */ + derSz = wc_MakeCertReq(req, NULL, 10000, key, NULL); + if (derSz < 0) { + ERROR_OUT(-7975, exit_rsa); + } + XFREE(der, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER); XFREE(req, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER); der = NULL; @@ -22561,6 +22578,17 @@ static int ecc_test_key_gen(WC_RNG* rng, int keySize) ERROR_OUT(-9890, done); } +#ifdef HAVE_COMP_KEY + /* test export of compressed public key */ + derSz = wc_EccPublicKeyToDer_ex(userA, der, ECC_BUFSIZE, 1, 1); + if (derSz < 0) { + ERROR_OUT(derSz, done); + } + if (derSz == 0) { + ERROR_OUT(-9890, done); + } +#endif + ret = SaveDerAndPem(der, derSz, eccPubKeyDerFile, NULL, 0, -8348); if (ret != 0) { goto done; @@ -25185,6 +25213,34 @@ static int ecc_encrypt_kat(WC_RNG *rng) 0xf4, 0x95, 0xd4, 0xcf, 0x30, 0xd6, 0xa2, 0xc5, 0x35, 0x96, 0x6a, 0xd4, 0x36, 0x15, 0xa9, 0xbd, 0x7f +#elif defined(WOLFSSL_ECIES_GEN_IV) + /* EC P-256 point */ + 0x04, + /* X */ + 0x50, 0xf2, 0x93, 0xa2, 0x48, 0xa9, 0xc0, 0x5a, + 0x9a, 0xa7, 0x70, 0x34, 0xb7, 0x7f, 0x4c, 0x3a, + 0xad, 0xfc, 0xd8, 0xb6, 0x76, 0x0a, 0xe3, 0xc1, + 0x87, 0x17, 0x07, 0x2d, 0x8d, 0xa3, 0x63, 0xa0, + /* Y */ + 0xc1, 0x27, 0xb2, 0x97, 0x9b, 0x84, 0xe7, 0xcd, + 0x20, 0x65, 0x8d, 0x2b, 0x6a, 0x93, 0x75, 0xaa, + 0x8b, 0xe1, 0x3a, 0x7b, 0x24, 0x1a, 0xbe, 0xe8, + 0x36, 0xd2, 0xe6, 0x34, 0x8a, 0x7a, 0xb3, 0x28, + /* IV */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* Encrypted Msg */ + 0xe5, 0x17, 0xaf, 0x0d, 0x65, 0x4d, 0x3d, 0x50, + 0x96, 0x05, 0xc9, 0x63, 0x2c, 0xef, 0x1c, 0x1f, + 0x78, 0xc9, 0x90, 0x7a, 0x14, 0x00, 0xfc, 0x44, + 0x71, 0x6d, 0x57, 0x8c, 0xdf, 0x23, 0xca, 0x65, + 0xcf, 0x93, 0x06, 0xb6, 0x9a, 0xf4, 0x61, 0xbd, + 0x44, 0x1a, 0xeb, 0x52, 0x68, 0x0f, 0xd1, 0xde, + /* HMAC */ + 0x5a, 0x22, 0xc1, 0x5d, 0x99, 0x66, 0x3f, 0x24, + 0x35, 0x96, 0xac, 0xf7, 0xf6, 0x28, 0x45, 0x16, + 0x52, 0x19, 0x0d, 0xe4, 0xb2, 0xca, 0x5b, 0x28, + 0x4e, 0xbb, 0xf3, 0x98, 0x57, 0xd7, 0x3b, 0xe2 #else 0x04, 0x50, 0xf2, 0x93, 0xa2, 0x48, 0xa9, 0xc0, 0x5a, 0x9a, 0xa7, 0x70, 0x34, 0xb7, 0x7f, 0x4c, @@ -25329,6 +25385,8 @@ static int ecc_encrypt_e2e_test(WC_RNG* rng, ecc_key* userA, ecc_key* userB, byte plain[48]; #ifdef WOLFSSL_ECIES_OLD byte out[80]; +#elif defined(WOLFSSL_ECIES_GEN_IV) + byte out[1 + ECC_KEYGEN_SIZE * 2 + 16 + 80]; #else byte out[1 + ECC_KEYGEN_SIZE * 2 + 80]; #endif @@ -25344,6 +25402,8 @@ static int ecc_encrypt_e2e_test(WC_RNG* rng, ecc_key* userA, ecc_key* userB, byte plain2[48]; #ifdef WOLFSSL_ECIES_OLD byte out2[80]; +#elif defined(WOLFSSL_ECIES_GEN_IV) + byte out2[1 + ECC_KEYGEN_SIZE * 2 + 16 + 80]; #else byte out2[1 + ECC_KEYGEN_SIZE * 2 + 80]; #endif @@ -27262,17 +27322,17 @@ WOLFSSL_TEST_SUBROUTINE int ed25519_test(void) 0x00 /* add an additional byte to make the pubkey appear bigger */ }; static byte privPubEd25519[] = { - 0x30,0x52,0x02,0x01,0x00,0x30,0x05,0x06, + 0x30,0x50,0x02,0x01,0x00,0x30,0x05,0x06, 0x03,0x2b,0x65,0x70,0x04,0x22,0x04,0x20, 0x9d,0x61,0xb1,0x9d,0xef,0xfd,0x5a,0x60, 0xba,0x84,0x4a,0xf4,0x92,0xec,0x2c,0xc4, 0x44,0x49,0xc5,0x69,0x7b,0x32,0x69,0x19, 0x70,0x3b,0xac,0x03,0x1c,0xae,0x7f,0x60, - 0xa1,0x22,0x04,0x20,0xd7,0x5a,0x98,0x01, - 0x82,0xb1,0x0a,0xb7,0xd5,0x4b,0xfe,0xd3, - 0xc9,0x64,0x07,0x3a,0x0e,0xe1,0x72,0xf3, - 0xda,0xa6,0x23,0x25,0xaf,0x02,0x1a,0x68, - 0xf7,0x07,0x51,0x1a + 0x81,0x20,0xd7,0x5a,0x98,0x01,0x82,0xb1, + 0x0a,0xb7,0xd5,0x4b,0xfe,0xd3,0xc9,0x64, + 0x07,0x3a,0x0e,0xe1,0x72,0xf3,0xda,0xa6, + 0x23,0x25,0xaf,0x02,0x1a,0x68,0xf7,0x07, + 0x51,0x1a }; word32 idx; @@ -28685,7 +28745,7 @@ WOLFSSL_TEST_SUBROUTINE int ed448_test(void) 0xaf, 0xe8, 0x25, 0x61, 0x80 }; static const byte privPubEd448[] = { - 0x30, 0x81, 0x84, 0x02, 0x01, 0x00, 0x30, 0x05, + 0x30, 0x81, 0x82, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x71, 0x04, 0x3b, 0x04, 0x39, 0x6c, 0x82, 0xa5, 0x62, 0xcb, 0x80, 0x8d, 0x10, 0xd6, 0x32, 0xbe, 0x89, 0xc8, 0x51, 0x3e, @@ -28694,14 +28754,14 @@ WOLFSSL_TEST_SUBROUTINE int ed448_test(void) 0xa3, 0x52, 0x8c, 0x8a, 0x3f, 0xcc, 0x2f, 0x04, 0x4e, 0x39, 0xa3, 0xfc, 0x5b, 0x94, 0x49, 0x2f, 0x8f, 0x03, 0x2e, 0x75, 0x49, 0xa2, 0x00, 0x98, - 0xf9, 0x5b, 0xa1, 0x3b, 0x04, 0x39, 0x5f, 0xd7, - 0x44, 0x9b, 0x59, 0xb4, 0x61, 0xfd, 0x2c, 0xe7, - 0x87, 0xec, 0x61, 0x6a, 0xd4, 0x6a, 0x1d, 0xa1, - 0x34, 0x24, 0x85, 0xa7, 0x0e, 0x1f, 0x8a, 0x0e, - 0xa7, 0x5d, 0x80, 0xe9, 0x67, 0x78, 0xed, 0xf1, - 0x24, 0x76, 0x9b, 0x46, 0xc7, 0x06, 0x1b, 0xd6, - 0x78, 0x3d, 0xf1, 0xe5, 0x0f, 0x6c, 0xd1, 0xfa, - 0x1a, 0xbe, 0xaf, 0xe8, 0x25, 0x61, 0x80 + 0xf9, 0x5b, 0x81, 0x39, 0x5f, 0xd7, 0x44, 0x9b, + 0x59, 0xb4, 0x61, 0xfd, 0x2c, 0xe7, 0x87, 0xec, + 0x61, 0x6a, 0xd4, 0x6a, 0x1d, 0xa1, 0x34, 0x24, + 0x85, 0xa7, 0x0e, 0x1f, 0x8a, 0x0e, 0xa7, 0x5d, + 0x80, 0xe9, 0x67, 0x78, 0xed, 0xf1, 0x24, 0x76, + 0x9b, 0x46, 0xc7, 0x06, 0x1b, 0xd6, 0x78, 0x3d, + 0xf1, 0xe5, 0x0f, 0x6c, 0xd1, 0xfa, 0x1a, 0xbe, + 0xaf, 0xe8, 0x25, 0x61, 0x80 }; word32 idx; @@ -35007,7 +35067,7 @@ static int pkcs7signed_run_vectors( #if defined(WOLF_C89) XSPRINTF((char*)&transId[k], "%02x", digest[j]); #else - XSNPRINTF((char*)&transId[k], 3, "%02x", digest[j]); + (void)XSNPRINTF((char*)&transId[k], 3, "%02x", digest[j]); #endif } } @@ -38195,7 +38255,10 @@ static int mp_test_mont(mp_int* a, mp_int* m, mp_int* n, mp_int* r, WC_RNG* rng) 0x1f, 0x13d, 0x45, 0x615 #endif }; - int bits[] = { 256, 384, 2048, + int bits[] = { 256, 384, +#if defined(SP_INT_MAX_BITS) && SP_INT_MAX_BITS > 4096 + 2048, +#endif #if defined(SP_INT_MAX_BITS) && SP_INT_MAX_BITS > 6144 3072 #endif diff --git a/wolfcrypt/test/test.h b/wolfcrypt/test/test.h index 07a0c21b8..3dcf9ad92 100644 --- a/wolfcrypt/test/test.h +++ b/wolfcrypt/test/test.h @@ -1,6 +1,6 @@ /* wolfcrypt/test/test.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/test/test_paths.h.in b/wolfcrypt/test/test_paths.h.in index 7a9d3a173..cd79e7adf 100644 --- a/wolfcrypt/test/test_paths.h.in +++ b/wolfcrypt/test/test_paths.h.in @@ -1,6 +1,6 @@ /* wolfcrypt/test/test_paths.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/user-crypto/README.txt b/wolfcrypt/user-crypto/README.txt index 6966a1712..fac01ca27 100644 --- a/wolfcrypt/user-crypto/README.txt +++ b/wolfcrypt/user-crypto/README.txt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/user-crypto/include/user_rsa.h b/wolfcrypt/user-crypto/include/user_rsa.h index f22f87bc5..683c5f1a5 100644 --- a/wolfcrypt/user-crypto/include/user_rsa.h +++ b/wolfcrypt/user-crypto/include/user_rsa.h @@ -1,6 +1,6 @@ /* user_rsa.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfcrypt/user-crypto/src/rsa.c b/wolfcrypt/user-crypto/src/rsa.c index 838b3dbf3..bf8c4844e 100644 --- a/wolfcrypt/user-crypto/src/rsa.c +++ b/wolfcrypt/user-crypto/src/rsa.c @@ -1,6 +1,6 @@ /* rsa.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl.rc b/wolfssl.rc index 1437f6e80..ea344ced3 100644 Binary files a/wolfssl.rc and b/wolfssl.rc differ diff --git a/wolfssl.vcproj b/wolfssl.vcproj index d9277c678..c49dfed8b 100644 --- a/wolfssl.vcproj +++ b/wolfssl.vcproj @@ -155,6 +155,10 @@ RelativePath=".\src\crl.c" > + + diff --git a/wolfssl.vcxproj b/wolfssl.vcxproj index 9c62ae8e5..bebef5489 100644 --- a/wolfssl.vcxproj +++ b/wolfssl.vcxproj @@ -277,6 +277,7 @@ + diff --git a/wolfssl/callbacks.h b/wolfssl/callbacks.h index a2a691687..0f562503c 100644 --- a/wolfssl/callbacks.h +++ b/wolfssl/callbacks.h @@ -1,6 +1,6 @@ /* callbacks.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/crl.h b/wolfssl/crl.h index d45ab3c3c..4cb376bda 100644 --- a/wolfssl/crl.h +++ b/wolfssl/crl.h @@ -1,6 +1,6 @@ /* crl.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/error-ssl.h b/wolfssl/error-ssl.h index a1de3a51a..da14594fe 100644 --- a/wolfssl/error-ssl.h +++ b/wolfssl/error-ssl.h @@ -1,6 +1,6 @@ /* error-ssl.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/internal.h b/wolfssl/internal.h index c91eb9499..33daeaa7c 100644 --- a/wolfssl/internal.h +++ b/wolfssl/internal.h @@ -1,6 +1,6 @@ /* internal.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -1205,6 +1205,7 @@ enum Misc { DTLS_MAJOR = 0xfe, /* DTLS major version number */ DTLS_MINOR = 0xff, /* DTLS minor version number */ + DTLS_BOGUS_MINOR = 0xfe, /* DTLS 0xfe was skipped, see RFC6347 Sec. 1 */ DTLSv1_2_MINOR = 0xfd, /* DTLS minor version number */ DTLSv1_3_MINOR = 0xfc, /* DTLS minor version number */ SSLv3_MAJOR = 3, /* SSLv3 and TLSv1+ major version number */ @@ -1313,6 +1314,7 @@ enum Misc { DTLS_HANDSHAKE_HEADER_SZ = 12, /* normal + seq(2) + offset(3) + length(3) */ DTLS_RECORD_HEADER_SZ = 13, /* normal + epoch(2) + seq_num(6) */ DTLS_UNIFIED_HEADER_MIN_SZ = 2, + DTLS_RECVD_RL_HEADER_MAX_SZ = 5, /* flags + seq_number(2) + length(20) */ DTLS_RECORD_HEADER_MAX_SZ = 13, DTLS_HANDSHAKE_EXTRA = 8, /* diff from normal */ DTLS_RECORD_EXTRA = 8, /* diff from normal */ @@ -3739,8 +3741,8 @@ typedef struct Options { #endif void* psk_ctx; #endif /* NO_PSK */ -#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) || defined(WOLFSSL_WPAS_SMALL) unsigned long mask; /* store SSL_OP_ flags */ +#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) || defined(WOLFSSL_WPAS_SMALL) word16 minProto:1; /* sets min to min available */ word16 maxProto:1; /* sets max to max available */ #endif @@ -4367,7 +4369,6 @@ typedef enum EarlyDataState { typedef struct Dtls13UnifiedHdrInfo { word16 recordLength; - word16 headerLength; byte seqLo; byte seqHi; byte seqHiPresent:1; @@ -4657,7 +4658,7 @@ struct WOLFSSL { Dtls13Epoch *dtls13DecryptEpoch; w64wrapper dtls13Epoch; w64wrapper dtls13PeerEpoch; - + byte dtls13CurRL[DTLS_RECVD_RL_HEADER_MAX_SZ]; word16 dtls13CurRlLength; /* used to store the message if it needs to be fragmented */ @@ -4670,6 +4671,8 @@ struct WOLFSSL { word32 dtls13FragOffset; byte dtls13FragHandshakeType; Dtls13Rtx dtls13Rtx; + byte *dtls13ClientHello; + word16 dtls13ClientHelloSz; #endif /* WOLFSSL_DTLS13 */ #endif /* WOLFSSL_DTLS */ @@ -5186,6 +5189,8 @@ WOLFSSL_LOCAL int cipherExtraData(WOLFSSL* ssl); #ifndef NO_WOLFSSL_CLIENT WOLFSSL_LOCAL int SendClientHello(WOLFSSL* ssl); + WOLFSSL_LOCAL int DoHelloVerifyRequest(WOLFSSL* ssl, const byte* input, word32* inOutIdx, + word32 size); #ifdef WOLFSSL_TLS13 WOLFSSL_LOCAL int SendTls13ClientHello(WOLFSSL* ssl); #endif @@ -5417,6 +5422,11 @@ WOLFSSL_LOCAL int oid2nid(word32 oid, int grp); WOLFSSL_LOCAL word32 nid2oid(int nid, int grp); #endif +#ifdef WOLFSSL_DTLS +WOLFSSL_API int wolfSSL_DtlsUpdateWindow(word16 cur_hi, word32 cur_lo, + word16* next_hi, word32* next_lo, word32 *window); +#endif + #ifdef WOLFSSL_DTLS13 WOLFSSL_LOCAL struct Dtls13Epoch* Dtls13GetEpoch(WOLFSSL* ssl, @@ -5443,6 +5453,7 @@ WOLFSSL_LOCAL int Dtls13RlAddPlaintextHeader(WOLFSSL* ssl, byte* out, WOLFSSL_LOCAL int Dtls13EncryptRecordNumber(WOLFSSL* ssl, byte* hdr, word16 recordLength); WOLFSSL_LOCAL int Dtls13IsUnifiedHeader(byte header_flags); +WOLFSSL_LOCAL int Dtls13GetUnifiedHeaderSize(const byte input, word16* size); WOLFSSL_LOCAL int Dtls13ParseUnifiedRecordLayer(WOLFSSL* ssl, const byte* input, word16 input_size, Dtls13UnifiedHdrInfo* hdrInfo); WOLFSSL_LOCAL int Dtls13HandshakeSend(WOLFSSL* ssl, byte* output, diff --git a/wolfssl/ocsp.h b/wolfssl/ocsp.h index 7e863c3a1..d75e1c1d6 100644 --- a/wolfssl/ocsp.h +++ b/wolfssl/ocsp.h @@ -1,6 +1,6 @@ /* ocsp.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/aes.h b/wolfssl/openssl/aes.h index 7b0ff1991..3a3eee41e 100644 --- a/wolfssl/openssl/aes.h +++ b/wolfssl/openssl/aes.h @@ -1,6 +1,6 @@ /* aes.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/asn1.h b/wolfssl/openssl/asn1.h index ebcf4f2c3..69a31154e 100644 --- a/wolfssl/openssl/asn1.h +++ b/wolfssl/openssl/asn1.h @@ -1,6 +1,6 @@ /* asn1.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/asn1t.h b/wolfssl/openssl/asn1t.h index 98c2404db..c327a5d96 100644 --- a/wolfssl/openssl/asn1t.h +++ b/wolfssl/openssl/asn1t.h @@ -1,6 +1,6 @@ /* asn1t.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/bio.h b/wolfssl/openssl/bio.h index 1f071228c..301198406 100644 --- a/wolfssl/openssl/bio.h +++ b/wolfssl/openssl/bio.h @@ -1,6 +1,6 @@ /* bio.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/bn.h b/wolfssl/openssl/bn.h index 5a9b864ce..cdc56d847 100644 --- a/wolfssl/openssl/bn.h +++ b/wolfssl/openssl/bn.h @@ -1,6 +1,6 @@ /* bn.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/buffer.h b/wolfssl/openssl/buffer.h index 9efdb02f3..d5b7147d9 100644 --- a/wolfssl/openssl/buffer.h +++ b/wolfssl/openssl/buffer.h @@ -1,6 +1,6 @@ /* buffer.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/camellia.h b/wolfssl/openssl/camellia.h index 024b4e337..6618cf24b 100644 --- a/wolfssl/openssl/camellia.h +++ b/wolfssl/openssl/camellia.h @@ -1,6 +1,6 @@ /* camellia.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/cmac.h b/wolfssl/openssl/cmac.h index ed741580d..777a7cb22 100644 --- a/wolfssl/openssl/cmac.h +++ b/wolfssl/openssl/cmac.h @@ -1,6 +1,6 @@ /* cmac.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/cms.h b/wolfssl/openssl/cms.h index a782abbfd..f0f56ca3c 100644 --- a/wolfssl/openssl/cms.h +++ b/wolfssl/openssl/cms.h @@ -1,6 +1,6 @@ /* cms.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/compat_types.h b/wolfssl/openssl/compat_types.h index 7ea3577ba..714bd3cd1 100644 --- a/wolfssl/openssl/compat_types.h +++ b/wolfssl/openssl/compat_types.h @@ -1,6 +1,6 @@ /* compat_types.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/conf.h b/wolfssl/openssl/conf.h index 9e233a568..737e4744f 100644 --- a/wolfssl/openssl/conf.h +++ b/wolfssl/openssl/conf.h @@ -1,6 +1,6 @@ /* conf.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/crypto.h b/wolfssl/openssl/crypto.h index ccc9bcc3b..a5d395aef 100644 --- a/wolfssl/openssl/crypto.h +++ b/wolfssl/openssl/crypto.h @@ -1,6 +1,6 @@ /* crypto.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/des.h b/wolfssl/openssl/des.h index 1fbad9885..8802c98fb 100644 --- a/wolfssl/openssl/des.h +++ b/wolfssl/openssl/des.h @@ -1,6 +1,6 @@ /* des.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/dh.h b/wolfssl/openssl/dh.h index 83a6525fa..b70436ef9 100644 --- a/wolfssl/openssl/dh.h +++ b/wolfssl/openssl/dh.h @@ -1,6 +1,6 @@ /* dh.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/dsa.h b/wolfssl/openssl/dsa.h index 06158bab3..6510950c9 100644 --- a/wolfssl/openssl/dsa.h +++ b/wolfssl/openssl/dsa.h @@ -1,6 +1,6 @@ /* dsa.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/ec.h b/wolfssl/openssl/ec.h index bfe317072..21afa8f07 100644 --- a/wolfssl/openssl/ec.h +++ b/wolfssl/openssl/ec.h @@ -1,6 +1,6 @@ /* ec.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/ec25519.h b/wolfssl/openssl/ec25519.h index f9cf3c9fc..977b0386b 100644 --- a/wolfssl/openssl/ec25519.h +++ b/wolfssl/openssl/ec25519.h @@ -1,6 +1,6 @@ /* ec25519.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/ec448.h b/wolfssl/openssl/ec448.h index 3f0b1b7b4..6d6fe6618 100644 --- a/wolfssl/openssl/ec448.h +++ b/wolfssl/openssl/ec448.h @@ -1,6 +1,6 @@ /* ec448.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/ecdh.h b/wolfssl/openssl/ecdh.h index 039e77071..9c0c17e36 100644 --- a/wolfssl/openssl/ecdh.h +++ b/wolfssl/openssl/ecdh.h @@ -1,6 +1,6 @@ /* ecdh.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/ecdsa.h b/wolfssl/openssl/ecdsa.h index c644ade56..e6aa370fb 100644 --- a/wolfssl/openssl/ecdsa.h +++ b/wolfssl/openssl/ecdsa.h @@ -1,6 +1,6 @@ /* ecdsa.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/ed25519.h b/wolfssl/openssl/ed25519.h index 50683d4b8..d7fca0e8c 100644 --- a/wolfssl/openssl/ed25519.h +++ b/wolfssl/openssl/ed25519.h @@ -1,6 +1,6 @@ /* ed25519.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/ed448.h b/wolfssl/openssl/ed448.h index 4ff184fbf..3d55f458d 100644 --- a/wolfssl/openssl/ed448.h +++ b/wolfssl/openssl/ed448.h @@ -1,6 +1,6 @@ /* ed448.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/err.h b/wolfssl/openssl/err.h index a479f3c04..7175d0bad 100644 --- a/wolfssl/openssl/err.h +++ b/wolfssl/openssl/err.h @@ -1,6 +1,6 @@ /* err.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/evp.h b/wolfssl/openssl/evp.h index b058577ed..28772836d 100644 --- a/wolfssl/openssl/evp.h +++ b/wolfssl/openssl/evp.h @@ -1,6 +1,6 @@ /* evp.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/fips_rand.h b/wolfssl/openssl/fips_rand.h index 3fc97b1b1..bc7462a7f 100644 --- a/wolfssl/openssl/fips_rand.h +++ b/wolfssl/openssl/fips_rand.h @@ -1,6 +1,6 @@ /* fips_rand.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/hmac.h b/wolfssl/openssl/hmac.h index a698c8c42..d9df83e77 100644 --- a/wolfssl/openssl/hmac.h +++ b/wolfssl/openssl/hmac.h @@ -1,6 +1,6 @@ /* hmac.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/kdf.h b/wolfssl/openssl/kdf.h index b25052d83..d80c98517 100644 --- a/wolfssl/openssl/kdf.h +++ b/wolfssl/openssl/kdf.h @@ -1,6 +1,6 @@ /* kdf.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/lhash.h b/wolfssl/openssl/lhash.h index 98256888a..a61453489 100644 --- a/wolfssl/openssl/lhash.h +++ b/wolfssl/openssl/lhash.h @@ -1,6 +1,6 @@ /* lhash.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/md4.h b/wolfssl/openssl/md4.h index 8e64975bd..545709f41 100644 --- a/wolfssl/openssl/md4.h +++ b/wolfssl/openssl/md4.h @@ -1,6 +1,6 @@ /* md4.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/md5.h b/wolfssl/openssl/md5.h index e312b60e3..4ec00d480 100644 --- a/wolfssl/openssl/md5.h +++ b/wolfssl/openssl/md5.h @@ -1,6 +1,6 @@ /* md5.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/modes.h b/wolfssl/openssl/modes.h index c1fe77217..1c73e44a9 100644 --- a/wolfssl/openssl/modes.h +++ b/wolfssl/openssl/modes.h @@ -1,6 +1,6 @@ /* modes.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/obj_mac.h b/wolfssl/openssl/obj_mac.h index 0544d6b1a..e3466c973 100644 --- a/wolfssl/openssl/obj_mac.h +++ b/wolfssl/openssl/obj_mac.h @@ -1,6 +1,6 @@ /* obj_mac.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/objects.h b/wolfssl/openssl/objects.h index 4e088d4b7..bffb9d6c4 100644 --- a/wolfssl/openssl/objects.h +++ b/wolfssl/openssl/objects.h @@ -1,6 +1,6 @@ /* objects.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/ocsp.h b/wolfssl/openssl/ocsp.h index 0768aa418..a68ddeb25 100644 --- a/wolfssl/openssl/ocsp.h +++ b/wolfssl/openssl/ocsp.h @@ -1,6 +1,6 @@ /* ocsp.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/opensslv.h b/wolfssl/openssl/opensslv.h index 2826aba4a..0733db644 100644 --- a/wolfssl/openssl/opensslv.h +++ b/wolfssl/openssl/opensslv.h @@ -1,6 +1,6 @@ /* opensslv.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/ossl_typ.h b/wolfssl/openssl/ossl_typ.h index 9b1142e2f..bc6cafbf9 100644 --- a/wolfssl/openssl/ossl_typ.h +++ b/wolfssl/openssl/ossl_typ.h @@ -1,6 +1,6 @@ /* ossl_typ.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/pem.h b/wolfssl/openssl/pem.h index 946e6ff7c..508405a5c 100644 --- a/wolfssl/openssl/pem.h +++ b/wolfssl/openssl/pem.h @@ -1,6 +1,6 @@ /* pem.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/pkcs12.h b/wolfssl/openssl/pkcs12.h index 1eb0f3ee9..294eb21b2 100644 --- a/wolfssl/openssl/pkcs12.h +++ b/wolfssl/openssl/pkcs12.h @@ -1,6 +1,6 @@ /* pkcs12.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/pkcs7.h b/wolfssl/openssl/pkcs7.h index dfede29e7..3f3e7eae1 100644 --- a/wolfssl/openssl/pkcs7.h +++ b/wolfssl/openssl/pkcs7.h @@ -1,6 +1,6 @@ /* pkcs7.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/rand.h b/wolfssl/openssl/rand.h index 11af818f6..e9410fa51 100644 --- a/wolfssl/openssl/rand.h +++ b/wolfssl/openssl/rand.h @@ -1,6 +1,6 @@ /* rand.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/rc4.h b/wolfssl/openssl/rc4.h index 9fc3ce1da..53432bd7c 100644 --- a/wolfssl/openssl/rc4.h +++ b/wolfssl/openssl/rc4.h @@ -1,6 +1,6 @@ /* rc4.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/ripemd.h b/wolfssl/openssl/ripemd.h index 5af54e51b..aa61c93e6 100644 --- a/wolfssl/openssl/ripemd.h +++ b/wolfssl/openssl/ripemd.h @@ -1,6 +1,6 @@ /* ripemd.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/rsa.h b/wolfssl/openssl/rsa.h index 3e2b643a5..bac6ede8b 100644 --- a/wolfssl/openssl/rsa.h +++ b/wolfssl/openssl/rsa.h @@ -1,6 +1,6 @@ /* rsa.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/sha.h b/wolfssl/openssl/sha.h index b3cfc0bf6..5a9e6d699 100644 --- a/wolfssl/openssl/sha.h +++ b/wolfssl/openssl/sha.h @@ -1,6 +1,6 @@ /* sha.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/sha3.h b/wolfssl/openssl/sha3.h index c23bbf7f3..1cb50c9d1 100644 --- a/wolfssl/openssl/sha3.h +++ b/wolfssl/openssl/sha3.h @@ -1,6 +1,6 @@ /* sha3.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/srp.h b/wolfssl/openssl/srp.h index f6aaec2fc..44bcb7778 100644 --- a/wolfssl/openssl/srp.h +++ b/wolfssl/openssl/srp.h @@ -1,6 +1,6 @@ /* srp.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/ssl.h b/wolfssl/openssl/ssl.h index 70fa7d191..e100a654a 100644 --- a/wolfssl/openssl/ssl.h +++ b/wolfssl/openssl/ssl.h @@ -1,6 +1,6 @@ /* ssl.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/stack.h b/wolfssl/openssl/stack.h index fd410b041..6b03994ab 100644 --- a/wolfssl/openssl/stack.h +++ b/wolfssl/openssl/stack.h @@ -1,6 +1,6 @@ /* stack.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/tls1.h b/wolfssl/openssl/tls1.h index 51923f693..7da25a961 100644 --- a/wolfssl/openssl/tls1.h +++ b/wolfssl/openssl/tls1.h @@ -1,6 +1,6 @@ /* tls1.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/txt_db.h b/wolfssl/openssl/txt_db.h index a7459589b..7b1752657 100644 --- a/wolfssl/openssl/txt_db.h +++ b/wolfssl/openssl/txt_db.h @@ -1,6 +1,6 @@ /* txt_db.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/x509.h b/wolfssl/openssl/x509.h index d1d65d39c..22560abf7 100644 --- a/wolfssl/openssl/x509.h +++ b/wolfssl/openssl/x509.h @@ -1,6 +1,6 @@ /* x509.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/x509_vfy.h b/wolfssl/openssl/x509_vfy.h index 410ea7cfe..10a9192a2 100644 --- a/wolfssl/openssl/x509_vfy.h +++ b/wolfssl/openssl/x509_vfy.h @@ -1,6 +1,6 @@ /* x509_vfy.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/openssl/x509v3.h b/wolfssl/openssl/x509v3.h index cd711bf88..0acff0999 100644 --- a/wolfssl/openssl/x509v3.h +++ b/wolfssl/openssl/x509v3.h @@ -1,6 +1,6 @@ /* x509v3.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/options.h.in b/wolfssl/options.h.in index c67095c9c..bedcc7dae 100644 --- a/wolfssl/options.h.in +++ b/wolfssl/options.h.in @@ -1,6 +1,6 @@ /* options.h.in * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/sniffer.h b/wolfssl/sniffer.h index 9b05e497c..6f94181ec 100644 --- a/wolfssl/sniffer.h +++ b/wolfssl/sniffer.h @@ -1,6 +1,6 @@ /* sniffer.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/sniffer_error.h b/wolfssl/sniffer_error.h index 8c12718d9..387f3de3f 100644 --- a/wolfssl/sniffer_error.h +++ b/wolfssl/sniffer_error.h @@ -1,6 +1,6 @@ /* sniffer_error.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index 97d56a930..9d7c21d6d 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -1,6 +1,6 @@ /* ssl.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/test.h b/wolfssl/test.h index c0abc7304..86cc821bf 100644 --- a/wolfssl/test.h +++ b/wolfssl/test.h @@ -174,7 +174,8 @@ #define XSELECT_WAIT(x,y) do { \ struct timeval tv = {((x) + ((y) / 1000000)),((y) % 1000000)}; \ - select(0, NULL, NULL, NULL, &tv); \ + if ((select(0, NULL, NULL, NULL, &tv) < 0) && (errno != EINTR)) \ + err_sys("select for XSELECT_WAIT failed."); \ } while (0) #define XSLEEP_US(u) XSELECT_WAIT(0,u) #define XSLEEP_MS(m) XSELECT_WAIT(0,(m)*1000) @@ -302,14 +303,94 @@ #endif -#ifdef TEST_IPV6 - typedef struct sockaddr_in6 SOCKADDR_IN_T; - #define AF_INET_V AF_INET6 -#else - typedef struct sockaddr_in SOCKADDR_IN_T; - #define AF_INET_V AF_INET +#ifndef MY_EX_USAGE +#define MY_EX_USAGE 2 #endif +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif + +#if defined(WOLFSSL_FORCE_MALLOC_FAIL_TEST) || defined(WOLFSSL_ZEPHYR) + #ifndef EXIT_SUCCESS + #define EXIT_SUCCESS 0 + #endif + #define XEXIT(rc) return rc + #define XEXIT_T(rc) return (THREAD_RETURN)rc +#else + #define XEXIT(rc) exit((int)(rc)) + #define XEXIT_T(rc) exit((int)(rc)) +#endif + +static WC_INLINE +#if defined(WOLFSSL_FORCE_MALLOC_FAIL_TEST) || defined(WOLFSSL_ZEPHYR) +THREAD_RETURN +#else +WC_NORETURN void +#endif +err_sys(const char* msg) +{ +#if !defined(__GNUC__) + /* scan-build (which pretends to be gnuc) can get confused and think the + * msg pointer can be null even when hardcoded and then it won't exit, + * making null pointer checks above the err_sys() call useless. + * We could just always exit() but some compilers will complain about no + * possible return, with gcc we know the attribute to handle that with + * WC_NORETURN. */ + if (msg) +#endif + { + fprintf(stderr, "wolfSSL error: %s\n", msg); + } + XEXIT_T(EXIT_FAILURE); +} + +static WC_INLINE +#if defined(WOLFSSL_FORCE_MALLOC_FAIL_TEST) || defined(WOLFSSL_ZEPHYR) +THREAD_RETURN +#else +WC_NORETURN void +#endif +err_sys_with_errno(const char* msg) +{ +#if !defined(__GNUC__) + /* scan-build (which pretends to be gnuc) can get confused and think the + * msg pointer can be null even when hardcoded and then it won't exit, + * making null pointer checks above the err_sys() call useless. + * We could just always exit() but some compilers will complain about no + * possible return, with gcc we know the attribute to handle that with + * WC_NORETURN. */ + if (msg) +#endif + { +#if defined(HAVE_STRING_H) && defined(HAVE_ERRNO_H) + fprintf(stderr, "wolfSSL error: %s: %s\n", msg, strerror(errno)); +#else + fprintf(stderr, "wolfSSL error: %s\n", msg); +#endif + } + XEXIT_T(EXIT_FAILURE); +} + +#define LIBCALL_CHECK_RET(...) do { \ + int _libcall_ret = (__VA_ARGS__); \ + if (_libcall_ret < 0) { \ + fprintf(stderr, "%s L%d error %d for \"%s\"\n", \ + __FILE__, __LINE__, errno, #__VA_ARGS__); \ + err_sys("library/system call failed"); \ + } \ + } while(0) + +#define PTHREAD_CHECK_RET(...) do { \ + int _pthread_ret = (__VA_ARGS__); \ + if (_pthread_ret != 0) { \ + errno = _pthread_ret; \ + fprintf(stderr, "%s L%d error %d for \"%s\"\n", \ + __FILE__, __LINE__, _pthread_ret, #__VA_ARGS__); \ + err_sys("pthread call failed"); \ + } \ + } while(0) + #ifndef WOLFSSL_NO_TLS12 #define SERVER_DEFAULT_VERSION 3 @@ -458,6 +539,15 @@ #endif #endif + +#ifdef TEST_IPV6 + typedef struct sockaddr_in6 SOCKADDR_IN_T; + #define AF_INET_V AF_INET6 +#else + typedef struct sockaddr_in SOCKADDR_IN_T; + #define AF_INET_V AF_INET +#endif + typedef struct tcp_ready { word16 ready; /* predicate */ word16 port; @@ -471,7 +561,6 @@ typedef struct tcp_ready { #endif } tcp_ready; - static WC_INLINE void InitTcpReady(tcp_ready* ready) { ready->ready = 0; @@ -479,8 +568,8 @@ static WC_INLINE void InitTcpReady(tcp_ready* ready) ready->srfName = NULL; #ifdef SINGLE_THREADED #elif defined(_POSIX_THREADS) && !defined(__MINGW32__) - pthread_mutex_init(&ready->mutex, 0); - pthread_cond_init(&ready->cond, 0); + PTHREAD_CHECK_RET(pthread_mutex_init(&ready->mutex, 0)); + PTHREAD_CHECK_RET(pthread_cond_init(&ready->cond, 0)); #elif defined(NETOS) tx_mutex_create(&ready->mutex, "wolfSSL Lock", TX_INHERIT); #endif @@ -495,8 +584,8 @@ static WC_INLINE void FreeTcpReady(tcp_ready* ready) #ifdef SINGLE_THREADED (void)ready; #elif defined(_POSIX_THREADS) && !defined(__MINGW32__) - pthread_mutex_destroy(&ready->mutex); - pthread_cond_destroy(&ready->cond); + PTHREAD_CHECK_RET(pthread_mutex_destroy(&ready->mutex)); + PTHREAD_CHECK_RET(pthread_cond_destroy(&ready->cond)); #elif defined(NETOS) tx_mutex_delete(&ready->mutex); #else @@ -576,78 +665,6 @@ void join_thread(THREAD_TYPE thread); static const word16 wolfSSLPort = 11111; - -#ifndef MY_EX_USAGE -#define MY_EX_USAGE 2 -#endif - -#ifndef EXIT_FAILURE -#define EXIT_FAILURE 1 -#endif - -#if defined(WOLFSSL_FORCE_MALLOC_FAIL_TEST) || defined(WOLFSSL_ZEPHYR) - #ifndef EXIT_SUCCESS - #define EXIT_SUCCESS 0 - #endif - #define XEXIT(rc) return rc - #define XEXIT_T(rc) return (THREAD_RETURN)rc -#else - #define XEXIT(rc) exit((int)(rc)) - #define XEXIT_T(rc) exit((int)(rc)) -#endif - - -static WC_INLINE -#if defined(WOLFSSL_FORCE_MALLOC_FAIL_TEST) || defined(WOLFSSL_ZEPHYR) -THREAD_RETURN -#else -WC_NORETURN void -#endif -err_sys(const char* msg) -{ -#if !defined(__GNUC__) - /* scan-build (which pretends to be gnuc) can get confused and think the - * msg pointer can be null even when hardcoded and then it won't exit, - * making null pointer checks above the err_sys() call useless. - * We could just always exit() but some compilers will complain about no - * possible return, with gcc we know the attribute to handle that with - * WC_NORETURN. */ - if (msg) -#endif - { - fprintf(stderr, "wolfSSL error: %s\n", msg); - } - XEXIT_T(EXIT_FAILURE); -} - -static WC_INLINE -#if defined(WOLFSSL_FORCE_MALLOC_FAIL_TEST) || defined(WOLFSSL_ZEPHYR) -THREAD_RETURN -#else -WC_NORETURN void -#endif -err_sys_with_errno(const char* msg) -{ -#if !defined(__GNUC__) - /* scan-build (which pretends to be gnuc) can get confused and think the - * msg pointer can be null even when hardcoded and then it won't exit, - * making null pointer checks above the err_sys() call useless. - * We could just always exit() but some compilers will complain about no - * possible return, with gcc we know the attribute to handle that with - * WC_NORETURN. */ - if (msg) -#endif - { -#if defined(HAVE_STRING_H) && defined(HAVE_ERRNO_H) - fprintf(stderr, "wolfSSL error: %s: %s\n", msg, strerror(errno)); -#else - fprintf(stderr, "wolfSSL error: %s\n", msg); -#endif - } - XEXIT_T(EXIT_FAILURE); -} - - extern int myoptind; extern char* myoptarg; @@ -658,8 +675,8 @@ static WC_INLINE void srtp_helper_init(srtp_test_helper *srtp) srtp->server_srtp_ekm_size = 0; srtp->server_srtp_ekm = NULL; - pthread_mutex_init(&srtp->mutex, 0); - pthread_cond_init(&srtp->cond, 0); + PTHREAD_CHECK_RET(pthread_mutex_init(&srtp->mutex, 0)); + PTHREAD_CHECK_RET(pthread_cond_init(&srtp->cond, 0)); } /** @@ -674,10 +691,10 @@ static WC_INLINE void srtp_helper_init(srtp_test_helper *srtp) static WC_INLINE void srtp_helper_get_ekm(srtp_test_helper *srtp, uint8_t **ekm, size_t *size) { - pthread_mutex_lock(&srtp->mutex); + PTHREAD_CHECK_RET(pthread_mutex_lock(&srtp->mutex)); if (srtp->server_srtp_ekm == NULL) - pthread_cond_wait(&srtp->cond, &srtp->mutex); + PTHREAD_CHECK_RET(pthread_cond_wait(&srtp->cond, &srtp->mutex)); *ekm = srtp->server_srtp_ekm; *size = srtp->server_srtp_ekm_size; @@ -686,7 +703,7 @@ static WC_INLINE void srtp_helper_get_ekm(srtp_test_helper *srtp, srtp->server_srtp_ekm = NULL; srtp->server_srtp_ekm_size = 0; - pthread_mutex_unlock(&srtp->mutex); + PTHREAD_CHECK_RET(pthread_mutex_unlock(&srtp->mutex)); } /** @@ -703,19 +720,19 @@ static WC_INLINE void srtp_helper_get_ekm(srtp_test_helper *srtp, static WC_INLINE void srtp_helper_set_ekm(srtp_test_helper *srtp, uint8_t *ekm, size_t size) { - pthread_mutex_lock(&srtp->mutex); + PTHREAD_CHECK_RET(pthread_mutex_lock(&srtp->mutex)); srtp->server_srtp_ekm_size = size; srtp->server_srtp_ekm = ekm; - pthread_cond_signal(&srtp->cond); + PTHREAD_CHECK_RET(pthread_cond_signal(&srtp->cond)); - pthread_mutex_unlock(&srtp->mutex); + PTHREAD_CHECK_RET(pthread_mutex_unlock(&srtp->mutex)); } static WC_INLINE void srtp_helper_free(srtp_test_helper *srtp) { - pthread_mutex_destroy(&srtp->mutex); - pthread_cond_destroy(&srtp->cond); + PTHREAD_CHECK_RET(pthread_mutex_destroy(&srtp->mutex)); + PTHREAD_CHECK_RET(pthread_cond_destroy(&srtp->cond)); } #endif /* WOLFSSL_SRTP && !SINGLE_THREADED && POSIX_THREADS */ @@ -1345,7 +1362,7 @@ static WC_INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer, hints.ai_protocol = IPPROTO_TCP; } - SNPRINTF(strPort, sizeof(strPort), "%d", port); + (void)SNPRINTF(strPort, sizeof(strPort), "%d", port); strPort[79] = '\0'; ret = getaddrinfo(peer, strPort, &hints, &answer); @@ -2080,11 +2097,11 @@ static WC_INLINE void udp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd, /* signal ready to accept data */ { tcp_ready* ready = args->signal; - pthread_mutex_lock(&ready->mutex); + PTHREAD_CHECK_RET(pthread_mutex_lock(&ready->mutex)); ready->ready = 1; ready->port = port; - pthread_cond_signal(&ready->cond); - pthread_mutex_unlock(&ready->mutex); + PTHREAD_CHECK_RET(pthread_cond_signal(&ready->cond)); + PTHREAD_CHECK_RET(pthread_mutex_unlock(&ready->mutex)); } #elif defined (WOLFSSL_TIRTOS) /* Need mutex? */ @@ -2128,11 +2145,11 @@ static WC_INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd, if (args) ready = args->signal; if (ready) { - pthread_mutex_lock(&ready->mutex); + PTHREAD_CHECK_RET(pthread_mutex_lock(&ready->mutex)); ready->ready = 1; ready->port = port; - pthread_cond_signal(&ready->cond); - pthread_mutex_unlock(&ready->mutex); + PTHREAD_CHECK_RET(pthread_cond_signal(&ready->cond)); + PTHREAD_CHECK_RET(pthread_mutex_unlock(&ready->mutex)); } #elif defined (WOLFSSL_TIRTOS) /* Need mutex? */ @@ -2170,7 +2187,7 @@ static WC_INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd, -p 0 to server on supported platforms with -R ready_file client can then wait for existence of ready_file and see which port the server is listening on. */ - fprintf(srf, "%d\n", (int)port); + LIBCALL_CHECK_RET(fprintf(srf, "%d\n", (int)port)); fclose(srf); } } @@ -2490,7 +2507,8 @@ static WC_INLINE unsigned int my_psk_client_cs_cb(WOLFSSL* ssl, static WC_INLINE double current_time(int reset) { struct timeval tv; - gettimeofday(&tv, NULL); + if (gettimeofday(&tv, NULL) < 0) + err_sys_with_errno("gettimeofday"); (void)reset; return (double)tv.tv_sec + (double)tv.tv_usec / 1000000; @@ -2562,7 +2580,7 @@ static WC_INLINE void OCSPRespFreeCb(void* ioCtx, unsigned char* response) return BAD_PATH_ERROR; } - fseek(lFile, 0, SEEK_END); + LIBCALL_CHECK_RET(fseek(lFile, 0, SEEK_END)); fileSz = (int)ftell(lFile); rewind(lFile); if (fileSz > 0) { diff --git a/wolfssl/version.h b/wolfssl/version.h index 01517d7c2..44d8eae6d 100644 --- a/wolfssl/version.h +++ b/wolfssl/version.h @@ -1,6 +1,6 @@ /* wolfssl_version.h.in * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -28,8 +28,8 @@ extern "C" { #endif -#define LIBWOLFSSL_VERSION_STRING "5.3.0" -#define LIBWOLFSSL_VERSION_HEX 0x05003000 +#define LIBWOLFSSL_VERSION_STRING "5.4.0" +#define LIBWOLFSSL_VERSION_HEX 0x05004000 #ifdef __cplusplus } diff --git a/wolfssl/version.h.in b/wolfssl/version.h.in index 673203f39..91063fadb 100644 --- a/wolfssl/version.h.in +++ b/wolfssl/version.h.in @@ -1,6 +1,6 @@ /* wolfssl_version.h.in * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/aes.h b/wolfssl/wolfcrypt/aes.h index 264fe5fe6..8fbc16f06 100644 --- a/wolfssl/wolfcrypt/aes.h +++ b/wolfssl/wolfcrypt/aes.h @@ -1,6 +1,6 @@ /* aes.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -106,7 +106,7 @@ block cipher mechanism that uses n-bit binary string parameter key with 128-bits #if defined(WOLFSSL_RENESAS_TSIP_TLS) && \ defined(WOLFSSL_RENESAS_TSIP_TLS_AES_CRYPT) - #include + #include #endif #ifdef __cplusplus diff --git a/wolfssl/wolfcrypt/arc4.h b/wolfssl/wolfcrypt/arc4.h index 4532d0fbf..62da9c810 100644 --- a/wolfssl/wolfcrypt/arc4.h +++ b/wolfssl/wolfcrypt/arc4.h @@ -1,6 +1,6 @@ /* arc4.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/asn.h b/wolfssl/wolfcrypt/asn.h index a82d60f0f..0e56b8099 100644 --- a/wolfssl/wolfcrypt/asn.h +++ b/wolfssl/wolfcrypt/asn.h @@ -1,6 +1,6 @@ /* asn.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -929,7 +929,8 @@ enum Misc_ASN { /* Max total extensions, id + len + others */ #endif #if defined(WOLFSSL_CERT_EXT) || defined(OPENSSL_EXTRA) || \ - defined(HAVE_PKCS7) || defined(OPENSSL_EXTRA_X509_SMALL) + defined(HAVE_PKCS7) || defined(OPENSSL_EXTRA_X509_SMALL) || \ + defined(HAVE_OID_DECODING) || defined(HAVE_OID_ENCODING) MAX_OID_SZ = 32, /* Max DER length of OID*/ MAX_OID_STRING_SZ = 64, /* Max string length representation of OID*/ #endif @@ -1636,6 +1637,11 @@ struct DecodedCert { const byte* subjectRaw; /* pointer to subject inside source */ int subjectRawLen; #endif +#if !defined(IGNORE_NAME_CONSTRAINTS) || \ + defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT) + char* subjectEmail; + int subjectEmailLen; +#endif #if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT) /* easy access to subject info for other sign */ char* subjectSN; @@ -1677,8 +1683,6 @@ struct DecodedCert { char* subjectPC; int subjectPCLen; char subjectPCEnc; - char* subjectEmail; - int subjectEmailLen; #if defined(WOLFSSL_HAVE_ISSUER_NAMES) char* issuerCN; int issuerCNLen; @@ -2140,6 +2144,11 @@ WOLFSSL_API int EccEnumToNID(int n); WOLFSSL_LOCAL void InitSignatureCtx(SignatureCtx* sigCtx, void* heap, int devId); WOLFSSL_LOCAL void FreeSignatureCtx(SignatureCtx* sigCtx); +WOLFSSL_LOCAL int SetAsymKeyDerPublic(const byte* pubKey, word32 pubKeyLen, + byte* output, word32 outLen, int keyType, int withHeader); +WOLFSSL_LOCAL int DecodeAsymKeyPublic(const byte* input, word32* inOutIdx, word32 inSz, + byte* pubKey, word32* pubKeyLen, int keyType); + #ifndef NO_CERTS WOLFSSL_LOCAL int wc_EncryptedInfoParse(EncryptedInfo* info, diff --git a/wolfssl/wolfcrypt/asn_public.h b/wolfssl/wolfcrypt/asn_public.h index f9351a765..96804578f 100644 --- a/wolfssl/wolfcrypt/asn_public.h +++ b/wolfssl/wolfcrypt/asn_public.h @@ -1,6 +1,6 @@ /* asn_public.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -384,6 +384,8 @@ typedef struct Cert { int selfSigned; /* self signed flag */ CertName subject; /* subject info */ int isCA; /* is this going to be a CA */ + byte pathLen; /* max depth of valid certification + * paths that include this cert */ /* internal use only */ int bodySz; /* pre sign total size */ int keyType; /* public key type of subject */ @@ -657,6 +659,9 @@ WOLFSSL_API int wc_DhPrivKeyToDer(DhKey* key, byte* out, word32* outSz); ecc_key* key, word32 inSz); WOLFSSL_API int wc_EccPublicKeyToDer(ecc_key* key, byte* output, word32 inLen, int with_AlgCurve); + WOLFSSL_API int wc_EccPublicKeyToDer_ex(ecc_key* key, byte* output, + word32 inLen, int with_AlgCurve, + int comp); WOLFSSL_API int wc_EccPublicKeyDerSize(ecc_key* key, int with_AlgCurve); #endif diff --git a/wolfssl/wolfcrypt/blake2-impl.h b/wolfssl/wolfcrypt/blake2-impl.h index c6a4becd2..df0de5420 100644 --- a/wolfssl/wolfcrypt/blake2-impl.h +++ b/wolfssl/wolfcrypt/blake2-impl.h @@ -12,7 +12,7 @@ */ /* blake2-impl.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/blake2-int.h b/wolfssl/wolfcrypt/blake2-int.h index de44a3524..e10fedbab 100644 --- a/wolfssl/wolfcrypt/blake2-int.h +++ b/wolfssl/wolfcrypt/blake2-int.h @@ -12,7 +12,7 @@ */ /* blake2-int.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/blake2.h b/wolfssl/wolfcrypt/blake2.h index 551844a10..70047811a 100644 --- a/wolfssl/wolfcrypt/blake2.h +++ b/wolfssl/wolfcrypt/blake2.h @@ -1,6 +1,6 @@ /* blake2.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/camellia.h b/wolfssl/wolfcrypt/camellia.h index 7ef0270a3..e75ea7d25 100644 --- a/wolfssl/wolfcrypt/camellia.h +++ b/wolfssl/wolfcrypt/camellia.h @@ -27,7 +27,7 @@ /* camellia.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/chacha.h b/wolfssl/wolfcrypt/chacha.h index 25e8bfabf..a5121bf63 100644 --- a/wolfssl/wolfcrypt/chacha.h +++ b/wolfssl/wolfcrypt/chacha.h @@ -1,6 +1,6 @@ /* chacha.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/chacha20_poly1305.h b/wolfssl/wolfcrypt/chacha20_poly1305.h index ed3bb6c1c..fdeb3aa87 100644 --- a/wolfssl/wolfcrypt/chacha20_poly1305.h +++ b/wolfssl/wolfcrypt/chacha20_poly1305.h @@ -1,6 +1,6 @@ /* chacha20_poly1305.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/cmac.h b/wolfssl/wolfcrypt/cmac.h index 8e39c679b..f06029874 100644 --- a/wolfssl/wolfcrypt/cmac.h +++ b/wolfssl/wolfcrypt/cmac.h @@ -1,6 +1,6 @@ /* cmac.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/coding.h b/wolfssl/wolfcrypt/coding.h index bcc4c5b95..954eab84b 100644 --- a/wolfssl/wolfcrypt/coding.h +++ b/wolfssl/wolfcrypt/coding.h @@ -1,6 +1,6 @@ /* coding.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/compress.h b/wolfssl/wolfcrypt/compress.h index 985f1e092..2c8ed2608 100644 --- a/wolfssl/wolfcrypt/compress.h +++ b/wolfssl/wolfcrypt/compress.h @@ -1,6 +1,6 @@ /* compress.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/cpuid.h b/wolfssl/wolfcrypt/cpuid.h index 865b5a28b..52692db07 100644 --- a/wolfssl/wolfcrypt/cpuid.h +++ b/wolfssl/wolfcrypt/cpuid.h @@ -1,6 +1,6 @@ /* cpuid.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/cryptocb.h b/wolfssl/wolfcrypt/cryptocb.h index 95c8ce974..6108e8e26 100644 --- a/wolfssl/wolfcrypt/cryptocb.h +++ b/wolfssl/wolfcrypt/cryptocb.h @@ -1,6 +1,6 @@ /* cryptocb.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/curve25519.h b/wolfssl/wolfcrypt/curve25519.h index aa0bf2eb6..df535519a 100644 --- a/wolfssl/wolfcrypt/curve25519.h +++ b/wolfssl/wolfcrypt/curve25519.h @@ -1,6 +1,6 @@ /* curve25519.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/curve448.h b/wolfssl/wolfcrypt/curve448.h index 86fa8ea58..76279a427 100644 --- a/wolfssl/wolfcrypt/curve448.h +++ b/wolfssl/wolfcrypt/curve448.h @@ -1,6 +1,6 @@ /* curve448.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/des3.h b/wolfssl/wolfcrypt/des3.h index 5cb94a093..5a878c1cb 100644 --- a/wolfssl/wolfcrypt/des3.h +++ b/wolfssl/wolfcrypt/des3.h @@ -1,6 +1,6 @@ /* des3.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/dh.h b/wolfssl/wolfcrypt/dh.h index fee7d7455..0df4cf144 100644 --- a/wolfssl/wolfcrypt/dh.h +++ b/wolfssl/wolfcrypt/dh.h @@ -1,6 +1,6 @@ /* dh.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/dsa.h b/wolfssl/wolfcrypt/dsa.h index 62de4d8ba..7365b61cb 100644 --- a/wolfssl/wolfcrypt/dsa.h +++ b/wolfssl/wolfcrypt/dsa.h @@ -1,6 +1,6 @@ /* dsa.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/ecc.h b/wolfssl/wolfcrypt/ecc.h index e4676f593..cf7ede4ff 100644 --- a/wolfssl/wolfcrypt/ecc.h +++ b/wolfssl/wolfcrypt/ecc.h @@ -1,6 +1,6 @@ /* ecc.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -850,6 +850,10 @@ enum ecFlags { REQ_RESP_SERVER = 2 }; +#ifndef WOLFSSL_ECIES_GEN_IV_SIZE +#define WOLFSSL_ECIES_GEN_IV_SIZE 12 +#endif + typedef struct ecEncCtx ecEncCtx; @@ -870,6 +874,8 @@ const byte* wc_ecc_ctx_get_own_salt(ecEncCtx* ctx); WOLFSSL_API int wc_ecc_ctx_set_peer_salt(ecEncCtx* ctx, const byte* salt); WOLFSSL_API +int wc_ecc_ctx_set_kdf_salt(ecEncCtx* ctx, const byte* salt, word32 sz); +WOLFSSL_API int wc_ecc_ctx_set_info(ecEncCtx* ctx, const byte* info, int sz); WOLFSSL_API diff --git a/wolfssl/wolfcrypt/eccsi.h b/wolfssl/wolfcrypt/eccsi.h index b7bde4bee..5e09b8272 100644 --- a/wolfssl/wolfcrypt/eccsi.h +++ b/wolfssl/wolfcrypt/eccsi.h @@ -1,6 +1,6 @@ /* eccsi.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/ed25519.h b/wolfssl/wolfcrypt/ed25519.h index b7d2ef949..fe1ac5a28 100644 --- a/wolfssl/wolfcrypt/ed25519.h +++ b/wolfssl/wolfcrypt/ed25519.h @@ -1,6 +1,6 @@ /* ed25519.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/ed448.h b/wolfssl/wolfcrypt/ed448.h index 4ee888bfd..18494e4fe 100644 --- a/wolfssl/wolfcrypt/ed448.h +++ b/wolfssl/wolfcrypt/ed448.h @@ -1,6 +1,6 @@ /* ed448.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/error-crypt.h b/wolfssl/wolfcrypt/error-crypt.h index 25a95ea51..9bcc08785 100644 --- a/wolfssl/wolfcrypt/error-crypt.h +++ b/wolfssl/wolfcrypt/error-crypt.h @@ -1,6 +1,6 @@ /* error-crypt.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -250,7 +250,10 @@ enum { AES_SIV_AUTH_E = -289, /* AES-SIV authentication failed */ NO_VALID_DEVID = -290, /* no valid device ID */ - WC_LAST_E = -290, /* Update this to indicate last error */ + IO_FAILED_E = -291, /* Input/output failure */ + SYSLIB_FAILED_E = -292, /* System/library call failed */ + + WC_LAST_E = -292, /* Update this to indicate last error */ MIN_CODE_E = -300 /* errors -101 - -299 */ /* add new companion error id strings for any new error codes diff --git a/wolfssl/wolfcrypt/falcon.h b/wolfssl/wolfcrypt/falcon.h index 8b42948ac..7f6116727 100644 --- a/wolfssl/wolfcrypt/falcon.h +++ b/wolfssl/wolfcrypt/falcon.h @@ -1,6 +1,6 @@ /* falcon.h * - * Copyright (C) 2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/fe_448.h b/wolfssl/wolfcrypt/fe_448.h index 9918f0ab3..38b752bca 100644 --- a/wolfssl/wolfcrypt/fe_448.h +++ b/wolfssl/wolfcrypt/fe_448.h @@ -1,6 +1,6 @@ /* fe448_448.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/fe_operations.h b/wolfssl/wolfcrypt/fe_operations.h index fc8ebb237..12d3dc814 100644 --- a/wolfssl/wolfcrypt/fe_operations.h +++ b/wolfssl/wolfcrypt/fe_operations.h @@ -1,6 +1,6 @@ /* fe_operations.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/fips_test.h b/wolfssl/wolfcrypt/fips_test.h index 2f04231e9..89bb15ebf 100644 --- a/wolfssl/wolfcrypt/fips_test.h +++ b/wolfssl/wolfcrypt/fips_test.h @@ -1,6 +1,6 @@ /* fips_test.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/ge_448.h b/wolfssl/wolfcrypt/ge_448.h index 4aa1ecf76..950e7dfd8 100644 --- a/wolfssl/wolfcrypt/ge_448.h +++ b/wolfssl/wolfcrypt/ge_448.h @@ -1,6 +1,6 @@ /* ge_448.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/ge_operations.h b/wolfssl/wolfcrypt/ge_operations.h index cff2fb6ee..837e9204f 100644 --- a/wolfssl/wolfcrypt/ge_operations.h +++ b/wolfssl/wolfcrypt/ge_operations.h @@ -1,6 +1,6 @@ /* ge_operations.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/hash.h b/wolfssl/wolfcrypt/hash.h index 81e176890..d4e685cb2 100644 --- a/wolfssl/wolfcrypt/hash.h +++ b/wolfssl/wolfcrypt/hash.h @@ -1,6 +1,6 @@ /* hash.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/hmac.h b/wolfssl/wolfcrypt/hmac.h index 7d38a3631..d21452427 100644 --- a/wolfssl/wolfcrypt/hmac.h +++ b/wolfssl/wolfcrypt/hmac.h @@ -1,6 +1,6 @@ /* hmac.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/include.am b/wolfssl/wolfcrypt/include.am index 4173dea3f..ff460c44a 100644 --- a/wolfssl/wolfcrypt/include.am +++ b/wolfssl/wolfcrypt/include.am @@ -95,6 +95,7 @@ noinst_HEADERS+= \ wolfssl/wolfcrypt/port/Renesas/renesas-sce-crypt.h \ wolfssl/wolfcrypt/port/Renesas/renesas_sync.h \ wolfssl/wolfcrypt/port/Renesas/renesas_cmn.h \ + wolfssl/wolfcrypt/port/Renesas/renesas_tsip_types.h \ wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h if BUILD_CRYPTOAUTHLIB diff --git a/wolfssl/wolfcrypt/integer.h b/wolfssl/wolfcrypt/integer.h index 9888c7133..8a3ce2b0a 100644 --- a/wolfssl/wolfcrypt/integer.h +++ b/wolfssl/wolfcrypt/integer.h @@ -1,6 +1,6 @@ /* integer.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/kdf.h b/wolfssl/wolfcrypt/kdf.h index fabf8a228..986fe298a 100644 --- a/wolfssl/wolfcrypt/kdf.h +++ b/wolfssl/wolfcrypt/kdf.h @@ -1,6 +1,6 @@ /* kdf.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/logging.h b/wolfssl/wolfcrypt/logging.h index 27f99a63b..492bf5b18 100644 --- a/wolfssl/wolfcrypt/logging.h +++ b/wolfssl/wolfcrypt/logging.h @@ -1,6 +1,6 @@ /* logging.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/md2.h b/wolfssl/wolfcrypt/md2.h index 64f9f50c7..c9c146492 100644 --- a/wolfssl/wolfcrypt/md2.h +++ b/wolfssl/wolfcrypt/md2.h @@ -1,6 +1,6 @@ /* md2.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/md4.h b/wolfssl/wolfcrypt/md4.h index 27f2a0231..42027d6ac 100644 --- a/wolfssl/wolfcrypt/md4.h +++ b/wolfssl/wolfcrypt/md4.h @@ -1,6 +1,6 @@ /* md4.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/md5.h b/wolfssl/wolfcrypt/md5.h index ffa41748c..769d2fd21 100644 --- a/wolfssl/wolfcrypt/md5.h +++ b/wolfssl/wolfcrypt/md5.h @@ -1,6 +1,6 @@ /* md5.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/mem_track.h b/wolfssl/wolfcrypt/mem_track.h index 073f3393e..cba10ffc4 100644 --- a/wolfssl/wolfcrypt/mem_track.h +++ b/wolfssl/wolfcrypt/mem_track.h @@ -1,6 +1,6 @@ /* mem_track.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/memory.h b/wolfssl/wolfcrypt/memory.h index 64b79a61e..3ca47205c 100644 --- a/wolfssl/wolfcrypt/memory.h +++ b/wolfssl/wolfcrypt/memory.h @@ -1,6 +1,6 @@ /* memory.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/misc.h b/wolfssl/wolfcrypt/misc.h index 04f3359d3..03312bfcc 100644 --- a/wolfssl/wolfcrypt/misc.h +++ b/wolfssl/wolfcrypt/misc.h @@ -1,6 +1,6 @@ /* misc.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/mpi_class.h b/wolfssl/wolfcrypt/mpi_class.h index e04acc263..4e8eac21c 100644 --- a/wolfssl/wolfcrypt/mpi_class.h +++ b/wolfssl/wolfcrypt/mpi_class.h @@ -1,6 +1,6 @@ /* mpi_class.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/mpi_superclass.h b/wolfssl/wolfcrypt/mpi_superclass.h index 91ebad820..963b77b5a 100644 --- a/wolfssl/wolfcrypt/mpi_superclass.h +++ b/wolfssl/wolfcrypt/mpi_superclass.h @@ -1,6 +1,6 @@ /* mpi_superclass.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/pkcs11.h b/wolfssl/wolfcrypt/pkcs11.h index 5dd130939..cff0fddb7 100644 --- a/wolfssl/wolfcrypt/pkcs11.h +++ b/wolfssl/wolfcrypt/pkcs11.h @@ -1,6 +1,6 @@ /* pkcs11.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/pkcs12.h b/wolfssl/wolfcrypt/pkcs12.h index f26a23668..3f24b8ce2 100644 --- a/wolfssl/wolfcrypt/pkcs12.h +++ b/wolfssl/wolfcrypt/pkcs12.h @@ -1,6 +1,6 @@ /* pkcs12.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/pkcs7.h b/wolfssl/wolfcrypt/pkcs7.h index 7dba5c946..3bec72d83 100644 --- a/wolfssl/wolfcrypt/pkcs7.h +++ b/wolfssl/wolfcrypt/pkcs7.h @@ -1,6 +1,6 @@ /* pkcs7.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/poly1305.h b/wolfssl/wolfcrypt/poly1305.h index 361f55aff..70d433413 100644 --- a/wolfssl/wolfcrypt/poly1305.h +++ b/wolfssl/wolfcrypt/poly1305.h @@ -1,6 +1,6 @@ /* poly1305.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h b/wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h index 9b3b79a71..9c8c95125 100644 --- a/wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h +++ b/wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h @@ -1,6 +1,6 @@ /* esp32-crypt.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/Renesas/renesas-sce-crypt.h b/wolfssl/wolfcrypt/port/Renesas/renesas-sce-crypt.h index 47ca05252..21e7a85f3 100644 --- a/wolfssl/wolfcrypt/port/Renesas/renesas-sce-crypt.h +++ b/wolfssl/wolfcrypt/port/Renesas/renesas-sce-crypt.h @@ -1,6 +1,6 @@ /* renesas-sce-crypt.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h b/wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h index cfcb189ba..c25574b03 100644 --- a/wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h +++ b/wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h @@ -26,24 +26,11 @@ #if defined(WOLFSSL_RENESAS_TSIP_IAREWRX) #include "r_bsp/mcu/all/r_rx_compiler.h" #include "r_bsp/platform.h" -#else - #include "platform.h" + #include "r_tsip_rx_if.h" #endif -#include "r_tsip_rx_if.h" - -#ifdef HAVE_CONFIG_H - #include -#endif - -#ifndef WOLFSSL_USER_SETTINGS - #include -#endif -#include - -#include -#include #include +#include #ifdef __cplusplus extern "C" { @@ -92,51 +79,6 @@ enum { TSIP_TEMP_WORK_SIZE = 128, }; -#if (!defined(NO_SHA) || !defined(NO_SHA256)) && \ - !defined(NO_WOLFSSL_RENESAS_TSIP_CRYPT_HASH) - -typedef enum { - TSIP_SHA1 = 0, - TSIP_SHA256 = 1, -} TSIP_SHA_TYPE; - -typedef enum { - TSIP_RSA2048, - TSIP_RSA4096, - TSIP_ECCP256, -} TSIP_KEY_TYPE; - -typedef struct { - byte* msg; - void* heap; - word32 used; - word32 len; - word32 sha_type; -#if defined(WOLF_CRYPTO_CB) - word32 flags; - int devId; -#endif -} wolfssl_TSIP_Hash; - -/* RAW hash function APIs are not implemented with TSIP */ -#define WOLFSSL_NO_HASH_RAW - -typedef wolfssl_TSIP_Hash wc_Sha; - -#if !defined(NO_SHA256) - typedef wolfssl_TSIP_Hash wc_Sha256; -#endif - -#endif /* NO_SHA */ - -#if defined(WOLFSSL_RENESAS_TSIP_TLS_AES_CRYPT) - typedef struct { - tsip_aes_key_index_t tsip_keyIdx; - word32 keySize; - byte setup; - } TSIP_AES_CTX; -#endif - struct WOLFSSL; struct KeyShareEntry; @@ -260,7 +202,7 @@ typedef struct TsipUserCtx { */ tsip_tls_p256_ecc_key_index_t ecc_p256_wrapped_key; - /* ephemeral ECDH pub-key Qx(256bit)||Qy(256bit) + /* ephemeral ECDH pub-key Qx(256bit)||Qy(256bit) * got from R_TSIP_GenerateTlsP256EccKeyIndex. * Should be sent to peer(server) in Client Key Exchange msg. */ @@ -272,8 +214,14 @@ typedef struct TsipUserCtx { uint8_t tsip_clientRandom[TSIP_TLS_CLIENTRANDOM_SZ]; uint8_t tsip_serverRandom[TSIP_TLS_SERVERRANDOM_SZ]; + /* installed key handling */ + tsip_aes_key_index_t user_aes256_key_index; + uint8_t user_aes256_key_set:1; + tsip_aes_key_index_t user_aes128_key_index; + uint8_t user_aes128_key_set:1; + /* TSIP defined cipher suite number */ - uint32_t tsip_cipher; + uint32_t tsip_cipher; /* flags */ uint8_t ClientRsaPrivKey_set:1; @@ -463,23 +411,23 @@ WOLFSSL_LOCAL int wc_tsip_generateMasterSecret( WOLFSSL_LOCAL int wc_tsip_storeKeyCtx( - struct WOLFSSL *ssl, + WOLFSSL *ssl, TsipUserCtx *userCtx); WOLFSSL_LOCAL int wc_tsip_generateEncryptPreMasterSecret( - struct WOLFSSL* ssl, + WOLFSSL* ssl, byte* out, word32* outSz); WOLFSSL_LOCAL int wc_tsip_EccSharedSecret( - struct WOLFSSL* ssl, + WOLFSSL* ssl, struct ecc_key* otherKey, unsigned char* pubKeyDer, unsigned int* pubKeySz, unsigned char* out, unsigned int* outlen, int side, void* ctx); WOLFSSL_LOCAL int wc_tsip_RsaVerify( - struct WOLFSSL* ssl, + WOLFSSL* ssl, byte* sig, word32 sigSz, byte** out, @@ -488,7 +436,7 @@ WOLFSSL_LOCAL int wc_tsip_RsaVerify( void* ctx); WOLFSSL_LOCAL int wc_tsip_EccVerify( - struct WOLFSSL* ssl, + WOLFSSL* ssl, const byte* sig, word32 sigSz, const byte* hash, word32 hashSz, const byte* key, word32 keySz, @@ -501,19 +449,19 @@ WOLFSSL_LOCAL int wc_tsip_generateVerifyData( uint8_t* hashes); WOLFSSL_LOCAL int wc_tsip_AesCbcEncrypt( - struct Aes* aes, + Aes* aes, byte* out, const byte* in, word32 sz); WOLFSSL_LOCAL int wc_tsip_AesCbcDecrypt( - struct Aes* aes, + Aes* aes, byte* out, const byte* in, word32 sz); WOLFSSL_LOCAL int wc_tsip_AesGcmEncrypt( - struct Aes* aes, byte* out, + Aes* aes, byte* out, const byte* in, word32 sz, byte* iv, word32 ivSz, byte* authTag, word32 authTagSz, @@ -521,7 +469,7 @@ WOLFSSL_LOCAL int wc_tsip_AesGcmEncrypt( void* ctx); WOLFSSL_LOCAL int wc_tsip_AesGcmDecrypt( - struct Aes* aes, byte* out, + Aes* aes, byte* out, const byte* in, word32 sz, const byte* iv, word32 ivSz, const byte* authTag, word32 authTagSz, @@ -529,14 +477,14 @@ WOLFSSL_LOCAL int wc_tsip_AesGcmDecrypt( void* ctx); WOLFSSL_LOCAL int wc_tsip_ShaXHmacVerify( - const struct WOLFSSL *ssl, + const WOLFSSL *ssl, const byte* message, word32 messageSz, word32 macSz, word32 content); WOLFSSL_LOCAL int wc_tsip_Sha1HmacGenerate( - const struct WOLFSSL *ssl, + const WOLFSSL *ssl, const byte* myInner, word32 innerSz, const byte* in, @@ -544,7 +492,7 @@ WOLFSSL_LOCAL int wc_tsip_Sha1HmacGenerate( byte* digest); WOLFSSL_LOCAL int wc_tsip_Sha256HmacGenerate( - const struct WOLFSSL *ssl, + const WOLFSSL *ssl, const byte* myInner, word32 innerSz, const byte* in, @@ -559,7 +507,7 @@ WOLFSSL_LOCAL int tsip_hw_lock(); WOLFSSL_LOCAL void tsip_hw_unlock( void ); -WOLFSSL_LOCAL int tsip_usable(const struct WOLFSSL *ssl, +WOLFSSL_LOCAL int tsip_usable(const WOLFSSL *ssl, uint8_t session_key_generated); WOLFSSL_LOCAL void tsip_inform_sflash_signedcacert( @@ -589,7 +537,7 @@ WOLFSSL_LOCAL int wc_tsip_generatePremasterSecret( word32 preSz); WOLFSSL_LOCAL int wc_tsip_generateSessionKey( - struct WOLFSSL* ssl, + WOLFSSL* ssl, TsipUserCtx* ctx, int devId); diff --git a/wolfssl/wolfcrypt/port/Renesas/renesas_sync.h b/wolfssl/wolfcrypt/port/Renesas/renesas_sync.h index c97718eaf..65518b7d7 100644 --- a/wolfssl/wolfcrypt/port/Renesas/renesas_sync.h +++ b/wolfssl/wolfcrypt/port/Renesas/renesas_sync.h @@ -1,6 +1,6 @@ /* renesas_sync.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/Renesas/renesas_tsip_types.h b/wolfssl/wolfcrypt/port/Renesas/renesas_tsip_types.h new file mode 100644 index 000000000..96c3dab71 --- /dev/null +++ b/wolfssl/wolfcrypt/port/Renesas/renesas_tsip_types.h @@ -0,0 +1,77 @@ + +/* renesas_tsip_types.h + * + * Copyright (C) 2006-2022 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifndef __RENESAS_TSIP_TYPES_H__ +#define __RENESAS_TSIP_TYPES_H__ + + +#include + +#if (!defined(NO_SHA) || !defined(NO_SHA256)) && \ + !defined(NO_WOLFSSL_RENESAS_TSIP_CRYPT_HASH) +typedef enum { + TSIP_SHA1 = 0, + TSIP_SHA256 = 1, +} TSIP_SHA_TYPE; + +typedef enum { + TSIP_RSA2048, + TSIP_RSA4096, + TSIP_ECCP256, +} TSIP_KEY_TYPE; + +typedef struct { + byte* msg; + void* heap; + word32 used; + word32 len; + word32 sha_type; +#if defined(WOLF_CRYPTO_CB) + word32 flags; + int devId; +#endif +} wolfssl_TSIP_Hash; + +/* RAW hash function APIs are not implemented with TSIP */ +#define WOLFSSL_NO_HASH_RAW + +typedef wolfssl_TSIP_Hash wc_Sha; + +#if !defined(NO_SHA256) +typedef wolfssl_TSIP_Hash wc_Sha256; +#endif + +#endif /* NO_SHA */ + + +#if defined(WOLFSSL_RENESAS_TSIP_TLS_AES_CRYPT) +#include "r_tsip_rx_if.h" + +typedef struct { + tsip_aes_key_index_t tsip_keyIdx; + word32 keySize; + byte setup; +} TSIP_AES_CTX; + +#endif + +#endif /* __RENESAS_TSIP_TYPES_H__ */ diff --git a/wolfssl/wolfcrypt/port/af_alg/afalg_hash.h b/wolfssl/wolfcrypt/port/af_alg/afalg_hash.h index 5fbcb6733..b97ea70cc 100644 --- a/wolfssl/wolfcrypt/port/af_alg/afalg_hash.h +++ b/wolfssl/wolfcrypt/port/af_alg/afalg_hash.h @@ -1,6 +1,6 @@ /* afalg_hash.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/af_alg/wc_afalg.h b/wolfssl/wolfcrypt/port/af_alg/wc_afalg.h index 27d712762..27de2d542 100644 --- a/wolfssl/wolfcrypt/port/af_alg/wc_afalg.h +++ b/wolfssl/wolfcrypt/port/af_alg/wc_afalg.h @@ -1,6 +1,6 @@ /* wc_afalg.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/arm/cryptoCell.h b/wolfssl/wolfcrypt/port/arm/cryptoCell.h index e434054d7..bcbf02457 100644 --- a/wolfssl/wolfcrypt/port/arm/cryptoCell.h +++ b/wolfssl/wolfcrypt/port/arm/cryptoCell.h @@ -1,6 +1,6 @@ /* cryptoCell.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/atmel/atmel.h b/wolfssl/wolfcrypt/port/atmel/atmel.h index b26637550..bfb00b1ca 100644 --- a/wolfssl/wolfcrypt/port/atmel/atmel.h +++ b/wolfssl/wolfcrypt/port/atmel/atmel.h @@ -1,6 +1,6 @@ /* atmel.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/caam/caam_driver.h b/wolfssl/wolfcrypt/port/caam/caam_driver.h index 131685a49..35ec59d21 100644 --- a/wolfssl/wolfcrypt/port/caam/caam_driver.h +++ b/wolfssl/wolfcrypt/port/caam/caam_driver.h @@ -1,6 +1,6 @@ /* caam_driver.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/caam/caam_error.h b/wolfssl/wolfcrypt/port/caam/caam_error.h index 35a9b25b6..f1f617cc3 100644 --- a/wolfssl/wolfcrypt/port/caam/caam_error.h +++ b/wolfssl/wolfcrypt/port/caam/caam_error.h @@ -1,6 +1,6 @@ /* caam_error.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/caam/caam_qnx.h b/wolfssl/wolfcrypt/port/caam/caam_qnx.h index b803e89dd..416c1c1cf 100644 --- a/wolfssl/wolfcrypt/port/caam/caam_qnx.h +++ b/wolfssl/wolfcrypt/port/caam/caam_qnx.h @@ -1,6 +1,6 @@ /* caam_qnx.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/caam/wolfcaam.h b/wolfssl/wolfcrypt/port/caam/wolfcaam.h index 4b7a374f2..7c7c681b1 100644 --- a/wolfssl/wolfcrypt/port/caam/wolfcaam.h +++ b/wolfssl/wolfcrypt/port/caam/wolfcaam.h @@ -1,6 +1,6 @@ /* wolfcaam.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/caam/wolfcaam_aes.h b/wolfssl/wolfcrypt/port/caam/wolfcaam_aes.h index 02ac4b8c0..1af45fc20 100644 --- a/wolfssl/wolfcrypt/port/caam/wolfcaam_aes.h +++ b/wolfssl/wolfcrypt/port/caam/wolfcaam_aes.h @@ -1,6 +1,6 @@ /* wolfcaam_aes.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/caam/wolfcaam_cmac.h b/wolfssl/wolfcrypt/port/caam/wolfcaam_cmac.h index cba837592..b49df498d 100644 --- a/wolfssl/wolfcrypt/port/caam/wolfcaam_cmac.h +++ b/wolfssl/wolfcrypt/port/caam/wolfcaam_cmac.h @@ -1,6 +1,6 @@ /* wolfcaam_cmac.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/caam/wolfcaam_ecdsa.h b/wolfssl/wolfcrypt/port/caam/wolfcaam_ecdsa.h index 9ab3a99c2..a7ed5d856 100644 --- a/wolfssl/wolfcrypt/port/caam/wolfcaam_ecdsa.h +++ b/wolfssl/wolfcrypt/port/caam/wolfcaam_ecdsa.h @@ -1,6 +1,6 @@ /* wolfcaam_ecdsa.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/caam/wolfcaam_hash.h b/wolfssl/wolfcrypt/port/caam/wolfcaam_hash.h index 7647a7b35..43daf9984 100644 --- a/wolfssl/wolfcrypt/port/caam/wolfcaam_hash.h +++ b/wolfssl/wolfcrypt/port/caam/wolfcaam_hash.h @@ -1,6 +1,6 @@ /* wolfcaam_hash.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/caam/wolfcaam_qnx.h b/wolfssl/wolfcrypt/port/caam/wolfcaam_qnx.h index 9e4eb7d04..81f86242b 100644 --- a/wolfssl/wolfcrypt/port/caam/wolfcaam_qnx.h +++ b/wolfssl/wolfcrypt/port/caam/wolfcaam_qnx.h @@ -1,6 +1,6 @@ /* wolfcaam_qnx.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/caam/wolfcaam_rsa.h b/wolfssl/wolfcrypt/port/caam/wolfcaam_rsa.h index 668007428..56ac199a0 100644 --- a/wolfssl/wolfcrypt/port/caam/wolfcaam_rsa.h +++ b/wolfssl/wolfcrypt/port/caam/wolfcaam_rsa.h @@ -1,6 +1,6 @@ /* wolfcaam_rsa.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/caam/wolfcaam_seco.h b/wolfssl/wolfcrypt/port/caam/wolfcaam_seco.h index ec6fb4cce..f9e18914d 100644 --- a/wolfssl/wolfcrypt/port/caam/wolfcaam_seco.h +++ b/wolfssl/wolfcrypt/port/caam/wolfcaam_seco.h @@ -1,6 +1,6 @@ /* wolfcaam_seco.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h b/wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h index d18a9e1f3..c46592014 100644 --- a/wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h +++ b/wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h @@ -1,6 +1,6 @@ /* wolfcaam_sha.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/caam/wolfcaam_x25519.h b/wolfssl/wolfcrypt/port/caam/wolfcaam_x25519.h index 4fcc31c7b..051c8170d 100644 --- a/wolfssl/wolfcrypt/port/caam/wolfcaam_x25519.h +++ b/wolfssl/wolfcrypt/port/caam/wolfcaam_x25519.h @@ -1,6 +1,6 @@ /* wolfcaam_x25519.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/cavium/cavium_octeon_sync.h b/wolfssl/wolfcrypt/port/cavium/cavium_octeon_sync.h index 6a0d76045..be65adcbf 100644 --- a/wolfssl/wolfcrypt/port/cavium/cavium_octeon_sync.h +++ b/wolfssl/wolfcrypt/port/cavium/cavium_octeon_sync.h @@ -1,6 +1,6 @@ /* cavium_octeon_sync.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h b/wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h index a41ace703..408c02a05 100644 --- a/wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h +++ b/wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h @@ -1,6 +1,6 @@ /* psoc6_crypto.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/devcrypto/wc_devcrypto.h b/wolfssl/wolfcrypt/port/devcrypto/wc_devcrypto.h index e7bb54ba9..fa4273682 100644 --- a/wolfssl/wolfcrypt/port/devcrypto/wc_devcrypto.h +++ b/wolfssl/wolfcrypt/port/devcrypto/wc_devcrypto.h @@ -1,6 +1,6 @@ /* wc_devcrypto.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/intel/quickassist_sync.h b/wolfssl/wolfcrypt/port/intel/quickassist_sync.h index f140f618c..383a72ba4 100644 --- a/wolfssl/wolfcrypt/port/intel/quickassist_sync.h +++ b/wolfssl/wolfcrypt/port/intel/quickassist_sync.h @@ -1,6 +1,6 @@ /* quickassist_sync.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/iotsafe/iotsafe.h b/wolfssl/wolfcrypt/port/iotsafe/iotsafe.h index 2ad536ba7..aab9f882a 100644 --- a/wolfssl/wolfcrypt/port/iotsafe/iotsafe.h +++ b/wolfssl/wolfcrypt/port/iotsafe/iotsafe.h @@ -1,6 +1,6 @@ /* iotsafe.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/kcapi/kcapi_dh.h b/wolfssl/wolfcrypt/port/kcapi/kcapi_dh.h index 00de2b57e..3029de153 100644 --- a/wolfssl/wolfcrypt/port/kcapi/kcapi_dh.h +++ b/wolfssl/wolfcrypt/port/kcapi/kcapi_dh.h @@ -1,6 +1,6 @@ /* kcapi_dh.h * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/kcapi/kcapi_ecc.h b/wolfssl/wolfcrypt/port/kcapi/kcapi_ecc.h index 823cafb21..d3cd0490e 100644 --- a/wolfssl/wolfcrypt/port/kcapi/kcapi_ecc.h +++ b/wolfssl/wolfcrypt/port/kcapi/kcapi_ecc.h @@ -1,6 +1,6 @@ /* kcapi_ecc.h * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/kcapi/kcapi_hash.h b/wolfssl/wolfcrypt/port/kcapi/kcapi_hash.h index 95f7af2fb..a31eb2508 100644 --- a/wolfssl/wolfcrypt/port/kcapi/kcapi_hash.h +++ b/wolfssl/wolfcrypt/port/kcapi/kcapi_hash.h @@ -1,6 +1,6 @@ /* kcapi_hash.h * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/kcapi/kcapi_hmac.h b/wolfssl/wolfcrypt/port/kcapi/kcapi_hmac.h index f1d8836f4..7196150db 100644 --- a/wolfssl/wolfcrypt/port/kcapi/kcapi_hmac.h +++ b/wolfssl/wolfcrypt/port/kcapi/kcapi_hmac.h @@ -1,6 +1,6 @@ /* kcapi_hmac.h * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/kcapi/kcapi_rsa.h b/wolfssl/wolfcrypt/port/kcapi/kcapi_rsa.h index 03991d2ad..2a4c4f64a 100644 --- a/wolfssl/wolfcrypt/port/kcapi/kcapi_rsa.h +++ b/wolfssl/wolfcrypt/port/kcapi/kcapi_rsa.h @@ -1,6 +1,6 @@ /* kcapi_rsa.h * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/kcapi/wc_kcapi.h b/wolfssl/wolfcrypt/port/kcapi/wc_kcapi.h index 5b7334b6b..a728d9269 100644 --- a/wolfssl/wolfcrypt/port/kcapi/wc_kcapi.h +++ b/wolfssl/wolfcrypt/port/kcapi/wc_kcapi.h @@ -1,6 +1,6 @@ /* wc_kcapi.h * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/nrf51.h b/wolfssl/wolfcrypt/port/nrf51.h index 169d9cf50..95d8fb917 100644 --- a/wolfssl/wolfcrypt/port/nrf51.h +++ b/wolfssl/wolfcrypt/port/nrf51.h @@ -1,6 +1,6 @@ /* nrf51.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/nxp/dcp_port.h b/wolfssl/wolfcrypt/port/nxp/dcp_port.h index 0813b37e7..49392a960 100644 --- a/wolfssl/wolfcrypt/port/nxp/dcp_port.h +++ b/wolfssl/wolfcrypt/port/nxp/dcp_port.h @@ -1,6 +1,6 @@ /* dcp_port.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/nxp/ksdk_port.h b/wolfssl/wolfcrypt/port/nxp/ksdk_port.h index 2f6ae42ed..d01bdc240 100644 --- a/wolfssl/wolfcrypt/port/nxp/ksdk_port.h +++ b/wolfssl/wolfcrypt/port/nxp/ksdk_port.h @@ -1,6 +1,6 @@ /* ksdk_port.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/nxp/se050_port.h b/wolfssl/wolfcrypt/port/nxp/se050_port.h index a58e97be6..f1c85b7d7 100644 --- a/wolfssl/wolfcrypt/port/nxp/se050_port.h +++ b/wolfssl/wolfcrypt/port/nxp/se050_port.h @@ -1,6 +1,6 @@ /* se050_port.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -24,7 +24,6 @@ #include #include -#include #ifdef __GNUC__ #pragma GCC diagnostic push @@ -39,7 +38,7 @@ #include "fsl_sss_api.h" #endif -#ifdef WOLFSSL_SE050 +#if defined(WOLFSSL_SE050) && defined(WOLFSSL_SE050_HASH) /* NXP SE050 - Disable SHA512 224/256 support */ #ifndef WOLFSSL_NOSHA512_224 #define WOLFSSL_NOSHA512_224 @@ -96,6 +95,8 @@ WOLFSSL_API int wc_se050_set_config(sss_session_t *pSession, #ifdef WOLFSSL_SE050_INIT WOLFSSL_API int wc_se050_init(const char* portName); #endif +WOLFSSL_API int se050_ecc_insert_private_key(int keyId, const byte* eccDer, + word32 eccDerSize); /* Private Functions */ WOLFSSL_LOCAL int se050_allocate_key(int keyType); @@ -105,7 +106,7 @@ WOLFSSL_LOCAL int se050_hash_init(SE050_HASH_Context* se050Ctx, void* heap); WOLFSSL_LOCAL int se050_hash_update(SE050_HASH_Context* se050Ctx, const byte* data, word32 len); WOLFSSL_LOCAL int se050_hash_final(SE050_HASH_Context* se050Ctx, byte* hash, - size_t digestLen, word32 algo); + size_t digestLen, sss_algorithm_t algo); WOLFSSL_LOCAL void se050_hash_free(SE050_HASH_Context* se050Ctx); struct Aes; @@ -140,6 +141,7 @@ WOLFSSL_LOCAL int se050_ecc_shared_secret(struct ecc_key* private_key, struct ecc_key* public_key, byte* out, word32* outlen); WOLFSSL_LOCAL void se050_ecc_free_key(struct ecc_key* key); + struct ed25519_key; WOLFSSL_LOCAL int se050_ed25519_create_key(struct ed25519_key* key); WOLFSSL_LOCAL void se050_ed25519_free_key(struct ed25519_key* key); diff --git a/wolfssl/wolfcrypt/port/pic32/pic32mz-crypt.h b/wolfssl/wolfcrypt/port/pic32/pic32mz-crypt.h index 4ffd8d144..43242a897 100644 --- a/wolfssl/wolfcrypt/port/pic32/pic32mz-crypt.h +++ b/wolfssl/wolfcrypt/port/pic32/pic32mz-crypt.h @@ -1,6 +1,6 @@ /* pic32mz-crypt.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/psa/psa.h b/wolfssl/wolfcrypt/port/psa/psa.h index e4683b28b..539fd99ae 100644 --- a/wolfssl/wolfcrypt/port/psa/psa.h +++ b/wolfssl/wolfcrypt/port/psa/psa.h @@ -1,6 +1,6 @@ /* psa.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/silabs/silabs_aes.h b/wolfssl/wolfcrypt/port/silabs/silabs_aes.h index 798a1ef8f..114318363 100644 --- a/wolfssl/wolfcrypt/port/silabs/silabs_aes.h +++ b/wolfssl/wolfcrypt/port/silabs/silabs_aes.h @@ -1,6 +1,6 @@ /* silabs_aes.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/silabs/silabs_ecc.h b/wolfssl/wolfcrypt/port/silabs/silabs_ecc.h index a55e5f6c4..feb48ec52 100644 --- a/wolfssl/wolfcrypt/port/silabs/silabs_ecc.h +++ b/wolfssl/wolfcrypt/port/silabs/silabs_ecc.h @@ -1,6 +1,6 @@ /* silabs_ecc.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/silabs/silabs_hash.h b/wolfssl/wolfcrypt/port/silabs/silabs_hash.h index a88da7145..9af6aeaa2 100644 --- a/wolfssl/wolfcrypt/port/silabs/silabs_hash.h +++ b/wolfssl/wolfcrypt/port/silabs/silabs_hash.h @@ -1,6 +1,6 @@ /* silabs_hash.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/silabs/silabs_random.h b/wolfssl/wolfcrypt/port/silabs/silabs_random.h index 4475ceff6..ce31d7e51 100644 --- a/wolfssl/wolfcrypt/port/silabs/silabs_random.h +++ b/wolfssl/wolfcrypt/port/silabs/silabs_random.h @@ -1,6 +1,6 @@ /* silabs_random.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/st/stm32.h b/wolfssl/wolfcrypt/port/st/stm32.h index 0516458ca..e1ec09933 100644 --- a/wolfssl/wolfcrypt/port/st/stm32.h +++ b/wolfssl/wolfcrypt/port/st/stm32.h @@ -1,6 +1,6 @@ /* stm32.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/st/stsafe.h b/wolfssl/wolfcrypt/port/st/stsafe.h index cf62a475d..d7a16253f 100644 --- a/wolfssl/wolfcrypt/port/st/stsafe.h +++ b/wolfssl/wolfcrypt/port/st/stsafe.h @@ -1,6 +1,6 @@ /* stsafe.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/ti/ti-ccm.h b/wolfssl/wolfcrypt/port/ti/ti-ccm.h index 4e47fd6e5..8c90947b0 100644 --- a/wolfssl/wolfcrypt/port/ti/ti-ccm.h +++ b/wolfssl/wolfcrypt/port/ti/ti-ccm.h @@ -1,6 +1,6 @@ /* port/ti/ti_ccm.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/ti/ti-hash.h b/wolfssl/wolfcrypt/port/ti/ti-hash.h index 7c5d610b0..4bdf88658 100644 --- a/wolfssl/wolfcrypt/port/ti/ti-hash.h +++ b/wolfssl/wolfcrypt/port/ti/ti-hash.h @@ -1,6 +1,6 @@ /* port/ti/ti-hash.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/port/xilinx/xil-sha3.h b/wolfssl/wolfcrypt/port/xilinx/xil-sha3.h index edaa4fa46..af2c55aa5 100644 --- a/wolfssl/wolfcrypt/port/xilinx/xil-sha3.h +++ b/wolfssl/wolfcrypt/port/xilinx/xil-sha3.h @@ -1,6 +1,6 @@ /* xil-sha3.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/pwdbased.h b/wolfssl/wolfcrypt/pwdbased.h index ff52ea091..945c952e7 100644 --- a/wolfssl/wolfcrypt/pwdbased.h +++ b/wolfssl/wolfcrypt/pwdbased.h @@ -1,6 +1,6 @@ /* pwdbased.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/random.h b/wolfssl/wolfcrypt/random.h index ff4ef0de5..1b12dd850 100644 --- a/wolfssl/wolfcrypt/random.h +++ b/wolfssl/wolfcrypt/random.h @@ -1,6 +1,6 @@ /* random.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/rc2.h b/wolfssl/wolfcrypt/rc2.h index 5aa641a82..d5b3e067f 100644 --- a/wolfssl/wolfcrypt/rc2.h +++ b/wolfssl/wolfcrypt/rc2.h @@ -1,6 +1,6 @@ /* rc2.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/ripemd.h b/wolfssl/wolfcrypt/ripemd.h index 7d7c8bce3..cd01d0673 100644 --- a/wolfssl/wolfcrypt/ripemd.h +++ b/wolfssl/wolfcrypt/ripemd.h @@ -1,6 +1,6 @@ /* ripemd.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/rsa.h b/wolfssl/wolfcrypt/rsa.h index bc845b8d7..46d23e9c0 100644 --- a/wolfssl/wolfcrypt/rsa.h +++ b/wolfssl/wolfcrypt/rsa.h @@ -1,6 +1,6 @@ /* rsa.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/sakke.h b/wolfssl/wolfcrypt/sakke.h index 79fc314e4..e82bb0c8b 100644 --- a/wolfssl/wolfcrypt/sakke.h +++ b/wolfssl/wolfcrypt/sakke.h @@ -1,6 +1,6 @@ /* sakke.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/selftest.h b/wolfssl/wolfcrypt/selftest.h index 0d675259d..00ee40be5 100644 --- a/wolfssl/wolfcrypt/selftest.h +++ b/wolfssl/wolfcrypt/selftest.h @@ -1,6 +1,6 @@ /* selftest.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index b920a8d9a..592eb5d8c 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -1,6 +1,6 @@ /* settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -1501,7 +1501,9 @@ extern void uITRON4_free(void *p) ; #define HAVE_HASHDRBG #define HAVE_ECC - #define ALT_ECC_SIZE + #if !defined(WOLFSSL_STATIC_MEMORY) && !defined(WOLFSSL_NO_MALLOC) + #define ALT_ECC_SIZE + #endif #define TFM_ECC192 #define TFM_ECC224 #define TFM_ECC256 @@ -1887,34 +1889,34 @@ extern void uITRON4_free(void *p) ; /* --------------------------------------------------------------------------- * Math Library Selection (in order of preference) - * ---------------------------------------------------------------------------*/ -/* Only evaluate this if: - * A) Not fips - * B) FIPS 140-3 (v5 or greater) */ + * --------------------------------------------------------------------------- + */ #if !defined(HAVE_FIPS_VERSION) || \ (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 5)) - /* 1) SP Math: wolfSSL proprietary math implementation (sp_int.c). - * Constant time: Always - * Enable: WOLFSSL_SP_MATH_ALL - * - * 2) Fast Math: Stack based (tfm.c) - * Constant time: Only with TFM_TIMING_RESISTANT - * Enable: USE_FAST_MATH - * - * 3) Integer Heap Math: Heap based (integer.c) - * Constant time: Not supported - * Enable: USE_INTEGER_HEAP_MATH - */ - #if defined(WOLFSSL_SP_MATH_ALL) || \ - (!defined(USE_FAST_MATH) && !defined(USE_INTEGER_HEAP_MATH)) - /* 1) Using wolfSSL SP Math (sp_int.c) */ - #ifndef WOLFSSL_SP_MATH_ALL - #define WOLFSSL_SP_MATH_ALL - #endif + #if defined(WOLFSSL_SP_MATH_ALL) + /* 1) SP Math: wolfSSL proprietary math implementation (sp_int.c). + * Constant time: Always + * Enable: WOLFSSL_SP_MATH_ALL + */ + #elif defined(WOLFSSL_SP_MATH) + /* 2) SP Math with restricted key sizes: wolfSSL proprietary math + * implementation (sp_*.c). + * Constant time: Always + * Enable: WOLFSSL_SP_MATH + */ #elif defined(USE_FAST_MATH) - /* 2) Using fast math (tfm.c) - USE_FAST_MATH */ + /* 3) Tom's Fast Math: Stack based (tfm.c) + * Constant time: Only with TFM_TIMING_RESISTANT + * Enable: USE_FAST_MATH + */ + #elif defined(USE_INTEGER_HEAP_MATH) + /* 4) Integer Heap Math: Heap based (integer.c) + * Constant time: Not supported + * Enable: USE_INTEGER_HEAP_MATH + */ #else - /* 3) Using heap math (integer.c) - USE_INTEGER_HEAP_MATH */ + /* default is SP Math. */ + #define WOLFSSL_SP_MATH_ALL #endif #else /* FIPS 140-2 or older */ @@ -2394,8 +2396,8 @@ extern void uITRON4_free(void *p) ; #undef HAVE_GMTIME_R /* don't trust macro with windows */ #endif /* WOLFSSL_MYSQL_COMPATIBLE */ -#if defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) \ - || defined(HAVE_LIGHTY) +#if (defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) \ + || defined(HAVE_LIGHTY)) && !defined(NO_TLS) #define OPENSSL_NO_ENGINE #ifndef OPENSSL_EXTRA #define OPENSSL_EXTRA diff --git a/wolfssl/wolfcrypt/sha.h b/wolfssl/wolfcrypt/sha.h index f9b1c7012..815cc3455 100644 --- a/wolfssl/wolfcrypt/sha.h +++ b/wolfssl/wolfcrypt/sha.h @@ -1,6 +1,6 @@ /* sha.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -107,7 +107,7 @@ enum { #include "wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h" #elif defined(WOLFSSL_RENESAS_TSIP_CRYPT) && \ !defined(NO_WOLFSSL_RENESAS_TSIP_CRYPT_HASH) - #include "wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h" + #include "wolfssl/wolfcrypt/port/Renesas/renesas_tsip_types.h" #else #if defined(WOLFSSL_SE050) && defined(WOLFSSL_SE050_HASH) diff --git a/wolfssl/wolfcrypt/sha256.h b/wolfssl/wolfcrypt/sha256.h index eaeaf5f0e..b6f131995 100644 --- a/wolfssl/wolfcrypt/sha256.h +++ b/wolfssl/wolfcrypt/sha256.h @@ -1,6 +1,6 @@ /* sha256.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -147,7 +147,7 @@ enum { #include "wolfssl/wolfcrypt/port/af_alg/afalg_hash.h" #elif defined(WOLFSSL_RENESAS_TSIP_CRYPT) && \ !defined(NO_WOLFSSL_RENESAS_TSIP_CRYPT_HASH) - #include "wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h" + #include "wolfssl/wolfcrypt/port/Renesas/renesas_tsip_types.h" #elif defined(WOLFSSL_RENESAS_SCEPROTECT) && \ !defined(NO_WOLFSSL_RENESAS_SCEPROTECT_HASH) #include "wolfssl/wolfcrypt/port/Renesas/renesas-sce-crypt.h" diff --git a/wolfssl/wolfcrypt/sha3.h b/wolfssl/wolfcrypt/sha3.h index 2d887f5c0..784fd486e 100644 --- a/wolfssl/wolfcrypt/sha3.h +++ b/wolfssl/wolfcrypt/sha3.h @@ -1,6 +1,6 @@ /* sha3.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/sha512.h b/wolfssl/wolfcrypt/sha512.h index b4e6dfaac..45e045e03 100644 --- a/wolfssl/wolfcrypt/sha512.h +++ b/wolfssl/wolfcrypt/sha512.h @@ -1,6 +1,6 @@ /* sha512.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -142,7 +142,7 @@ enum { #if defined(WOLFSSL_IMX6_CAAM) && !defined(WOLFSSL_QNX_CAAM) #include "wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h" #else -#if defined(WOLFSSL_SE050) +#if defined(WOLFSSL_SE050) && defined(WOLFSSL_SE050_HASH) #include "wolfssl/wolfcrypt/port/nxp/se050_port.h" #endif /* wc_Sha512 digest */ @@ -177,7 +177,7 @@ struct wc_Sha512 { #ifdef WOLFSSL_KCAPI_HASH wolfssl_KCAPI_Hash kcapi; #endif -#if defined(WOLFSSL_SE050) +#if defined(WOLFSSL_SE050) && defined(WOLFSSL_SE050_HASH) SE050_HASH_Context se050Ctx; #endif #if defined(WOLFSSL_HASH_KEEP) diff --git a/wolfssl/wolfcrypt/signature.h b/wolfssl/wolfcrypt/signature.h index d7c4188f2..7097ec0cd 100644 --- a/wolfssl/wolfcrypt/signature.h +++ b/wolfssl/wolfcrypt/signature.h @@ -1,6 +1,6 @@ /* signature.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/siphash.h b/wolfssl/wolfcrypt/siphash.h index 4f40ca7ad..c86155e28 100644 --- a/wolfssl/wolfcrypt/siphash.h +++ b/wolfssl/wolfcrypt/siphash.h @@ -1,6 +1,6 @@ /* siphash.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/sp.h b/wolfssl/wolfcrypt/sp.h index f244325d9..528ab0b55 100644 --- a/wolfssl/wolfcrypt/sp.h +++ b/wolfssl/wolfcrypt/sp.h @@ -1,6 +1,6 @@ /* sp.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/sp_int.h b/wolfssl/wolfcrypt/sp_int.h index 4b0eeb47d..b72eaa21d 100644 --- a/wolfssl/wolfcrypt/sp_int.h +++ b/wolfssl/wolfcrypt/sp_int.h @@ -1,6 +1,6 @@ /* sp_int.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/srp.h b/wolfssl/wolfcrypt/srp.h index b06fb8a87..0545c934e 100644 --- a/wolfssl/wolfcrypt/srp.h +++ b/wolfssl/wolfcrypt/srp.h @@ -1,6 +1,6 @@ /* srp.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/tfm.h b/wolfssl/wolfcrypt/tfm.h index 5a478c697..327bd950e 100644 --- a/wolfssl/wolfcrypt/tfm.h +++ b/wolfssl/wolfcrypt/tfm.h @@ -1,6 +1,6 @@ /* tfm.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/visibility.h b/wolfssl/wolfcrypt/visibility.h index 69db36370..b93e6859c 100644 --- a/wolfssl/wolfcrypt/visibility.h +++ b/wolfssl/wolfcrypt/visibility.h @@ -1,6 +1,6 @@ /* visibility.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/wc_encrypt.h b/wolfssl/wolfcrypt/wc_encrypt.h index 86c3afdcb..d118c35ed 100644 --- a/wolfssl/wolfcrypt/wc_encrypt.h +++ b/wolfssl/wolfcrypt/wc_encrypt.h @@ -1,6 +1,6 @@ /* wc_encrypt.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/wc_pkcs11.h b/wolfssl/wolfcrypt/wc_pkcs11.h index 47a517620..05d6332ec 100644 --- a/wolfssl/wolfcrypt/wc_pkcs11.h +++ b/wolfssl/wolfcrypt/wc_pkcs11.h @@ -1,6 +1,6 @@ /* wc_pkcs11.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index d21fabfdb..0dd9cc75c 100644 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -1,6 +1,6 @@ /* wc_port.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/wolfevent.h b/wolfssl/wolfcrypt/wolfevent.h index 639f548a1..22daae8b8 100644 --- a/wolfssl/wolfcrypt/wolfevent.h +++ b/wolfssl/wolfcrypt/wolfevent.h @@ -1,6 +1,6 @@ /* wolfevent.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfcrypt/wolfmath.h b/wolfssl/wolfcrypt/wolfmath.h index 3430033eb..6a06f0ef9 100644 --- a/wolfssl/wolfcrypt/wolfmath.h +++ b/wolfssl/wolfcrypt/wolfmath.h @@ -1,6 +1,6 @@ /* wolfmath.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wolfssl/wolfio.h b/wolfssl/wolfio.h index 8beae7471..090b7fc9d 100644 --- a/wolfssl/wolfio.h +++ b/wolfssl/wolfio.h @@ -1,6 +1,6 @@ /* io.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wrapper/CSharp/wolfSSL-DTLS-PSK-Server/wolfSSL-DTLS-PSK-Server.cs b/wrapper/CSharp/wolfSSL-DTLS-PSK-Server/wolfSSL-DTLS-PSK-Server.cs index 8e94c4ea5..77a813798 100644 --- a/wrapper/CSharp/wolfSSL-DTLS-PSK-Server/wolfSSL-DTLS-PSK-Server.cs +++ b/wrapper/CSharp/wolfSSL-DTLS-PSK-Server/wolfSSL-DTLS-PSK-Server.cs @@ -1,6 +1,6 @@ /* wolfSSL-DTLS-PSK-Server.cs * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -20,6 +20,7 @@ */ + using System; diff --git a/wrapper/CSharp/wolfSSL-DTLS-Server/wolfSSL-DTLS-Server.cs b/wrapper/CSharp/wolfSSL-DTLS-Server/wolfSSL-DTLS-Server.cs index 1116ba874..da596e5de 100644 --- a/wrapper/CSharp/wolfSSL-DTLS-Server/wolfSSL-DTLS-Server.cs +++ b/wrapper/CSharp/wolfSSL-DTLS-Server/wolfSSL-DTLS-Server.cs @@ -1,6 +1,6 @@ /* wolfSSL-DTLS-Server.cs * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -20,6 +20,7 @@ */ + using System; using System.Runtime.InteropServices; diff --git a/wrapper/CSharp/wolfSSL-Example-IOCallbacks/wolfSSL-Example-IOCallbacks.cs b/wrapper/CSharp/wolfSSL-Example-IOCallbacks/wolfSSL-Example-IOCallbacks.cs index aaeb31a72..fc5e15ff2 100644 --- a/wrapper/CSharp/wolfSSL-Example-IOCallbacks/wolfSSL-Example-IOCallbacks.cs +++ b/wrapper/CSharp/wolfSSL-Example-IOCallbacks/wolfSSL-Example-IOCallbacks.cs @@ -1,6 +1,6 @@ /* wolfSSL-Example-IOCallbacks.cs * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + using System; diff --git a/wrapper/CSharp/wolfSSL-TLS-Client/wolfSSL-TLS-Client.cs b/wrapper/CSharp/wolfSSL-TLS-Client/wolfSSL-TLS-Client.cs index dccdc4d3f..a2cc12720 100644 --- a/wrapper/CSharp/wolfSSL-TLS-Client/wolfSSL-TLS-Client.cs +++ b/wrapper/CSharp/wolfSSL-TLS-Client/wolfSSL-TLS-Client.cs @@ -1,6 +1,6 @@ /* wolfSSL-TLS-Client.cs * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wrapper/CSharp/wolfSSL-TLS-PSK-Client/wolfSSL-TLS-PSK-Client.cs b/wrapper/CSharp/wolfSSL-TLS-PSK-Client/wolfSSL-TLS-PSK-Client.cs index 0383eaf10..5e2537a67 100644 --- a/wrapper/CSharp/wolfSSL-TLS-PSK-Client/wolfSSL-TLS-PSK-Client.cs +++ b/wrapper/CSharp/wolfSSL-TLS-PSK-Client/wolfSSL-TLS-PSK-Client.cs @@ -1,6 +1,6 @@ /* wolfSSL-TLS-PSK-Client.cs * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + using System; diff --git a/wrapper/CSharp/wolfSSL-TLS-PSK-Server/wolfSSL-TLS-PSK-Server.cs b/wrapper/CSharp/wolfSSL-TLS-PSK-Server/wolfSSL-TLS-PSK-Server.cs index ff6ce7316..3679028d8 100644 --- a/wrapper/CSharp/wolfSSL-TLS-PSK-Server/wolfSSL-TLS-PSK-Server.cs +++ b/wrapper/CSharp/wolfSSL-TLS-PSK-Server/wolfSSL-TLS-PSK-Server.cs @@ -1,6 +1,6 @@ /* wolfSSL-TLS-PSK-Server.cs * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + using System; diff --git a/wrapper/CSharp/wolfSSL-TLS-Server/wolfSSL-TLS-Server.cs b/wrapper/CSharp/wolfSSL-TLS-Server/wolfSSL-TLS-Server.cs index 487f7815e..adbfcdd54 100644 --- a/wrapper/CSharp/wolfSSL-TLS-Server/wolfSSL-TLS-Server.cs +++ b/wrapper/CSharp/wolfSSL-TLS-Server/wolfSSL-TLS-Server.cs @@ -1,6 +1,6 @@ /* wolfSSL-TLS-Server.cs * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + using System; diff --git a/wrapper/CSharp/wolfSSL-TLS-ServerThreaded/wolfSSL-TLS-ServerThreaded.cs b/wrapper/CSharp/wolfSSL-TLS-ServerThreaded/wolfSSL-TLS-ServerThreaded.cs index a7540508a..eed661479 100644 --- a/wrapper/CSharp/wolfSSL-TLS-ServerThreaded/wolfSSL-TLS-ServerThreaded.cs +++ b/wrapper/CSharp/wolfSSL-TLS-ServerThreaded/wolfSSL-TLS-ServerThreaded.cs @@ -1,6 +1,6 @@ /* wolfSSL-TLS-ServerThreaded.cs * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/wrapper/CSharp/wolfSSL_CSharp/wolfSSL.cs b/wrapper/CSharp/wolfSSL_CSharp/wolfSSL.cs index a6b159577..d6fbba878 100644 --- a/wrapper/CSharp/wolfSSL_CSharp/wolfSSL.cs +++ b/wrapper/CSharp/wolfSSL_CSharp/wolfSSL.cs @@ -1,6 +1,6 @@ /* wolfSSL.cs * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + using System; using System.Runtime.InteropServices; using System.Text; diff --git a/zephyr/samples/wolfssl_tls_sock/src/tls_sock.c b/zephyr/samples/wolfssl_tls_sock/src/tls_sock.c index c83383bb4..5e2ca0c49 100644 --- a/zephyr/samples/wolfssl_tls_sock/src/tls_sock.c +++ b/zephyr/samples/wolfssl_tls_sock/src/tls_sock.c @@ -1,6 +1,6 @@ /* tls_sock.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/zephyr/samples/wolfssl_tls_thread/src/tls_threaded.c b/zephyr/samples/wolfssl_tls_thread/src/tls_threaded.c index 52f34122b..9516850fa 100644 --- a/zephyr/samples/wolfssl_tls_thread/src/tls_threaded.c +++ b/zephyr/samples/wolfssl_tls_thread/src/tls_threaded.c @@ -1,6 +1,6 @@ /* tls_threaded.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/zephyr/user_settings-tls-generic.h b/zephyr/user_settings-tls-generic.h index 65e40521a..d73e6edf3 100644 --- a/zephyr/user_settings-tls-generic.h +++ b/zephyr/user_settings-tls-generic.h @@ -1,7 +1,7 @@ /* user_settings-tls-generic.h * generated from configure options * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/zephyr/user_settings.h b/zephyr/user_settings.h index 81de4293f..97dccda2c 100644 --- a/zephyr/user_settings.h +++ b/zephyr/user_settings.h @@ -1,6 +1,6 @@ /* user_settings.h * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * diff --git a/zephyr/zephyr_init.c b/zephyr/zephyr_init.c index 45c027ed2..1e3e8aca5 100644 --- a/zephyr/zephyr_init.c +++ b/zephyr/zephyr_init.c @@ -1,6 +1,6 @@ /* zephyr_init.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. *