tls_sign_misc.c File Reference

Helper functions for signature generation and verification. More...

#include "tls/tls.h"
#include "tls/tls_cipher_suites.h"
#include "tls/tls_sign_misc.h"
#include "tls/tls_misc.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   TLS_TRACE_LEVEL
 

Functions

error_t tlsSelectSignAlgo (TlsContext *context, const TlsCertDesc *cert, const TlsSignSchemeList *signAlgoList)
 Select the algorithm to be used when generating digital signatures. More...
 
error_t tlsFormatSignAlgosExtension (TlsContext *context, uint8_t *p, size_t *written)
 Format SignatureAlgorithms extension. More...
 
error_t tlsFormatSignAlgosCertExtension (TlsContext *context, uint8_t *p, size_t *written)
 Format SignatureAlgorithmsCert extension. More...
 
error_t tlsFormatSupportedSignAlgos (TlsContext *context, uint8_t *p, size_t *written)
 Format the list of supported signature algorithms. More...
 
bool_t tlsIsSignAlgoOffered (uint16_t signScheme, const TlsSignSchemeList *signSchemeList)
 Check whether a signature algorithm is offered in the SignatureAlgorithms extension. More...
 
bool_t tlsIsSignAlgoAcceptable (TlsContext *context, uint16_t signScheme, const TlsCertDesc *cert)
 Check whether a signature algorithm is compatible with the specified end-entity certificate. More...
 
bool_t tlsIsSignAlgoSupported (TlsContext *context, uint16_t signScheme)
 Check whether a signature algorithm can be used for digital signatures. More...
 
bool_t tlsIsCertSignAlgoSupported (uint16_t signScheme)
 Check whether a signature algorithm can be used for X.509 certificate validation. More...
 

Variables

const uint16_t tlsSupportedSignAlgos []
 

Detailed Description

Helper functions for signature generation and verification.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2022-2026 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneIPSEC Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.6.4

Definition in file tls_sign_misc.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   TLS_TRACE_LEVEL

Definition at line 32 of file tls_sign_misc.c.

Function Documentation

◆ tlsFormatSignAlgosCertExtension()

error_t tlsFormatSignAlgosCertExtension ( TlsContext context,
uint8_t *  p,
size_t *  written 
)

Format SignatureAlgorithmsCert extension.

Parameters
[in]contextPointer to the TLS context
[in]pOutput stream where to write the SignatureAlgorithmsCert extension
[out]writtenTotal number of bytes that have been written
Returns
Error code

Definition at line 308 of file tls_sign_misc.c.

◆ tlsFormatSignAlgosExtension()

error_t tlsFormatSignAlgosExtension ( TlsContext context,
uint8_t *  p,
size_t *  written 
)

Format SignatureAlgorithms extension.

Parameters
[in]contextPointer to the TLS context
[in]pOutput stream where to write the SignatureAlgorithms extension
[out]writtenTotal number of bytes that have been written
Returns
Error code

Definition at line 245 of file tls_sign_misc.c.

◆ tlsFormatSupportedSignAlgos()

error_t tlsFormatSupportedSignAlgos ( TlsContext context,
uint8_t *  p,
size_t *  written 
)

Format the list of supported signature algorithms.

Parameters
[in]contextPointer to the TLS context
[in]pOutput stream where to write the list of signature algorithms
[out]writtenTotal number of bytes that have been written
Returns
Error code

Definition at line 378 of file tls_sign_misc.c.

◆ tlsIsCertSignAlgoSupported()

bool_t tlsIsCertSignAlgoSupported ( uint16_t  signScheme)

Check whether a signature algorithm can be used for X.509 certificate validation.

Parameters
[in]signSchemeSignature scheme
Returns
TRUE if the signature algorithm is supported, else FALSE

Definition at line 1108 of file tls_sign_misc.c.

◆ tlsIsSignAlgoAcceptable()

bool_t tlsIsSignAlgoAcceptable ( TlsContext context,
uint16_t  signScheme,
const TlsCertDesc cert 
)

Check whether a signature algorithm is compatible with the specified end-entity certificate.

Parameters
[in]contextPointer to the TLS context
[in]signSchemeSignature scheme
[in]certEnd entity certificate
Returns
TRUE if the signature algorithm is compatible, else FALSE

Definition at line 490 of file tls_sign_misc.c.

◆ tlsIsSignAlgoOffered()

bool_t tlsIsSignAlgoOffered ( uint16_t  signScheme,
const TlsSignSchemeList signSchemeList 
)

Check whether a signature algorithm is offered in the SignatureAlgorithms extension.

Parameters
[in]signSchemeSignature scheme
[in]signSchemeListList of signature schemes
Returns
TRUE if the signature algorithm is offered in the SignatureAlgorithms extension, else FALSE

Definition at line 447 of file tls_sign_misc.c.

◆ tlsIsSignAlgoSupported()

bool_t tlsIsSignAlgoSupported ( TlsContext context,
uint16_t  signScheme 
)

Check whether a signature algorithm can be used for digital signatures.

Parameters
[in]contextPointer to the TLS context
[in]signSchemeSignature scheme
Returns
TRUE if the signature algorithm is supported, else FALSE

Definition at line 731 of file tls_sign_misc.c.

◆ tlsSelectSignAlgo()

error_t tlsSelectSignAlgo ( TlsContext context,
const TlsCertDesc cert,
const TlsSignSchemeList signAlgoList 
)

Select the algorithm to be used when generating digital signatures.

Parameters
[in]contextPointer to the TLS context
[in]certEnd entity certificate
[in]signAlgoListList of signature/hash algorithm pairs offered by the peer
Returns
Error code

Definition at line 88 of file tls_sign_misc.c.

Variable Documentation

◆ tlsSupportedSignAlgos

const uint16_t tlsSupportedSignAlgos[]

Definition at line 45 of file tls_sign_misc.c.