mbedtls/library
Gaurav Aggarwal a9f64006ea Add support for const error description strings
Problem
-------
mbedtls_strerror is a utility function which converts an mbedTLS error code
into a human readable string. It requires the caller to allocate a buffer every
time an error code needs to be converted to a string. It is an overkill and a
waste of RAM for resource constrained microcontrollers - where the most common
use case is to use these strings for logging.

Solution
--------
The proposed commit adds two functions:

* const char * mbedtls_high_level_strerr( int error_code );
* const char * mbedtls_low_level_strerr( int error_code );

The above two functions convert the high level and low level parts of an mbedTLS
error code to human readable strings. They return a const pointer to an
unmodifiable string which is not supposed to be modified by the caller and only
to be used for logging purposes. The caller no longer needs to allocate a
buffer.

Backward Compatibility
----------------------
The proposed change is completely backward compatible as it does not change
the existing mbedtls_strerror function and ensures that it continues to behave
the same way.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2020-04-09 01:44:52 -07:00
..
.gitignore
aes.c Merge branch 'development' into development-restricted 2020-01-15 15:55:11 +00:00
aesni.c
arc4.c
aria.c
asn1parse.c Replace use of uint8_t by unsigned char in ASN.1 seq traversal API 2020-02-03 10:39:55 +00:00
asn1write.c Merge pull request #323 from yanesca/iotcrypt-942-initialise-return-values 2019-12-19 10:24:22 +00:00
base64.c
bignum.c Merge pull request #346 from gilles-peskine-arm/mpi_copy_shrink 2020-02-06 09:52:01 +01:00
blowfish.c
camellia.c
ccm.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
certs.c Revert "Remove unused TLS, NET, and X.509 files" 2020-03-19 13:36:33 +01:00
chacha20.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
chachapoly.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
cipher_wrap.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
cipher.c Remove redundant block_size validity check 2020-01-21 15:02:14 +01:00
cmac.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
CMakeLists.txt Fix the shared library build with CMake 2020-03-23 17:55:32 +01:00
ctr_drbg.c Merge branch 'development' into development-restricted 2020-01-15 15:55:11 +00:00
debug.c Revert "Remove unused TLS, NET, and X.509 files" 2020-03-19 13:36:33 +01:00
des.c
dhm.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
ecdh.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
ecdsa.c Fix incrementing pointer instead of value 2020-01-24 12:11:56 +01:00
ecjpake.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
ecp_curves.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
ecp.c Revert "ecp: Remove dependency on TLS and X.509" 2020-03-19 14:23:45 +01:00
entropy_poll.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
entropy.c Merge pull request #323 from yanesca/iotcrypt-942-initialise-return-values 2019-12-19 10:24:22 +00:00
error.c Add support for const error description strings 2020-04-09 01:44:52 -07:00
gcm.c Merge branch 'development' into development-restricted 2020-01-15 15:55:11 +00:00
havege.c
hkdf.c hkdf_expand: explicitly initialize t 2020-04-02 19:54:51 +02:00
hmac_drbg.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
Makefile makefile: remove unneeded priority dependency from library makefile 2020-03-26 07:18:42 -04:00
md2.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
md4.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
md5.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
md.c Revert "md: Remove dependency on X.509" 2020-03-19 14:23:45 +01:00
memory_buffer_alloc.c
net_sockets.c Revert "Remove unused TLS, NET, and X.509 files" 2020-03-19 13:36:33 +01:00
nist_kw.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
oid.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
padlock.c
pem.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
pk_wrap.c Remove mbedtls_psa_translate_ecc_group 2020-01-31 10:15:32 +01:00
pk.c pk: USE_PSA_CRYPTO: don't translate via the TLS ID 2020-01-31 10:15:32 +01:00
pkcs5.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
pkcs11.c Revert "Remove unused TLS, NET, and X.509 files" 2020-03-19 13:36:33 +01:00
pkcs12.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
pkparse.c Fix pkparse bug wrt MBEDTLS_RSA_ALT 2020-02-18 10:31:29 +01:00
pkwrite.c Change key types to a 16-bit encoding 2020-01-31 10:24:21 +01:00
platform_util.c
platform.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
poly1305.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
psa_crypto_core.h
psa_crypto_invasive.h
psa_crypto_its.h
psa_crypto_se.c
psa_crypto_se.h
psa_crypto_service_integration.h
psa_crypto_slot_management.c
psa_crypto_slot_management.h
psa_crypto_storage.c Change key types to a 16-bit encoding 2020-01-31 10:24:21 +01:00
psa_crypto_storage.h
psa_crypto.c Merge pull request #345 from gilles-peskine-arm/psa_mac_verify_finish-status 2020-02-03 13:55:11 +00:00
psa_its_file.c
ripemd160.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
rsa_internal.c
rsa.c Final review comments 2020-01-28 14:43:52 -05:00
sha1.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
sha256.c Initialise return values to an error 2019-12-03 16:07:18 +00:00
sha512.c Fix some whitespace issues 2020-01-29 09:46:49 +01:00
ssl_cache.c Revert "Remove unused TLS, NET, and X.509 files" 2020-03-19 13:36:33 +01:00
ssl_ciphersuites.c Rename identifiers containing double-underscore 2020-03-23 17:55:32 +01:00
ssl_cli.c Merge remote-tracking branch 'public/pr/2856' into development 2020-04-06 10:15:49 +02:00
ssl_cookie.c Revert "Remove unused TLS, NET, and X.509 files" 2020-03-19 13:36:33 +01:00
ssl_msg.c Improve debug logging of client hard reconnect 2020-03-31 12:33:57 +02:00
ssl_srv.c Merge remote-tracking branch 'public/pr/2856' into development 2020-04-06 10:15:49 +02:00
ssl_ticket.c Revert "Remove unused TLS, NET, and X.509 files" 2020-03-19 13:36:33 +01:00
ssl_tls.c Merge 'mbedtls/development' into merge-crypto-unremoved-20200304 2020-03-23 18:02:07 +01:00
threading.c
timing.c
version_features.c Refresh generated files 2020-03-23 21:54:07 +01:00
version.c
x509_create.c Revert "Remove unused TLS, NET, and X.509 files" 2020-03-19 13:36:33 +01:00
x509_crl.c Revert "Remove unused TLS, NET, and X.509 files" 2020-03-19 13:36:33 +01:00
x509_crt.c Revert "Remove unused TLS, NET, and X.509 files" 2020-03-19 13:36:33 +01:00
x509_csr.c Revert "Remove unused TLS, NET, and X.509 files" 2020-03-19 13:36:33 +01:00
x509.c Correct comment on the configuration option in x509.c 2020-03-27 17:16:15 +00:00
x509write_crt.c Revert "Remove unused TLS, NET, and X.509 files" 2020-03-19 13:36:33 +01:00
x509write_csr.c Revert "Remove unused TLS, NET, and X.509 files" 2020-03-19 13:36:33 +01:00
xtea.c