57#ifndef MBEDTLS_ECDSA_H
58#define MBEDTLS_ECDSA_H
60#if !defined(MBEDTLS_CONFIG_FILE)
63#include MBEDTLS_CONFIG_FILE
83#if MBEDTLS_ECP_MAX_BYTES > 124
84#error "MBEDTLS_ECP_MAX_BYTES bigger than expected, please fix MBEDTLS_ECDSA_MAX_LEN"
87#define MBEDTLS_ECDSA_MAX_LEN ( 3 + 2 * ( 3 + MBEDTLS_ECP_MAX_BYTES ) )
102#if defined(MBEDTLS_ECP_RESTARTABLE)
109typedef struct mbedtls_ecdsa_restart_ver mbedtls_ecdsa_restart_ver_ctx;
116typedef struct mbedtls_ecdsa_restart_sig mbedtls_ecdsa_restart_sig_ctx;
118#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
124typedef struct mbedtls_ecdsa_restart_det mbedtls_ecdsa_restart_det_ctx;
134 mbedtls_ecdsa_restart_ver_ctx *ver;
135 mbedtls_ecdsa_restart_sig_ctx *sig;
136#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
137 mbedtls_ecdsa_restart_det_ctx *det;
186 int (*f_rng)(
void *,
unsigned char *,
size_t),
void *p_rng );
188#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
239 const unsigned char *
buf,
size_t blen,
282 const unsigned char *
buf,
size_t blen,
284 int (*f_rng_blind)(
void *,
unsigned char *,
322 const unsigned char *
buf,
size_t blen,
375 const unsigned char *
hash,
size_t hlen,
376 unsigned char *sig,
size_t *slen,
377 int (*f_rng)(
void *,
unsigned char *,
size_t),
421 const unsigned char *
hash,
size_t hlen,
422 unsigned char *sig,
size_t *slen,
423 int (*f_rng)(
void *,
unsigned char *,
size_t),
427#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
428#if ! defined(MBEDTLS_DEPRECATED_REMOVED)
429#if defined(MBEDTLS_DEPRECATED_WARNING)
430#define MBEDTLS_DEPRECATED __attribute__((deprecated))
432#define MBEDTLS_DEPRECATED
478 const unsigned char *
hash,
size_t hlen,
479 unsigned char *sig,
size_t *slen,
481#undef MBEDTLS_DEPRECATED
513 const unsigned char *
hash,
size_t hlen,
514 const unsigned char *sig,
size_t slen );
548 const unsigned char *
hash,
size_t hlen,
549 const unsigned char *sig,
size_t slen,
569 int (*f_rng)(
void *,
unsigned char *,
size_t),
void *p_rng );
606#if defined(MBEDTLS_ECP_RESTARTABLE)
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 *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.
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_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.
void mbedtls_ecdsa_free(mbedtls_ecdsa_context *ctx)
This function frees an ECDSA context.
int mbedtls_ecdsa_sign_det(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)
This function computes the ECDSA signature of a previously-hashed message, deterministic version.
int mbedtls_ecdsa_write_signature_det(mbedtls_ecdsa_context *ctx, const unsigned char *hash, size_t hlen, unsigned char *sig, size_t *slen, mbedtls_md_type_t md_alg) MBEDTLS_DEPRECATED
This function computes an ECDSA signature and writes it to a buffer, serialized as defined in RFC-449...
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.
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 *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_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.
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.
mbedtls_ecp_keypair mbedtls_ecdsa_context
The ECDSA context structure.
#define MBEDTLS_DEPRECATED
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.
void mbedtls_ecdsa_restart_ctx
void mbedtls_ecdsa_init(mbedtls_ecdsa_context *ctx)
This function initializes an ECDSA context.
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.
This file provides an API for Elliptic Curves over GF(P) (ECP).
GLdouble GLdouble GLdouble r
GLenum GLuint GLenum GLsizei const GLchar * buf
This file contains the generic message-digest wrapper.
mbedtls_md_type_t
Supported message digests.
The ECP key-pair structure.
The ECP point structure, in Jacobian coordinates.