eddsa.c
Go to the documentation of this file.
1 /**
2  * @file eddsa.c
3  * @brief EdDSA (Edwards-Curve Digital Signature Algorithm)
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 CycloneCrypto 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 //Switch to the appropriate trace level
32 #define TRACE_LEVEL CRYPTO_TRACE_LEVEL
33 
34 //Dependencies
35 #include "core/crypto.h"
36 #include "ecc/eddsa.h"
37 #include "mpi/mpi.h"
38 #include "debug.h"
39 
40 //Check crypto library configuration
41 #if (ED25519_SUPPORT == ENABLED || ED448_SUPPORT == ENABLED)
42 
43 
44 /**
45  * @brief Initialize a DSA public key
46  * @param[in] key Pointer to the DSA public key to initialize
47  **/
48 
50 {
51  //Initialize multiple precision integer
52  mpiInit(&key->q);
53 }
54 
55 
56 /**
57  * @brief Release a DSA public key
58  * @param[in] key Pointer to the DSA public key to free
59  **/
60 
62 {
63  //Free multiple precision integer
64  mpiFree(&key->q);
65 }
66 
67 
68 /**
69  * @brief Initialize a DSA private key
70  * @param[in] key Pointer to the DSA private key to initialize
71  **/
72 
74 {
75  //Initialize multiple precision integers
76  mpiInit(&key->d);
77  mpiInit(&key->q);
78 }
79 
80 
81 /**
82  * @brief Release a DSA private key
83  * @param[in] key Pointer to the DSA public key to free
84  **/
85 
87 {
88  //Free multiple precision integers
89  mpiFree(&key->d);
90  mpiFree(&key->q);
91 }
92 
93 #endif
void eddsaFreePrivateKey(EddsaPrivateKey *key)
Release a DSA private key.
Definition: eddsa.c:86
void eddsaInitPrivateKey(EddsaPrivateKey *key)
Initialize a DSA private key.
Definition: eddsa.c:73
void mpiInit(Mpi *r)
Initialize a multiple precision integer.
Definition: mpi.c:48
Mpi q
Public key.
Definition: eddsa.h:50
EdDSA public key.
Definition: eddsa.h:48
EdDSA (Edwards-Curve Digital Signature Algorithm)
MPI (Multiple Precision Integer Arithmetic)
Mpi q
Public key.
Definition: eddsa.h:61
General definitions for cryptographic algorithms.
EdDSA private key.
Definition: eddsa.h:58
Mpi d
Private key.
Definition: eddsa.h:60
void eddsaFreePublicKey(EddsaPublicKey *key)
Release a DSA public key.
Definition: eddsa.c:61
void eddsaInitPublicKey(EddsaPublicKey *key)
Initialize a DSA public key.
Definition: eddsa.c:49
Debugging facilities.
void mpiFree(Mpi *r)
Release a multiple precision integer.
Definition: mpi.c:62