mbed TLS v3.4.0
Data Fields
mbedtls_ecp_group Struct Reference

The ECP group structure. More...

#include <ecp.h>

Collaboration diagram for mbedtls_ecp_group:
Collaboration graph
[legend]

Data Fields

mbedtls_ecp_group_id id
 
mbedtls_mpi P
 
mbedtls_mpi A
 
mbedtls_mpi B
 
mbedtls_ecp_point G
 
mbedtls_mpi N
 
size_t pbits
 
size_t nbits
 
unsigned int private_h
 
int(* private_modp )(mbedtls_mpi *)
 
int(* private_t_pre )(mbedtls_ecp_point *, void *)
 
int(* private_t_post )(mbedtls_ecp_point *, void *)
 
void * private_t_data
 
mbedtls_ecp_pointprivate_T
 
size_t private_T_size
 

Detailed Description

The ECP group structure.

We consider two types of curve equations:

In both cases, the generator (G) for a prime-order subgroup is fixed.

For Short Weierstrass, this subgroup is the whole curve, and its cardinality is denoted by N. Our code requires that N is an odd prime as mbedtls_ecp_mul() requires an odd number, and mbedtls_ecdsa_sign() requires that it is prime for blinding purposes.

For Montgomery curves, we do not store A, but (A + 2) / 4, which is the quantity used in the formulas. Additionally, nbits is not the size of N but the required size for private keys.

If modp is NULL, reduction modulo P is done using a generic algorithm. Otherwise, modp must point to a function that takes an mbedtls_mpi in the range of 0..2^(2*pbits)-1, and transforms it in-place to an integer which is congruent mod P to the given MPI, and is close enough to pbits in size, so that it may be efficiently brought in the 0..P-1 range by a few additions or subtractions. Therefore, it is only an approximative modular reduction. It must return 0 on success and non-zero on failure.

Note
Alternative implementations of the ECP module must obey the following constraints.
  • Group IDs must be distinct: if two group structures have the same ID, then they must be identical.
  • The fields id, P, A, B, G, N, pbits and nbits must have the same type and semantics as in the built-in implementation. They must be available for reading, but direct modification of these fields does not need to be supported. They do not need to be at the same offset in the structure.

Definition at line 232 of file ecp.h.

Field Documentation

mbedtls_mpi mbedtls_ecp_group::A

For Short Weierstrass: A in the equation. For Montgomery curves: (A + 2) / 4.

Definition at line 235 of file ecp.h.

mbedtls_mpi mbedtls_ecp_group::B

For Short Weierstrass: B in the equation. For Montgomery curves: unused.

Definition at line 237 of file ecp.h.

mbedtls_ecp_point mbedtls_ecp_group::G

The generator of the subgroup used.

Definition at line 239 of file ecp.h.

mbedtls_ecp_group_id mbedtls_ecp_group::id

An internal group identifier.

Definition at line 233 of file ecp.h.

mbedtls_mpi mbedtls_ecp_group::N

The order of G.

Definition at line 240 of file ecp.h.

size_t mbedtls_ecp_group::nbits

For Short Weierstrass: The number of bits in P. For Montgomery curves: the number of bits in the private keys.

Definition at line 242 of file ecp.h.

mbedtls_mpi mbedtls_ecp_group::P

The prime modulus of the base field.

Definition at line 234 of file ecp.h.

size_t mbedtls_ecp_group::pbits

The number of bits in P.

Definition at line 241 of file ecp.h.

unsigned int mbedtls_ecp_group::private_h

Definition at line 247 of file ecp.h.

int(* mbedtls_ecp_group::private_modp) (mbedtls_mpi *)

The function for fast pseudo-reduction mod P (see above).

Definition at line 248 of file ecp.h.

mbedtls_ecp_point* mbedtls_ecp_group::private_T

Pre-computed points for ecp_mul_comb().

Definition at line 253 of file ecp.h.

void* mbedtls_ecp_group::private_t_data

Unused.

Definition at line 252 of file ecp.h.

int(* mbedtls_ecp_group::private_t_post) (mbedtls_ecp_point *, void *)

Unused.

Definition at line 251 of file ecp.h.

int(* mbedtls_ecp_group::private_t_pre) (mbedtls_ecp_point *, void *)

Unused.

Definition at line 250 of file ecp.h.

size_t mbedtls_ecp_group::private_T_size

The number of dynamic allocated pre-computed points.

Definition at line 254 of file ecp.h.


The documentation for this struct was generated from the following file: