ecdsa.h File Reference

ECDSA (Elliptic Curve Digital Signature Algorithm) More...

#include "core/crypto.h"
#include "ecc/ec.h"

Go to the source code of this file.

Data Structures

struct  EcdsaSignature
 ECDSA signature. More...
 

Functions

void ecdsaInitSignature (EcdsaSignature *signature)
 Initialize an ECDSA signature. More...
 
void ecdsaFreeSignature (EcdsaSignature *signature)
 Release an ECDSA signature. More...
 
error_t ecdsaWriteSignature (const EcdsaSignature *signature, uint8_t *data, size_t *length)
 Encode ECDSA signature using ASN.1. More...
 
error_t ecdsaReadSignature (const uint8_t *data, size_t length, EcdsaSignature *signature)
 Read an ASN.1 encoded ECDSA signature. More...
 
error_t ecdsaGenerateKeyPair (const EcDomainParameters *params, const PrngAlgo *prngAlgo, void *prngContext, Mpi *privateKey, EcPoint *publicKey)
 ECDSA key pair generation. More...
 
error_t ecdsaGenerateSignature (const EcDomainParameters *params, const PrngAlgo *prngAlgo, void *prngContext, const Mpi *privateKey, const uint8_t *digest, size_t digestLen, EcdsaSignature *signature)
 ECDSA signature generation. More...
 
error_t ecdsaVerifySignature (const EcDomainParameters *params, const EcPoint *publicKey, const uint8_t *digest, size_t digestLen, const EcdsaSignature *signature)
 ECDSA signature verification. More...
 

Variables

const uint8_t ECDSA_WITH_SHA1_OID [7]
 
const uint8_t ECDSA_WITH_SHA224_OID [8]
 
const uint8_t ECDSA_WITH_SHA256_OID [8]
 
const uint8_t ECDSA_WITH_SHA384_OID [8]
 
const uint8_t ECDSA_WITH_SHA512_OID [8]
 
const uint8_t ECDSA_WITH_SHA3_224_OID [9]
 
const uint8_t ECDSA_WITH_SHA3_256_OID [9]
 
const uint8_t ECDSA_WITH_SHA3_384_OID [9]
 
const uint8_t ECDSA_WITH_SHA3_512_OID [9]
 

Detailed Description

ECDSA (Elliptic Curve Digital Signature Algorithm)

License

Copyright (C) 2010-2018 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
1.9.0

Definition in file ecdsa.h.

Function Documentation

◆ ecdsaFreeSignature()

void ecdsaFreeSignature ( EcdsaSignature signature)

Release an ECDSA signature.

Parameters
[in]signaturePointer to the ECDSA signature to free

Definition at line 80 of file ecdsa.c.

◆ ecdsaGenerateKeyPair()

error_t ecdsaGenerateKeyPair ( const EcDomainParameters params,
const PrngAlgo prngAlgo,
void *  prngContext,
Mpi privateKey,
EcPoint publicKey 
)

ECDSA key pair generation.

Parameters
[in]paramsEC domain parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[out]privateKeyECDSA private key
[out]publicKeyECDSA public key
Returns
Error code

Definition at line 353 of file ecdsa.c.

◆ ecdsaGenerateSignature()

error_t ecdsaGenerateSignature ( const EcDomainParameters params,
const PrngAlgo prngAlgo,
void *  prngContext,
const Mpi privateKey,
const uint8_t *  digest,
size_t  digestLen,
EcdsaSignature signature 
)

ECDSA signature generation.

Parameters
[in]paramsEC domain parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[in]privateKeySigner's ECDSA private key
[in]digestDigest of the message to be signed
[in]digestLenLength in octets of the digest
[out]signature(R, S) integer pair
Returns
Error code

Definition at line 409 of file ecdsa.c.

◆ ecdsaInitSignature()

void ecdsaInitSignature ( EcdsaSignature signature)

Initialize an ECDSA signature.

Parameters
[in]signaturePointer to the ECDSA signature to initialize

Definition at line 67 of file ecdsa.c.

◆ ecdsaReadSignature()

error_t ecdsaReadSignature ( const uint8_t *  data,
size_t  length,
EcdsaSignature signature 
)

Read an ASN.1 encoded ECDSA signature.

Parameters
[in]dataPointer to the ASN.1 structure to decode
[in]lengthLength of the ASN.1 structure
[out]signature(R, S) integer pair
Returns
Error code

Definition at line 253 of file ecdsa.c.

◆ ecdsaVerifySignature()

error_t ecdsaVerifySignature ( const EcDomainParameters params,
const EcPoint publicKey,
const uint8_t *  digest,
size_t  digestLen,
const EcdsaSignature signature 
)

ECDSA signature verification.

Parameters
[in]paramsEC domain parameters
[in]publicKeySigner's ECDSA public key
[in]digestDigest of the message whose signature is to be verified
[in]digestLenLength in octets of the digest
[in]signature(R, S) integer pair
Returns
Error code

Definition at line 524 of file ecdsa.c.

◆ ecdsaWriteSignature()

error_t ecdsaWriteSignature ( const EcdsaSignature signature,
uint8_t *  data,
size_t *  length 
)

Encode ECDSA signature using ASN.1.

Parameters
[in]signature(R, S) integer pair
[out]dataPointer to the buffer where to store the resulting ASN.1 structure
[out]lengthLength of the ASN.1 structure
Returns
Error code

Definition at line 96 of file ecdsa.c.

Variable Documentation

◆ ECDSA_WITH_SHA1_OID

const uint8_t ECDSA_WITH_SHA1_OID[7]

Definition at line 43 of file ecdsa.c.

◆ ECDSA_WITH_SHA224_OID

const uint8_t ECDSA_WITH_SHA224_OID[8]

Definition at line 45 of file ecdsa.c.

◆ ECDSA_WITH_SHA256_OID

const uint8_t ECDSA_WITH_SHA256_OID[8]

Definition at line 47 of file ecdsa.c.

◆ ECDSA_WITH_SHA384_OID

const uint8_t ECDSA_WITH_SHA384_OID[8]

Definition at line 49 of file ecdsa.c.

◆ ECDSA_WITH_SHA3_224_OID

const uint8_t ECDSA_WITH_SHA3_224_OID[9]

Definition at line 53 of file ecdsa.c.

◆ ECDSA_WITH_SHA3_256_OID

const uint8_t ECDSA_WITH_SHA3_256_OID[9]

Definition at line 55 of file ecdsa.c.

◆ ECDSA_WITH_SHA3_384_OID

const uint8_t ECDSA_WITH_SHA3_384_OID[9]

Definition at line 57 of file ecdsa.c.

◆ ECDSA_WITH_SHA3_512_OID

const uint8_t ECDSA_WITH_SHA3_512_OID[9]

Definition at line 59 of file ecdsa.c.

◆ ECDSA_WITH_SHA512_OID

const uint8_t ECDSA_WITH_SHA512_OID[8]

Definition at line 51 of file ecdsa.c.