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