MPHELL  5.0.0
Data Structures | Macros | Typedefs | Functions
mphell_tuto_eddsa-448+25519.c File Reference

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

#include <stdio.h>
#include <time.h>
#include "mphell/mphell.h"
Include dependency graph for mphell_tuto_eddsa-448+25519.c:

Go to the source code of this file.

Data Structures

struct  eddsa_sig
 Define an EdDSA signature. More...
 
struct  ecdsa_precomp
 Precomputation structure. More...
 

Macros

#define PRECOMP_WIN_SIZE   9
 
#define PRECOMP_SIZE   256
 
#define HASH_SIZE   64
 

Typedefs

typedef struct eddsa_sig eddsa_sig_t
 Define the EdDSA signature type.
 
typedef eddsa_sig_t eddsa_sig[1]
 Pointer on an allocated eddsa_sig_t structure.
 
typedef struct ecdsa_precomp ecdsa_precomp_t
 
typedef ecdsa_precomp_t ecdsa_precomp[1]
 

Functions

void eddsa_sign_alloc (eddsa_sig *sig, ec_curve_srcptr E, uint8_t size)
 
void eddsa_sign_free (eddsa_sig *sig, ec_curve_srcptr E)
 Free a used signature structure. More...
 
void ecdsa_precal (ecdsa_precomp *precomp, ec_point *key, ec_curve_ptr E)
 
void ecdsa_precal_free (ecdsa_precomp *precomp, ec_curve_ptr E)
 
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)
 
void eddsa_sign (unsigned char *hash, eddsa_sig *sig, number priv_key, ec_point *pub_key, ec_curve *curve)
 
int8_t eddsa_verify (unsigned char *hash, eddsa_sig *sig, ec_point *pub_key, ec_curve *curve, ecdsa_precomp precomp)
 
int8_t eddsa_pub_key_validation (ec_point *pub_key, ec_curve *curve)
 Verify that the public key is valid (id est check taht pub_key belongs to the curve, that pub_key is not the neutral element and that pub_key is of ordre n) More...
 
int main (int argc, char **argv)
 

Detailed Description

Tutorial for eddsa signature and verification using mphell.

Definition in file mphell_tuto_eddsa-448+25519.c.

Function Documentation

◆ eddsa_pub_key_validation()

int8_t eddsa_pub_key_validation ( ec_point pub_key,
ec_curve curve 
)

Verify that the public key is valid (id est check taht pub_key belongs to the curve, that pub_key is not the neutral element and that pub_key is of ordre n)

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.
pub_keyPublic key
curveElliptic curve
Returns
1 on success, 0 on failure

Definition at line 633 of file mphell_tuto_eddsa-448+25519.c.

◆ eddsa_sign_free()

void eddsa_sign_free ( eddsa_sig sig,
ec_curve_srcptr  E 
)

Free a used signature structure.

Parameters
sigSignature

Definition at line 125 of file mphell_tuto_eddsa-448+25519.c.