tls_signature.h
Go to the documentation of this file.
1 /**
2  * @file tls_signature.h
3  * @brief RSA/DSA/ECDSA/EdDSA signature generation and verification
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2019 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneSSL Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 1.9.6
29  **/
30 
31 #ifndef _TLS_SIGNATURE_H
32 #define _TLS_SIGNATURE_H
33 
34 //Dependencies
35 #include "tls.h"
36 
37 //C++ guard
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 //TLS related functions
44  const TlsSignHashAlgos *supportedSignAlgos);
45 
46 error_t tlsGenerateSignature(TlsContext *context, uint8_t *p,
47  size_t *length);
48 
49 error_t tlsVerifySignature(TlsContext *context, const uint8_t *p,
50  size_t length);
51 
52 error_t tls12GenerateSignature(TlsContext *context, uint8_t *p,
53  size_t *length);
54 
55 error_t tls12VerifySignature(TlsContext *context, const uint8_t *p,
56  size_t length);
57 
59  const uint8_t *digest, uint8_t *signature, size_t *signatureLen);
60 
62  const uint8_t *digest, const uint8_t *signature, size_t signatureLen);
63 
64 error_t tlsGenerateDsaSignature(TlsContext *context, const uint8_t *digest,
65  size_t digestLen, uint8_t *signature, size_t *signatureLen);
66 
67 error_t tlsVerifyDsaSignature(TlsContext *context, const uint8_t *digest,
68  size_t digestLen, const uint8_t *signature, size_t signatureLen);
69 
70 error_t tlsGenerateEcdsaSignature(TlsContext *context, const uint8_t *digest,
71  size_t digestLen, uint8_t *signature, size_t *signatureLen);
72 
73 error_t tlsVerifyEcdsaSignature(TlsContext *context, const uint8_t *digest,
74  size_t digestLen, const uint8_t *signature, size_t signatureLen);
75 
76 error_t tlsGenerateEddsaSignature(TlsContext *context, const uint8_t *message,
77  size_t messageLen, uint8_t *signature, size_t *signatureLen);
78 
79 error_t tlsVerifyEddsaSignature(TlsContext *context, const uint8_t *message,
80  size_t messageLen, const uint8_t *signature, size_t signatureLen);
81 
82 //C++ guard
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 #endif
error_t tlsVerifySignature(TlsContext *context, const uint8_t *p, size_t length)
Digital signature verification (SSL 3.0, TLS 1.0 and TLS 1.1)
uint8_t length
Definition: dtls_misc.h:149
error_t tlsVerifyDsaSignature(TlsContext *context, const uint8_t *digest, size_t digestLen, const uint8_t *signature, size_t signatureLen)
Verify DSA signature.
error_t tlsVerifyEddsaSignature(TlsContext *context, const uint8_t *message, size_t messageLen, const uint8_t *signature, size_t signatureLen)
Verify EdDSA signature.
error_t tlsGenerateEddsaSignature(TlsContext *context, const uint8_t *message, size_t messageLen, uint8_t *signature, size_t *signatureLen)
Generate EdDSA signature.
uint8_t p
Definition: ndp.h:298
uint8_t signature
Definition: tls.h:1370
error_t tlsGenerateEcdsaSignature(TlsContext *context, const uint8_t *digest, size_t digestLen, uint8_t *signature, size_t *signatureLen)
Generate ECDSA signature.
error_t tlsGenerateSignature(TlsContext *context, uint8_t *p, size_t *length)
Digital signature generation(SSL 3.0, TLS 1.0 or TLS 1.1)
__start_packed struct @65 TlsSignHashAlgos
List of signature algorithms.
error_t tlsVerifyEcdsaSignature(TlsContext *context, const uint8_t *digest, size_t digestLen, const uint8_t *signature, size_t signatureLen)
Verify ECDSA signature.
#define TlsContext
Definition: tls.h:36
error_t
Error codes.
Definition: error.h:42
error_t tlsGenerateDsaSignature(TlsContext *context, const uint8_t *digest, size_t digestLen, uint8_t *signature, size_t *signatureLen)
Generate DSA signature.
RSA public key.
Definition: rsa.h:48
error_t tls12GenerateSignature(TlsContext *context, uint8_t *p, size_t *length)
error_t tlsVerifyRsaSignature(const RsaPublicKey *key, const uint8_t *digest, const uint8_t *signature, size_t signatureLen)
Verify RSA signature (SSL 3.0, TLS 1.0 and TLS 1.1)
Certificate descriptor.
Definition: tls.h:1877
RSA private key.
Definition: rsa.h:59
error_t tlsGenerateRsaSignature(const RsaPrivateKey *key, const uint8_t *digest, uint8_t *signature, size_t *signatureLen)
Generate RSA signature (SSL 3.0, TLS 1.0 and TLS 1.1)
uint8_t message[]
Definition: chap.h:152
TLS (Transport Layer Security)
error_t tlsSelectSignatureScheme(TlsContext *context, const TlsCertDesc *cert, const TlsSignHashAlgos *supportedSignAlgos)
Select the algorithm to be used when generating digital signatures.
Definition: tls_signature.c:60
error_t tls12VerifySignature(TlsContext *context, const uint8_t *p, size_t length)