57QSC_CPLUSPLUS_ENABLED_START
134#if defined(QSC_ECDSA_S1P256)
140# define QSC_ECDSA_SIGNATURE_SIZE 64U
146# define QSC_ECDSA_PRIVATEKEY_SIZE 96U
152# define QSC_ECDSA_PUBLICKEY_SIZE 64U
158# define QSC_ECDSA_SEED_SIZE 32ULL
164# define QSC_ECDSA_ALGNAME "ECDSAP256"
169# define QSC_ECDSA_SEC1_PUBLICKEY_SIZE 65U
174# define QSC_ECDSA_SPKI_DER_SIZE 91U
179# define QSC_ECDSA_SIGNATURE_DER_MAX_SIZE 72U
181#elif defined(QSC_ECDSA_S3P384)
187# define QSC_ECDSA_SIGNATURE_SIZE 96U
193# define QSC_ECDSA_PRIVATEKEY_SIZE 144U
199# define QSC_ECDSA_PUBLICKEY_SIZE 96U
205# define QSC_ECDSA_SEED_SIZE 48ULL
211# define QSC_ECDSA_ALGNAME "ECDSAP384"
216# define QSC_ECDSA_SEC1_PUBLICKEY_SIZE 97U
221# define QSC_ECDSA_SPKI_DER_SIZE 120U
226# define QSC_ECDSA_SIGNATURE_DER_MAX_SIZE 104U
228#elif defined(QSC_ECDSA_S5P521)
234# define QSC_ECDSA_SIGNATURE_SIZE 132U
240# define QSC_ECDSA_PRIVATEKEY_SIZE 198U
246# define QSC_ECDSA_PUBLICKEY_SIZE 132U
252# define QSC_ECDSA_SEED_SIZE 66ULL
258# define QSC_ECDSA_ALGNAME "ECDSAP521"
263# define QSC_ECDSA_SEC1_PUBLICKEY_SIZE 133U
268# define QSC_ECDSA_SPKI_DER_SIZE 158U
273# define QSC_ECDSA_SIGNATURE_DER_MAX_SIZE 139U
276# error "The ECDSA parameter set is invalid! Define QSC_ECDSA_S1EC256 or QSC_ECDSA_S3P384."
367QSC_EXPORT_API bool qsc_ecdsa_sign(uint8_t* signedmsg,
size_t* smsglen,
const uint8_t* message,
size_t msglen,
const uint8_t* privatekey);
406QSC_CPLUSPLUS_ENABLED_END
QSC_EXPORT_API bool qsc_ecdsa_sign(uint8_t *signedmsg, size_t *smsglen, const uint8_t *message, size_t msglen, const uint8_t *privatekey)
Sign a message with a P-256 private key.
Definition ecdsa.c:128
QSC_EXPORT_API bool qsc_ecdsa_generate_seeded_keypair(uint8_t *publickey, uint8_t *privatekey, const uint8_t *seed)
Generate a P-256 public/private key pair from a 32-byte seed.
Definition ecdsa.c:67
QSC_EXPORT_API bool qsc_ecdsa_generate_keypair(uint8_t *publickey, uint8_t *privatekey, bool(*rng_generate)(uint8_t *, size_t))
Generate a P-256 public/private key pair using a caller-supplied RNG.
Definition ecdsa.c:91
QSC_EXPORT_API bool qsc_ecdsa_sign_scalar(uint8_t *signedmsg, size_t *smsglen, const uint8_t *message, size_t msglen, const uint8_t *privatekey)
Sign a message with a P-256 private key, used primarily for RFC KAT testing).
Definition ecdsa.c:162
QSC_EXPORT_API int32_t qsc_ecdsa_publickey_from_privatekey(uint8_t *publickey, const uint8_t *privatekey)
Derive a P-256 public key from a raw private scalar.
Definition ecdsa.c:11
QSC_EXPORT_API void qsc_ecdsa_publickey_to_sec1(uint8_t *secpub, const uint8_t *publickey)
Convert a raw public key (Qx || Qy) to SEC 1 uncompressed point form.
Definition ecdsa.c:55
QSC_EXPORT_API bool qsc_ecdsa_publickey_from_sec1(uint8_t *publickey, const uint8_t *secpub)
Convert a SEC 1 uncompressed point to the library raw public-key form.
Definition ecdsa.c:34
QSC_EXPORT_API bool qsc_ecdsa_verify(uint8_t *message, size_t *msglen, const uint8_t *signedmsg, size_t smsglen, const uint8_t *publickey)
Verify a P-256 ECDSA signature and recover the message.
Definition ecdsa.c:196
Contains common definitions for the Quantum Secure Cryptographic (QSC) library.
#define QSC_EXPORT_API
API export macro for Microsoft compilers when importing from a DLL.
Definition qsccommon.h:605