eddsa.h File Reference

EdDSA (Edwards-Curve Digital Signature Algorithm) More...

#include "core/crypto.h"
#include "ecc/ec.h"
#include "ecc/ec_curves.h"
#include "ecc/ed25519.h"
#include "ecc/ed448.h"

Go to the source code of this file.

Data Structures

struct  EddsaPublicKey
 EdDSA public key. More...
 
struct  EddsaPrivateKey
 EdDSA private key. More...
 

Macros

#define EDDSA_MAX_PUBLIC_KEY_LEN   57
 
#define EDDSA_MAX_PRIVATE_KEY_LEN   57
 

Functions

void eddsaInitPublicKey (EddsaPublicKey *key)
 Initialize an EdDSA public key. More...
 
void eddsaFreePublicKey (EddsaPublicKey *key)
 Release an EdDSA public key. More...
 
void eddsaInitPrivateKey (EddsaPrivateKey *key)
 Initialize an EdDSA private key. More...
 
void eddsaFreePrivateKey (EddsaPrivateKey *key)
 Release an EdDSA private key. More...
 
error_t eddsaGenerateKeyPair (const PrngAlgo *prngAlgo, void *prngContext, const EcCurve *curve, EddsaPrivateKey *privateKey, EddsaPublicKey *publicKey)
 EdDSA key pair generation. More...
 
error_t eddsaGeneratePrivateKey (const PrngAlgo *prngAlgo, void *prngContext, const EcCurve *curve, EddsaPrivateKey *privateKey)
 EdDSA private key generation. More...
 
error_t eddsaGeneratePublicKey (const EddsaPrivateKey *privateKey, EddsaPublicKey *publicKey)
 Derive the public key from an EdDSA private key. More...
 
error_t eddsaImportPublicKey (EddsaPublicKey *key, const EcCurve *curve, const uint8_t *data, size_t length)
 Import an EdDSA public key. More...
 
error_t eddsaExportPublicKey (const EddsaPublicKey *key, uint8_t *data, size_t *length)
 Export an EdDSA public key. More...
 
error_t eddsaImportPrivateKey (EddsaPrivateKey *key, const EcCurve *curve, const uint8_t *data, size_t length)
 Import an EdDSA private key. More...
 
error_t eddsaExportPrivateKey (const EddsaPrivateKey *key, uint8_t *data, size_t *length)
 Export an EdDSA private key. More...
 

Detailed Description

EdDSA (Edwards-Curve Digital Signature Algorithm)

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2025 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneCRYPTO 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.5.0

Definition in file eddsa.h.

Macro Definition Documentation

◆ EDDSA_MAX_PRIVATE_KEY_LEN

#define EDDSA_MAX_PRIVATE_KEY_LEN   57

Definition at line 48 of file eddsa.h.

◆ EDDSA_MAX_PUBLIC_KEY_LEN

#define EDDSA_MAX_PUBLIC_KEY_LEN   57

Definition at line 41 of file eddsa.h.

Function Documentation

◆ eddsaExportPrivateKey()

error_t eddsaExportPrivateKey ( const EddsaPrivateKey key,
uint8_t *  data,
size_t *  length 
)

Export an EdDSA private key.

Parameters
[in]keyEdDSA private key
[out]dataPointer to the octet string
[out]lengthLength of the octet string, in bytes
Returns
Error code

Definition at line 424 of file eddsa.c.

◆ eddsaExportPublicKey()

error_t eddsaExportPublicKey ( const EddsaPublicKey key,
uint8_t *  data,
size_t *  length 
)

Export an EdDSA public key.

Parameters
[in]keyEdDSA public key
[out]dataPointer to the octet string
[out]lengthLength of the octet string, in bytes
Returns
Error code

Definition at line 327 of file eddsa.c.

◆ eddsaFreePrivateKey()

void eddsaFreePrivateKey ( EddsaPrivateKey key)

Release an EdDSA private key.

Parameters
[in]keyPointer to the EdDSA public key to free

Definition at line 95 of file eddsa.c.

◆ eddsaFreePublicKey()

void eddsaFreePublicKey ( EddsaPublicKey key)

Release an EdDSA public key.

Parameters
[in]keyPointer to the EdDSA public key to free

Definition at line 63 of file eddsa.c.

◆ eddsaGenerateKeyPair()

error_t eddsaGenerateKeyPair ( const PrngAlgo prngAlgo,
void *  prngContext,
const EcCurve curve,
EddsaPrivateKey privateKey,
EddsaPublicKey publicKey 
)

EdDSA key pair generation.

Parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[in]curveElliptic curve parameters
[out]privateKeyEdDSA private key
[out]publicKeyEdDSA public key (optional parameter)
Returns
Error code

Definition at line 112 of file eddsa.c.

◆ eddsaGeneratePrivateKey()

error_t eddsaGeneratePrivateKey ( const PrngAlgo prngAlgo,
void *  prngContext,
const EcCurve curve,
EddsaPrivateKey privateKey 
)

EdDSA private key generation.

Parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[in]curveElliptic curve parameters
[out]privateKeyEdDSA private key
Returns
Error code

Definition at line 154 of file eddsa.c.

◆ eddsaGeneratePublicKey()

error_t eddsaGeneratePublicKey ( const EddsaPrivateKey privateKey,
EddsaPublicKey publicKey 
)

Derive the public key from an EdDSA private key.

Parameters
[in]privateKeyEdDSA private key
[out]publicKeyEdDSA public key
Returns
Error code

Definition at line 217 of file eddsa.c.

◆ eddsaImportPrivateKey()

error_t eddsaImportPrivateKey ( EddsaPrivateKey key,
const EcCurve curve,
const uint8_t *  data,
size_t  length 
)

Import an EdDSA private key.

Parameters
[out]keyEdDSA private key
[in]dataPointer to the octet string
[in]lengthLength of the octet string, in bytes
Returns
Error code

Definition at line 371 of file eddsa.c.

◆ eddsaImportPublicKey()

error_t eddsaImportPublicKey ( EddsaPublicKey key,
const EcCurve curve,
const uint8_t *  data,
size_t  length 
)

Import an EdDSA public key.

Parameters
[out]keyEdDSA public key
[in]dataPointer to the octet string
[in]lengthLength of the octet string, in bytes
Returns
Error code

Definition at line 274 of file eddsa.c.

◆ eddsaInitPrivateKey()

void eddsaInitPrivateKey ( EddsaPrivateKey key)

Initialize an EdDSA private key.

Parameters
[in]keyPointer to the EdDSA private key to initialize

Definition at line 75 of file eddsa.c.

◆ eddsaInitPublicKey()

void eddsaInitPublicKey ( EddsaPublicKey key)

Initialize an EdDSA public key.

Parameters
[in]keyPointer to the EdDSA public key to initialize

Definition at line 48 of file eddsa.c.