30 #ifndef MBEDTLS_ECDSA_H
31 #define MBEDTLS_ECDSA_H
56 #define MBEDTLS_ECDSA_MAX_SIG_LEN( bits ) \
57 ( ( ( bits ) >= 61 * 8 ? 3 : 2 ) + \
58 2 * ( ( ( bits ) >= 127 * 8 ? 3 : 2 ) + \
59 ( ( bits ) + 8 ) / 8 ) )
62 #define MBEDTLS_ECDSA_MAX_LEN MBEDTLS_ECDSA_MAX_SIG_LEN( MBEDTLS_ECP_MAX_BITS )
77 #if defined(MBEDTLS_ECP_RESTARTABLE)
93 #if defined(MBEDTLS_ECDSA_DETERMINISTIC)
111 #if defined(MBEDTLS_ECDSA_DETERMINISTIC)
170 const mbedtls_mpi *d,
const unsigned char *buf,
size_t blen,
171 int (*f_rng)(
void *,
unsigned char *,
size_t),
void *p_rng );
173 #if defined(MBEDTLS_ECDSA_DETERMINISTIC)
215 const unsigned char *buf,
size_t blen,
217 int (*f_rng_blind)(
void *,
unsigned char *,
size_t),
254 const unsigned char *buf,
size_t blen,
309 const unsigned char *hash,
size_t hlen,
310 unsigned char *sig,
size_t sig_size,
size_t *slen,
311 int (*f_rng)(
void *,
unsigned char *,
size_t),
356 const unsigned char *hash,
size_t hlen,
357 unsigned char *sig,
size_t sig_size,
size_t *slen,
358 int (*f_rng)(
void *,
unsigned char *,
size_t),
360 mbedtls_ecdsa_restart_ctx *rs_ctx );
390 const unsigned char *hash,
size_t hlen,
391 const unsigned char *sig,
size_t slen );
425 const unsigned char *hash,
size_t hlen,
426 const unsigned char *sig,
size_t slen,
427 mbedtls_ecdsa_restart_ctx *rs_ctx );
446 int (*f_rng)(
void *,
unsigned char *,
size_t),
void *p_rng );
483 #if defined(MBEDTLS_ECP_RESTARTABLE)
struct mbedtls_ecdsa_restart_sig mbedtls_ecdsa_restart_sig_ctx
Internal restart context for ecdsa_sign()
void mbedtls_ecdsa_free(mbedtls_ecdsa_context *ctx)
This function frees an ECDSA context.
This file provides an API for Elliptic Curves over GF(P) (ECP).
The ECP key-pair structure.
struct mbedtls_ecdsa_restart_ver mbedtls_ecdsa_restart_ver_ctx
Internal restart context for ecdsa_verify()
#define MBEDTLS_PRIVATE(member)
void mbedtls_ecdsa_restart_free(mbedtls_ecdsa_restart_ctx *ctx)
Free the components of a restart context.
General context for resuming ECDSA operations.
void mbedtls_ecdsa_init(mbedtls_ecdsa_context *ctx)
This function initializes an ECDSA context.
int mbedtls_ecdsa_verify(mbedtls_ecp_group *grp, const unsigned char *buf, size_t blen, const mbedtls_ecp_point *Q, const mbedtls_mpi *r, const mbedtls_mpi *s)
This function verifies the ECDSA signature of a previously-hashed message.
int mbedtls_ecdsa_sign(mbedtls_ecp_group *grp, mbedtls_mpi *r, mbedtls_mpi *s, const mbedtls_mpi *d, const unsigned char *buf, size_t blen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
This function computes the ECDSA signature of a previously-hashed message.
struct mbedtls_ecdsa_restart_det mbedtls_ecdsa_restart_det_ctx
Internal restart context for ecdsa_sign_det()
int mbedtls_ecdsa_from_keypair(mbedtls_ecdsa_context *ctx, const mbedtls_ecp_keypair *key)
This function sets up an ECDSA context from an EC key pair.
Macro wrapper for struct's memebrs.
int mbedtls_ecdsa_sign_det_ext(mbedtls_ecp_group *grp, mbedtls_mpi *r, mbedtls_mpi *s, const mbedtls_mpi *d, const unsigned char *buf, size_t blen, mbedtls_md_type_t md_alg, int(*f_rng_blind)(void *, unsigned char *, size_t), void *p_rng_blind)
This function computes the ECDSA signature of a previously-hashed message, deterministic version...
int mbedtls_ecdsa_can_do(mbedtls_ecp_group_id gid)
This function checks whether a given group can be used for ECDSA.
void mbedtls_ecdsa_restart_init(mbedtls_ecdsa_restart_ctx *ctx)
Initialize a restart context.
mbedtls_ecp_keypair mbedtls_ecdsa_context
The ECDSA context structure.
Build-time configuration info.
int mbedtls_ecdsa_genkey(mbedtls_ecdsa_context *ctx, mbedtls_ecp_group_id gid, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
This function generates an ECDSA keypair on the given curve.
int mbedtls_ecdsa_read_signature_restartable(mbedtls_ecdsa_context *ctx, const unsigned char *hash, size_t hlen, const unsigned char *sig, size_t slen, mbedtls_ecdsa_restart_ctx *rs_ctx)
This function reads and verifies an ECDSA signature, in a restartable way.
This file contains the generic message-digest wrapper.
int mbedtls_ecdsa_read_signature(mbedtls_ecdsa_context *ctx, const unsigned char *hash, size_t hlen, const unsigned char *sig, size_t slen)
This function reads and verifies an ECDSA signature.
int mbedtls_ecdsa_write_signature(mbedtls_ecdsa_context *ctx, mbedtls_md_type_t md_alg, const unsigned char *hash, size_t hlen, unsigned char *sig, size_t sig_size, size_t *slen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
This function computes the ECDSA signature and writes it to a buffer, serialized as defined in RFC-44...
int mbedtls_ecdsa_write_signature_restartable(mbedtls_ecdsa_context *ctx, mbedtls_md_type_t md_alg, const unsigned char *hash, size_t hlen, unsigned char *sig, size_t sig_size, size_t *slen, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, mbedtls_ecdsa_restart_ctx *rs_ctx)
This function computes the ECDSA signature and writes it to a buffer, in a restartable way...
General context for resuming ECC operations.
The ECP point structure, in Jacobian coordinates.
mbedtls_md_type_t
Supported message digests.