Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
ctidh_api.h File Reference
#include "../common/namespace.h"
#include "../common/primes.h"
#include "ctidh.h"
#include "../common/fp/mulx/fp.h"
Include dependency graph for ctidh_api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define internal_keygen   NS(keygen)
#define internal_derive   NS(derive)
#define init_keys   NS(init_keys)
#define skgen   NS(skgen)
#define pkgen   NS(pkgen)
#define free_keys   NS(free_keys)

Functions

const size_t NSAPI (pk_size)
const size_t NSAPI (sk_size)
const size_t NSAPI (ss_size)
void internal_keygen (public_key *pk, private_key *sk)
bool internal_derive (fp *ss, public_key *const pk, private_key *const sk)
void init_keys (public_key **pk, int8_t **sk)
void skgen (int8_t *sk)
void pkgen (public_key *pk, int8_t *const sk)
void free_keys (public_key **pk, int8_t **sk)

Macro Definition Documentation

◆ free_keys

#define free_keys   NS(free_keys)

Definition at line 31 of file ctidh_api.h.

◆ init_keys

#define init_keys   NS(init_keys)

Definition at line 25 of file ctidh_api.h.

◆ internal_derive

#define internal_derive   NS(derive)

Definition at line 23 of file ctidh_api.h.

Referenced by secsidh_derive().

◆ internal_keygen

#define internal_keygen   NS(keygen)

Definition at line 21 of file ctidh_api.h.

Referenced by secsidh_keygen().

◆ pkgen

#define pkgen   NS(pkgen)

Definition at line 29 of file ctidh_api.h.

◆ skgen

#define skgen   NS(skgen)

Definition at line 27 of file ctidh_api.h.

Function Documentation

◆ free_keys()

void free_keys ( public_key ** pk,
int8_t ** sk )

◆ init_keys()

void init_keys ( public_key ** pk,
int8_t ** sk )

◆ internal_derive()

bool internal_derive ( fp * ss,
public_key *const pk,
private_key *const sk )

Definition at line 63 of file ctidh_api.c.

64{
65
66#ifdef ENABLE_CT_TESTING
67 VALGRIND_MAKE_MEM_DEFINED(pk, sizeof(public_key));
68#endif
69
70 if (!validate((public_key*)pk)) return 0; // validating the input Montgomery curve affine coefficiente (it must be supersingular!)
71
72 public_key shared;
73 action((public_key*)&shared, pk, sk); // Secrect sharing Montgomery curve affine coefficient: [sk] * pk
74
75 //HASH((uint8_t*)shared.A, sizeof(fp), (uint8_t*) ss);
76 fp_copy(*ss, shared.A);
77 return 1;
78}
#define validate
Definition ctidh.h:53
#define action
Definition ctidh.h:54
#define fp_copy
Definition fp-gmp.h:79

References public_key::A, action, fp_copy, and validate.

◆ internal_keygen()

void internal_keygen ( public_key * pk,
private_key * sk )

Definition at line 46 of file ctidh_api.c.

47{
48 ctidh_private((private_key*) sk); // random private integer vector
49
50 action(pk,&base,(private_key*)sk);
51
52 // we need to compute the seed of the full order point
53 fp u;
54 fulltorsion_points(u, pk->A);
55
56 pk->seed = u[0];
57 printf("seed: %ld\n", pk->seed);
58}
#define ctidh_private
Definition ctidh.h:47
#define base
Definition ctidh.h:44
#define fulltorsion_points
Definition ctidh.h:57
uint64_t fp[NUMBER_OF_WORDS]
Definition fp-gmp.h:22
uint64_t seed
Definition ctidh.h:41

References public_key::A, action, base, ctidh_private, fulltorsion_points, and public_key::seed.

◆ NSAPI() [1/3]

const size_t NSAPI ( pk_size )
extern

References pk_size.

◆ NSAPI() [2/3]

const size_t NSAPI ( sk_size )
extern

References sk_size.

◆ NSAPI() [3/3]

const size_t NSAPI ( ss_size )
extern

References ss_size.

◆ pkgen()

void pkgen ( public_key * pk,
int8_t *const sk )

Definition at line 85 of file ctidh_api.c.

86{
87 action(pk,&base,(private_key*)sk);
88}

References action, and base.

◆ skgen()

void skgen ( int8_t * sk)

Definition at line 80 of file ctidh_api.c.

81{
83}

References ctidh_private.