Sergey Pastor / 1

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

ecdsa.c File Reference

ecdsa.c File Reference

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

Go to the source code of this file.

Functions

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

Detailed Description

ECDSA (Elliptic Curve Digital Signature Algorithm)

License

Copyright (C) 2010-2017 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.7.6

Definition in file ecdsa.c.


Function Documentation

void ecdsaFreeSignature ( EcdsaSignature signature )

Release an ECDSA signature.

Parameters:
[in]signaturePointer to the ECDSA signature to free

Definition at line 81 of file ecdsa.c.

error_t ecdsaGenerateSignature ( const EcDomainParameters params,
const PrngAlgo prngAlgo,
void *  prngContext,
const Mpi privateKey,
const uint8_t *  digest,
size_t  digestLength,
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]digestLengthLength in octets of the digest
[out]signature(R, S) integer pair
Returns:
Error code

Definition at line 360 of file ecdsa.c.

void ecdsaInitSignature ( EcdsaSignature signature )

Initialize an ECDSA signature.

Parameters:
[in]signaturePointer to the ECDSA signature to initialize

Definition at line 68 of file ecdsa.c.

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.

error_t ecdsaVerifySignature ( const EcDomainParameters params,
const EcPoint publicKey,
const uint8_t *  digest,
size_t  digestLength,
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]digestLengthLength in octets of the digest
[in]signature(R, S) integer pair
Returns:
Error code

Definition at line 475 of file ecdsa.c.

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 97 of file ecdsa.c.