tls_sign_verify.c File Reference

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

#include "tls.h"
#include "tls_sign_verify.h"
#include "tls_sign_misc.h"
#include "tls_transcript_hash.h"
#include "tls_misc.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 tlsVerifySignature (TlsContext *context, const uint8_t *p, size_t length)
 Digital signature verification (TLS 1.0 and TLS 1.1) More...
 
error_t tls12VerifySignature (TlsContext *context, const uint8_t *p, size_t length)
 Digital signature verification (TLS 1.2) More...
 
error_t tlsVerifyRsaSignature (const RsaPublicKey *key, const uint8_t *digest, const uint8_t *signature, size_t signatureLen)
 Verify RSA signature (TLS 1.0 and TLS 1.1) More...
 
error_t tlsVerifyRsaEm (const uint8_t *digest, const uint8_t *em, size_t emLen)
 Verify RSA encoded message. More...
 
error_t tlsVerifyDsaSignature (TlsContext *context, const uint8_t *digest, size_t digestLen, const uint8_t *signature, size_t signatureLen)
 Verify DSA signature. More...
 
error_t tlsVerifyEcdsaSignature (TlsContext *context, const uint8_t *digest, size_t digestLen, const uint8_t *signature, size_t signatureLen)
 Verify ECDSA signature. More...
 
error_t tlsVerifyEd25519Signature (TlsContext *context, const DataChunk *messageChunks, const uint8_t *signature, size_t signatureLen)
 Verify Ed25519 signature. More...
 
error_t tlsVerifyEd448Signature (TlsContext *context, const DataChunk *messageChunks, const uint8_t *signature, size_t signatureLen)
 Verify Ed448 signature. More...
 

Detailed Description

RSA/DSA/ECDSA/EdDSA signature verification.

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.4

Definition in file tls_sign_verify.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   TLS_TRACE_LEVEL

Definition at line 32 of file tls_sign_verify.c.

Function Documentation

◆ tls12VerifySignature()

error_t tls12VerifySignature ( TlsContext context,
const uint8_t *  p,
size_t  length 
)

Digital signature verification (TLS 1.2)

Parameters
[in]contextPointer to the TLS context
[in]pPointer to the digitally-signed element to be verified
[in]lengthLength of the digitally-signed element
Returns
Error code

Definition at line 163 of file tls_sign_verify.c.

◆ tlsVerifyDsaSignature()

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

Verify DSA signature.

Parameters
[in]contextPointer to the TLS context
[in]digestDigest of the message whose signature is to be verified
[in]digestLenLength in octets of the digest
[in]signatureSignature to be verified
[in]signatureLenLength of the signature to be verified
Returns
Error code

Definition at line 501 of file tls_sign_verify.c.

◆ tlsVerifyEcdsaSignature()

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

Verify ECDSA signature.

Parameters
[in]contextPointer to the TLS context
[in]digestDigest of the message whose signature is to be verified
[in]digestLenLength in octets of the digest
[in]signatureSignature to be verified
[in]signatureLenLength of the signature to be verified
Returns
Error code

Definition at line 549 of file tls_sign_verify.c.

◆ tlsVerifyEd25519Signature()

error_t tlsVerifyEd25519Signature ( TlsContext context,
const DataChunk messageChunks,
const uint8_t *  signature,
size_t  signatureLen 
)

Verify Ed25519 signature.

Parameters
[in]contextPointer to the TLS context
[in]messageChunksArray of data chunks representing the message whose signature is to be verified
[in]signatureSignature to be verified
[in]signatureLenLength of the signature to be verified
Returns
Error code

Definition at line 617 of file tls_sign_verify.c.

◆ tlsVerifyEd448Signature()

error_t tlsVerifyEd448Signature ( TlsContext context,
const DataChunk messageChunks,
const uint8_t *  signature,
size_t  signatureLen 
)

Verify Ed448 signature.

Parameters
[in]contextPointer to the TLS context
[in]messageChunksArray of data chunks representing the message whose signature is to be verified
[in]signatureSignature to be verified
[in]signatureLenLength of the signature to be verified
Returns
Error code

Definition at line 665 of file tls_sign_verify.c.

◆ tlsVerifyRsaEm()

error_t tlsVerifyRsaEm ( const uint8_t *  digest,
const uint8_t *  em,
size_t  emLen 
)

Verify RSA encoded message.

Parameters
[in]digestDigest value
[in]emEncoded message
[in]emLenLength of the encoded message
Returns
Error code

Definition at line 442 of file tls_sign_verify.c.

◆ tlsVerifyRsaSignature()

error_t tlsVerifyRsaSignature ( const RsaPublicKey key,
const uint8_t *  digest,
const uint8_t *  signature,
size_t  signatureLen 
)

Verify RSA signature (TLS 1.0 and TLS 1.1)

Parameters
[in]keySigner's RSA public key
[in]digestDigest of the message whose signature is to be verified
[in]signatureSignature to be verified
[in]signatureLenLength of the signature to be verified
Returns
Error code

Definition at line 348 of file tls_sign_verify.c.

◆ tlsVerifySignature()

error_t tlsVerifySignature ( TlsContext context,
const uint8_t *  p,
size_t  length 
)

Digital signature verification (TLS 1.0 and TLS 1.1)

Parameters
[in]contextPointer to the TLS context
[in]pPointer to the digitally-signed element to be verified
[in]lengthLength of the digitally-signed element
Returns
Error code

Definition at line 58 of file tls_sign_verify.c.