miden-crypto/src/dsa/rpo_falcon512/falcon_c/falcon.h
src/dsa/rpo_falcon512/falcon_c/falcon.hRaw
1#include <stddef.h>
2#include <stdint.h>
3
4#define PQCLEAN_FALCON512_CLEAN_CRYPTO_SECRETKEYBYTES 1281
5#define PQCLEAN_FALCON512_CLEAN_CRYPTO_PUBLICKEYBYTES 897
6#define PQCLEAN_FALCON512_CLEAN_CRYPTO_BYTES 666
7
8/*
9 * Generate a new key pair. Public key goes into pk[], private key in sk[].
10 * Key sizes are exact (in bytes):
11 * public (pk): PQCLEAN_FALCON512_CLEAN_CRYPTO_PUBLICKEYBYTES
12 * private (sk): PQCLEAN_FALCON512_CLEAN_CRYPTO_SECRETKEYBYTES
13 *
14 * Return value: 0 on success, -1 on error.
15 *
16 * Note: This implementation follows the reference implementation in PQClean
17 * https://github.com/PQClean/PQClean/tree/master/crypto_sign/falcon-512
18 * verbatim except for the sections that are marked otherwise.
19 */
20int PQCLEAN_FALCON512_CLEAN_crypto_sign_keypair_rpo(
21 uint8_t *pk, uint8_t *sk);
22
23/*
24 * Generate a new key pair from seed. Public key goes into pk[], private key in sk[].
25 * Key sizes are exact (in bytes):
26 * public (pk): PQCLEAN_FALCON512_CLEAN_CRYPTO_PUBLICKEYBYTES
27 * private (sk): PQCLEAN_FALCON512_CLEAN_CRYPTO_SECRETKEYBYTES
28 *
29 * Return value: 0 on success, -1 on error.
30 */
31int PQCLEAN_FALCON512_CLEAN_crypto_sign_keypair_from_seed_rpo(
32 uint8_t *pk, uint8_t *sk, unsigned char *seed);
33
34/*
35 * Compute a signature on a provided message (m, mlen), with a given
36 * private key (sk). Signature is written in sig[], with length written
37 * into *siglen. Signature length is variable; maximum signature length
38 * (in bytes) is PQCLEAN_FALCON512_CLEAN_CRYPTO_BYTES.
39 *
40 * sig[], m[] and sk[] may overlap each other arbitrarily.
41 *
42 * Return value: 0 on success, -1 on error.
43 *
44 * Note: This implementation follows the reference implementation in PQClean
45 * https://github.com/PQClean/PQClean/tree/master/crypto_sign/falcon-512
46 * verbatim except for the sections that are marked otherwise.
47 */
48int PQCLEAN_FALCON512_CLEAN_crypto_sign_signature_rpo(
49 uint8_t *sig, size_t *siglen,
50 const uint8_t *m, size_t mlen, const uint8_t *sk);
51
52/*
53 * Verify a signature (sig, siglen) on a message (m, mlen) with a given
54 * public key (pk).
55 *
56 * sig[], m[] and pk[] may overlap each other arbitrarily.
57 *
58 * Return value: 0 on success, -1 on error.
59 *
60 * Note: This implementation follows the reference implementation in PQClean
61 * https://github.com/PQClean/PQClean/tree/master/crypto_sign/falcon-512
62 * verbatim except for the sections that are marked otherwise.
63 */
64int PQCLEAN_FALCON512_CLEAN_crypto_sign_verify_rpo(
65 const uint8_t *sig, size_t siglen,
66 const uint8_t *m, size_t mlen, const uint8_t *pk);