32 #ifndef MBEDTLS_ECDSA_H 33 #define MBEDTLS_ECDSA_H 52 #if MBEDTLS_ECP_MAX_BYTES > 124 53 #error "MBEDTLS_ECP_MAX_BYTES bigger than expected, please fix MBEDTLS_ECDSA_MAX_LEN" 56 #define MBEDTLS_ECDSA_MAX_LEN ( 3 + 2 * ( 3 + MBEDTLS_ECP_MAX_BYTES ) ) 71 #if defined(MBEDTLS_ECP_RESTARTABLE) 78 typedef struct mbedtls_ecdsa_restart_ver mbedtls_ecdsa_restart_ver_ctx;
85 typedef struct mbedtls_ecdsa_restart_sig mbedtls_ecdsa_restart_sig_ctx;
87 #if defined(MBEDTLS_ECDSA_DETERMINISTIC) 93 typedef struct mbedtls_ecdsa_restart_det mbedtls_ecdsa_restart_det_ctx;
103 mbedtls_ecdsa_restart_ver_ctx *ver;
104 mbedtls_ecdsa_restart_sig_ctx *sig;
105 #if defined(MBEDTLS_ECDSA_DETERMINISTIC) 106 mbedtls_ecdsa_restart_det_ctx *det;
154 const mbedtls_mpi *d,
const unsigned char *buf,
size_t blen,
155 int (*f_rng)(
void *,
unsigned char *,
size_t),
void *p_rng );
157 #if defined(MBEDTLS_ECDSA_DETERMINISTIC) 195 const unsigned char *buf,
size_t blen,
232 const unsigned char *buf,
size_t blen,
285 const unsigned char *hash,
size_t hlen,
286 unsigned char *sig,
size_t *slen,
287 int (*f_rng)(
void *,
unsigned char *,
size_t),
331 const unsigned char *hash,
size_t hlen,
332 unsigned char *sig,
size_t *slen,
333 int (*f_rng)(
void *,
unsigned char *,
size_t),
337 #if defined(MBEDTLS_ECDSA_DETERMINISTIC) 338 #if ! defined(MBEDTLS_DEPRECATED_REMOVED) 339 #if defined(MBEDTLS_DEPRECATED_WARNING) 340 #define MBEDTLS_DEPRECATED __attribute__((deprecated)) 342 #define MBEDTLS_DEPRECATED 388 const unsigned char *hash,
size_t hlen,
389 unsigned char *sig,
size_t *slen,
391 #undef MBEDTLS_DEPRECATED 423 const unsigned char *hash,
size_t hlen,
424 const unsigned char *sig,
size_t slen );
458 const unsigned char *hash,
size_t hlen,
459 const unsigned char *sig,
size_t slen,
479 int (*f_rng)(
void *,
unsigned char *,
size_t),
void *p_rng );
516 #if defined(MBEDTLS_ECP_RESTARTABLE) void mbedtls_ecdsa_free(mbedtls_ecdsa_context *ctx)
This function frees an ECDSA context.
#define MBEDTLS_DEPRECATED
Definition: aes.h:625
This file provides an API for Elliptic Curves over GF(P) (ECP).
The ECP key-pair structure.
Definition: ecp.h:326
void mbedtls_ecdsa_restart_ctx
Definition: ecdsa.h:113
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.
The ECP group structure.
Definition: ecp.h:167
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.
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_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.
void mbedtls_ecp_restart_ctx
Definition: ecp.h:252
mbedtls_ecp_keypair mbedtls_ecdsa_context
The ECDSA context structure.
Definition: ecdsa.h:69
mbedtls_ecp_group_id
Definition: ecp.h:71
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.
MPI structure.
Definition: bignum.h:180
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.
The ECP point structure, in Jacobian coordinates.
Definition: ecp.h:118
mbedtls_md_type_t
Supported message digests.
Definition: md.h:58
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...