second-round version of SQIsign

Co-authored-by: Marius A. Aardal <marius.andre.aardal@gmail.com>
Co-authored-by: Gora Adj <gora.adj@tii.ae>
Co-authored-by: Diego F. Aranha <dfaranha@cs.au.dk>
Co-authored-by: Andrea Basso <sqisign@andreabasso.com>
Co-authored-by: Isaac Andrés Canales Martínez <icanalesm0500@gmail.com>
Co-authored-by: Jorge Chávez-Saab <jorgechavezsaab@gmail.com>
Co-authored-by: Maria Corte-Real Santos <mariascrsantos98@gmail.com>
Co-authored-by: Luca De Feo <github@defeo.lu>
Co-authored-by: Max Duparc <max.duparc@epfl.ch>
Co-authored-by: Jonathan Komada Eriksen <jonathan.eriksen97@gmail.com>
Co-authored-by: Décio Luiz Gazzoni Filho <decio@decpp.net>
Co-authored-by: Basil Hess <bhe@zurich.ibm.com>
Co-authored-by: Antonin Leroux <antonin.leroux@polytechnique.org>
Co-authored-by: Patrick Longa <plonga@microsoft.com>
Co-authored-by: Luciano Maino <mainoluciano.96@gmail.com>
Co-authored-by: Michael Meyer <michael@random-oracles.org>
Co-authored-by: Hiroshi Onuki <onuki@mist.i.u-tokyo.ac.jp>
Co-authored-by: Lorenz Panny <lorenz@yx7.cc>
Co-authored-by: Giacomo Pope <giacomopope@gmail.com>
Co-authored-by: Krijn Reijnders <reijnderskrijn@gmail.com>
Co-authored-by: Damien Robert <damien.robert@inria.fr>
Co-authored-by: Francisco Rodríguez-Henriquez <francisco.rodriguez@tii.ae>
Co-authored-by: Sina Schaeffler <sschaeffle@student.ethz.ch>
Co-authored-by: Benjamin Wesolowski <benjamin.wesolowski@ens-lyon.fr>
This commit is contained in:
SQIsign team
2025-02-06 00:00:00 +00:00
committed by Lorenz Panny
parent ff34a8cd18
commit 91e9e464fe
481 changed files with 80785 additions and 55963 deletions

View File

@@ -3,10 +3,11 @@
#ifndef MEM_H
#define MEM_H
#include <stddef.h>
#include <sqisign_namespace.h>
/**
* Clears and frees allocated memory.
*
*
* @param[out] mem Memory to be cleared and freed.
* @param size Size of memory to be cleared and freed.
*/
@@ -14,10 +15,10 @@ void sqisign_secure_free(void *mem, size_t size);
/**
* Clears memory.
*
*
* @param[out] mem Memory to be cleared.
* @param size Size of memory to be cleared.
*/
void sqisign_secure_clear(void *mem, size_t size);
#endif
#endif

View File

@@ -3,6 +3,8 @@
#ifndef rng_h
#define rng_h
#include <sqisign_namespace.h>
/**
* Randombytes initialization.
* Initialization may be needed for some random number generators (e.g. CTR-DRBG).
@@ -11,10 +13,22 @@
* @param[in] personalization_string Personalization string
* @param[in] security_strength Security string
*/
SQISIGN_API
void randombytes_init(unsigned char *entropy_input,
unsigned char *personalization_string,
int security_strength);
/**
* Random byte generation using /dev/urandom.
* The caller is responsible to allocate sufficient memory to hold x.
*
* @param[out] x Memory to hold the random bytes.
* @param[in] xlen Number of random bytes to be generated
* @return int 0 on success, -1 otherwise
*/
SQISIGN_API
int randombytes_select(unsigned char *x, unsigned long long xlen);
/**
* Random byte generation.
* The caller is responsible to allocate sufficient memory to hold x.
@@ -23,6 +37,7 @@ void randombytes_init(unsigned char *entropy_input,
* @param[in] xlen Number of random bytes to be generated
* @return int 0 on success, -1 otherwise
*/
SQISIGN_API
int randombytes(unsigned char *x, unsigned long long xlen);
#endif /* rng_h */

View File

@@ -4,7 +4,9 @@
#define SQISIGN_H
#include <stdint.h>
#include <sqisign_namespace.h>
#if defined(ENABLE_SIGN)
/**
* SQIsign keypair generation.
*
@@ -15,6 +17,7 @@
* @param[out] sk SQIsign secret key
* @return int status code
*/
SQISIGN_API
int sqisign_keypair(unsigned char *pk, unsigned char *sk);
/**
@@ -31,16 +34,20 @@ int sqisign_keypair(unsigned char *pk, unsigned char *sk);
* @param[in] sk Compacted secret key
* @return int status code
*/
SQISIGN_API
int sqisign_sign(unsigned char *sm,
unsigned long long *smlen, const unsigned char *m,
unsigned long long mlen, const unsigned char *sk);
unsigned long long *smlen,
const unsigned char *m,
unsigned long long mlen,
const unsigned char *sk);
#endif
/**
* SQIsign open signature.
*
* The implementation performs SQIsign.verify(). If the signature verification succeeded, the original message is stored in m.
* Keys provided is a compact public key.
* The caller is responsible to allocate sufficient memory to hold m.
* The implementation performs SQIsign.verify(). If the signature verification succeeded, the
* original message is stored in m. Keys provided is a compact public key. The caller is responsible
* to allocate sufficient memory to hold m.
*
* @param[out] m Message stored if verification succeeds
* @param[out] mlen Pointer to the length of m
@@ -49,10 +56,12 @@ int sqisign_sign(unsigned char *sm,
* @param[in] pk Compacted public key
* @return int status code
*/
SQISIGN_API
int sqisign_open(unsigned char *m,
unsigned long long *mlen, const unsigned char *sm,
unsigned long long smlen, const unsigned char *pk);
unsigned long long *mlen,
const unsigned char *sm,
unsigned long long smlen,
const unsigned char *pk);
/**
* SQIsign verify signature.
@@ -66,8 +75,11 @@ int sqisign_open(unsigned char *m,
* @param[in] pk Compacted public key
* @return int 0 if verification succeeded, 1 otherwise.
*/
SQISIGN_API
int sqisign_verify(const unsigned char *m,
unsigned long long mlen, const unsigned char *sig,
unsigned long long siglen, const unsigned char *pk);
unsigned long long mlen,
const unsigned char *sig,
unsigned long long siglen,
const unsigned char *pk);
#endif

1022
include/sqisign_namespace.h Normal file

File diff suppressed because it is too large Load Diff