MPHELL  5.0.0
Data Structures | Typedefs | Functions
mphell_tuto_ecdsa_fips.c File Reference

Tutorial for ecdsa signature and verification using mphell. More...

#include <stdio.h>
#include "mphell/mphell.h"
Include dependency graph for mphell_tuto_ecdsa_fips.c:

Go to the source code of this file.

Data Structures

struct  ecdsa_sig
 Define an ECDSA signature. More...
 

Typedefs

typedef struct ecdsa_sig ecdsa_sig_t
 
typedef ecdsa_sig_t ecdsa_sig[1]
 

Functions

void ecdsa_sign_alloc (ecdsa_sig *sig, uint8_t size)
 
void ecdsa_sign_free (ecdsa_sig *sig)
 
void ec_point_mul_ecdsa (ec_point dst, number_srcptr u1, ec_point_srcptr G, number_srcptr u2, ec_point_srcptr key, ec_curve_srcptr E)
 Compute u1 * G + u2 * key. More...
 
void ecdsa_sign (unsigned char *hash, ecdsa_sig *sig, number_ptr priv_key, ec_curve *curve)
 
int8_t ecdsa_verify (unsigned char *hash, ecdsa_sig *sig, ec_point *pub_key, ec_curve *curve)
 Verify the signature "sig" of hash "hash" using public key "pub_key" and the EC "curve". More...
 
int8_t ecdsa_pub_key_validation (ec_point *pub_key, ec_curve *curve)
 
int main ()
 

Detailed Description

Tutorial for ecdsa signature and verification using mphell.

Definition in file mphell_tuto_ecdsa_fips.c.

Function Documentation

◆ ec_point_mul_ecdsa()

void ec_point_mul_ecdsa ( ec_point  dst,
number_srcptr  u1,
ec_point_srcptr  G,
number_srcptr  u2,
ec_point_srcptr  key,
ec_curve_srcptr  E 
)

Compute u1 * G + u2 * key.

Parameters
dstDestination point
u1Number
GBase point
u2Number
keyPublic key
EElliptic curve

Definition at line 118 of file mphell_tuto_ecdsa_fips.c.

◆ ecdsa_verify()

int8_t ecdsa_verify ( unsigned char *  hash,
ecdsa_sig sig,
ec_point pub_key,
ec_curve curve 
)

Verify the signature "sig" of hash "hash" using public key "pub_key" and the EC "curve".

Parameters
hashH(m) where H is a cryptographic hash function and m the message to sign. Must be written under hexadecimal form. ex: 64 hexadecimal characters for sha256.
sigSignature of hash
pub_keyPublic key
curveElliptic curve
Returns
1 on success, 0 on failure

Definition at line 242 of file mphell_tuto_ecdsa_fips.c.