Go to the documentation of this file.
32 #define TRACE_LEVEL TLS_TRACE_LEVEL
42 #if (TLS_SUPPORT == ENABLED)
113 if(signAlgoList != NULL)
116 if(context->numSupportedSignAlgos > 0)
120 for(i = 0; i < context->numSupportedSignAlgos; i++)
123 signScheme = context->supportedSignAlgos[i];
145 n =
ntohs(signAlgoList->length) /
sizeof(uint16_t);
148 for(i = 0; i <
n; i++)
151 signScheme =
ntohs(signAlgoList->value[i]);
238 #if (TLS_MAX_VERSION >= TLS_VERSION_1_2 && TLS_MIN_VERSION <= TLS_VERSION_1_3)
257 extension->length =
htons(
n);
293 uint8_t *
p,
size_t *written)
297 #if (TLS_MAX_VERSION >= TLS_VERSION_1_2 && TLS_MIN_VERSION <= TLS_VERSION_1_3)
332 n *=
sizeof(uint16_t);
334 signAlgoList->length =
htons(
n);
339 extension->length =
htons(
n);
365 #if (TLS_MAX_VERSION >= TLS_VERSION_1_2 && TLS_MIN_VERSION <= TLS_VERSION_1_3)
368 uint_t numSupportedSignAlgos;
369 const uint16_t *supportedSignAlgos;
377 if(context->numSupportedSignAlgos > 0)
380 supportedSignAlgos = context->supportedSignAlgos;
381 numSupportedSignAlgos = context->numSupportedSignAlgos;
395 for(i = 0; i < numSupportedSignAlgos; i++)
401 signAlgoList->value[
n++] =
htons(supportedSignAlgos[i]);
406 n *=
sizeof(uint16_t);
408 signAlgoList->length =
htons(
n);
442 if(signSchemeList != NULL)
445 n =
ntohs(signSchemeList->length) /
sizeof(uint16_t);
449 for(i = 0; i <
n && !found; i++)
452 if(
ntohs(signSchemeList->value[i]) == signScheme)
482 #if (TLS_RSA_SIGN_SUPPORT == ENABLED)
514 #if (TLS_RSA_PSS_SIGN_SUPPORT == ENABLED)
532 #if (TLS_DSA_SIGN_SUPPORT == ENABLED)
548 #if (TLS_ECDSA_SIGN_SUPPORT == ENABLED)
601 #if (TLS_SM2_SIGN_SUPPORT == ENABLED)
617 #if (TLS_ED25519_SIGN_SUPPORT == ENABLED)
633 #if (TLS_ED448_SIGN_SUPPORT == ENABLED)
669 #if (TLS_MAX_VERSION >= TLS_VERSION_1_2 && TLS_MIN_VERSION <= TLS_VERSION_1_3)
690 cipherSuiteTypes = context->cipherSuiteTypes;
695 cipherSuiteTypes = context->cipherSuiteTypes;
698 #if (TLS_RSA_SIGN_SUPPORT == ENABLED)
724 #if (TLS_DSA_SIGN_SUPPORT == ENABLED)
747 #if (TLS_ECDSA_SIGN_SUPPORT == ENABLED)
772 #if (TLS_RSA_PSS_SIGN_SUPPORT == ENABLED && TLS_SHA256_SUPPORT == ENABLED)
785 #if (TLS_RSA_PSS_SIGN_SUPPORT == ENABLED && TLS_SHA384_SUPPORT == ENABLED)
798 #if (TLS_RSA_PSS_SIGN_SUPPORT == ENABLED && TLS_SHA512_SUPPORT == ENABLED)
811 #if (TLS_RSA_PSS_SIGN_SUPPORT == ENABLED && TLS_SHA256_SUPPORT == ENABLED)
828 #if (TLS_RSA_PSS_SIGN_SUPPORT == ENABLED && TLS_SHA384_SUPPORT == ENABLED)
845 #if (TLS_RSA_PSS_SIGN_SUPPORT == ENABLED && TLS_SHA512_SUPPORT == ENABLED)
862 #if (TLS_ECDSA_SIGN_SUPPORT == ENABLED && TLS_SHA256_SUPPORT == ENABLED && \
863 TLS_BRAINPOOLP256R1_SUPPORT == ENABLED)
875 #if (TLS_ECDSA_SIGN_SUPPORT == ENABLED && TLS_SHA384_SUPPORT == ENABLED && \
876 TLS_BRAINPOOLP384R1_SUPPORT == ENABLED)
888 #if (TLS_ECDSA_SIGN_SUPPORT == ENABLED && TLS_SHA512_SUPPORT == ENABLED && \
889 TLS_BRAINPOOLP512R1_SUPPORT == ENABLED)
901 #if (TLS_SM2_SIGN_SUPPORT == ENABLED)
913 #if (TLS_ED25519_SIGN_SUPPORT == ENABLED)
926 #if (TLS_ED448_SIGN_SUPPORT == ENABLED)
962 hashAlgo != context->cipherSuite.prfHashAlgo)
975 if(context->numSupportedSignAlgos > 0)
978 for(i = 0; i < context->numSupportedSignAlgos; i++)
981 if(context->supportedSignAlgos[i] == signScheme)
986 if(i >= context->numSupportedSignAlgos)
1158 #if (EC_SUPPORT == ENABLED)
bool_t x509IsCurveSupported(const uint8_t *oid, size_t length)
Check whether a given elliptic curve is supported.
@ TLS_CIPHER_SUITE_TYPE_RSA
@ TLS_SIGN_SCHEME_ECDSA_BP256R1_TLS13_SHA256
bool_t x509IsSignAlgoSupported(X509SignatureAlgo signAlgo)
Check whether a given signature algorithm is supported.
const HashAlgo * tlsGetHashAlgo(TlsHashAlgo hashAlgoId)
Get the hash algorithm that matches the specified identifier.
bool_t x509IsHashAlgoSupported(X509HashAlgo hashAlgo)
Check whether a given hash algorithm is supported.
@ TLS_SIGN_SCHEME_RSA_PSS_RSAE_SHA256
bool_t tlsIsCertSignAlgoSupported(uint16_t signScheme)
Check whether a signature algorithm can be used for X.509 certificate validation.
@ TLS_STATE_CERTIFICATE_REQUEST
TlsCertificateType type
End entity certificate type.
const uint8_t BRAINPOOLP512R1_OID[9]
@ TLS_SIGN_SCHEME_RSA_PSS_PSS_SHA512
error_t tlsFormatSignAlgosExtension(TlsContext *context, uint8_t *p, size_t *written)
Format SignatureAlgorithms extension.
bool_t tlsIsSignAlgoAcceptable(TlsContext *context, uint16_t signScheme, const TlsCertDesc *cert)
Check whether a signature algorithm is compatible with the specified end-entity certificate.
TlsHashAlgo
Hash algorithms.
const uint8_t BRAINPOOLP384R1_OID[9]
@ TLS_SIGN_SCHEME_RSA_PSS_RSAE_SHA512
@ TLS_SIGN_SCHEME_ED25519
@ TLS_GROUP_BRAINPOOLP256R1
#define TLS_HASH_ALGO(signScheme)
@ TLS_CIPHER_SUITE_TYPE_TLS13
@ TLS_SIGN_SCHEME_RSA_PSS_PSS_SHA384
@ TLS_SIGN_SCHEME_RSA_PSS_RSAE_SHA384
@ TLS_CIPHER_SUITE_TYPE_SM
error_t tlsFormatSupportedSignAlgos(TlsContext *context, uint8_t *p, size_t *written)
Format the list of supported signature algorithms.
@ TLS_EXT_SIGNATURE_ALGORITHMS_CERT
@ TLS_CIPHER_SUITE_TYPE_ECDSA
@ TLS_SIGN_SCHEME_RSA_PKCS1_SHA1
bool_t tlsIsSignAlgoSupported(TlsContext *context, uint16_t signScheme)
Check whether a signature algorithm can be used for digital signatures.
const uint16_t tlsSupportedSignAlgos[]
@ TLS_SIGN_SCHEME_RSA_PSS_PSS_SHA256
@ TLS_SIGN_SCHEME_ECDSA_SECP521R1_SHA512
@ TLS_HASH_ALGO_INTRINSIC
error_t tlsSelectSignAlgo(TlsContext *context, const TlsCertDesc *cert, const TlsSignSchemeList *signAlgoList)
Select the algorithm to be used when generating digital signatures.
@ TLS_SIGN_SCHEME_ECDSA_SHA1
@ TLS_SIGN_SCHEME_RSA_PKCS1_SHA256
@ TLS_STATE_CLIENT_CERTIFICATE_VERIFY
@ TLS_SIGN_SCHEME_ECDSA_BP512R1_TLS13_SHA512
@ TLS_GROUP_BRAINPOOLP512R1
bool_t tlsIsSignAlgoOffered(uint16_t signScheme, const TlsSignSchemeList *signSchemeList)
Check whether a signature algorithm is offered in the SignatureAlgorithms extension.
@ TLS_SIGN_SCHEME_SM2SIG_SM3
@ TLS_SIGN_SCHEME_RSA_PKCS1_SHA512
@ TLS_SIGN_SCHEME_ECDSA_BP384R1_TLS13_SHA384
@ TLS_SIGN_SCHEME_RSA_PKCS1_SHA384
@ TLS_SIGN_SCHEME_ECDSA_SECP384R1_SHA384
Helper functions for signature generation and verification.
TLS (Transport Layer Security)
@ TLS_EXT_SIGNATURE_ALGORITHMS
Common interface for hash algorithms.
#define TLS_SIGN_ALGO(signScheme)
@ TLS_SIGN_SCHEME_ECDSA_SECP256R1_SHA256
error_t tlsFormatSignAlgosCertExtension(TlsContext *context, uint8_t *p, size_t *written)
Format SignatureAlgorithmsCert extension.
TlsSignatureScheme
Signature schemes.
@ TLS_CIPHER_SUITE_TYPE_DSA
#define TLS_SIGN_SCHEME(signAlgo, hashAlgo)
TlsNamedGroup namedCurve
Named curve used to generate the EC public key.
@ TLS_GROUP_BRAINPOOLP384R1
const uint8_t BRAINPOOLP256R1_OID[9]