4#ifndef PROTOCORE_ECDSA_H
5#define PROTOCORE_ECDSA_H
65#define PROTOCORE_ECDSA_P256_PRIV_LEN 32
68#define PROTOCORE_ECDSA_P256_COORD_LEN 32
71#define PROTOCORE_ECDSA_P256_PUB_LEN 65
74#define PROTOCORE_ECDSA_P256_SIG_LEN 64
79 proto_bool (*pubkey)(uint8_t *,
const uint8_t *, uint8_t *);
80 proto_bool (*sign)(uint8_t *,
const uint8_t *, size_t,
const uint8_t *, uint8_t *);
81 proto_bool (*verify)(uint8_t *,
const uint8_t *,
const uint8_t *, size_t,
const uint8_t *);
82 proto_bool (*ecdh)(uint8_t *,
const uint8_t *,
const uint8_t *, uint8_t *);
proto_bool protocore_ecdsa_ecdh(uint8_t *work, const uint8_t *peer_pub, const uint8_t *priv, uint8_t *shared_x)
Write the X coordinate of d * Q_peer.
PROTOCORE_NS EcdsaNs Ecdsa PROTOCORE_UNUSED
Module namespace.
proto_bool protocore_ecdsa_pubkey(uint8_t *work, const uint8_t *priv, uint8_t *pub)
Derive Q = d*G and write it uncompressed.
proto_bool protocore_ecdsa_sign(uint8_t *work, const uint8_t *msg, size_t mlen, const uint8_t *priv, uint8_t *sig)
Hash the message with SHA-256 and write the raw r || s.
proto_bool protocore_ecdsa_verify(uint8_t *work, const uint8_t *pub, const uint8_t *msg, size_t mlen, const uint8_t *sig)
Hash the message with SHA-256 and check r || s against the point.
#define PROTOCORE_NS_LAYOUT(T,...)
Pin every dispatch slot of a table that is nothing but function pointers.
#define PROTOCORE_NS
Storage for a dispatch table. The const is load bearing.
Dispatch table. Addressed by offset, so the layout is asserted below.
proto_bool(* pubkey)(uint8_t *, const uint8_t *, uint8_t *)
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
_Bool proto_bool
The truth value.
#define PROTOCORE_END_DECLS