mirror of
https://github.com/espressif/mbedtls.git
synced 2026-08-26 13:11:17 +00:00
feat(mbedtls): update to version 4.0.0
This commit is contained in:
+1
-1
@@ -3,4 +3,4 @@
|
||||
url = https://github.com/Mbed-TLS/mbedtls-framework
|
||||
[submodule "tf-psa-crypto"]
|
||||
path = tf-psa-crypto
|
||||
url = https://github.com/Mbed-TLS/TF-PSA-Crypto.git
|
||||
url = https://gitlab.espressif.cn:6688/espressif/TF-PSA-Crypto
|
||||
|
||||
+6
-6
@@ -3,10 +3,10 @@ libmbed*
|
||||
*.vcxproj
|
||||
|
||||
###START_GENERATED_FILES###
|
||||
/error.c
|
||||
/mbedtls_config_check_before.h
|
||||
/mbedtls_config_check_final.h
|
||||
/mbedtls_config_check_user.h
|
||||
/version_features.c
|
||||
/ssl_debug_helpers_generated.c
|
||||
#/error.c
|
||||
#/mbedtls_config_check_before.h
|
||||
#/mbedtls_config_check_final.h
|
||||
#/mbedtls_config_check_user.h
|
||||
#/version_features.c
|
||||
#/ssl_debug_helpers_generated.c
|
||||
###END_GENERATED_FILES###
|
||||
|
||||
+509
@@ -0,0 +1,509 @@
|
||||
/*
|
||||
* Error message information
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "tf_psa_crypto_common.h"
|
||||
|
||||
#include "mbedtls/error.h"
|
||||
|
||||
#if defined(MBEDTLS_ERROR_C) || defined(MBEDTLS_ERROR_STRERROR_DUMMY)
|
||||
|
||||
#if defined(MBEDTLS_ERROR_C)
|
||||
|
||||
#include "mbedtls/platform.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(MBEDTLS_NET_C)
|
||||
#include "mbedtls/net_sockets.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_PKCS7_C)
|
||||
#include "mbedtls/pkcs7.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_TLS_C)
|
||||
#include "mbedtls/ssl.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_X509_USE_C) || \
|
||||
defined(MBEDTLS_X509_CREATE_C)
|
||||
#include "mbedtls/x509.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_AES_C)
|
||||
#include "mbedtls/private/aes.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ARIA_C)
|
||||
#include "mbedtls/private/aria.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_BIGNUM_C)
|
||||
#include "mbedtls/private/bignum.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_CAMELLIA_C)
|
||||
#include "mbedtls/private/camellia.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_CHACHAPOLY_C)
|
||||
#include "mbedtls/private/chachapoly.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_C)
|
||||
#include "mbedtls/private/cipher.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_CTR_DRBG_C)
|
||||
#include "mbedtls/private/ctr_drbg.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_C)
|
||||
#include "mbedtls/private/ecp.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ENTROPY_C)
|
||||
#include "mbedtls/private/entropy.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_HMAC_DRBG_C)
|
||||
#include "mbedtls/private/hmac_drbg.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_PKCS5_C)
|
||||
#include "mbedtls/private/pkcs5.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_RSA_C)
|
||||
#include "mbedtls/private/rsa.h"
|
||||
#endif
|
||||
|
||||
|
||||
static const char *mbedtls_high_level_strerr(int error_code)
|
||||
{
|
||||
int high_level_error_code;
|
||||
|
||||
if (error_code < 0) {
|
||||
error_code = -error_code;
|
||||
}
|
||||
|
||||
/* Extract the high-level part from the error code. */
|
||||
high_level_error_code = error_code & 0xFF80;
|
||||
|
||||
switch (high_level_error_code) {
|
||||
/* Begin Auto-Generated Code. */
|
||||
#if defined(MBEDTLS_PKCS7_C)
|
||||
case -(MBEDTLS_ERR_PKCS7_INVALID_FORMAT):
|
||||
return( "PKCS7 - The format is invalid, e.g. different type expected" );
|
||||
case -(MBEDTLS_ERR_PKCS7_FEATURE_UNAVAILABLE):
|
||||
return( "PKCS7 - Unavailable feature, e.g. anything other than signed data" );
|
||||
case -(MBEDTLS_ERR_PKCS7_INVALID_VERSION):
|
||||
return( "PKCS7 - The PKCS #7 version element is invalid or cannot be parsed" );
|
||||
case -(MBEDTLS_ERR_PKCS7_INVALID_CONTENT_INFO):
|
||||
return( "PKCS7 - The PKCS #7 content info is invalid or cannot be parsed" );
|
||||
case -(MBEDTLS_ERR_PKCS7_INVALID_ALG):
|
||||
return( "PKCS7 - The algorithm tag or value is invalid or cannot be parsed" );
|
||||
case -(MBEDTLS_ERR_PKCS7_INVALID_CERT):
|
||||
return( "PKCS7 - The certificate tag or value is invalid or cannot be parsed" );
|
||||
case -(MBEDTLS_ERR_PKCS7_INVALID_SIGNATURE):
|
||||
return( "PKCS7 - Error parsing the signature" );
|
||||
case -(MBEDTLS_ERR_PKCS7_INVALID_SIGNER_INFO):
|
||||
return( "PKCS7 - Error parsing the signer's info" );
|
||||
case -(MBEDTLS_ERR_PKCS7_CERT_DATE_INVALID):
|
||||
return( "PKCS7 - The PKCS #7 date issued/expired dates are invalid" );
|
||||
#endif /* MBEDTLS_PKCS7_C */
|
||||
|
||||
#if defined(MBEDTLS_SSL_TLS_C)
|
||||
case -(MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS):
|
||||
return( "SSL - A cryptographic operation is in progress. Try again later" );
|
||||
case -(MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE):
|
||||
return( "SSL - The requested feature is not available" );
|
||||
case -(MBEDTLS_ERR_SSL_INVALID_MAC):
|
||||
return( "SSL - Verification of the message MAC failed" );
|
||||
case -(MBEDTLS_ERR_SSL_INVALID_RECORD):
|
||||
return( "SSL - An invalid SSL record was received" );
|
||||
case -(MBEDTLS_ERR_SSL_CONN_EOF):
|
||||
return( "SSL - The connection indicated an EOF" );
|
||||
case -(MBEDTLS_ERR_SSL_DECODE_ERROR):
|
||||
return( "SSL - A message could not be parsed due to a syntactic error" );
|
||||
case -(MBEDTLS_ERR_SSL_NO_RNG):
|
||||
return( "SSL - No RNG was provided to the SSL module" );
|
||||
case -(MBEDTLS_ERR_SSL_NO_CLIENT_CERTIFICATE):
|
||||
return( "SSL - No client certification received from the client, but required by the authentication mode" );
|
||||
case -(MBEDTLS_ERR_SSL_UNSUPPORTED_EXTENSION):
|
||||
return( "SSL - Client received an extended server hello containing an unsupported extension" );
|
||||
case -(MBEDTLS_ERR_SSL_NO_APPLICATION_PROTOCOL):
|
||||
return( "SSL - No ALPN protocols supported that the client advertises" );
|
||||
case -(MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED):
|
||||
return( "SSL - The own private key or pre-shared key is not set, but needed" );
|
||||
case -(MBEDTLS_ERR_SSL_CA_CHAIN_REQUIRED):
|
||||
return( "SSL - No CA Chain is set, but required to operate" );
|
||||
case -(MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE):
|
||||
return( "SSL - An unexpected message was received from our peer" );
|
||||
case -(MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE):
|
||||
return( "SSL - A fatal alert message was received from our peer" );
|
||||
case -(MBEDTLS_ERR_SSL_UNRECOGNIZED_NAME):
|
||||
return( "SSL - No server could be identified matching the client's SNI" );
|
||||
case -(MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY):
|
||||
return( "SSL - The peer notified us that the connection is going to be closed" );
|
||||
case -(MBEDTLS_ERR_SSL_BAD_CERTIFICATE):
|
||||
return( "SSL - Processing of the Certificate handshake message failed" );
|
||||
case -(MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET):
|
||||
return( "SSL - * Received NewSessionTicket Post Handshake Message. This error code is experimental and may be changed or removed without notice" );
|
||||
case -(MBEDTLS_ERR_SSL_CANNOT_READ_EARLY_DATA):
|
||||
return( "SSL - Not possible to read early data" );
|
||||
case -(MBEDTLS_ERR_SSL_RECEIVED_EARLY_DATA):
|
||||
return( "SSL - * Early data has been received as part of an on-going handshake. This error code can be returned only on server side if and only if early data has been enabled by means of the mbedtls_ssl_conf_early_data() API. This error code can then be returned by mbedtls_ssl_handshake(), mbedtls_ssl_handshake_step(), mbedtls_ssl_read() or mbedtls_ssl_write() if early data has been received as part of the handshake sequence they triggered. To read the early data, call mbedtls_ssl_read_early_data()" );
|
||||
case -(MBEDTLS_ERR_SSL_CANNOT_WRITE_EARLY_DATA):
|
||||
return( "SSL - Not possible to write early data" );
|
||||
case -(MBEDTLS_ERR_SSL_CACHE_ENTRY_NOT_FOUND):
|
||||
return( "SSL - Cache entry not found" );
|
||||
case -(MBEDTLS_ERR_SSL_HW_ACCEL_FAILED):
|
||||
return( "SSL - Hardware acceleration function returned with error" );
|
||||
case -(MBEDTLS_ERR_SSL_HW_ACCEL_FALLTHROUGH):
|
||||
return( "SSL - Hardware acceleration function skipped / left alone data" );
|
||||
case -(MBEDTLS_ERR_SSL_BAD_PROTOCOL_VERSION):
|
||||
return( "SSL - Handshake protocol not within min/max boundaries" );
|
||||
case -(MBEDTLS_ERR_SSL_HANDSHAKE_FAILURE):
|
||||
return( "SSL - The handshake negotiation failed" );
|
||||
case -(MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED):
|
||||
return( "SSL - Session ticket has expired" );
|
||||
case -(MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH):
|
||||
return( "SSL - Public key type mismatch (eg, asked for RSA key exchange and presented EC key)" );
|
||||
case -(MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY):
|
||||
return( "SSL - Unknown identity received (eg, PSK identity)" );
|
||||
case -(MBEDTLS_ERR_SSL_INTERNAL_ERROR):
|
||||
return( "SSL - Internal error (eg, unexpected failure in lower-level module)" );
|
||||
case -(MBEDTLS_ERR_SSL_COUNTER_WRAPPING):
|
||||
return( "SSL - A counter would wrap (eg, too many messages exchanged)" );
|
||||
case -(MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO):
|
||||
return( "SSL - Unexpected message at ServerHello in renegotiation" );
|
||||
case -(MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED):
|
||||
return( "SSL - DTLS client must retry for hello verification" );
|
||||
case -(MBEDTLS_ERR_SSL_WANT_READ):
|
||||
return( "SSL - No data of requested type currently available on underlying transport" );
|
||||
case -(MBEDTLS_ERR_SSL_WANT_WRITE):
|
||||
return( "SSL - Connection requires a write call" );
|
||||
case -(MBEDTLS_ERR_SSL_TIMEOUT):
|
||||
return( "SSL - The operation timed out" );
|
||||
case -(MBEDTLS_ERR_SSL_CLIENT_RECONNECT):
|
||||
return( "SSL - The client initiated a reconnect from the same port" );
|
||||
case -(MBEDTLS_ERR_SSL_UNEXPECTED_RECORD):
|
||||
return( "SSL - Record header looks valid but is not expected" );
|
||||
case -(MBEDTLS_ERR_SSL_NON_FATAL):
|
||||
return( "SSL - The alert message received indicates a non-fatal error" );
|
||||
case -(MBEDTLS_ERR_SSL_ILLEGAL_PARAMETER):
|
||||
return( "SSL - A field in a message was incorrect or inconsistent with other fields" );
|
||||
case -(MBEDTLS_ERR_SSL_CONTINUE_PROCESSING):
|
||||
return( "SSL - Internal-only message signaling that further message-processing should be done" );
|
||||
case -(MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS):
|
||||
return( "SSL - The asynchronous operation is not completed yet" );
|
||||
case -(MBEDTLS_ERR_SSL_EARLY_MESSAGE):
|
||||
return( "SSL - Internal-only message signaling that a message arrived early" );
|
||||
case -(MBEDTLS_ERR_SSL_UNEXPECTED_CID):
|
||||
return( "SSL - An encrypted DTLS-frame with an unexpected CID was received" );
|
||||
case -(MBEDTLS_ERR_SSL_VERSION_MISMATCH):
|
||||
return( "SSL - An operation failed due to an unexpected version or configuration" );
|
||||
case -(MBEDTLS_ERR_SSL_BAD_CONFIG):
|
||||
return( "SSL - Invalid value in SSL config" );
|
||||
case -(MBEDTLS_ERR_SSL_CERTIFICATE_VERIFICATION_WITHOUT_HOSTNAME):
|
||||
return( "SSL - Attempt to verify a certificate without an expected hostname. This is usually insecure. In TLS clients, when a client authenticates a server through its certificate, the client normally checks three things: - the certificate chain must be valid; - the chain must start from a trusted CA; - the certificate must cover the server name that is expected by the client. Omitting any of these checks is generally insecure, and can allow a malicious server to impersonate a legitimate server. The third check may be safely skipped in some unusual scenarios, such as networks where eavesdropping is a risk but not active attacks, or a private PKI where the client equally trusts all servers that are accredited by the root CA. You should call mbedtls_ssl_set_hostname() with the expected server name before starting a TLS handshake on a client (unless the client is set up to only use PSK-based authentication, which does not rely on the host name). If you have determined that server name verification is not required for security in your scenario, call mbedtls_ssl_set_hostname() with \\p NULL as the server name. This error is raised if all of the following conditions are met: - A TLS client is configured with the authentication mode #MBEDTLS_SSL_VERIFY_REQUIRED (default). - Certificate authentication is enabled. - The client does not call mbedtls_ssl_set_hostname()" );
|
||||
#endif /* MBEDTLS_SSL_TLS_C */
|
||||
|
||||
#if defined(MBEDTLS_X509_USE_C) || \
|
||||
defined(MBEDTLS_X509_CREATE_C)
|
||||
case -(MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE):
|
||||
return( "X509 - Unavailable feature, e.g. RSA hashing/encryption combination" );
|
||||
case -(MBEDTLS_ERR_X509_UNKNOWN_OID):
|
||||
return( "X509 - Requested OID is unknown" );
|
||||
case -(MBEDTLS_ERR_X509_INVALID_FORMAT):
|
||||
return( "X509 - The CRT/CRL/CSR format is invalid, e.g. different type expected" );
|
||||
case -(MBEDTLS_ERR_X509_INVALID_VERSION):
|
||||
return( "X509 - The CRT/CRL/CSR version element is invalid" );
|
||||
case -(MBEDTLS_ERR_X509_INVALID_SERIAL):
|
||||
return( "X509 - The serial tag or value is invalid" );
|
||||
case -(MBEDTLS_ERR_X509_INVALID_ALG):
|
||||
return( "X509 - The algorithm tag or value is invalid" );
|
||||
case -(MBEDTLS_ERR_X509_INVALID_NAME):
|
||||
return( "X509 - The name tag or value is invalid" );
|
||||
case -(MBEDTLS_ERR_X509_INVALID_DATE):
|
||||
return( "X509 - The date tag or value is invalid" );
|
||||
case -(MBEDTLS_ERR_X509_INVALID_SIGNATURE):
|
||||
return( "X509 - The signature tag or value invalid" );
|
||||
case -(MBEDTLS_ERR_X509_INVALID_EXTENSIONS):
|
||||
return( "X509 - The extension tag or value is invalid" );
|
||||
case -(MBEDTLS_ERR_X509_UNKNOWN_VERSION):
|
||||
return( "X509 - CRT/CRL/CSR has an unsupported version number" );
|
||||
case -(MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG):
|
||||
return( "X509 - Signature algorithm (oid) is unsupported" );
|
||||
case -(MBEDTLS_ERR_X509_SIG_MISMATCH):
|
||||
return( "X509 - Signature algorithms do not match. (see \\c ::mbedtls_x509_crt sig_oid)" );
|
||||
case -(MBEDTLS_ERR_X509_CERT_VERIFY_FAILED):
|
||||
return( "X509 - Certificate verification failed, e.g. CRL, CA or signature check failed" );
|
||||
case -(MBEDTLS_ERR_X509_CERT_UNKNOWN_FORMAT):
|
||||
return( "X509 - Format not recognized as DER or PEM" );
|
||||
case -(MBEDTLS_ERR_X509_BAD_INPUT_DATA):
|
||||
return( "X509 - Input invalid" );
|
||||
case -(MBEDTLS_ERR_X509_FILE_IO_ERROR):
|
||||
return( "X509 - Read/write of file failed" );
|
||||
case -(MBEDTLS_ERR_X509_FATAL_ERROR):
|
||||
return( "X509 - A fatal error occurred, eg the chain is too long or the vrfy callback failed" );
|
||||
#endif /* MBEDTLS_X509_USE_C ||
|
||||
MBEDTLS_X509_CREATE_C */
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_C)
|
||||
case -(MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE):
|
||||
return( "CIPHER - The selected feature is not available" );
|
||||
case -(MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED):
|
||||
return( "CIPHER - Decryption of block requires a full block" );
|
||||
case -(MBEDTLS_ERR_CIPHER_INVALID_CONTEXT):
|
||||
return( "CIPHER - The context is invalid. For example, because it was freed" );
|
||||
#endif /* MBEDTLS_CIPHER_C */
|
||||
|
||||
#if defined(MBEDTLS_ECP_C)
|
||||
case -(MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE):
|
||||
return( "ECP - The requested feature is not available, for example, the requested curve is not supported" );
|
||||
case -(MBEDTLS_ERR_ECP_RANDOM_FAILED):
|
||||
return( "ECP - Generation of random value, such as ephemeral key, failed" );
|
||||
case -(MBEDTLS_ERR_ECP_INVALID_KEY):
|
||||
return( "ECP - Invalid private or public key" );
|
||||
#endif /* MBEDTLS_ECP_C */
|
||||
|
||||
#if defined(MBEDTLS_PKCS5_C)
|
||||
case -(MBEDTLS_ERR_PKCS5_INVALID_FORMAT):
|
||||
return( "PKCS5 - Unexpected ASN.1 data" );
|
||||
case -(MBEDTLS_ERR_PKCS5_FEATURE_UNAVAILABLE):
|
||||
return( "PKCS5 - Requested encryption or digest alg not available" );
|
||||
case -(MBEDTLS_ERR_PKCS5_PASSWORD_MISMATCH):
|
||||
return( "PKCS5 - Given private key password does not allow for correct decryption" );
|
||||
#endif /* MBEDTLS_PKCS5_C */
|
||||
|
||||
#if defined(MBEDTLS_RSA_C)
|
||||
case -(MBEDTLS_ERR_RSA_KEY_GEN_FAILED):
|
||||
return( "RSA - Something failed during generation of a key" );
|
||||
case -(MBEDTLS_ERR_RSA_KEY_CHECK_FAILED):
|
||||
return( "RSA - Key failed to pass the validity check of the library" );
|
||||
case -(MBEDTLS_ERR_RSA_PUBLIC_FAILED):
|
||||
return( "RSA - The public key operation failed" );
|
||||
case -(MBEDTLS_ERR_RSA_PRIVATE_FAILED):
|
||||
return( "RSA - The private key operation failed" );
|
||||
case -(MBEDTLS_ERR_RSA_RNG_FAILED):
|
||||
return( "RSA - The random generator failed to generate non-zeros" );
|
||||
#endif /* MBEDTLS_RSA_C */
|
||||
/* End Auto-Generated Code. */
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *mbedtls_low_level_strerr(int error_code)
|
||||
{
|
||||
int low_level_error_code;
|
||||
|
||||
if (error_code < 0) {
|
||||
error_code = -error_code;
|
||||
}
|
||||
|
||||
/* Extract the low-level part from the error code. */
|
||||
low_level_error_code = error_code & ~0xFF80;
|
||||
|
||||
switch (low_level_error_code) {
|
||||
/* Begin Auto-Generated Code. */
|
||||
#if defined(MBEDTLS_NET_C)
|
||||
case -(MBEDTLS_ERR_NET_SOCKET_FAILED):
|
||||
return( "NET - Failed to open a socket" );
|
||||
case -(MBEDTLS_ERR_NET_CONNECT_FAILED):
|
||||
return( "NET - The connection to the given server / port failed" );
|
||||
case -(MBEDTLS_ERR_NET_BIND_FAILED):
|
||||
return( "NET - Binding of the socket failed" );
|
||||
case -(MBEDTLS_ERR_NET_LISTEN_FAILED):
|
||||
return( "NET - Could not listen on the socket" );
|
||||
case -(MBEDTLS_ERR_NET_ACCEPT_FAILED):
|
||||
return( "NET - Could not accept the incoming connection" );
|
||||
case -(MBEDTLS_ERR_NET_RECV_FAILED):
|
||||
return( "NET - Reading information from the socket failed" );
|
||||
case -(MBEDTLS_ERR_NET_SEND_FAILED):
|
||||
return( "NET - Sending information through the socket failed" );
|
||||
case -(MBEDTLS_ERR_NET_CONN_RESET):
|
||||
return( "NET - Connection was reset by peer" );
|
||||
case -(MBEDTLS_ERR_NET_UNKNOWN_HOST):
|
||||
return( "NET - Failed to get an IP address for the given hostname" );
|
||||
case -(MBEDTLS_ERR_NET_INVALID_CONTEXT):
|
||||
return( "NET - The context is invalid, eg because it was free()ed" );
|
||||
case -(MBEDTLS_ERR_NET_POLL_FAILED):
|
||||
return( "NET - Polling the net context failed" );
|
||||
case -(MBEDTLS_ERR_NET_BAD_INPUT_DATA):
|
||||
return( "NET - Input invalid" );
|
||||
#endif /* MBEDTLS_NET_C */
|
||||
|
||||
#if defined(MBEDTLS_AES_C)
|
||||
case -(MBEDTLS_ERR_AES_INVALID_KEY_LENGTH):
|
||||
return( "AES - Invalid key length" );
|
||||
case -(MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH):
|
||||
return( "AES - Invalid data input length" );
|
||||
#endif /* MBEDTLS_AES_C */
|
||||
|
||||
#if defined(MBEDTLS_ARIA_C)
|
||||
case -(MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH):
|
||||
return( "ARIA - Invalid data input length" );
|
||||
#endif /* MBEDTLS_ARIA_C */
|
||||
|
||||
#if defined(MBEDTLS_BIGNUM_C)
|
||||
case -(MBEDTLS_ERR_MPI_FILE_IO_ERROR):
|
||||
return( "BIGNUM - An error occurred while reading from or writing to a file" );
|
||||
case -(MBEDTLS_ERR_MPI_INVALID_CHARACTER):
|
||||
return( "BIGNUM - There is an invalid character in the digit string" );
|
||||
case -(MBEDTLS_ERR_MPI_NEGATIVE_VALUE):
|
||||
return( "BIGNUM - The input arguments are negative or result in illegal output" );
|
||||
case -(MBEDTLS_ERR_MPI_DIVISION_BY_ZERO):
|
||||
return( "BIGNUM - The input argument for division is zero, which is not allowed" );
|
||||
case -(MBEDTLS_ERR_MPI_NOT_ACCEPTABLE):
|
||||
return( "BIGNUM - The input arguments are not acceptable" );
|
||||
#endif /* MBEDTLS_BIGNUM_C */
|
||||
|
||||
#if defined(MBEDTLS_CAMELLIA_C)
|
||||
case -(MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH):
|
||||
return( "CAMELLIA - Invalid data input length" );
|
||||
#endif /* MBEDTLS_CAMELLIA_C */
|
||||
|
||||
#if defined(MBEDTLS_CHACHAPOLY_C)
|
||||
case -(MBEDTLS_ERR_CHACHAPOLY_BAD_STATE):
|
||||
return( "CHACHAPOLY - The requested operation is not permitted in the current state" );
|
||||
#endif /* MBEDTLS_CHACHAPOLY_C */
|
||||
|
||||
#if defined(MBEDTLS_CTR_DRBG_C)
|
||||
case -(MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED):
|
||||
return( "CTR_DRBG - The entropy source failed" );
|
||||
case -(MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG):
|
||||
return( "CTR_DRBG - The requested random buffer length is too big" );
|
||||
case -(MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG):
|
||||
return( "CTR_DRBG - The input (entropy + additional data) is too large" );
|
||||
case -(MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR):
|
||||
return( "CTR_DRBG - Read or write error in file" );
|
||||
#endif /* MBEDTLS_CTR_DRBG_C */
|
||||
|
||||
#if defined(MBEDTLS_ENTROPY_C)
|
||||
case -(MBEDTLS_ERR_ENTROPY_MAX_SOURCES):
|
||||
return( "ENTROPY - No more sources can be added" );
|
||||
case -(MBEDTLS_ERR_ENTROPY_NO_SOURCES_DEFINED):
|
||||
return( "ENTROPY - No sources have been added to poll" );
|
||||
case -(MBEDTLS_ERR_ENTROPY_NO_STRONG_SOURCE):
|
||||
return( "ENTROPY - No strong sources have been added to poll" );
|
||||
case -(MBEDTLS_ERR_ENTROPY_FILE_IO_ERROR):
|
||||
return( "ENTROPY - Read/write error in file" );
|
||||
#endif /* MBEDTLS_ENTROPY_C */
|
||||
|
||||
#if defined(MBEDTLS_HMAC_DRBG_C)
|
||||
case -(MBEDTLS_ERR_HMAC_DRBG_REQUEST_TOO_BIG):
|
||||
return( "HMAC_DRBG - Too many random requested in single call" );
|
||||
case -(MBEDTLS_ERR_HMAC_DRBG_INPUT_TOO_BIG):
|
||||
return( "HMAC_DRBG - Input too large (Entropy + additional)" );
|
||||
case -(MBEDTLS_ERR_HMAC_DRBG_FILE_IO_ERROR):
|
||||
return( "HMAC_DRBG - Read/write error in file" );
|
||||
case -(MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED):
|
||||
return( "HMAC_DRBG - The entropy source failed" );
|
||||
#endif /* MBEDTLS_HMAC_DRBG_C */
|
||||
/* End Auto-Generated Code. */
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void mbedtls_strerror(int ret, char *buf, size_t buflen)
|
||||
{
|
||||
size_t len;
|
||||
int use_ret;
|
||||
const char *high_level_error_description = NULL;
|
||||
const char *low_level_error_description = NULL;
|
||||
|
||||
if (buflen == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
memset(buf, 0x00, buflen);
|
||||
|
||||
if (ret < 0) {
|
||||
ret = -ret;
|
||||
}
|
||||
|
||||
if (ret & 0xFF80) {
|
||||
use_ret = ret & 0xFF80;
|
||||
|
||||
// Translate high level error code.
|
||||
high_level_error_description = mbedtls_high_level_strerr(ret);
|
||||
|
||||
if (high_level_error_description == NULL) {
|
||||
mbedtls_snprintf(buf, buflen, "UNKNOWN ERROR CODE (%04X)", (unsigned int) use_ret);
|
||||
} else {
|
||||
mbedtls_snprintf(buf, buflen, "%s", high_level_error_description);
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SSL_TLS_C)
|
||||
// Early return in case of a fatal error - do not try to translate low
|
||||
// level code.
|
||||
if (use_ret == -(MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE)) {
|
||||
return;
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_TLS_C */
|
||||
}
|
||||
|
||||
use_ret = ret & ~0xFF80;
|
||||
|
||||
if (use_ret == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If high level code is present, make a concatenation between both
|
||||
// error strings.
|
||||
//
|
||||
len = strlen(buf);
|
||||
|
||||
if (len > 0) {
|
||||
if (buflen - len < 5) {
|
||||
return;
|
||||
}
|
||||
|
||||
mbedtls_snprintf(buf + len, buflen - len, " : ");
|
||||
|
||||
buf += len + 3;
|
||||
buflen -= len + 3;
|
||||
}
|
||||
|
||||
// Translate low level error code.
|
||||
low_level_error_description = mbedtls_low_level_strerr(ret);
|
||||
|
||||
if (low_level_error_description == NULL) {
|
||||
mbedtls_snprintf(buf, buflen, "UNKNOWN ERROR CODE (%04X)", (unsigned int) use_ret);
|
||||
} else {
|
||||
mbedtls_snprintf(buf, buflen, "%s", low_level_error_description);
|
||||
}
|
||||
}
|
||||
|
||||
#else /* MBEDTLS_ERROR_C */
|
||||
|
||||
/*
|
||||
* Provide a dummy implementation when MBEDTLS_ERROR_C is not defined
|
||||
*/
|
||||
void mbedtls_strerror(int ret, char *buf, size_t buflen)
|
||||
{
|
||||
((void) ret);
|
||||
|
||||
if (buflen > 0) {
|
||||
buf[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* MBEDTLS_ERROR_C */
|
||||
|
||||
#endif /* MBEDTLS_ERROR_C || MBEDTLS_ERROR_STRERROR_DUMMY */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
/* mbedtls_config_check_final.h (generated part of mbedtls_config.c). */
|
||||
/* Automatically generated by generate_config_checks.py. Do not edit! */
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_CHECK_BYPASS) //no-check-names
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#endif /* !defined(MBEDTLS_CONFIG_CHECK_BYPASS) */ //no-check-names
|
||||
|
||||
/* End of automatically generated mbedtls_config_check_final.h */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,243 @@
|
||||
/* Automatically generated by generate_ssl_debug_helpers.py. DO NOT EDIT. */
|
||||
|
||||
/**
|
||||
* \file ssl_debug_helpers_generated.c
|
||||
*
|
||||
* \brief Automatically generated helper functions for debugging
|
||||
*/
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ssl_misc.h"
|
||||
|
||||
#if defined(MBEDTLS_DEBUG_C)
|
||||
|
||||
#include "ssl_debug_helpers.h"
|
||||
|
||||
|
||||
const char *mbedtls_ssl_named_group_to_str( uint16_t in )
|
||||
{
|
||||
switch( in )
|
||||
{
|
||||
case MBEDTLS_SSL_IANA_TLS_GROUP_SECP256K1:
|
||||
return "secp256k1";
|
||||
case MBEDTLS_SSL_IANA_TLS_GROUP_SECP256R1:
|
||||
return "secp256r1";
|
||||
case MBEDTLS_SSL_IANA_TLS_GROUP_SECP384R1:
|
||||
return "secp384r1";
|
||||
case MBEDTLS_SSL_IANA_TLS_GROUP_SECP521R1:
|
||||
return "secp521r1";
|
||||
case MBEDTLS_SSL_IANA_TLS_GROUP_BP256R1:
|
||||
return "bp256r1";
|
||||
case MBEDTLS_SSL_IANA_TLS_GROUP_BP384R1:
|
||||
return "bp384r1";
|
||||
case MBEDTLS_SSL_IANA_TLS_GROUP_BP512R1:
|
||||
return "bp512r1";
|
||||
case MBEDTLS_SSL_IANA_TLS_GROUP_X25519:
|
||||
return "x25519";
|
||||
case MBEDTLS_SSL_IANA_TLS_GROUP_X448:
|
||||
return "x448";
|
||||
case MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE2048:
|
||||
return "ffdhe2048";
|
||||
case MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE3072:
|
||||
return "ffdhe3072";
|
||||
case MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE4096:
|
||||
return "ffdhe4096";
|
||||
case MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE6144:
|
||||
return "ffdhe6144";
|
||||
case MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE8192:
|
||||
return "ffdhe8192";
|
||||
};
|
||||
|
||||
return "UNKNOWN";
|
||||
}
|
||||
const char *mbedtls_ssl_sig_alg_to_str( uint16_t in )
|
||||
{
|
||||
switch( in )
|
||||
{
|
||||
case MBEDTLS_TLS1_3_SIG_RSA_PKCS1_SHA256:
|
||||
return "rsa_pkcs1_sha256";
|
||||
case MBEDTLS_TLS1_3_SIG_RSA_PKCS1_SHA384:
|
||||
return "rsa_pkcs1_sha384";
|
||||
case MBEDTLS_TLS1_3_SIG_RSA_PKCS1_SHA512:
|
||||
return "rsa_pkcs1_sha512";
|
||||
case MBEDTLS_TLS1_3_SIG_ECDSA_SECP256R1_SHA256:
|
||||
return "ecdsa_secp256r1_sha256";
|
||||
case MBEDTLS_TLS1_3_SIG_ECDSA_SECP384R1_SHA384:
|
||||
return "ecdsa_secp384r1_sha384";
|
||||
case MBEDTLS_TLS1_3_SIG_ECDSA_SECP521R1_SHA512:
|
||||
return "ecdsa_secp521r1_sha512";
|
||||
case MBEDTLS_TLS1_3_SIG_RSA_PSS_RSAE_SHA256:
|
||||
return "rsa_pss_rsae_sha256";
|
||||
case MBEDTLS_TLS1_3_SIG_RSA_PSS_RSAE_SHA384:
|
||||
return "rsa_pss_rsae_sha384";
|
||||
case MBEDTLS_TLS1_3_SIG_RSA_PSS_RSAE_SHA512:
|
||||
return "rsa_pss_rsae_sha512";
|
||||
case MBEDTLS_TLS1_3_SIG_ED25519:
|
||||
return "ed25519";
|
||||
case MBEDTLS_TLS1_3_SIG_ED448:
|
||||
return "ed448";
|
||||
case MBEDTLS_TLS1_3_SIG_RSA_PSS_PSS_SHA256:
|
||||
return "rsa_pss_pss_sha256";
|
||||
case MBEDTLS_TLS1_3_SIG_RSA_PSS_PSS_SHA384:
|
||||
return "rsa_pss_pss_sha384";
|
||||
case MBEDTLS_TLS1_3_SIG_RSA_PSS_PSS_SHA512:
|
||||
return "rsa_pss_pss_sha512";
|
||||
case MBEDTLS_TLS1_3_SIG_RSA_PKCS1_SHA1:
|
||||
return "rsa_pkcs1_sha1";
|
||||
case MBEDTLS_TLS1_3_SIG_ECDSA_SHA1:
|
||||
return "ecdsa_sha1";
|
||||
case MBEDTLS_TLS1_3_SIG_NONE:
|
||||
return "none";
|
||||
};
|
||||
|
||||
return "UNKNOWN";
|
||||
}
|
||||
const char *mbedtls_ssl_states_str( mbedtls_ssl_states in )
|
||||
{
|
||||
switch (in) {
|
||||
case MBEDTLS_SSL_HELLO_REQUEST:
|
||||
return "MBEDTLS_SSL_HELLO_REQUEST";
|
||||
case MBEDTLS_SSL_CLIENT_HELLO:
|
||||
return "MBEDTLS_SSL_CLIENT_HELLO";
|
||||
case MBEDTLS_SSL_SERVER_HELLO:
|
||||
return "MBEDTLS_SSL_SERVER_HELLO";
|
||||
case MBEDTLS_SSL_SERVER_CERTIFICATE:
|
||||
return "MBEDTLS_SSL_SERVER_CERTIFICATE";
|
||||
case MBEDTLS_SSL_SERVER_KEY_EXCHANGE:
|
||||
return "MBEDTLS_SSL_SERVER_KEY_EXCHANGE";
|
||||
case MBEDTLS_SSL_CERTIFICATE_REQUEST:
|
||||
return "MBEDTLS_SSL_CERTIFICATE_REQUEST";
|
||||
case MBEDTLS_SSL_SERVER_HELLO_DONE:
|
||||
return "MBEDTLS_SSL_SERVER_HELLO_DONE";
|
||||
case MBEDTLS_SSL_CLIENT_CERTIFICATE:
|
||||
return "MBEDTLS_SSL_CLIENT_CERTIFICATE";
|
||||
case MBEDTLS_SSL_CLIENT_KEY_EXCHANGE:
|
||||
return "MBEDTLS_SSL_CLIENT_KEY_EXCHANGE";
|
||||
case MBEDTLS_SSL_CERTIFICATE_VERIFY:
|
||||
return "MBEDTLS_SSL_CERTIFICATE_VERIFY";
|
||||
case MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC:
|
||||
return "MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC";
|
||||
case MBEDTLS_SSL_CLIENT_FINISHED:
|
||||
return "MBEDTLS_SSL_CLIENT_FINISHED";
|
||||
case MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC:
|
||||
return "MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC";
|
||||
case MBEDTLS_SSL_SERVER_FINISHED:
|
||||
return "MBEDTLS_SSL_SERVER_FINISHED";
|
||||
case MBEDTLS_SSL_FLUSH_BUFFERS:
|
||||
return "MBEDTLS_SSL_FLUSH_BUFFERS";
|
||||
case MBEDTLS_SSL_HANDSHAKE_WRAPUP:
|
||||
return "MBEDTLS_SSL_HANDSHAKE_WRAPUP";
|
||||
case MBEDTLS_SSL_NEW_SESSION_TICKET:
|
||||
return "MBEDTLS_SSL_NEW_SESSION_TICKET";
|
||||
case MBEDTLS_SSL_SERVER_HELLO_VERIFY_REQUEST_SENT:
|
||||
return "MBEDTLS_SSL_SERVER_HELLO_VERIFY_REQUEST_SENT";
|
||||
case MBEDTLS_SSL_HELLO_RETRY_REQUEST:
|
||||
return "MBEDTLS_SSL_HELLO_RETRY_REQUEST";
|
||||
case MBEDTLS_SSL_ENCRYPTED_EXTENSIONS:
|
||||
return "MBEDTLS_SSL_ENCRYPTED_EXTENSIONS";
|
||||
case MBEDTLS_SSL_END_OF_EARLY_DATA:
|
||||
return "MBEDTLS_SSL_END_OF_EARLY_DATA";
|
||||
case MBEDTLS_SSL_CLIENT_CERTIFICATE_VERIFY:
|
||||
return "MBEDTLS_SSL_CLIENT_CERTIFICATE_VERIFY";
|
||||
case MBEDTLS_SSL_CLIENT_CCS_AFTER_SERVER_FINISHED:
|
||||
return "MBEDTLS_SSL_CLIENT_CCS_AFTER_SERVER_FINISHED";
|
||||
case MBEDTLS_SSL_CLIENT_CCS_BEFORE_2ND_CLIENT_HELLO:
|
||||
return "MBEDTLS_SSL_CLIENT_CCS_BEFORE_2ND_CLIENT_HELLO";
|
||||
case MBEDTLS_SSL_SERVER_CCS_AFTER_SERVER_HELLO:
|
||||
return "MBEDTLS_SSL_SERVER_CCS_AFTER_SERVER_HELLO";
|
||||
case MBEDTLS_SSL_CLIENT_CCS_AFTER_CLIENT_HELLO:
|
||||
return "MBEDTLS_SSL_CLIENT_CCS_AFTER_CLIENT_HELLO";
|
||||
case MBEDTLS_SSL_SERVER_CCS_AFTER_HELLO_RETRY_REQUEST:
|
||||
return "MBEDTLS_SSL_SERVER_CCS_AFTER_HELLO_RETRY_REQUEST";
|
||||
case MBEDTLS_SSL_HANDSHAKE_OVER:
|
||||
return "MBEDTLS_SSL_HANDSHAKE_OVER";
|
||||
case MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET:
|
||||
return "MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET";
|
||||
case MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET_FLUSH:
|
||||
return "MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET_FLUSH";
|
||||
default:
|
||||
return "UNKNOWN_VALUE";
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SSL_EARLY_DATA) && defined(MBEDTLS_SSL_CLI_C)
|
||||
const char *mbedtls_ssl_early_data_status_str( mbedtls_ssl_early_data_status in )
|
||||
{
|
||||
switch (in) {
|
||||
case MBEDTLS_SSL_EARLY_DATA_STATUS_NOT_INDICATED:
|
||||
return "MBEDTLS_SSL_EARLY_DATA_STATUS_NOT_INDICATED";
|
||||
case MBEDTLS_SSL_EARLY_DATA_STATUS_ACCEPTED:
|
||||
return "MBEDTLS_SSL_EARLY_DATA_STATUS_ACCEPTED";
|
||||
case MBEDTLS_SSL_EARLY_DATA_STATUS_REJECTED:
|
||||
return "MBEDTLS_SSL_EARLY_DATA_STATUS_REJECTED";
|
||||
default:
|
||||
return "UNKNOWN_VALUE";
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* defined(MBEDTLS_SSL_EARLY_DATA) && defined(MBEDTLS_SSL_CLI_C) */
|
||||
const char *mbedtls_ssl_protocol_version_str( mbedtls_ssl_protocol_version in )
|
||||
{
|
||||
switch (in) {
|
||||
case MBEDTLS_SSL_VERSION_UNKNOWN:
|
||||
return "MBEDTLS_SSL_VERSION_UNKNOWN";
|
||||
case MBEDTLS_SSL_VERSION_TLS1_2:
|
||||
return "MBEDTLS_SSL_VERSION_TLS1_2";
|
||||
case MBEDTLS_SSL_VERSION_TLS1_3:
|
||||
return "MBEDTLS_SSL_VERSION_TLS1_3";
|
||||
default:
|
||||
return "UNKNOWN_VALUE";
|
||||
}
|
||||
}
|
||||
|
||||
const char *mbedtls_tls_prf_types_str( mbedtls_tls_prf_types in )
|
||||
{
|
||||
switch (in) {
|
||||
case MBEDTLS_SSL_TLS_PRF_NONE:
|
||||
return "MBEDTLS_SSL_TLS_PRF_NONE";
|
||||
case MBEDTLS_SSL_TLS_PRF_SHA384:
|
||||
return "MBEDTLS_SSL_TLS_PRF_SHA384";
|
||||
case MBEDTLS_SSL_TLS_PRF_SHA256:
|
||||
return "MBEDTLS_SSL_TLS_PRF_SHA256";
|
||||
case MBEDTLS_SSL_HKDF_EXPAND_SHA384:
|
||||
return "MBEDTLS_SSL_HKDF_EXPAND_SHA384";
|
||||
case MBEDTLS_SSL_HKDF_EXPAND_SHA256:
|
||||
return "MBEDTLS_SSL_HKDF_EXPAND_SHA256";
|
||||
default:
|
||||
return "UNKNOWN_VALUE";
|
||||
}
|
||||
}
|
||||
|
||||
const char *mbedtls_ssl_key_export_type_str( mbedtls_ssl_key_export_type in )
|
||||
{
|
||||
switch (in) {
|
||||
case MBEDTLS_SSL_KEY_EXPORT_TLS12_MASTER_SECRET:
|
||||
return "MBEDTLS_SSL_KEY_EXPORT_TLS12_MASTER_SECRET";
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
case MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_EARLY_SECRET:
|
||||
return "MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_EARLY_SECRET";
|
||||
case MBEDTLS_SSL_KEY_EXPORT_TLS1_3_EARLY_EXPORTER_SECRET:
|
||||
return "MBEDTLS_SSL_KEY_EXPORT_TLS1_3_EARLY_EXPORTER_SECRET";
|
||||
case MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_HANDSHAKE_TRAFFIC_SECRET:
|
||||
return "MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_HANDSHAKE_TRAFFIC_SECRET";
|
||||
case MBEDTLS_SSL_KEY_EXPORT_TLS1_3_SERVER_HANDSHAKE_TRAFFIC_SECRET:
|
||||
return "MBEDTLS_SSL_KEY_EXPORT_TLS1_3_SERVER_HANDSHAKE_TRAFFIC_SECRET";
|
||||
case MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_APPLICATION_TRAFFIC_SECRET:
|
||||
return "MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_APPLICATION_TRAFFIC_SECRET";
|
||||
case MBEDTLS_SSL_KEY_EXPORT_TLS1_3_SERVER_APPLICATION_TRAFFIC_SECRET:
|
||||
return "MBEDTLS_SSL_KEY_EXPORT_TLS1_3_SERVER_APPLICATION_TRAFFIC_SECRET";
|
||||
#endif
|
||||
default:
|
||||
return "UNKNOWN_VALUE";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* MBEDTLS_DEBUG_C */
|
||||
/* End of automatically generated file. */
|
||||
|
||||
@@ -0,0 +1,244 @@
|
||||
/*
|
||||
* Version feature information
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "ssl_misc.h"
|
||||
|
||||
#if defined(MBEDTLS_VERSION_C)
|
||||
|
||||
#include "mbedtls/version.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static const char * const features[] = {
|
||||
#if defined(MBEDTLS_VERSION_FEATURES)
|
||||
#if defined(MBEDTLS_NET_C)
|
||||
"NET_C", //no-check-names
|
||||
#endif /* MBEDTLS_NET_C */
|
||||
#if defined(MBEDTLS_TIMING_ALT)
|
||||
"TIMING_ALT", //no-check-names
|
||||
#endif /* MBEDTLS_TIMING_ALT */
|
||||
#if defined(MBEDTLS_TIMING_C)
|
||||
"TIMING_C", //no-check-names
|
||||
#endif /* MBEDTLS_TIMING_C */
|
||||
#if defined(MBEDTLS_ERROR_C)
|
||||
"ERROR_C", //no-check-names
|
||||
#endif /* MBEDTLS_ERROR_C */
|
||||
#if defined(MBEDTLS_ERROR_STRERROR_DUMMY)
|
||||
"ERROR_STRERROR_DUMMY", //no-check-names
|
||||
#endif /* MBEDTLS_ERROR_STRERROR_DUMMY */
|
||||
#if defined(MBEDTLS_VERSION_C)
|
||||
"VERSION_C", //no-check-names
|
||||
#endif /* MBEDTLS_VERSION_C */
|
||||
#if defined(MBEDTLS_VERSION_FEATURES)
|
||||
"VERSION_FEATURES", //no-check-names
|
||||
#endif /* MBEDTLS_VERSION_FEATURES */
|
||||
#if defined(MBEDTLS_CONFIG_FILE)
|
||||
"CONFIG_FILE", //no-check-names
|
||||
#endif /* MBEDTLS_CONFIG_FILE */
|
||||
#if defined(MBEDTLS_USER_CONFIG_FILE)
|
||||
"USER_CONFIG_FILE", //no-check-names
|
||||
#endif /* MBEDTLS_USER_CONFIG_FILE */
|
||||
#if defined(MBEDTLS_SSL_NULL_CIPHERSUITES)
|
||||
"SSL_NULL_CIPHERSUITES", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_NULL_CIPHERSUITES */
|
||||
#if defined(MBEDTLS_DEBUG_C)
|
||||
"DEBUG_C", //no-check-names
|
||||
#endif /* MBEDTLS_DEBUG_C */
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED)
|
||||
"KEY_EXCHANGE_ECDHE_ECDSA_ENABLED", //no-check-names
|
||||
#endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED */
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED)
|
||||
"KEY_EXCHANGE_ECDHE_PSK_ENABLED", //no-check-names
|
||||
#endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED */
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED)
|
||||
"KEY_EXCHANGE_ECDHE_RSA_ENABLED", //no-check-names
|
||||
#endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED */
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||
"KEY_EXCHANGE_ECJPAKE_ENABLED", //no-check-names
|
||||
#endif /* MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED)
|
||||
"KEY_EXCHANGE_PSK_ENABLED", //no-check-names
|
||||
#endif /* MBEDTLS_KEY_EXCHANGE_PSK_ENABLED */
|
||||
#if defined(MBEDTLS_SSL_ALL_ALERT_MESSAGES)
|
||||
"SSL_ALL_ALERT_MESSAGES", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_ALL_ALERT_MESSAGES */
|
||||
#if defined(MBEDTLS_SSL_ALPN)
|
||||
"SSL_ALPN", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_ALPN */
|
||||
#if defined(MBEDTLS_SSL_ASYNC_PRIVATE)
|
||||
"SSL_ASYNC_PRIVATE", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_ASYNC_PRIVATE */
|
||||
#if defined(MBEDTLS_SSL_CACHE_C)
|
||||
"SSL_CACHE_C", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_CACHE_C */
|
||||
#if defined(MBEDTLS_SSL_CLI_C)
|
||||
"SSL_CLI_C", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_CLI_C */
|
||||
#if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION)
|
||||
"SSL_CONTEXT_SERIALIZATION", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_CONTEXT_SERIALIZATION */
|
||||
#if defined(MBEDTLS_SSL_COOKIE_C)
|
||||
"SSL_COOKIE_C", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_COOKIE_C */
|
||||
#if defined(MBEDTLS_SSL_DEBUG_ALL)
|
||||
"SSL_DEBUG_ALL", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_DEBUG_ALL */
|
||||
#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
|
||||
"SSL_DTLS_ANTI_REPLAY", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_DTLS_ANTI_REPLAY */
|
||||
#if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE)
|
||||
"SSL_DTLS_CLIENT_PORT_REUSE", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE */
|
||||
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
|
||||
"SSL_DTLS_CONNECTION_ID", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
|
||||
#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY)
|
||||
"SSL_DTLS_HELLO_VERIFY", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_DTLS_HELLO_VERIFY */
|
||||
#if defined(MBEDTLS_SSL_DTLS_SRTP)
|
||||
"SSL_DTLS_SRTP", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_DTLS_SRTP */
|
||||
#if defined(MBEDTLS_SSL_EARLY_DATA)
|
||||
"SSL_EARLY_DATA", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_EARLY_DATA */
|
||||
#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
|
||||
"SSL_ENCRYPT_THEN_MAC", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_ENCRYPT_THEN_MAC */
|
||||
#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
|
||||
"SSL_EXTENDED_MASTER_SECRET", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_EXTENDED_MASTER_SECRET */
|
||||
#if defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
|
||||
"SSL_KEEP_PEER_CERTIFICATE", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
|
||||
#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
|
||||
"SSL_MAX_FRAGMENT_LENGTH", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
|
||||
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||
"SSL_PROTO_DTLS", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_PROTO_DTLS */
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||
"SSL_PROTO_TLS1_2", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
"SSL_PROTO_TLS1_3", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
|
||||
#if defined(MBEDTLS_SSL_RECORD_SIZE_LIMIT)
|
||||
"SSL_RECORD_SIZE_LIMIT", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_RECORD_SIZE_LIMIT */
|
||||
#if defined(MBEDTLS_SSL_KEYING_MATERIAL_EXPORT)
|
||||
"SSL_KEYING_MATERIAL_EXPORT", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_KEYING_MATERIAL_EXPORT */
|
||||
#if defined(MBEDTLS_SSL_RENEGOTIATION)
|
||||
"SSL_RENEGOTIATION", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_RENEGOTIATION */
|
||||
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
|
||||
"SSL_SERVER_NAME_INDICATION", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */
|
||||
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
|
||||
"SSL_SESSION_TICKETS", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
|
||||
#if defined(MBEDTLS_SSL_SRV_C)
|
||||
"SSL_SRV_C", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_SRV_C */
|
||||
#if defined(MBEDTLS_SSL_TICKET_C)
|
||||
"SSL_TICKET_C", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_TICKET_C */
|
||||
#if defined(MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE)
|
||||
"SSL_TLS1_3_COMPATIBILITY_MODE", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE */
|
||||
#if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED)
|
||||
"SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED */
|
||||
#if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED)
|
||||
"SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED */
|
||||
#if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED)
|
||||
"SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED */
|
||||
#if defined(MBEDTLS_SSL_TLS_C)
|
||||
"SSL_TLS_C", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_TLS_C */
|
||||
#if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
|
||||
"SSL_VARIABLE_BUFFER_LENGTH", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH */
|
||||
#if defined(MBEDTLS_PSK_MAX_LEN)
|
||||
"PSK_MAX_LEN", //no-check-names
|
||||
#endif /* MBEDTLS_PSK_MAX_LEN */
|
||||
#if defined(MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES)
|
||||
"SSL_CACHE_DEFAULT_MAX_ENTRIES", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES */
|
||||
#if defined(MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT)
|
||||
"SSL_CACHE_DEFAULT_TIMEOUT", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT */
|
||||
#if defined(MBEDTLS_SSL_CID_IN_LEN_MAX)
|
||||
"SSL_CID_IN_LEN_MAX", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_CID_IN_LEN_MAX */
|
||||
#if defined(MBEDTLS_SSL_CID_OUT_LEN_MAX)
|
||||
"SSL_CID_OUT_LEN_MAX", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_CID_OUT_LEN_MAX */
|
||||
#if defined(MBEDTLS_SSL_CID_TLS1_3_PADDING_GRANULARITY)
|
||||
"SSL_CID_TLS1_3_PADDING_GRANULARITY", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_CID_TLS1_3_PADDING_GRANULARITY */
|
||||
#if defined(MBEDTLS_SSL_CIPHERSUITES)
|
||||
"SSL_CIPHERSUITES", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_CIPHERSUITES */
|
||||
#if defined(MBEDTLS_SSL_COOKIE_TIMEOUT)
|
||||
"SSL_COOKIE_TIMEOUT", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_COOKIE_TIMEOUT */
|
||||
#if defined(MBEDTLS_SSL_DTLS_MAX_BUFFERING)
|
||||
"SSL_DTLS_MAX_BUFFERING", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_DTLS_MAX_BUFFERING */
|
||||
#if defined(MBEDTLS_SSL_IN_CONTENT_LEN)
|
||||
"SSL_IN_CONTENT_LEN", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_IN_CONTENT_LEN */
|
||||
#if defined(MBEDTLS_SSL_MAX_EARLY_DATA_SIZE)
|
||||
"SSL_MAX_EARLY_DATA_SIZE", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_MAX_EARLY_DATA_SIZE */
|
||||
#if defined(MBEDTLS_SSL_OUT_CONTENT_LEN)
|
||||
"SSL_OUT_CONTENT_LEN", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_OUT_CONTENT_LEN */
|
||||
#if defined(MBEDTLS_SSL_TLS1_3_DEFAULT_NEW_SESSION_TICKETS)
|
||||
"SSL_TLS1_3_DEFAULT_NEW_SESSION_TICKETS", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_TLS1_3_DEFAULT_NEW_SESSION_TICKETS */
|
||||
#if defined(MBEDTLS_SSL_TLS1_3_TICKET_AGE_TOLERANCE)
|
||||
"SSL_TLS1_3_TICKET_AGE_TOLERANCE", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_TLS1_3_TICKET_AGE_TOLERANCE */
|
||||
#if defined(MBEDTLS_SSL_TLS1_3_TICKET_NONCE_LENGTH)
|
||||
"SSL_TLS1_3_TICKET_NONCE_LENGTH", //no-check-names
|
||||
#endif /* MBEDTLS_SSL_TLS1_3_TICKET_NONCE_LENGTH */
|
||||
#endif /* MBEDTLS_VERSION_FEATURES */
|
||||
NULL
|
||||
};
|
||||
|
||||
int mbedtls_version_check_feature(const char *feature)
|
||||
{
|
||||
const char * const *idx = features;
|
||||
|
||||
if (*idx == NULL) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (feature == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strncmp(feature, "MBEDTLS_", 8)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
feature += 8;
|
||||
|
||||
while (*idx != NULL) {
|
||||
if (!strcmp(*idx, feature)) {
|
||||
return 0;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* MBEDTLS_VERSION_C */
|
||||
Submodule
+1
Submodule tf-psa-crypto added at d0351902c7
@@ -1,156 +0,0 @@
|
||||
set(src_crypto
|
||||
psa_crypto.c
|
||||
psa_crypto_client.c
|
||||
psa_crypto_driver_wrappers_no_static.c
|
||||
psa_crypto_slot_management.c
|
||||
psa_crypto_storage.c
|
||||
psa_its_file.c
|
||||
)
|
||||
|
||||
if(GEN_FILES)
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${CMAKE_CURRENT_BINARY_DIR}/psa_crypto_driver_wrappers.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/psa_crypto_driver_wrappers_no_static.c
|
||||
COMMAND
|
||||
${TF_PSA_CRYPTO_PYTHON_EXECUTABLE}
|
||||
${TF_PSA_CRYPTO_DIR}/scripts/generate_driver_wrappers.py
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
DEPENDS
|
||||
${TF_PSA_CRYPTO_DIR}/scripts/generate_driver_wrappers.py
|
||||
${TF_PSA_CRYPTO_DIR}/scripts/data_files/driver_templates/psa_crypto_driver_wrappers.h.jinja
|
||||
${TF_PSA_CRYPTO_DIR}/scripts/data_files/driver_templates/psa_crypto_driver_wrappers_no_static.c.jinja
|
||||
)
|
||||
else()
|
||||
link_to_source(psa_crypto_driver_wrappers.h)
|
||||
link_to_source(psa_crypto_driver_wrappers_no_static.c)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
set(LIBS_C_FLAGS -Wmissing-declarations -Wmissing-prototypes)
|
||||
endif(CMAKE_COMPILER_IS_GNUCC)
|
||||
|
||||
if(CMAKE_COMPILER_IS_CLANG)
|
||||
set(LIBS_C_FLAGS -Wmissing-declarations -Wmissing-prototypes -Wno-documentation-deprecated-sync -Wunreachable-code)
|
||||
endif(CMAKE_COMPILER_IS_CLANG)
|
||||
|
||||
if(CMAKE_COMPILER_IS_MSVC)
|
||||
option(MSVC_STATIC_RUNTIME "Build the libraries with /MT compiler flag" OFF)
|
||||
if(MSVC_STATIC_RUNTIME)
|
||||
foreach(flag_var
|
||||
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_C_FLAGS_CHECK)
|
||||
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
||||
endforeach(flag_var)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang")
|
||||
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
|
||||
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
||||
endif()
|
||||
|
||||
if(LINK_WITH_PTHREAD)
|
||||
set(libs ${libs} ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
if(LINK_WITH_TRUSTED_STORAGE)
|
||||
set(libs ${libs} trusted_storage)
|
||||
endif()
|
||||
|
||||
if (NOT USE_STATIC_TF_PSA_CRYPTO_LIBRARY AND NOT USE_SHARED_TF_PSA_CRYPTO_LIBRARY)
|
||||
message(FATAL_ERROR "Need to choose static or shared TF-PSA-Crypto build!")
|
||||
endif(NOT USE_STATIC_TF_PSA_CRYPTO_LIBRARY AND NOT USE_SHARED_TF_PSA_CRYPTO_LIBRARY)
|
||||
|
||||
set(tfpsacrypto_target "${TF_PSA_CRYPTO_TARGET_PREFIX}tfpsacrypto")
|
||||
set(builtin_target "${TF_PSA_CRYPTO_TARGET_PREFIX}builtin")
|
||||
|
||||
if (USE_STATIC_TF_PSA_CRYPTO_LIBRARY)
|
||||
set(tfpsacrypto_static_target ${tfpsacrypto_target})
|
||||
set(builtin_static_target ${builtin_target})
|
||||
endif()
|
||||
|
||||
set(target_libraries ${tfpsacrypto_target})
|
||||
|
||||
if(USE_STATIC_TF_PSA_CRYPTO_LIBRARY AND USE_SHARED_TF_PSA_CRYPTO_LIBRARY)
|
||||
string(APPEND tfpsacrypto_static_target "_static")
|
||||
string(APPEND builtin_static_target "_static")
|
||||
|
||||
list(APPEND target_libraries
|
||||
${tfpsacrypto_static_target})
|
||||
endif()
|
||||
|
||||
set(p256m_target "${TF_PSA_CRYPTO_TARGET_PREFIX}p256m")
|
||||
set(everest_target "${TF_PSA_CRYPTO_TARGET_PREFIX}everest")
|
||||
|
||||
if(USE_STATIC_TF_PSA_CRYPTO_LIBRARY)
|
||||
add_library(${tfpsacrypto_static_target} STATIC ${src_crypto})
|
||||
set_base_compile_options(${tfpsacrypto_static_target})
|
||||
target_compile_options(${tfpsacrypto_static_target} PRIVATE ${LIBS_C_FLAGS})
|
||||
set_target_properties(${tfpsacrypto_static_target} PROPERTIES OUTPUT_NAME tfpsacrypto)
|
||||
target_link_libraries(${tfpsacrypto_static_target} PUBLIC ${libs})
|
||||
|
||||
target_link_libraries(${tfpsacrypto_static_target} PUBLIC ${builtin_static_target})
|
||||
|
||||
if(TARGET ${everest_target})
|
||||
target_link_libraries(${tfpsacrypto_static_target} PUBLIC ${everest_target})
|
||||
endif()
|
||||
|
||||
if(TARGET ${p256m_target})
|
||||
target_link_libraries(${tfpsacrypto_static_target} PUBLIC ${p256m_target})
|
||||
endif()
|
||||
endif(USE_STATIC_TF_PSA_CRYPTO_LIBRARY)
|
||||
|
||||
if(USE_SHARED_TF_PSA_CRYPTO_LIBRARY)
|
||||
set(CMAKE_LIBRARY_PATH ${CMAKE_CURRENT_BINARY_DIR})
|
||||
add_library(${tfpsacrypto_target} SHARED ${src_crypto})
|
||||
set_base_compile_options(${tfpsacrypto_target})
|
||||
target_compile_options(${tfpsacrypto_target} PRIVATE ${LIBS_C_FLAGS})
|
||||
set_target_properties(${tfpsacrypto_target} PROPERTIES VERSION 4.0.0 SOVERSION 16)
|
||||
target_link_libraries(${tfpsacrypto_target} PUBLIC ${libs})
|
||||
|
||||
target_link_libraries(${tfpsacrypto_target} PUBLIC ${builtin_target})
|
||||
|
||||
if(TARGET ${everest_target})
|
||||
target_link_libraries(${tfpsacrypto_target} PUBLIC ${everest_target})
|
||||
endif()
|
||||
|
||||
if(TARGET ${p256m_target})
|
||||
target_link_libraries(${tfpsacrypto_target} PUBLIC ${p256m_target})
|
||||
endif()
|
||||
endif(USE_SHARED_TF_PSA_CRYPTO_LIBRARY)
|
||||
|
||||
foreach(target IN LISTS target_libraries)
|
||||
add_library(TF-PSA-Crypto::${target} ALIAS ${target}) # add_subdirectory support
|
||||
# Include public header files include/, drivers/builtin/include/ and
|
||||
# ${MBEDTLS_DIR}/include/ as we still need it. Include private header files
|
||||
# from core/ and drivers/builtin/src/.
|
||||
target_include_directories(${target}
|
||||
PUBLIC $<BUILD_INTERFACE:${TF_PSA_CRYPTO_DIR}/include/>
|
||||
$<BUILD_INTERFACE:${TF_PSA_CRYPTO_DIR}/drivers/builtin/include/>
|
||||
$<INSTALL_INTERFACE:include/>
|
||||
PRIVATE ${TF_PSA_CRYPTO_DIR}/core
|
||||
${TF_PSA_CRYPTO_DIR}/drivers/builtin/src
|
||||
# Needed to include psa_crypto_driver_wrappers.h
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_config_files_compile_definitions(${target})
|
||||
install(
|
||||
TARGETS ${target}
|
||||
EXPORT MbedTLSTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
|
||||
install(
|
||||
TARGETS ${target}
|
||||
EXPORT TF-PSA-CryptoTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
|
||||
endforeach(target)
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,247 +0,0 @@
|
||||
/*
|
||||
* Functions to delegate cryptographic operations to an available
|
||||
* and appropriate accelerator.
|
||||
* Warning: This file is now auto-generated.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
|
||||
/* BEGIN-common headers */
|
||||
#include "common.h"
|
||||
#include "psa_crypto_aead.h"
|
||||
#include "psa_crypto_cipher.h"
|
||||
#include "psa_crypto_core.h"
|
||||
#include "psa_crypto_driver_wrappers_no_static.h"
|
||||
#include "psa_crypto_hash.h"
|
||||
#include "psa_crypto_mac.h"
|
||||
#include "psa_crypto_pake.h"
|
||||
#include "psa_crypto_rsa.h"
|
||||
|
||||
#include "mbedtls/platform.h"
|
||||
/* END-common headers */
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
||||
|
||||
/* BEGIN-driver headers */
|
||||
/* Headers for mbedtls_test opaque driver */
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
#include "test/drivers/test_driver.h"
|
||||
|
||||
#endif
|
||||
/* Headers for mbedtls_test transparent driver */
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
#include "test/drivers/test_driver.h"
|
||||
|
||||
#endif
|
||||
/* Headers for p256 transparent driver */
|
||||
#if defined(MBEDTLS_PSA_P256M_DRIVER_ENABLED)
|
||||
#include "../drivers/p256-m/p256-m_driver_entrypoints.h"
|
||||
|
||||
#endif
|
||||
/* Headers for esp_sha transparent driver */
|
||||
#if defined(ESP_SHA_DRIVER_ENABLED)
|
||||
#include "../../../port/psa_driver/include/psa_crypto_driver_esp_sha.h"
|
||||
|
||||
#endif
|
||||
/* Headers for esp_aes transparent driver */
|
||||
#if defined(ESP_AES_DRIVER_ENABLED)
|
||||
#include "../../../port/psa_driver/include/psa_crypto_driver_esp_aes.h"
|
||||
#include "../../../port/psa_driver/include/psa_crypto_driver_esp_aes_gcm.h"
|
||||
|
||||
#endif
|
||||
/* Headers for esp_cmac transparent driver */
|
||||
#if defined(ESP_AES_DRIVER_ENABLED)
|
||||
#include "../../../port/psa_driver/include/psa_crypto_driver_esp_cmac.h"
|
||||
|
||||
#endif
|
||||
|
||||
/* END-driver headers */
|
||||
|
||||
/* Auto-generated values depending on which drivers are registered.
|
||||
* ID 0 is reserved for unallocated operations.
|
||||
* ID 1 is reserved for the Mbed TLS software driver. */
|
||||
/* BEGIN-driver id definition */
|
||||
#define PSA_CRYPTO_MBED_TLS_DRIVER_ID (1)
|
||||
#define MBEDTLS_TEST_OPAQUE_DRIVER_ID (2)
|
||||
#define MBEDTLS_TEST_TRANSPARENT_DRIVER_ID (3)
|
||||
#define P256_TRANSPARENT_DRIVER_ID (4)
|
||||
#define ESP_SHA_TRANSPARENT_DRIVER_ID (5)
|
||||
#define ESP_AES_TRANSPARENT_DRIVER_ID (6)
|
||||
#define ESP_CMAC_TRANSPARENT_DRIVER_ID (7)
|
||||
|
||||
/* END-driver id */
|
||||
|
||||
/* BEGIN-Common Macro definitions */
|
||||
|
||||
/* END-Common Macro definitions */
|
||||
|
||||
/** Get the key buffer size required to store the key material of a key
|
||||
* associated with an opaque driver.
|
||||
*
|
||||
* \param[in] attributes The key attributes.
|
||||
* \param[out] key_buffer_size Minimum buffer size to contain the key material
|
||||
*
|
||||
* \retval #PSA_SUCCESS
|
||||
* The minimum size for a buffer to contain the key material has been
|
||||
* returned successfully.
|
||||
* \retval #PSA_ERROR_NOT_SUPPORTED
|
||||
* The type and/or the size in bits of the key or the combination of
|
||||
* the two is not supported.
|
||||
* \retval #PSA_ERROR_INVALID_ARGUMENT
|
||||
* The key is declared with a lifetime not known to us.
|
||||
*/
|
||||
psa_status_t psa_driver_wrapper_get_key_buffer_size(
|
||||
const psa_key_attributes_t *attributes,
|
||||
size_t *key_buffer_size )
|
||||
{
|
||||
psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION( psa_get_key_lifetime(attributes) );
|
||||
psa_key_type_t key_type = psa_get_key_type(attributes);
|
||||
size_t key_bits = psa_get_key_bits(attributes);
|
||||
|
||||
*key_buffer_size = 0;
|
||||
switch( location )
|
||||
{
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
case PSA_CRYPTO_TEST_DRIVER_LOCATION:
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS)
|
||||
/* Emulate property 'builtin_key_size' */
|
||||
if( psa_key_id_is_builtin(
|
||||
MBEDTLS_SVC_KEY_ID_GET_KEY_ID(
|
||||
psa_get_key_id( attributes ) ) ) )
|
||||
{
|
||||
*key_buffer_size = sizeof( psa_drv_slot_number_t );
|
||||
return( PSA_SUCCESS );
|
||||
}
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS */
|
||||
*key_buffer_size = mbedtls_test_opaque_size_function( key_type,
|
||||
key_bits );
|
||||
return( ( *key_buffer_size != 0 ) ?
|
||||
PSA_SUCCESS : PSA_ERROR_NOT_SUPPORTED );
|
||||
#endif /* PSA_CRYPTO_DRIVER_TEST */
|
||||
|
||||
default:
|
||||
(void)key_type;
|
||||
(void)key_bits;
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
}
|
||||
}
|
||||
|
||||
psa_status_t psa_driver_wrapper_export_public_key(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key_buffer, size_t key_buffer_size,
|
||||
uint8_t *data, size_t data_size, size_t *data_length )
|
||||
|
||||
{
|
||||
|
||||
psa_status_t status = PSA_ERROR_INVALID_ARGUMENT;
|
||||
psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION(
|
||||
psa_get_key_lifetime( attributes ) );
|
||||
|
||||
switch( location )
|
||||
{
|
||||
case PSA_KEY_LOCATION_LOCAL_STORAGE:
|
||||
/* Key is stored in the slot in export representation, so
|
||||
* cycle through all known transparent accelerators */
|
||||
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
|
||||
|
||||
#if (defined(PSA_CRYPTO_DRIVER_TEST) )
|
||||
status = mbedtls_test_transparent_export_public_key
|
||||
(attributes,
|
||||
key_buffer,
|
||||
key_buffer_size,
|
||||
data,
|
||||
data_size,
|
||||
data_length
|
||||
);
|
||||
|
||||
if( status != PSA_ERROR_NOT_SUPPORTED )
|
||||
return( status );
|
||||
#endif
|
||||
|
||||
#if (defined(MBEDTLS_PSA_P256M_DRIVER_ENABLED) )
|
||||
status = p256_transparent_export_public_key
|
||||
(attributes,
|
||||
key_buffer,
|
||||
key_buffer_size,
|
||||
data,
|
||||
data_size,
|
||||
data_length
|
||||
);
|
||||
|
||||
if( status != PSA_ERROR_NOT_SUPPORTED )
|
||||
return( status );
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT */
|
||||
/* Fell through, meaning no accelerator supports this operation */
|
||||
return( psa_export_public_key_internal( attributes,
|
||||
key_buffer,
|
||||
key_buffer_size,
|
||||
data,
|
||||
data_size,
|
||||
data_length ) );
|
||||
|
||||
/* Add cases for opaque driver here */
|
||||
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
|
||||
|
||||
#if (defined(PSA_CRYPTO_DRIVER_TEST) )
|
||||
case 0x7fffff:
|
||||
return( mbedtls_test_opaque_export_public_key
|
||||
(attributes,
|
||||
key_buffer,
|
||||
key_buffer_size,
|
||||
data,
|
||||
data_size,
|
||||
data_length
|
||||
));
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT */
|
||||
default:
|
||||
/* Key is declared with a lifetime not known to us */
|
||||
return( status );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
psa_status_t psa_driver_wrapper_get_builtin_key(
|
||||
psa_drv_slot_number_t slot_number,
|
||||
psa_key_attributes_t *attributes,
|
||||
uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length )
|
||||
{
|
||||
|
||||
psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION( psa_get_key_lifetime(attributes) );
|
||||
switch( location )
|
||||
{
|
||||
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
|
||||
|
||||
#if (defined(PSA_CRYPTO_DRIVER_TEST) )
|
||||
case 0x7fffff:
|
||||
return( mbedtls_test_opaque_get_builtin_key
|
||||
(slot_number,
|
||||
attributes,
|
||||
key_buffer,
|
||||
key_buffer_size,
|
||||
key_buffer_length
|
||||
));
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT */
|
||||
default:
|
||||
(void) slot_number;
|
||||
(void) key_buffer;
|
||||
(void) key_buffer_size;
|
||||
(void) key_buffer_length;
|
||||
return( PSA_ERROR_DOES_NOT_EXIST );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_C */
|
||||
@@ -1,863 +0,0 @@
|
||||
/**
|
||||
* \file mbedtls/config_adjust_legacy_from_psa.h
|
||||
* \brief Adjust PSA configuration: activate legacy implementations
|
||||
*
|
||||
* This is an internal header. Do not include it directly.
|
||||
*
|
||||
* Activate legacy implementations of cryptographic mechanisms as needed to
|
||||
* fulfill the needs of the PSA configuration. Generally speaking, we activate
|
||||
* a legacy mechanism if it's needed for a requested PSA mechanism and there is
|
||||
* no PSA driver for it.
|
||||
*/
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef MBEDTLS_CONFIG_ADJUST_LEGACY_FROM_PSA_H
|
||||
#define MBEDTLS_CONFIG_ADJUST_LEGACY_FROM_PSA_H
|
||||
|
||||
#if !defined(TF_PSA_CRYPTO_CONFIG_FILES_READ)
|
||||
#error "Do not include mbedtls/config_adjust_*.h manually! This can lead to problems, " \
|
||||
"up to and including runtime errors such as buffer overflows. " \
|
||||
"If you're trying to fix a complaint from check_config.h, just remove " \
|
||||
"it from your configuration file: since Mbed TLS 3.0, it is included " \
|
||||
"automatically at the right point."
|
||||
#endif /* */
|
||||
|
||||
/* Define appropriate ACCEL macros for the p256-m driver.
|
||||
* In the future, those should be generated from the drivers JSON description.
|
||||
*/
|
||||
#if defined(MBEDTLS_PSA_P256M_DRIVER_ENABLED)
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_ECDSA
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_ECDH
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_BASIC
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_IMPORT
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_EXPORT
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_GENERATE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ECC: support for a feature is controlled by a triplet or a pair:
|
||||
* (curve, key_type public/basic, alg) or (curve, key_type_<action>).
|
||||
*
|
||||
* A triplet/pair is accelerated if all of is components are accelerated;
|
||||
* otherwise each component needs to be built in.
|
||||
*
|
||||
* We proceed in two passes:
|
||||
* 1. Check if acceleration is complete for curves, key types, algs.
|
||||
* 2. Then enable built-ins for each thing that's either not accelerated of
|
||||
* doesn't have complete acceleration of the other triplet/pair components.
|
||||
*
|
||||
* Note: this needs psa/crypto_adjust_keypair_types.h to have been included
|
||||
* already, so that we know the full set of key types that are requested.
|
||||
*/
|
||||
|
||||
/* ECC: curves: is acceleration complete? */
|
||||
#if (defined(PSA_WANT_ECC_BRAINPOOL_P_R1_256) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_256)) || \
|
||||
(defined(PSA_WANT_ECC_BRAINPOOL_P_R1_384) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_384)) || \
|
||||
(defined(PSA_WANT_ECC_BRAINPOOL_P_R1_512) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_512)) || \
|
||||
(defined(PSA_WANT_ECC_SECP_R1_192) && !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192)) || \
|
||||
(defined(PSA_WANT_ECC_SECP_R1_224) && !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224)) || \
|
||||
(defined(PSA_WANT_ECC_SECP_R1_256) && !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256)) || \
|
||||
(defined(PSA_WANT_ECC_SECP_R1_384) && !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384)) || \
|
||||
(defined(PSA_WANT_ECC_SECP_R1_521) && !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521)) || \
|
||||
(defined(PSA_WANT_ECC_SECP_K1_192) && !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192)) || \
|
||||
(defined(PSA_WANT_ECC_SECP_K1_256) && !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256))
|
||||
#define MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_CURVES
|
||||
#define MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_WEIERSTRASS_CURVES
|
||||
#endif
|
||||
|
||||
#if (defined(PSA_WANT_ECC_MONTGOMERY_255) && !defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255)) || \
|
||||
(defined(PSA_WANT_ECC_MONTGOMERY_448) && !defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448))
|
||||
#define MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_CURVES
|
||||
#endif
|
||||
|
||||
/* ECC: algs: is acceleration complete? */
|
||||
#if (defined(PSA_WANT_ALG_ECDH) && !defined(MBEDTLS_PSA_ACCEL_ALG_ECDH)) || \
|
||||
(defined(PSA_WANT_ALG_ECDSA) && !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA)) || \
|
||||
(defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA)) || \
|
||||
(defined(PSA_WANT_ALG_JPAKE) && !defined(MBEDTLS_PSA_ACCEL_ALG_JPAKE))
|
||||
#define MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_ALGS
|
||||
#endif
|
||||
|
||||
/* ECC: key types: is acceleration complete? */
|
||||
#if (defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY)) || \
|
||||
(defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_BASIC))
|
||||
#define MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES_BASIC
|
||||
#endif
|
||||
|
||||
/* Special case: we don't support cooked key derivation in drivers yet */
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_DERIVE)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_DERIVE
|
||||
#endif
|
||||
|
||||
/* Note: the condition about key derivation is always true as DERIVE can't be
|
||||
* accelerated yet */
|
||||
#if (defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY)) || \
|
||||
(defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_BASIC)) || \
|
||||
(defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_IMPORT)) || \
|
||||
(defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_EXPORT)) || \
|
||||
(defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_GENERATE)) || \
|
||||
(defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_DERIVE))
|
||||
#define MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES
|
||||
#endif
|
||||
|
||||
/* ECC: curves: enable built-ins as needed.
|
||||
*
|
||||
* We need the curve built-in:
|
||||
* - if it's not accelerated, or
|
||||
* - if there's a key type with missing acceleration, or
|
||||
* - if there's a alg with missing acceleration.
|
||||
*/
|
||||
#if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_256)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_256) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_ALGS)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_256 1
|
||||
#define MBEDTLS_ECP_DP_BP256R1_ENABLED
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_ECC_BRAINPOOL_P_R1_256 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_384)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_384) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_ALGS)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_384 1
|
||||
#define MBEDTLS_ECP_DP_BP384R1_ENABLED
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_ECC_BRAINPOOL_P_R1_384 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_512)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_512) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_ALGS)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_512 1
|
||||
#define MBEDTLS_ECP_DP_BP512R1_ENABLED
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_ECC_BRAINPOOL_P_R1_512 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_MONTGOMERY_255)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_ALGS)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_255 1
|
||||
#define MBEDTLS_ECP_DP_CURVE25519_ENABLED
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_ECC_MONTGOMERY_255 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_MONTGOMERY_448)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_ALGS)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_448 1
|
||||
#define MBEDTLS_ECP_DP_CURVE448_ENABLED
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_ECC_MONTGOMERY_448 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_R1_192)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_ALGS)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_192 1
|
||||
#define MBEDTLS_ECP_DP_SECP192R1_ENABLED
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_ECC_SECP_R1_192 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_R1_224)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_ALGS)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_224 1
|
||||
#define MBEDTLS_ECP_DP_SECP224R1_ENABLED
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_ECC_SECP_R1_224 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_R1_256)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_ALGS)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_256 1
|
||||
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_ECC_SECP_R1_256 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_R1_384)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_ALGS)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_384 1
|
||||
#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_ECC_SECP_R1_384 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_R1_521)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_ALGS)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_521 1
|
||||
#define MBEDTLS_ECP_DP_SECP521R1_ENABLED
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_ECC_SECP_R1_521 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_K1_192)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_ALGS)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_192 1
|
||||
#define MBEDTLS_ECP_DP_SECP192K1_ENABLED
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_ECC_SECP_K1_192 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_K1_256)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_ALGS)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_256 1
|
||||
#define MBEDTLS_ECP_DP_SECP256K1_ENABLED
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_ECC_SECP_K1_256 */
|
||||
|
||||
/* ECC: algs: enable built-ins as needed.
|
||||
*
|
||||
* We need the alg built-in:
|
||||
* - if it's not accelerated, or
|
||||
* - if there's a relevant curve (see below) with missing acceleration, or
|
||||
* - if there's a key type among (public, basic) with missing acceleration.
|
||||
*
|
||||
* Relevant curves are:
|
||||
* - all curves for ECDH
|
||||
* - Weierstrass curves for (deterministic) ECDSA
|
||||
* - secp256r1 for EC J-PAKE
|
||||
*/
|
||||
#if defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_WEIERSTRASS_CURVES) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES_BASIC)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA 1
|
||||
#define MBEDTLS_ECDSA_DETERMINISTIC
|
||||
#define MBEDTLS_HMAC_DRBG_C
|
||||
#define MBEDTLS_MD_C
|
||||
#define MBEDTLS_ECDSA_C
|
||||
#define MBEDTLS_ECP_C
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#define MBEDTLS_ASN1_PARSE_C
|
||||
#define MBEDTLS_ASN1_WRITE_C
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_ALG_DETERMINISTIC_ECDSA */
|
||||
|
||||
#if defined(PSA_WANT_ALG_ECDH)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_ECDH) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_CURVES) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES_BASIC)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_ECDH 1
|
||||
#define MBEDTLS_ECDH_C
|
||||
#define MBEDTLS_ECP_C
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_ALG_ECDH */
|
||||
|
||||
#if defined(PSA_WANT_ALG_ECDSA)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_WEIERSTRASS_CURVES) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES_BASIC)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_ECDSA 1
|
||||
#define MBEDTLS_ECDSA_C
|
||||
#define MBEDTLS_ECP_C
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#define MBEDTLS_ASN1_PARSE_C
|
||||
#define MBEDTLS_ASN1_WRITE_C
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_ALG_ECDSA */
|
||||
|
||||
#if defined(PSA_WANT_ALG_JPAKE)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_JPAKE) || \
|
||||
!defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES_BASIC)
|
||||
#define MBEDTLS_PSA_BUILTIN_PAKE 1
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_JPAKE 1
|
||||
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#define MBEDTLS_ECP_C
|
||||
#define MBEDTLS_ECJPAKE_C
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_ALG_JPAKE */
|
||||
|
||||
/* ECC: key types: enable built-ins as needed.
|
||||
*
|
||||
* We need the key type built-in:
|
||||
* - if it's not accelerated, or
|
||||
* - if there's a curve with missing acceleration, or
|
||||
* - only for public/basic: if there's an alg with missing acceleration.
|
||||
*/
|
||||
#if defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_CURVES) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_ALGS)
|
||||
// #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY 1
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_BASIC) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_CURVES) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_ALGS)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_BASIC 1
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_IMPORT) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_CURVES)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_IMPORT 1
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_EXPORT) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_CURVES)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_EXPORT 1
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_GENERATE) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_CURVES)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_GENERATE 1
|
||||
#endif /* missing accel */
|
||||
#endif /* PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE */
|
||||
|
||||
/* Note: the condition is always true as DERIVE can't be accelerated yet */
|
||||
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_DERIVE) || \
|
||||
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_CURVES)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_DERIVE 1
|
||||
#endif /* missing accel */
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_DERIVE */
|
||||
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_BASIC) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_IMPORT) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_DERIVE)
|
||||
#define MBEDTLS_ECP_LIGHT
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_EXPORT) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_GENERATE)
|
||||
#define MBEDTLS_ECP_C
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#endif
|
||||
|
||||
/* End of ECC section */
|
||||
|
||||
/*
|
||||
* DH key types follow the same pattern used above for EC keys. They are defined
|
||||
* by a triplet (group, key_type, alg). A triplet is accelerated if all its
|
||||
* component are accelerated, otherwise each component needs to be builtin.
|
||||
*/
|
||||
|
||||
/* DH: groups: is acceleration complete? */
|
||||
#if (defined(PSA_WANT_DH_RFC7919_2048) && !defined(MBEDTLS_PSA_ACCEL_DH_RFC7919_2048)) || \
|
||||
(defined(PSA_WANT_DH_RFC7919_3072) && !defined(MBEDTLS_PSA_ACCEL_DH_RFC7919_3072)) || \
|
||||
(defined(PSA_WANT_DH_RFC7919_4096) && !defined(MBEDTLS_PSA_ACCEL_DH_RFC7919_4096)) || \
|
||||
(defined(PSA_WANT_DH_RFC7919_6144) && !defined(MBEDTLS_PSA_ACCEL_DH_RFC7919_6144)) || \
|
||||
(defined(PSA_WANT_DH_RFC7919_8192) && !defined(MBEDTLS_PSA_ACCEL_DH_RFC7919_8192))
|
||||
#define MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_GROUPS
|
||||
#endif
|
||||
|
||||
/* DH: algs: is acceleration complete? */
|
||||
#if defined(PSA_WANT_ALG_FFDH) && !defined(MBEDTLS_PSA_ACCEL_ALG_FFDH)
|
||||
#define MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_ALGS
|
||||
#endif
|
||||
|
||||
/* DH: key types: is acceleration complete? */
|
||||
#if (defined(PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_PUBLIC_KEY)) || \
|
||||
(defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_BASIC)) || \
|
||||
(defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_IMPORT)) || \
|
||||
(defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_EXPORT)) || \
|
||||
(defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_GENERATE))
|
||||
#define MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_KEY_TYPES
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_DH_RFC7919_2048)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_DH_RFC7919_2048) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_ALGS) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_KEY_TYPES)
|
||||
#define MBEDTLS_PSA_BUILTIN_DH_RFC7919_2048 1
|
||||
#endif /* !MBEDTLS_PSA_BUILTIN_DH_RFC7919_2048 */
|
||||
#endif /* PSA_WANT_DH_RFC7919_2048 */
|
||||
|
||||
#if defined(PSA_WANT_DH_RFC7919_3072)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_DH_RFC7919_3072) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_ALGS) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_KEY_TYPES)
|
||||
#define MBEDTLS_PSA_BUILTIN_DH_RFC7919_3072 1
|
||||
#endif /* !MBEDTLS_PSA_BUILTIN_DH_RFC7919_3072 */
|
||||
#endif /* PSA_WANT_DH_RFC7919_3072 */
|
||||
|
||||
#if defined(PSA_WANT_DH_RFC7919_4096)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_DH_RFC7919_4096) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_ALGS) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_KEY_TYPES)
|
||||
#define MBEDTLS_PSA_BUILTIN_DH_RFC7919_4096 1
|
||||
#endif /* !MBEDTLS_PSA_BUILTIN_DH_RFC7919_4096 */
|
||||
#endif /* PSA_WANT_DH_RFC7919_4096 */
|
||||
|
||||
#if defined(PSA_WANT_DH_RFC7919_6144)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_DH_RFC7919_6144) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_ALGS) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_KEY_TYPES)
|
||||
#define MBEDTLS_PSA_BUILTIN_DH_RFC7919_6144 1
|
||||
#endif /* !MBEDTLS_PSA_BUILTIN_DH_RFC7919_6144 */
|
||||
#endif /* PSA_WANT_DH_RFC7919_6144 */
|
||||
|
||||
#if defined(PSA_WANT_DH_RFC7919_8192)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_DH_RFC7919_8192) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_ALGS) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_KEY_TYPES)
|
||||
#define MBEDTLS_PSA_BUILTIN_DH_RFC7919_8192 1
|
||||
#endif /* !MBEDTLS_PSA_BUILTIN_DH_RFC7919_8192 */
|
||||
#endif /* PSA_WANT_DH_RFC7919_8192 */
|
||||
|
||||
#if defined(PSA_WANT_ALG_FFDH)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_FFDH) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_GROUPS) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_KEY_TYPES)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_FFDH 1
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ALG_FFDH */
|
||||
#endif /* PSA_WANT_ALG_FFDH */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_IMPORT) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_GROUPS) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_ALGS)
|
||||
// #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_IMPORT 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_IMPORT */
|
||||
#endif /* PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_EXPORT) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_GROUPS) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_ALGS)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_EXPORT 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_EXPORT */
|
||||
#endif /* PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_GENERATE)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_GENERATE 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_GENERATE */
|
||||
#endif /* PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_BASIC) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_GROUPS) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_ALGS)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_BASIC 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_BASIC */
|
||||
#endif /* PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_PUBLIC_KEY) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_GROUPS) || \
|
||||
defined(MBEDTLS_PSA_DH_ACCEL_INCOMPLETE_ALGS)
|
||||
// #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY 1
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_PUBLIC_KEY */
|
||||
#endif /* PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY */
|
||||
|
||||
/* End of DH section */
|
||||
|
||||
#if defined(PSA_WANT_ALG_HKDF)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_HKDF)
|
||||
/*
|
||||
* The PSA implementation has its own implementation of HKDF, separate from
|
||||
* hkdf.c. No need to enable MBEDTLS_HKDF_C here.
|
||||
*/
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_HKDF 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ALG_HKDF */
|
||||
#endif /* PSA_WANT_ALG_HKDF */
|
||||
|
||||
#if defined(PSA_WANT_ALG_HKDF_EXTRACT)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_HKDF_EXTRACT)
|
||||
/*
|
||||
* The PSA implementation has its own implementation of HKDF, separate from
|
||||
* hkdf.c. No need to enable MBEDTLS_HKDF_C here.
|
||||
*/
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_HKDF_EXTRACT 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ALG_HKDF_EXTRACT */
|
||||
#endif /* PSA_WANT_ALG_HKDF_EXTRACT */
|
||||
|
||||
#if defined(PSA_WANT_ALG_HKDF_EXPAND)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_HKDF_EXPAND)
|
||||
/*
|
||||
* The PSA implementation has its own implementation of HKDF, separate from
|
||||
* hkdf.c. No need to enable MBEDTLS_HKDF_C here.
|
||||
*/
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_HKDF_EXPAND 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ALG_HKDF_EXPAND */
|
||||
#endif /* PSA_WANT_ALG_HKDF_EXPAND */
|
||||
|
||||
#if defined(PSA_WANT_ALG_HMAC)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_HMAC)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ALG_HMAC */
|
||||
#endif /* PSA_WANT_ALG_HMAC */
|
||||
|
||||
#if defined(PSA_WANT_ALG_MD5) && !defined(MBEDTLS_PSA_ACCEL_ALG_MD5)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_MD5 1
|
||||
#define MBEDTLS_MD5_C
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_RIPEMD160) && !defined(MBEDTLS_PSA_ACCEL_ALG_RIPEMD160)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160 1
|
||||
#define MBEDTLS_RIPEMD160_C
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_RSA_OAEP)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_OAEP)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP 1
|
||||
#define MBEDTLS_RSA_C
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#define MBEDTLS_PKCS1_V21
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ALG_RSA_OAEP */
|
||||
#endif /* PSA_WANT_ALG_RSA_OAEP */
|
||||
|
||||
#if defined(PSA_WANT_ALG_RSA_PKCS1V15_CRYPT)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_CRYPT)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT 1
|
||||
#define MBEDTLS_RSA_C
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#define MBEDTLS_PKCS1_V15
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_CRYPT */
|
||||
#endif /* PSA_WANT_ALG_RSA_PKCS1V15_CRYPT */
|
||||
|
||||
#if defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN 1
|
||||
#define MBEDTLS_RSA_C
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#define MBEDTLS_PKCS1_V15
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN */
|
||||
#endif /* PSA_WANT_ALG_RSA_PKCS1V15_SIGN */
|
||||
|
||||
#if defined(PSA_WANT_ALG_RSA_PSS)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS 1
|
||||
#define MBEDTLS_RSA_C
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#define MBEDTLS_PKCS1_V21
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ALG_RSA_PSS */
|
||||
#endif /* PSA_WANT_ALG_RSA_PSS */
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA_1) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_1)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_1 1
|
||||
#define MBEDTLS_SHA1_C
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA_224) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_224)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_224 1
|
||||
#define MBEDTLS_SHA224_C
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA_256) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_256)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_256 1
|
||||
#define MBEDTLS_SHA256_C
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA_384) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_384)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_384 1
|
||||
#define MBEDTLS_SHA384_C
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA_512) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_512)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_512 1
|
||||
#define MBEDTLS_SHA512_C
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA3_224) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_224)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA3_224 1
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA3_256) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_256)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA3_256 1
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA3_384) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_384)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA3_384 1
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA3_512) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_512)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA3_512 1
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_PBKDF2_HMAC)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_PBKDF2_HMAC)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_PBKDF2_HMAC 1
|
||||
#define PSA_HAVE_SOFT_PBKDF2_HMAC 1
|
||||
#endif /* !MBEDTLS_PSA_BUILTIN_ALG_PBKDF2_HMAC */
|
||||
#endif /* PSA_WANT_ALG_PBKDF2_HMAC */
|
||||
|
||||
#if defined(PSA_WANT_ALG_TLS12_PRF)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PRF 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF */
|
||||
#endif /* PSA_WANT_ALG_TLS12_PRF */
|
||||
|
||||
#if defined(PSA_WANT_ALG_TLS12_PSK_TO_MS)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PSK_TO_MS 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS */
|
||||
#endif /* PSA_WANT_ALG_TLS12_PSK_TO_MS */
|
||||
|
||||
#if defined(PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_ECJPAKE_TO_PMS)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_TLS12_ECJPAKE_TO_PMS 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ALG_TLS12_ECJPAKE_TO_PMS */
|
||||
#endif /* PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_IMPORT)
|
||||
// #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_IMPORT 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_IMPORT */
|
||||
#endif /* PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_EXPORT)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_EXPORT 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_EXPORT */
|
||||
#endif /* PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_GENERATE)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_GENERATE 1
|
||||
#define MBEDTLS_GENPRIME
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_GENERATE */
|
||||
#endif /* PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_BASIC)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_BASIC 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_BASIC */
|
||||
#endif /* PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY 1
|
||||
#define MBEDTLS_RSA_C
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#define MBEDTLS_ASN1_PARSE_C
|
||||
#define MBEDTLS_ASN1_WRITE_C
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY */
|
||||
#endif /* PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY */
|
||||
|
||||
/* If any of the block modes are requested that don't have an
|
||||
* associated HW assist, define PSA_HAVE_SOFT_BLOCK_MODE for checking
|
||||
* in the block cipher key types. */
|
||||
#if (defined(PSA_WANT_ALG_CTR) && !defined(MBEDTLS_PSA_ACCEL_ALG_CTR)) || \
|
||||
(defined(PSA_WANT_ALG_CFB) && !defined(MBEDTLS_PSA_ACCEL_ALG_CFB)) || \
|
||||
(defined(PSA_WANT_ALG_OFB) && !defined(MBEDTLS_PSA_ACCEL_ALG_OFB)) || \
|
||||
(defined(PSA_WANT_ALG_ECB_NO_PADDING) && !defined(MBEDTLS_PSA_ACCEL_ALG_ECB_NO_PADDING)) || \
|
||||
(defined(PSA_WANT_ALG_CBC_NO_PADDING) && !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING)) || \
|
||||
(defined(PSA_WANT_ALG_CBC_PKCS7) && !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7)) || \
|
||||
(defined(PSA_WANT_ALG_CMAC) && !defined(MBEDTLS_PSA_ACCEL_ALG_CMAC))
|
||||
#define PSA_HAVE_SOFT_BLOCK_MODE 1
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_PBKDF2_AES_CMAC_PRF_128)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_PBKDF2_AES_CMAC_PRF_128 1
|
||||
#define PSA_HAVE_SOFT_PBKDF2_CMAC 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ALG_PBKDF2_AES_CMAC_PRF_128 */
|
||||
#endif /* PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_AES)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_AES)
|
||||
#define PSA_HAVE_SOFT_KEY_TYPE_AES 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_AES */
|
||||
#if defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \
|
||||
defined(PSA_HAVE_SOFT_BLOCK_MODE)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_AES 1
|
||||
#define MBEDTLS_AES_C
|
||||
#endif /* PSA_HAVE_SOFT_KEY_TYPE_AES || PSA_HAVE_SOFT_BLOCK_MODE */
|
||||
#endif /* PSA_WANT_KEY_TYPE_AES */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_ARIA)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA)
|
||||
#define PSA_HAVE_SOFT_KEY_TYPE_ARIA 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA */
|
||||
#if defined(PSA_HAVE_SOFT_KEY_TYPE_ARIA) || \
|
||||
defined(PSA_HAVE_SOFT_BLOCK_MODE)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ARIA 1
|
||||
#define MBEDTLS_ARIA_C
|
||||
#endif /* PSA_HAVE_SOFT_KEY_TYPE_ARIA || PSA_HAVE_SOFT_BLOCK_MODE */
|
||||
#endif /* PSA_WANT_KEY_TYPE_ARIA */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_CAMELLIA)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA)
|
||||
#define PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA */
|
||||
#if defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA) || \
|
||||
defined(PSA_HAVE_SOFT_BLOCK_MODE)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CAMELLIA 1
|
||||
#define MBEDTLS_CAMELLIA_C
|
||||
#endif /* PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA || PSA_HAVE_SOFT_BLOCK_MODE */
|
||||
#endif /* PSA_WANT_KEY_TYPE_CAMELLIA */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_DES)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DES)
|
||||
#define PSA_HAVE_SOFT_KEY_TYPE_DES 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_DES */
|
||||
#if defined(PSA_HAVE_SOFT_KEY_TYPE_DES) || \
|
||||
defined(PSA_HAVE_SOFT_BLOCK_MODE)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DES 1
|
||||
#define MBEDTLS_DES_C
|
||||
#endif /*PSA_HAVE_SOFT_KEY_TYPE_DES || PSA_HAVE_SOFT_BLOCK_MODE */
|
||||
#endif /* PSA_WANT_KEY_TYPE_DES */
|
||||
|
||||
#if defined(PSA_WANT_ALG_STREAM_CIPHER)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_STREAM_CIPHER)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER 1
|
||||
#endif /* MBEDTLS_PSA_ACCEL_ALG_STREAM_CIPHER */
|
||||
#endif /* PSA_WANT_ALG_STREAM_CIPHER */
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_CHACHA20)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CHACHA20 1
|
||||
#define MBEDTLS_CHACHA20_C
|
||||
#endif /*!MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20 */
|
||||
#endif /* PSA_WANT_KEY_TYPE_CHACHA20 */
|
||||
|
||||
/* If any of the software block ciphers are selected, define
|
||||
* PSA_HAVE_SOFT_BLOCK_CIPHER, which can be used in any of these
|
||||
* situations. */
|
||||
#if defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \
|
||||
defined(PSA_HAVE_SOFT_KEY_TYPE_ARIA) || \
|
||||
defined(PSA_HAVE_SOFT_KEY_TYPE_DES) || \
|
||||
defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA)
|
||||
#define PSA_HAVE_SOFT_BLOCK_CIPHER 1
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_CMAC)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CMAC) || \
|
||||
defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_CMAC 1
|
||||
#define MBEDTLS_CMAC_C
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ALG_CMAC */
|
||||
#endif /* PSA_WANT_ALG_CMAC */
|
||||
|
||||
#if defined(PSA_HAVE_SOFT_PBKDF2_HMAC) || \
|
||||
defined(PSA_HAVE_SOFT_PBKDF2_CMAC)
|
||||
#define PSA_HAVE_SOFT_PBKDF2 1
|
||||
#endif /* PSA_HAVE_SOFT_PBKDF2_HMAC || PSA_HAVE_SOFT_PBKDF2_CMAC */
|
||||
|
||||
#if defined(PSA_WANT_ALG_CTR)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CTR) || \
|
||||
defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_CTR 1
|
||||
#define MBEDTLS_CIPHER_MODE_CTR
|
||||
#endif
|
||||
#endif /* PSA_WANT_ALG_CTR */
|
||||
|
||||
#if defined(PSA_WANT_ALG_CFB)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CFB) || \
|
||||
defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_CFB 1
|
||||
#define MBEDTLS_CIPHER_MODE_CFB
|
||||
#endif
|
||||
#endif /* PSA_WANT_ALG_CFB */
|
||||
|
||||
#if defined(PSA_WANT_ALG_OFB)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_OFB) || \
|
||||
defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_OFB 1
|
||||
#define MBEDTLS_CIPHER_MODE_OFB
|
||||
#endif
|
||||
#endif /* PSA_WANT_ALG_OFB */
|
||||
|
||||
#if defined(PSA_WANT_ALG_ECB_NO_PADDING) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_ALG_ECB_NO_PADDING)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING 1
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_CBC_NO_PADDING)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING) || \
|
||||
defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
|
||||
#define MBEDTLS_CIPHER_MODE_CBC
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_CBC_NO_PADDING 1
|
||||
#endif
|
||||
#endif /* PSA_WANT_ALG_CBC_NO_PADDING */
|
||||
|
||||
#if defined(PSA_WANT_ALG_CBC_PKCS7)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7) || \
|
||||
defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
|
||||
#define MBEDTLS_CIPHER_MODE_CBC
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7 1
|
||||
#define MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
#endif
|
||||
#endif /* PSA_WANT_ALG_CBC_PKCS7 */
|
||||
|
||||
#if defined(PSA_WANT_ALG_CCM)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CCM) || \
|
||||
defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \
|
||||
defined(PSA_HAVE_SOFT_KEY_TYPE_ARIA) || \
|
||||
defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_CCM 1
|
||||
#define MBEDTLS_CCM_C
|
||||
#endif
|
||||
#endif /* PSA_WANT_ALG_CCM */
|
||||
|
||||
#if defined(PSA_WANT_ALG_CCM_STAR_NO_TAG)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CCM_STAR_NO_TAG) || \
|
||||
defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \
|
||||
defined(PSA_HAVE_SOFT_KEY_TYPE_ARIA) || \
|
||||
defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_CCM_STAR_NO_TAG 1
|
||||
#define MBEDTLS_CCM_C
|
||||
#endif
|
||||
#endif /* PSA_WANT_ALG_CCM_STAR_NO_TAG */
|
||||
|
||||
#if defined(PSA_WANT_ALG_GCM)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_GCM) || \
|
||||
defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \
|
||||
defined(PSA_HAVE_SOFT_KEY_TYPE_ARIA) || \
|
||||
defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_GCM 1
|
||||
#define MBEDTLS_GCM_C
|
||||
#endif
|
||||
#endif /* PSA_WANT_ALG_GCM */
|
||||
|
||||
#if defined(PSA_WANT_ALG_CHACHA20_POLY1305)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CHACHA20_POLY1305)
|
||||
#if defined(PSA_WANT_KEY_TYPE_CHACHA20)
|
||||
#define MBEDTLS_CHACHAPOLY_C
|
||||
#define MBEDTLS_CHACHA20_C
|
||||
#define MBEDTLS_POLY1305_C
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_CHACHA20_POLY1305 1
|
||||
#endif /* PSA_WANT_KEY_TYPE_CHACHA20 */
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ALG_CHACHA20_POLY1305 */
|
||||
#endif /* PSA_WANT_ALG_CHACHA20_POLY1305 */
|
||||
|
||||
#endif /* MBEDTLS_CONFIG_ADJUST_LEGACY_FROM_PSA_H */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,278 +0,0 @@
|
||||
/**
|
||||
* \file crypto_builtin_composites.h
|
||||
*
|
||||
* \brief Context structure declaration of the Mbed TLS software-based PSA
|
||||
* drivers called through the PSA Crypto driver dispatch layer. This file
|
||||
* contains the context structures of those algorithms which need to rely on
|
||||
* other algorithms, i.e. are 'composite' algorithms.
|
||||
*
|
||||
* \note This file may not be included directly. Applications must
|
||||
* include psa/crypto.h.
|
||||
*
|
||||
* \note This header and its content are not part of the Mbed TLS API and
|
||||
* applications must not depend on it. Its main purpose is to define the
|
||||
* multi-part state objects of the Mbed TLS software-based PSA drivers. The
|
||||
* definitions of these objects are then used by crypto_struct.h to define the
|
||||
* implementation-defined types of PSA multi-part state objects.
|
||||
*/
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_BUILTIN_COMPOSITES_H
|
||||
#define PSA_CRYPTO_BUILTIN_COMPOSITES_H
|
||||
#include "mbedtls/private_access.h"
|
||||
|
||||
#include <psa/crypto_driver_common.h>
|
||||
|
||||
#include "mbedtls/cmac.h"
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_GCM)
|
||||
#include "mbedtls/gcm.h"
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_CCM)
|
||||
#include "mbedtls/ccm.h"
|
||||
#endif
|
||||
#include "mbedtls/chachapoly.h"
|
||||
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_ECDH)
|
||||
#include "mbedtls/ecdh.h"
|
||||
#endif
|
||||
|
||||
#if defined(ESP_AES_DRIVER_ENABLED)
|
||||
#include "psa_crypto_driver_esp_cmac_contexts.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* MAC multi-part operation definitions.
|
||||
*/
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_CMAC) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_HMAC)
|
||||
#define MBEDTLS_PSA_BUILTIN_MAC
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_HMAC) || defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
typedef struct {
|
||||
/** The HMAC algorithm in use */
|
||||
psa_algorithm_t MBEDTLS_PRIVATE(alg);
|
||||
/** The hash context. */
|
||||
struct psa_hash_operation_s hash_ctx;
|
||||
/** The HMAC part of the context. */
|
||||
uint8_t MBEDTLS_PRIVATE(opad)[PSA_HMAC_MAX_HASH_BLOCK_SIZE];
|
||||
} mbedtls_psa_hmac_operation_t;
|
||||
|
||||
#define MBEDTLS_PSA_HMAC_OPERATION_INIT { 0, PSA_HASH_OPERATION_INIT, { 0 } }
|
||||
#endif /* MBEDTLS_PSA_BUILTIN_ALG_HMAC */
|
||||
|
||||
typedef struct {
|
||||
psa_algorithm_t MBEDTLS_PRIVATE(alg);
|
||||
union {
|
||||
unsigned MBEDTLS_PRIVATE(dummy); /* Make the union non-empty even with no supported algorithms. */
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_HMAC) || defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
mbedtls_psa_hmac_operation_t MBEDTLS_PRIVATE(hmac);
|
||||
#endif /* MBEDTLS_PSA_BUILTIN_ALG_HMAC */
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_CMAC) || defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
mbedtls_cipher_context_t MBEDTLS_PRIVATE(cmac);
|
||||
#endif /* MBEDTLS_PSA_BUILTIN_ALG_CMAC */
|
||||
#if defined(ESP_AES_DRIVER_ENABLED)
|
||||
esp_cmac_operation_t MBEDTLS_PRIVATE(esp_cmac);
|
||||
#endif /* ESP_AES_DRIVER_ENABLED */
|
||||
} MBEDTLS_PRIVATE(ctx);
|
||||
} mbedtls_psa_mac_operation_t;
|
||||
|
||||
#define MBEDTLS_PSA_MAC_OPERATION_INIT { 0, { 0 } }
|
||||
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_GCM) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_CCM) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_CHACHA20_POLY1305)
|
||||
#define MBEDTLS_PSA_BUILTIN_AEAD 1
|
||||
#endif
|
||||
|
||||
/* Context structure for the Mbed TLS AEAD implementation. */
|
||||
typedef struct {
|
||||
psa_algorithm_t MBEDTLS_PRIVATE(alg);
|
||||
psa_key_type_t MBEDTLS_PRIVATE(key_type);
|
||||
|
||||
unsigned int MBEDTLS_PRIVATE(is_encrypt) : 1;
|
||||
|
||||
uint8_t MBEDTLS_PRIVATE(tag_length);
|
||||
|
||||
union {
|
||||
unsigned dummy; /* Enable easier initializing of the union. */
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_CCM)
|
||||
mbedtls_ccm_context MBEDTLS_PRIVATE(ccm);
|
||||
#endif /* MBEDTLS_PSA_BUILTIN_ALG_CCM */
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_GCM)
|
||||
mbedtls_gcm_context MBEDTLS_PRIVATE(gcm);
|
||||
#endif /* MBEDTLS_PSA_BUILTIN_ALG_GCM */
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_CHACHA20_POLY1305)
|
||||
mbedtls_chachapoly_context MBEDTLS_PRIVATE(chachapoly);
|
||||
#endif /* MBEDTLS_PSA_BUILTIN_ALG_CHACHA20_POLY1305 */
|
||||
|
||||
} ctx;
|
||||
|
||||
} mbedtls_psa_aead_operation_t;
|
||||
|
||||
#define MBEDTLS_PSA_AEAD_OPERATION_INIT { 0, 0, 0, 0, { 0 } }
|
||||
|
||||
#include "mbedtls/ecdsa.h"
|
||||
|
||||
/* Context structure for the Mbed TLS interruptible sign hash implementation. */
|
||||
typedef struct {
|
||||
#if (defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA)) && \
|
||||
defined(MBEDTLS_ECP_RESTARTABLE)
|
||||
mbedtls_ecdsa_context *MBEDTLS_PRIVATE(ctx);
|
||||
mbedtls_ecdsa_restart_ctx MBEDTLS_PRIVATE(restart_ctx);
|
||||
|
||||
uint32_t MBEDTLS_PRIVATE(num_ops);
|
||||
|
||||
size_t MBEDTLS_PRIVATE(coordinate_bytes);
|
||||
psa_algorithm_t MBEDTLS_PRIVATE(alg);
|
||||
mbedtls_md_type_t MBEDTLS_PRIVATE(md_alg);
|
||||
uint8_t MBEDTLS_PRIVATE(hash)[PSA_BITS_TO_BYTES(PSA_VENDOR_ECC_MAX_CURVE_BITS)];
|
||||
size_t MBEDTLS_PRIVATE(hash_length);
|
||||
|
||||
#else
|
||||
/* Make the struct non-empty if algs not supported. */
|
||||
unsigned MBEDTLS_PRIVATE(dummy);
|
||||
|
||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) ||
|
||||
* defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) &&
|
||||
* defined( MBEDTLS_ECP_RESTARTABLE ) */
|
||||
} mbedtls_psa_sign_hash_interruptible_operation_t;
|
||||
|
||||
#if (defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA)) && \
|
||||
defined(MBEDTLS_ECP_RESTARTABLE)
|
||||
#define MBEDTLS_PSA_SIGN_HASH_INTERRUPTIBLE_OPERATION_INIT { { 0 }, { 0 }, 0, 0, 0, 0, 0, 0 }
|
||||
#else
|
||||
#define MBEDTLS_PSA_SIGN_HASH_INTERRUPTIBLE_OPERATION_INIT { 0 }
|
||||
#endif
|
||||
|
||||
/* Context structure for the Mbed TLS interruptible verify hash
|
||||
* implementation.*/
|
||||
typedef struct {
|
||||
#if (defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA)) && \
|
||||
defined(MBEDTLS_ECP_RESTARTABLE)
|
||||
|
||||
mbedtls_ecdsa_context *MBEDTLS_PRIVATE(ctx);
|
||||
mbedtls_ecdsa_restart_ctx MBEDTLS_PRIVATE(restart_ctx);
|
||||
|
||||
uint32_t MBEDTLS_PRIVATE(num_ops);
|
||||
|
||||
uint8_t MBEDTLS_PRIVATE(hash)[PSA_BITS_TO_BYTES(PSA_VENDOR_ECC_MAX_CURVE_BITS)];
|
||||
size_t MBEDTLS_PRIVATE(hash_length);
|
||||
|
||||
mbedtls_mpi MBEDTLS_PRIVATE(r);
|
||||
mbedtls_mpi MBEDTLS_PRIVATE(s);
|
||||
|
||||
#else
|
||||
/* Make the struct non-empty if algs not supported. */
|
||||
unsigned MBEDTLS_PRIVATE(dummy);
|
||||
|
||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) ||
|
||||
* defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) &&
|
||||
* defined( MBEDTLS_ECP_RESTARTABLE ) */
|
||||
|
||||
} mbedtls_psa_verify_hash_interruptible_operation_t;
|
||||
|
||||
#if (defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA)) && \
|
||||
defined(MBEDTLS_ECP_RESTARTABLE)
|
||||
#define MBEDTLS_VERIFY_SIGN_HASH_INTERRUPTIBLE_OPERATION_INIT { { 0 }, { 0 }, 0, 0, 0, 0, { 0 }, \
|
||||
{ 0 } }
|
||||
#else
|
||||
#define MBEDTLS_VERIFY_SIGN_HASH_INTERRUPTIBLE_OPERATION_INIT { 0 }
|
||||
#endif
|
||||
|
||||
|
||||
/* EC-JPAKE operation definitions */
|
||||
|
||||
#include "mbedtls/ecjpake.h"
|
||||
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_JPAKE)
|
||||
#define MBEDTLS_PSA_BUILTIN_PAKE 1
|
||||
#endif
|
||||
|
||||
/* Note: the format for mbedtls_ecjpake_read/write function has an extra
|
||||
* length byte for each step, plus an extra 3 bytes for ECParameters in the
|
||||
* server's 2nd round. */
|
||||
#define MBEDTLS_PSA_JPAKE_BUFFER_SIZE ((3 + 1 + 65 + 1 + 65 + 1 + 32) * 2)
|
||||
|
||||
typedef struct {
|
||||
psa_algorithm_t MBEDTLS_PRIVATE(alg);
|
||||
|
||||
uint8_t *MBEDTLS_PRIVATE(password);
|
||||
size_t MBEDTLS_PRIVATE(password_len);
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_JPAKE)
|
||||
mbedtls_ecjpake_role MBEDTLS_PRIVATE(role);
|
||||
uint8_t MBEDTLS_PRIVATE(buffer[MBEDTLS_PSA_JPAKE_BUFFER_SIZE]);
|
||||
size_t MBEDTLS_PRIVATE(buffer_length);
|
||||
size_t MBEDTLS_PRIVATE(buffer_offset);
|
||||
#endif
|
||||
/* Context structure for the Mbed TLS EC-JPAKE implementation. */
|
||||
union {
|
||||
unsigned int MBEDTLS_PRIVATE(dummy);
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_JPAKE)
|
||||
mbedtls_ecjpake_context MBEDTLS_PRIVATE(jpake);
|
||||
#endif
|
||||
} MBEDTLS_PRIVATE(ctx);
|
||||
|
||||
} mbedtls_psa_pake_operation_t;
|
||||
|
||||
#define MBEDTLS_PSA_PAKE_OPERATION_INIT { { 0 } }
|
||||
|
||||
typedef struct {
|
||||
#if defined(MBEDTLS_ECP_C)
|
||||
mbedtls_ecp_keypair MBEDTLS_PRIVATE(ecp);
|
||||
uint32_t num_ops;
|
||||
#else
|
||||
/* Make the struct non-empty if algs not supported. */
|
||||
unsigned MBEDTLS_PRIVATE(dummy);
|
||||
#endif
|
||||
} mbedtls_psa_generate_key_iop_t;
|
||||
|
||||
#if defined(MBEDTLS_ECP_C)
|
||||
#define MBEDTLS_PSA_GENERATE_KEY_IOP_INIT { MBEDTLS_ECP_KEYPAIR_INIT, 0 }
|
||||
#else
|
||||
#define MBEDTLS_PSA_GENERATE_KEY_IOP_INIT { 0 }
|
||||
#endif
|
||||
|
||||
/* Context structure for the Mbed TLS interruptible key agreement implementation. */
|
||||
typedef struct {
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_ECDH) && defined(MBEDTLS_ECP_RESTARTABLE)
|
||||
mbedtls_ecdh_context MBEDTLS_PRIVATE(ctx);
|
||||
uint32_t MBEDTLS_PRIVATE(num_ops);
|
||||
#else
|
||||
/* Make the struct non-empty if algs not supported. */
|
||||
unsigned MBEDTLS_PRIVATE(dummy);
|
||||
#endif
|
||||
} mbedtls_psa_key_agreement_interruptible_operation_t;
|
||||
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_ECDH) && defined(MBEDTLS_ECP_RESTARTABLE)
|
||||
#define MBEDTLS_PSA_KEY_AGREEMENT_IOP_INIT { MBEDTLS_ECDH_CONTEXT_INIT, 0 }
|
||||
#else
|
||||
#define MBEDTLS_PSA_KEY_AGREEMENT_IOP_INIT { 0 }
|
||||
#endif
|
||||
|
||||
/* Context structure for the Mbed TLS interruptible export public-key implementation. */
|
||||
typedef struct {
|
||||
#if defined(MBEDTLS_ECP_C) && defined(MBEDTLS_ECP_RESTARTABLE)
|
||||
mbedtls_ecp_keypair *MBEDTLS_PRIVATE(key);
|
||||
mbedtls_ecp_restart_ctx MBEDTLS_PRIVATE(restart_ctx);
|
||||
uint32_t MBEDTLS_PRIVATE(num_ops);
|
||||
#else
|
||||
/* Make the struct non-empty if algs not supported. */
|
||||
unsigned MBEDTLS_PRIVATE(dummy);
|
||||
#endif
|
||||
} mbedtls_psa_export_public_key_iop_t;
|
||||
|
||||
#if defined(MBEDTLS_ECP_C) && defined(MBEDTLS_ECP_RESTARTABLE)
|
||||
#define MBEDTLS_PSA_EXPORT_PUBLIC_KEY_IOP_INIT { NULL, MBEDTLS_ECP_RESTART_INIT, 0 }
|
||||
#else
|
||||
#define MBEDTLS_PSA_EXPORT_PUBLIC_KEY_IOP_INIT { 0 }
|
||||
#endif
|
||||
|
||||
#endif /* PSA_CRYPTO_BUILTIN_COMPOSITES_H */
|
||||
@@ -1,116 +0,0 @@
|
||||
/**
|
||||
* \file crypto_builtin_primitives.h
|
||||
*
|
||||
* \brief Context structure declaration of the Mbed TLS software-based PSA
|
||||
* drivers called through the PSA Crypto driver dispatch layer. This file
|
||||
* contains the context structures of those algorithms which do not rely on
|
||||
* other algorithms, i.e. are 'primitive' algorithms.
|
||||
*
|
||||
* \note This file may not be included directly. Applications must
|
||||
* include psa/crypto.h.
|
||||
*
|
||||
* \note This header and its content are not part of the Mbed TLS API and
|
||||
* applications must not depend on it. Its main purpose is to define the
|
||||
* multi-part state objects of the Mbed TLS software-based PSA drivers. The
|
||||
* definitions of these objects are then used by crypto_struct.h to define the
|
||||
* implementation-defined types of PSA multi-part state objects.
|
||||
*/
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_BUILTIN_PRIMITIVES_H
|
||||
#define PSA_CRYPTO_BUILTIN_PRIMITIVES_H
|
||||
#include "mbedtls/private_access.h"
|
||||
|
||||
#include <psa/crypto_driver_common.h>
|
||||
|
||||
/*
|
||||
* Hash multi-part operation definitions.
|
||||
*/
|
||||
|
||||
#include "mbedtls/md5.h"
|
||||
#include "mbedtls/ripemd160.h"
|
||||
#include "mbedtls/sha1.h"
|
||||
#include "mbedtls/sha256.h"
|
||||
#include "mbedtls/sha512.h"
|
||||
#include "mbedtls/sha3.h"
|
||||
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_MD5) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_1) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
||||
#define MBEDTLS_PSA_BUILTIN_HASH
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
psa_algorithm_t MBEDTLS_PRIVATE(alg);
|
||||
union {
|
||||
unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_MD5)
|
||||
mbedtls_md5_context md5;
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160)
|
||||
mbedtls_ripemd160_context ripemd160;
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_1)
|
||||
mbedtls_sha1_context sha1;
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
|
||||
mbedtls_sha256_context sha256;
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
|
||||
mbedtls_sha512_context sha512;
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
||||
mbedtls_sha3_context sha3;
|
||||
#endif
|
||||
} MBEDTLS_PRIVATE(ctx);
|
||||
} mbedtls_psa_hash_operation_t;
|
||||
|
||||
#define MBEDTLS_PSA_HASH_OPERATION_INIT { 0, { 0 } }
|
||||
|
||||
/*
|
||||
* Cipher multi-part operation definitions.
|
||||
*/
|
||||
|
||||
#include "mbedtls/cipher.h"
|
||||
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_CTR) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_CFB) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_OFB) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_CBC_NO_PADDING) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_CCM_STAR_NO_TAG)
|
||||
// #define MBEDTLS_PSA_BUILTIN_CIPHER 1
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
/* Context structure for the Mbed TLS cipher implementation. */
|
||||
psa_algorithm_t MBEDTLS_PRIVATE(alg);
|
||||
uint8_t MBEDTLS_PRIVATE(iv_length);
|
||||
uint8_t MBEDTLS_PRIVATE(block_length);
|
||||
union {
|
||||
unsigned int MBEDTLS_PRIVATE(dummy);
|
||||
mbedtls_cipher_context_t MBEDTLS_PRIVATE(cipher);
|
||||
} MBEDTLS_PRIVATE(ctx);
|
||||
} mbedtls_psa_cipher_operation_t;
|
||||
|
||||
#define MBEDTLS_PSA_CIPHER_OPERATION_INIT { 0, 0, 0, { 0 } }
|
||||
|
||||
#endif /* PSA_CRYPTO_BUILTIN_PRIMITIVES_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,159 +0,0 @@
|
||||
/**
|
||||
* \file crypto_driver_contexts_composites.h
|
||||
*
|
||||
* \brief Declaration of context structures for use with the PSA driver wrapper
|
||||
* interface. This file contains the context structures for 'composite'
|
||||
* operations, i.e. those operations which need to make use of other operations
|
||||
* from the primitives (crypto_driver_contexts_primitives.h)
|
||||
*
|
||||
* \warning This file will be auto-generated in the future.
|
||||
*
|
||||
* \note This file may not be included directly. Applications must
|
||||
* include psa/crypto.h.
|
||||
*
|
||||
* \note This header and its content are not part of the Mbed TLS API and
|
||||
* applications must not depend on it. Its main purpose is to define the
|
||||
* multi-part state objects of the PSA drivers included in the cryptographic
|
||||
* library. The definitions of these objects are then used by crypto_struct.h
|
||||
* to define the implementation-defined types of PSA multi-part state objects.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H
|
||||
#define PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H
|
||||
|
||||
#include "psa/crypto_driver_common.h"
|
||||
|
||||
/* Include the context structure definitions for the Mbed TLS software drivers */
|
||||
#include "psa/crypto_builtin_composites.h"
|
||||
|
||||
/* Include the context structure definitions for those drivers that were
|
||||
* declared during the autogeneration process. */
|
||||
|
||||
#if defined(MBEDTLS_TEST_LIBTESTDRIVER1)
|
||||
#include <libtestdriver1/tf-psa-crypto/include/psa/crypto.h>
|
||||
#endif
|
||||
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
|
||||
defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
|
||||
typedef libtestdriver1_mbedtls_psa_mac_operation_t
|
||||
mbedtls_transparent_test_driver_mac_operation_t;
|
||||
typedef libtestdriver1_mbedtls_psa_mac_operation_t
|
||||
mbedtls_opaque_test_driver_mac_operation_t;
|
||||
|
||||
#define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \
|
||||
LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT
|
||||
#define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \
|
||||
LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT
|
||||
|
||||
#else
|
||||
typedef mbedtls_psa_mac_operation_t
|
||||
mbedtls_transparent_test_driver_mac_operation_t;
|
||||
typedef mbedtls_psa_mac_operation_t
|
||||
mbedtls_opaque_test_driver_mac_operation_t;
|
||||
|
||||
#define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \
|
||||
MBEDTLS_PSA_MAC_OPERATION_INIT
|
||||
#define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \
|
||||
MBEDTLS_PSA_MAC_OPERATION_INIT
|
||||
|
||||
#endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC */
|
||||
|
||||
#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
|
||||
defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD)
|
||||
typedef libtestdriver1_mbedtls_psa_aead_operation_t
|
||||
mbedtls_transparent_test_driver_aead_operation_t;
|
||||
|
||||
#define MBEDTLS_TRANSPARENT_TEST_DRIVER_AEAD_OPERATION_INIT \
|
||||
LIBTESTDRIVER1_MBEDTLS_PSA_AEAD_OPERATION_INIT
|
||||
#else
|
||||
typedef mbedtls_psa_aead_operation_t
|
||||
mbedtls_transparent_test_driver_aead_operation_t;
|
||||
|
||||
#define MBEDTLS_TRANSPARENT_TEST_DRIVER_AEAD_OPERATION_INIT \
|
||||
MBEDTLS_PSA_AEAD_OPERATION_INIT
|
||||
|
||||
#endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD */
|
||||
|
||||
#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
|
||||
defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_PAKE)
|
||||
|
||||
typedef libtestdriver1_mbedtls_psa_pake_operation_t
|
||||
mbedtls_transparent_test_driver_pake_operation_t;
|
||||
typedef libtestdriver1_mbedtls_psa_pake_operation_t
|
||||
mbedtls_opaque_test_driver_pake_operation_t;
|
||||
|
||||
#define MBEDTLS_TRANSPARENT_TEST_DRIVER_PAKE_OPERATION_INIT \
|
||||
LIBTESTDRIVER1_MBEDTLS_PSA_PAKE_OPERATION_INIT
|
||||
#define MBEDTLS_OPAQUE_TEST_DRIVER_PAKE_OPERATION_INIT \
|
||||
LIBTESTDRIVER1_MBEDTLS_PSA_PAKE_OPERATION_INIT
|
||||
|
||||
#else
|
||||
typedef mbedtls_psa_pake_operation_t
|
||||
mbedtls_transparent_test_driver_pake_operation_t;
|
||||
typedef mbedtls_psa_pake_operation_t
|
||||
mbedtls_opaque_test_driver_pake_operation_t;
|
||||
|
||||
#define MBEDTLS_TRANSPARENT_TEST_DRIVER_PAKE_OPERATION_INIT \
|
||||
MBEDTLS_PSA_PAKE_OPERATION_INIT
|
||||
#define MBEDTLS_OPAQUE_TEST_DRIVER_PAKE_OPERATION_INIT \
|
||||
MBEDTLS_PSA_PAKE_OPERATION_INIT
|
||||
|
||||
#endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_PAKE */
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_TEST */
|
||||
|
||||
/* Define the context to be used for an operation that is executed through the
|
||||
* PSA Driver wrapper layer as the union of all possible driver's contexts.
|
||||
*
|
||||
* The union members are the driver's context structures, and the member names
|
||||
* are formatted as `'drivername'_ctx`. This allows for procedural generation
|
||||
* of both this file and the content of psa_crypto_driver_wrappers.h */
|
||||
|
||||
typedef union {
|
||||
unsigned dummy; /* Make sure this union is always non-empty */
|
||||
mbedtls_psa_mac_operation_t mbedtls_ctx;
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
mbedtls_transparent_test_driver_mac_operation_t transparent_test_driver_ctx;
|
||||
mbedtls_opaque_test_driver_mac_operation_t opaque_test_driver_ctx;
|
||||
#endif
|
||||
#if defined(ESP_AES_DRIVER_ENABLED)
|
||||
esp_cmac_operation_t esp_cmac_ctx;
|
||||
#endif /* ESP_AES_DRIVER_ENABLED */
|
||||
} psa_driver_mac_context_t;
|
||||
|
||||
typedef union {
|
||||
unsigned dummy; /* Make sure this union is always non-empty */
|
||||
mbedtls_psa_aead_operation_t mbedtls_ctx;
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
mbedtls_transparent_test_driver_aead_operation_t transparent_test_driver_ctx;
|
||||
#endif
|
||||
#if defined(ESP_AES_DRIVER_ENABLED)
|
||||
esp_aes_gcm_operation_t esp_aes_gcm_ctx;
|
||||
#endif
|
||||
} psa_driver_aead_context_t;
|
||||
|
||||
typedef union {
|
||||
unsigned dummy; /* Make sure this union is always non-empty */
|
||||
mbedtls_psa_sign_hash_interruptible_operation_t mbedtls_ctx;
|
||||
} psa_driver_sign_hash_interruptible_context_t;
|
||||
|
||||
typedef union {
|
||||
unsigned dummy; /* Make sure this union is always non-empty */
|
||||
mbedtls_psa_verify_hash_interruptible_operation_t mbedtls_ctx;
|
||||
} psa_driver_verify_hash_interruptible_context_t;
|
||||
|
||||
typedef union {
|
||||
unsigned dummy; /* Make sure this union is always non-empty */
|
||||
mbedtls_psa_pake_operation_t mbedtls_ctx;
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
mbedtls_transparent_test_driver_pake_operation_t transparent_test_driver_ctx;
|
||||
mbedtls_opaque_test_driver_pake_operation_t opaque_test_driver_ctx;
|
||||
#endif
|
||||
} psa_driver_pake_context_t;
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H */
|
||||
/* End of automatically generated file. */
|
||||
@@ -1,121 +0,0 @@
|
||||
/**
|
||||
* \file crypto_driver_contexts_primitives.h
|
||||
*
|
||||
* \brief Declaration of context structures for use with the PSA driver wrapper
|
||||
* interface. This file contains the context structures for 'primitive'
|
||||
* operations, i.e. those operations which do not rely on other contexts.
|
||||
*
|
||||
* \warning This file will be auto-generated in the future.
|
||||
*
|
||||
* \note This file may not be included directly. Applications must
|
||||
* include psa/crypto.h.
|
||||
*
|
||||
* \note This header and its content are not part of the Mbed TLS API and
|
||||
* applications must not depend on it. Its main purpose is to define the
|
||||
* multi-part state objects of the PSA drivers included in the cryptographic
|
||||
* library. The definitions of these objects are then used by crypto_struct.h
|
||||
* to define the implementation-defined types of PSA multi-part state objects.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H
|
||||
#define PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H
|
||||
|
||||
#include "psa/crypto_driver_common.h"
|
||||
|
||||
/* Include the context structure definitions for the Mbed TLS software drivers */
|
||||
#include "psa/crypto_builtin_primitives.h"
|
||||
|
||||
/* Include the context structure definitions for those drivers that were
|
||||
* declared during the autogeneration process. */
|
||||
|
||||
#if defined(MBEDTLS_TEST_LIBTESTDRIVER1)
|
||||
#include <libtestdriver1/tf-psa-crypto/include/psa/crypto.h>
|
||||
#endif
|
||||
|
||||
#if defined(ESP_SHA_DRIVER_ENABLED)
|
||||
#include "psa_crypto_driver_esp_sha_contexts.h"
|
||||
#endif
|
||||
|
||||
#if defined(ESP_AES_DRIVER_ENABLED)
|
||||
#include "psa_crypto_driver_esp_aes_contexts.h"
|
||||
#endif
|
||||
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
|
||||
#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
|
||||
defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
|
||||
typedef libtestdriver1_mbedtls_psa_cipher_operation_t
|
||||
mbedtls_transparent_test_driver_cipher_operation_t;
|
||||
|
||||
#define MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT \
|
||||
LIBTESTDRIVER1_MBEDTLS_PSA_CIPHER_OPERATION_INIT
|
||||
#else
|
||||
typedef mbedtls_psa_cipher_operation_t
|
||||
mbedtls_transparent_test_driver_cipher_operation_t;
|
||||
|
||||
#define MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT \
|
||||
MBEDTLS_PSA_CIPHER_OPERATION_INIT
|
||||
#endif /* MBEDTLS_TEST_LIBTESTDRIVER1 &&
|
||||
LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER */
|
||||
|
||||
#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
|
||||
defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
|
||||
typedef libtestdriver1_mbedtls_psa_hash_operation_t
|
||||
mbedtls_transparent_test_driver_hash_operation_t;
|
||||
|
||||
#define MBEDTLS_TRANSPARENT_TEST_DRIVER_HASH_OPERATION_INIT \
|
||||
LIBTESTDRIVER1_MBEDTLS_PSA_HASH_OPERATION_INIT
|
||||
#else
|
||||
typedef mbedtls_psa_hash_operation_t
|
||||
mbedtls_transparent_test_driver_hash_operation_t;
|
||||
|
||||
#define MBEDTLS_TRANSPARENT_TEST_DRIVER_HASH_OPERATION_INIT \
|
||||
MBEDTLS_PSA_HASH_OPERATION_INIT
|
||||
#endif /* MBEDTLS_TEST_LIBTESTDRIVER1 &&
|
||||
LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH */
|
||||
|
||||
typedef struct {
|
||||
unsigned int initialised : 1;
|
||||
mbedtls_transparent_test_driver_cipher_operation_t ctx;
|
||||
} mbedtls_opaque_test_driver_cipher_operation_t;
|
||||
|
||||
#define MBEDTLS_OPAQUE_TEST_DRIVER_CIPHER_OPERATION_INIT \
|
||||
{ 0, MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT }
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_TEST */
|
||||
|
||||
/* Define the context to be used for an operation that is executed through the
|
||||
* PSA Driver wrapper layer as the union of all possible driver's contexts.
|
||||
*
|
||||
* The union members are the driver's context structures, and the member names
|
||||
* are formatted as `'drivername'_ctx`. This allows for procedural generation
|
||||
* of both this file and the content of psa_crypto_driver_wrappers.h */
|
||||
|
||||
typedef union {
|
||||
unsigned dummy; /* Make sure this union is always non-empty */
|
||||
mbedtls_psa_hash_operation_t mbedtls_ctx;
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
mbedtls_transparent_test_driver_hash_operation_t test_driver_ctx;
|
||||
#endif
|
||||
#if defined(ESP_SHA_DRIVER_ENABLED)
|
||||
esp_sha_hash_operation_t esp_ctx;
|
||||
#endif
|
||||
} psa_driver_hash_context_t;
|
||||
|
||||
typedef union {
|
||||
unsigned dummy; /* Make sure this union is always non-empty */
|
||||
mbedtls_psa_cipher_operation_t mbedtls_ctx;
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
mbedtls_transparent_test_driver_cipher_operation_t transparent_test_driver_ctx;
|
||||
mbedtls_opaque_test_driver_cipher_operation_t opaque_test_driver_ctx;
|
||||
#endif
|
||||
#if defined(ESP_AES_DRIVER_ENABLED)
|
||||
esp_aes_operation_t esp_aes_ctx;
|
||||
#endif
|
||||
} psa_driver_cipher_context_t;
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H */
|
||||
/* End of automatically generated file. */
|
||||
@@ -1 +0,0 @@
|
||||
["mbedtls_test_opaque_driver.json","mbedtls_test_transparent_driver.json","p256_transparent_driver.json", "esp_sha_driver.json", "esp_aes_driver.json", "esp_cmac_driver.json"]
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"prefix": "esp_aes",
|
||||
"type": "transparent",
|
||||
"mbedtls/h_condition": "defined(ESP_AES_DRIVER_ENABLED)",
|
||||
"headers": ["../../../port/psa_driver/include/psa_crypto_driver_esp_aes.h", "../../../port/psa_driver/include/psa_crypto_driver_esp_aes_gcm.h"],
|
||||
"capabilities": [
|
||||
{
|
||||
"mbedtls/c_condition": "defined(ESP_AES_DRIVER_ENABLED)",
|
||||
"_comment": "This driver will support AES operations using the ESP hardware accelerator.",
|
||||
"entry_points": ["cipher_encrypt", "cipher_decrypt", "cipher_encrypt_setup", "cipher_decrypt_setup", "cipher_set_iv", "cipher_update", "cipher_finish", "cipher_abort"],
|
||||
"algorithms": ["PSA_ALG_AES_CBC", "PSA_ALG_AES_GCM"],
|
||||
"fallback": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"prefix": "esp_cmac",
|
||||
"type": "transparent",
|
||||
"mbedtls/h_condition": "defined(ESP_AES_DRIVER_ENABLED)",
|
||||
"headers": ["../../../port/psa_driver/include/psa_crypto_driver_esp_cmac.h"],
|
||||
"capabilities": [
|
||||
{
|
||||
"mbedtls/c_condition": "defined(ESP_AES_DRIVER_ENABLED)",
|
||||
"_comment": "This driver will support CMAC operations using the ESP hardware accelerator.",
|
||||
"entry_points": ["mac_setup", "mac_update", "mac_finish", "mac_abort", "mac_compute"],
|
||||
"algorithms": ["PSA_ALG_CMAC"],
|
||||
"fallback": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"prefix": "esp_sha",
|
||||
"type": "transparent",
|
||||
"mbedtls/h_condition": "defined(ESP_SHA_DRIVER_ENABLED)",
|
||||
"headers": ["../../../port/psa_driver/include/psa_crypto_driver_esp_sha.h"],
|
||||
"capabilities": [
|
||||
{
|
||||
"mbedtls/c_condition": "defined(ESP_SHA_DRIVER_ENABLED)",
|
||||
"_comment": "This driver will support SHA operations using the ESP hardware accelerator.",
|
||||
"entry_points": ["hash_setup", "hash_update", "hash_finish", "hash_abort", "hash_compute"],
|
||||
"algorithms": ["PSA_ALG_SHA_1", "PSA_ALG_SHA_256"],
|
||||
"fallback": false
|
||||
}
|
||||
]
|
||||
}
|
||||
-3002
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user