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