create api.h
This commit is contained in:
parent
d02c1879e9
commit
fcbd6918c2
@ -1,75 +1,18 @@
|
|||||||
/**
|
#ifndef PQCLEAN_LEDAKEMLT12_CLEAN_API_H
|
||||||
*
|
#define PQCLEAN_LEDAKEMLT12_CLEAN_API_H
|
||||||
* <api.h>
|
|
||||||
*
|
|
||||||
* @version 2.0 (March 2019)
|
|
||||||
*
|
|
||||||
* Reference ISO-C11 Implementation of the LEDAcrypt KEM-LT cipher using GCC built-ins.
|
|
||||||
*
|
|
||||||
* In alphabetical order:
|
|
||||||
*
|
|
||||||
* @author Marco Baldi <m.baldi@univpm.it>
|
|
||||||
* @author Alessandro Barenghi <alessandro.barenghi@polimi.it>
|
|
||||||
* @author Franco Chiaraluce <f.chiaraluce@univpm.it>
|
|
||||||
* @author Gerardo Pelosi <gerardo.pelosi@polimi.it>
|
|
||||||
* @author Paolo Santini <p.santini@pm.univpm.it>
|
|
||||||
*
|
|
||||||
* This code is hereby placed in the public domain.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
|
|
||||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
|
||||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
||||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
|
|
||||||
#pragma once
|
#define PQCLEAN_LEDAKEMLT12_CLEAN_CRYPTO_SECRETKEYBYTES 25
|
||||||
|
#define PQCLEAN_LEDAKEMLT12_CLEAN_CRYPTO_PUBLICKEYBYTES 6520
|
||||||
|
#define PQCLEAN_LEDAKEMLT12_CLEAN_CRYPTO_CIPHERTEXTBYTES 6520
|
||||||
|
#define PQCLEAN_LEDAKEMLT12_CLEAN_CRYPTO_BYTES 32
|
||||||
|
|
||||||
#include "qc_ldpc_parameters.h"
|
#define PQCLEAN_LEDAKEMLT12_CLEAN_CRYPTO_ALGNAME "LEDAKEMLT12"
|
||||||
#include "gf2x_limbs.h"
|
|
||||||
#include "gf2x_arith_mod_xPplusOne.h"
|
|
||||||
|
|
||||||
#define CRYPTO_ALGNAME "LEDA"
|
int PQCLEAN_LEDAKEMLT12_CLEAN_crypto_kem_keypair(unsigned char *pk, unsigned char *sk);
|
||||||
|
|
||||||
/* required bytes of input randomness */
|
int PQCLEAN_LEDAKEMLT12_CLEAN_crypto_kem_enc(unsigned char *ct, unsigned char *ss, const unsigned char *pk);
|
||||||
#define CRYPTO_RANDOMBYTES TRNG_BYTE_LENGTH
|
|
||||||
|
|
||||||
/* size in bytes of the secret key */
|
int PQCLEAN_LEDAKEMLT12_CLEAN_crypto_kem_dec(unsigned char *ss, const unsigned char *ct, const unsigned char *sk);
|
||||||
#define CRYPTO_SECRETKEYBYTES TRNG_BYTE_LENGTH+1
|
|
||||||
|
|
||||||
/* size in bytes of the public key */
|
|
||||||
#define CRYPTO_PUBLICKEYBYTES ((N0-1)*NUM_DIGITS_GF2X_ELEMENT*DIGIT_SIZE_B)
|
|
||||||
|
|
||||||
/* size in bytes of the shared secret */
|
|
||||||
#define CRYPTO_BYTES HASH_BYTE_LENGTH
|
|
||||||
|
|
||||||
/*size in bytes of the ciphertext*/
|
|
||||||
#define CRYPTO_CIPHERTEXTBYTES (NUM_DIGITS_GF2X_ELEMENT*DIGIT_SIZE_B)
|
|
||||||
|
|
||||||
/* Your functions must return 0 to indicate success, -1 to indicate an error
|
|
||||||
* condition */
|
|
||||||
|
|
||||||
/* Generates a keypair - pk is the public key and sk is the secret key. */
|
|
||||||
int crypto_kem_keypair( unsigned char *pk,
|
|
||||||
unsigned char *sk );
|
|
||||||
|
|
||||||
/* Encrypt - pk is the public key, ct is a key encapsulation message
|
|
||||||
(ciphertext), ss is the shared secret.*/
|
|
||||||
int crypto_kem_enc( unsigned char *ct,
|
|
||||||
unsigned char *ss,
|
|
||||||
const unsigned char *pk );
|
|
||||||
|
|
||||||
|
|
||||||
/* Decrypt - ct is a key encapsulation message (ciphertext), sk is the private
|
#endif
|
||||||
key, ss is the shared secret */
|
|
||||||
|
|
||||||
int crypto_kem_dec( unsigned char *ss,
|
|
||||||
const unsigned char *ct,
|
|
||||||
const unsigned char *sk );
|
|
||||||
|
Loading…
Reference in New Issue
Block a user