Type Definition bearssl::br_ecdsa_sign [] [src]

type br_ecdsa_sign = Option<unsafe extern "C" fn(_: *const br_ec_impl, _: *const br_hash_class, _: *const c_void, _: *const br_ec_private_key, _: *mut c_void) -> usize>;

\brief Type for an ECDSA signer function.

A pointer to the EC implementation is provided. The hash value is assumed to have the length inferred from the designated hash function class.

Signature is written in the buffer pointed to by sig, and the length (in bytes) is returned. On error, nothing is written in the buffer, and 0 is returned. This function returns 0 if the specified curve is not supported by the provided EC implementation.

The signature format is either "raw" or "asn1", depending on the implementation; maximum length is predictable from the implemented curve:

curve raw asn1
NIST P-256 64 72
NIST P-384 96 104
NIST P-521 132 139

\param impl EC implementation to use. \param hf hash function used to process the data. \param hash_value signed data (hashed). \param sk EC private key. \param sig destination buffer. \return the signature length (in bytes), or 0 on error.