From fcbd6918c249aa28b86404032e39de9d9e43a9ce Mon Sep 17 00:00:00 2001 From: Leon Date: Sun, 19 May 2019 19:41:03 +0200 Subject: [PATCH] create api.h --- crypto_kem/ledakemlt12/clean/api.h | 79 +++++------------------------- 1 file changed, 11 insertions(+), 68 deletions(-) diff --git a/crypto_kem/ledakemlt12/clean/api.h b/crypto_kem/ledakemlt12/clean/api.h index cf7cd668..6fc42ab8 100644 --- a/crypto_kem/ledakemlt12/clean/api.h +++ b/crypto_kem/ledakemlt12/clean/api.h @@ -1,75 +1,18 @@ -/** - * - * - * - * @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 - * @author Alessandro Barenghi - * @author Franco Chiaraluce - * @author Gerardo Pelosi - * @author Paolo Santini - * - * 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. - * - **/ +#ifndef PQCLEAN_LEDAKEMLT12_CLEAN_API_H +#define PQCLEAN_LEDAKEMLT12_CLEAN_API_H -#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" -#include "gf2x_limbs.h" -#include "gf2x_arith_mod_xPplusOne.h" +#define PQCLEAN_LEDAKEMLT12_CLEAN_CRYPTO_ALGNAME "LEDAKEMLT12" -#define CRYPTO_ALGNAME "LEDA" +int PQCLEAN_LEDAKEMLT12_CLEAN_crypto_kem_keypair(unsigned char *pk, unsigned char *sk); -/* required bytes of input randomness */ -#define CRYPTO_RANDOMBYTES TRNG_BYTE_LENGTH +int PQCLEAN_LEDAKEMLT12_CLEAN_crypto_kem_enc(unsigned char *ct, unsigned char *ss, const unsigned char *pk); -/* size in bytes of the secret key */ -#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 ); +int PQCLEAN_LEDAKEMLT12_CLEAN_crypto_kem_dec(unsigned char *ss, const unsigned char *ct, const unsigned char *sk); -/* Decrypt - ct is a key encapsulation message (ciphertext), sk is the private - key, ss is the shared secret */ - -int crypto_kem_dec( unsigned char *ss, - const unsigned char *ct, - const unsigned char *sk ); +#endif