dsa.h File Reference

DSA (Digital Signature Algorithm) More...

#include "core/crypto.h"
#include "mpi/mpi.h"

Go to the source code of this file.

Data Structures

struct  DsaPublicKey
 DSA public key. More...
 
struct  DsaPrivateKey
 DSA private key. More...
 
struct  DsaSignature
 DSA signature. More...
 

Functions

void dsaInitPublicKey (DsaPublicKey *key)
 Initialize a DSA public key. More...
 
void dsaFreePublicKey (DsaPublicKey *key)
 Release a DSA public key. More...
 
void dsaInitPrivateKey (DsaPrivateKey *key)
 Initialize a DSA private key. More...
 
void dsaFreePrivateKey (DsaPrivateKey *key)
 Release a DSA private key. More...
 
void dsaInitSignature (DsaSignature *signature)
 Initialize a DSA signature. More...
 
void dsaFreeSignature (DsaSignature *signature)
 Release a DSA signature. More...
 
error_t dsaWriteSignature (const DsaSignature *signature, uint8_t *data, size_t *length)
 Encode DSA signature using ASN.1. More...
 
error_t dsaReadSignature (const uint8_t *data, size_t length, DsaSignature *signature)
 Read an ASN.1 encoded DSA signature. More...
 
error_t dsaGenerateSignature (const PrngAlgo *prngAlgo, void *prngContext, const DsaPrivateKey *key, const uint8_t *digest, size_t digestLen, DsaSignature *signature)
 DSA signature generation. More...
 
error_t dsaVerifySignature (const DsaPublicKey *key, const uint8_t *digest, size_t digestLen, const DsaSignature *signature)
 DSA signature verification. More...
 

Variables

const uint8_t DSA_OID [7]
 
const uint8_t DSA_WITH_SHA1_OID [7]
 
const uint8_t DSA_WITH_SHA224_OID [9]
 
const uint8_t DSA_WITH_SHA256_OID [9]
 
const uint8_t DSA_WITH_SHA384_OID [9]
 
const uint8_t DSA_WITH_SHA512_OID [9]
 
const uint8_t DSA_WITH_SHA3_224_OID [9]
 
const uint8_t DSA_WITH_SHA3_256_OID [9]
 
const uint8_t DSA_WITH_SHA3_384_OID [9]
 
const uint8_t DSA_WITH_SHA3_512_OID [9]
 

Detailed Description

DSA (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 dsa.h.

Function Documentation

◆ dsaFreePrivateKey()

void dsaFreePrivateKey ( DsaPrivateKey key)

Release a DSA private key.

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

Definition at line 120 of file dsa.c.

◆ dsaFreePublicKey()

void dsaFreePublicKey ( DsaPublicKey key)

Release a DSA public key.

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

Definition at line 90 of file dsa.c.

◆ dsaFreeSignature()

void dsaFreeSignature ( DsaSignature signature)

Release a DSA signature.

Parameters
[in]signaturePointer to the DSA signature to free

Definition at line 148 of file dsa.c.

◆ dsaGenerateSignature()

error_t dsaGenerateSignature ( const PrngAlgo prngAlgo,
void *  prngContext,
const DsaPrivateKey key,
const uint8_t *  digest,
size_t  digestLen,
DsaSignature signature 
)

DSA signature generation.

Parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[in]keySigner's DSA 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 420 of file dsa.c.

◆ dsaInitPrivateKey()

void dsaInitPrivateKey ( DsaPrivateKey key)

Initialize a DSA private key.

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

Definition at line 105 of file dsa.c.

◆ dsaInitPublicKey()

void dsaInitPublicKey ( DsaPublicKey key)

Initialize a DSA public key.

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

Definition at line 75 of file dsa.c.

◆ dsaInitSignature()

void dsaInitSignature ( DsaSignature signature)

Initialize a DSA signature.

Parameters
[in]signaturePointer to the DSA signature to initialize

Definition at line 135 of file dsa.c.

◆ dsaReadSignature()

error_t dsaReadSignature ( const uint8_t *  data,
size_t  length,
DsaSignature signature 
)

Read an ASN.1 encoded DSA 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 320 of file dsa.c.

◆ dsaVerifySignature()

error_t dsaVerifySignature ( const DsaPublicKey key,
const uint8_t *  digest,
size_t  digestLen,
const DsaSignature signature 
)

DSA signature verification.

Parameters
[in]keySigner's DSA 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 526 of file dsa.c.

◆ dsaWriteSignature()

error_t dsaWriteSignature ( const DsaSignature signature,
uint8_t *  data,
size_t *  length 
)

Encode DSA 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 164 of file dsa.c.

Variable Documentation

◆ DSA_OID

const uint8_t DSA_OID[7]

Definition at line 49 of file dsa.c.

◆ DSA_WITH_SHA1_OID

const uint8_t DSA_WITH_SHA1_OID[7]

Definition at line 51 of file dsa.c.

◆ DSA_WITH_SHA224_OID

const uint8_t DSA_WITH_SHA224_OID[9]

Definition at line 53 of file dsa.c.

◆ DSA_WITH_SHA256_OID

const uint8_t DSA_WITH_SHA256_OID[9]

Definition at line 55 of file dsa.c.

◆ DSA_WITH_SHA384_OID

const uint8_t DSA_WITH_SHA384_OID[9]

Definition at line 57 of file dsa.c.

◆ DSA_WITH_SHA3_224_OID

const uint8_t DSA_WITH_SHA3_224_OID[9]

Definition at line 61 of file dsa.c.

◆ DSA_WITH_SHA3_256_OID

const uint8_t DSA_WITH_SHA3_256_OID[9]

Definition at line 63 of file dsa.c.

◆ DSA_WITH_SHA3_384_OID

const uint8_t DSA_WITH_SHA3_384_OID[9]

Definition at line 65 of file dsa.c.

◆ DSA_WITH_SHA3_512_OID

const uint8_t DSA_WITH_SHA3_512_OID[9]

Definition at line 67 of file dsa.c.

◆ DSA_WITH_SHA512_OID

const uint8_t DSA_WITH_SHA512_OID[9]

Definition at line 59 of file dsa.c.