tls_sign_generate.c File Reference

RSA/DSA/ECDSA/EdDSA signature generation. More...

#include "tls.h"
#include "tls_sign_generate.h"
#include "tls_sign_misc.h"
#include "tls_transcript_hash.h"
#include "tls_misc.h"
#include "pkix/pem_import.h"
#include "pkc/rsa.h"
#include "pkc/dsa.h"
#include "ecc/ecdsa.h"
#include "ecc/eddsa.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   TLS_TRACE_LEVEL
 

Functions

error_t tlsGenerateSignature (TlsContext *context, uint8_t *p, size_t *length)
 Digital signature generation (TLS 1.0 or TLS 1.1) More...
 
error_t tls12GenerateSignature (TlsContext *context, uint8_t *p, size_t *length)
 Digital signature generation (TLS 1.2) More...
 
error_t tlsGenerateRsaSignature (const RsaPrivateKey *key, const uint8_t *digest, uint8_t *signature, size_t *signatureLen)
 Generate RSA signature (TLS 1.0 and TLS 1.1) More...
 
error_t tlsGenerateRsaPkcs1Signature (TlsContext *context, const HashAlgo *hashAlgo, const uint8_t *digest, uint8_t *signature, size_t *signatureLen)
 Generate RSA signature (TLS 1.2) More...
 
error_t tlsGenerateRsaPssSignature (TlsContext *context, const HashAlgo *hashAlgo, const uint8_t *digest, uint8_t *signature, size_t *signatureLen)
 Generate RSA-PSS signature. More...
 
error_t tlsGenerateDsaSignature (TlsContext *context, const uint8_t *digest, size_t digestLen, uint8_t *signature, size_t *signatureLen)
 Generate DSA signature. More...
 
error_t tlsGenerateEcdsaSignature (TlsContext *context, const uint8_t *digest, size_t digestLen, uint8_t *signature, size_t *signatureLen)
 Generate ECDSA signature. More...
 
error_t tlsGenerateEd25519Signature (TlsContext *context, const EddsaMessageChunk *messageChunks, uint8_t *signature, size_t *signatureLen)
 Generate Ed25519 signature. More...
 
error_t tlsGenerateEd448Signature (TlsContext *context, const EddsaMessageChunk *messageChunks, uint8_t *signature, size_t *signatureLen)
 Generate Ed448 signature. More...
 

Detailed Description

RSA/DSA/ECDSA/EdDSA signature generation.

License

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

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneSSL 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.4.0

Definition in file tls_sign_generate.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   TLS_TRACE_LEVEL

Definition at line 32 of file tls_sign_generate.c.

Function Documentation

◆ tls12GenerateSignature()

error_t tls12GenerateSignature ( TlsContext context,
uint8_t *  p,
size_t *  length 
)

Digital signature generation (TLS 1.2)

Parameters
[in]contextPointer to the TLS context
[out]pBuffer where to store the digitally-signed element
[out]lengthLength of the digitally-signed element
Returns
Error code

Definition at line 183 of file tls_sign_generate.c.

◆ tlsGenerateDsaSignature()

error_t tlsGenerateDsaSignature ( TlsContext context,
const uint8_t *  digest,
size_t  digestLen,
uint8_t *  signature,
size_t *  signatureLen 
)

Generate DSA signature.

Parameters
[in]contextPointer to the TLS context
[in]digestDigest of the message to be signed
[in]digestLenLength in octets of the digest
[out]signatureResulting signature
[out]signatureLenLength of the resulting signature
Returns
Error code

Definition at line 543 of file tls_sign_generate.c.

◆ tlsGenerateEcdsaSignature()

error_t tlsGenerateEcdsaSignature ( TlsContext context,
const uint8_t *  digest,
size_t  digestLen,
uint8_t *  signature,
size_t *  signatureLen 
)

Generate ECDSA signature.

Parameters
[in]contextPointer to the TLS context
[in]digestDigest of the message to be signed
[in]digestLenLength in octets of the digest
[out]signatureResulting signature
[out]signatureLenLength of the resulting signature
Returns
Error code

Definition at line 598 of file tls_sign_generate.c.

◆ tlsGenerateEd25519Signature()

error_t tlsGenerateEd25519Signature ( TlsContext context,
const EddsaMessageChunk messageChunks,
uint8_t *  signature,
size_t *  signatureLen 
)

Generate Ed25519 signature.

Parameters
[in]contextPointer to the TLS context
[in]messageChunksCollection of chunks representing the message to be signed
[out]signatureResulting signature
[out]signatureLenLength of the resulting signature
Returns
Error code

Definition at line 680 of file tls_sign_generate.c.

◆ tlsGenerateEd448Signature()

error_t tlsGenerateEd448Signature ( TlsContext context,
const EddsaMessageChunk messageChunks,
uint8_t *  signature,
size_t *  signatureLen 
)

Generate Ed448 signature.

Parameters
[in]contextPointer to the TLS context
[in]messageChunksCollection of chunks representing the message to be signed
[out]signatureResulting signature
[out]signatureLenLength of the resulting signature
Returns
Error code

Definition at line 742 of file tls_sign_generate.c.

◆ tlsGenerateRsaPkcs1Signature()

error_t tlsGenerateRsaPkcs1Signature ( TlsContext context,
const HashAlgo hashAlgo,
const uint8_t *  digest,
uint8_t *  signature,
size_t *  signatureLen 
)

Generate RSA signature (TLS 1.2)

Parameters
[in]contextPointer to the TLS context
[in]hashAlgoHash function used to digest the message
[in]digestDigest of the message to be signed
[out]signatureResulting signature
[out]signatureLenLength of the resulting signature
Returns
Error code

Definition at line 451 of file tls_sign_generate.c.

◆ tlsGenerateRsaPssSignature()

error_t tlsGenerateRsaPssSignature ( TlsContext context,
const HashAlgo hashAlgo,
const uint8_t *  digest,
uint8_t *  signature,
size_t *  signatureLen 
)

Generate RSA-PSS signature.

Parameters
[in]contextPointer to the TLS context
[in]hashAlgoHash function used to digest the message
[in]digestDigest of the message to be signed
[in]digestLenLength in octets of the digest
[out]signatureResulting signature
[out]signatureLenLength of the resulting signature
Returns
Error code

Definition at line 497 of file tls_sign_generate.c.

◆ tlsGenerateRsaSignature()

error_t tlsGenerateRsaSignature ( const RsaPrivateKey key,
const uint8_t *  digest,
uint8_t *  signature,
size_t *  signatureLen 
)

Generate RSA signature (TLS 1.0 and TLS 1.1)

Parameters
[in]keySigner's RSA private key
[in]digestDigest of the message to be signed
[out]signatureResulting signature
[out]signatureLenLength of the resulting signature
Returns
Error code

Definition at line 330 of file tls_sign_generate.c.

◆ tlsGenerateSignature()

error_t tlsGenerateSignature ( TlsContext context,
uint8_t *  p,
size_t *  length 
)

Digital signature generation (TLS 1.0 or TLS 1.1)

Parameters
[in]contextPointer to the TLS context
[out]pBuffer where to store the digitally-signed element
[out]lengthLength of the digitally-signed element
Returns
Error code

Definition at line 59 of file tls_sign_generate.c.