1 /* 2 * Copyright (C) 2017 - This file is part of libecc project 3 * 4 * Authors: 5 * Ryad BENADJILA <ryadbenadjila@gmail.com> 6 * Arnaud EBALARD <arnaud.ebalard@ssi.gouv.fr> 7 * Jean-Pierre FLORI <jean-pierre.flori@ssi.gouv.fr> 8 * 9 * Contributors: 10 * Nicolas VIVET <nicolas.vivet@ssi.gouv.fr> 11 * Karim KHALFALLAH <karim.khalfallah@ssi.gouv.fr> 12 * 13 * This software is licensed under a dual BSD and GPL v2 license. 14 * See LICENSE file at the root folder of the project. 15 */ 16 #include <libecc/lib_ecc_config.h> 17 #ifdef WITH_SIG_BIGN 18 19 #include <libecc/nn/nn_rand.h> 20 #include <libecc/nn/nn_mul_public.h> 21 #include <libecc/nn/nn_logical.h> 22 23 #include <libecc/sig/sig_algs_internal.h> 24 #include <libecc/sig/ec_key.h> 25 #include <libecc/utils/utils.h> 26 #ifdef VERBOSE_INNER_VALUES 27 #define EC_SIG_ALG "BIGN" 28 #endif 29 #include <libecc/utils/dbg_sig.h> 30 31 int bign_init_pub_key(ec_pub_key *out_pub, const ec_priv_key *in_priv) 32 { 33 return __bign_init_pub_key(out_pub, in_priv, BIGN); 34 } 35 36 int bign_siglen(u16 p_bit_len, u16 q_bit_len, u8 hsize, u8 blocksize, u8 *siglen) 37 { 38 return __bign_siglen(p_bit_len, q_bit_len, hsize, blocksize, siglen); 39 } 40 41 int _bign_sign_init(struct ec_sign_context *ctx) 42 { 43 return __bign_sign_init(ctx, BIGN); 44 } 45 46 int _bign_sign_update(struct ec_sign_context *ctx, 47 const u8 *chunk, u32 chunklen) 48 { 49 return __bign_sign_update(ctx, chunk, chunklen, BIGN); 50 } 51 52 int _bign_sign_finalize(struct ec_sign_context *ctx, u8 *sig, u8 siglen) 53 { 54 return __bign_sign_finalize(ctx, sig, siglen, BIGN); 55 } 56 57 int _bign_verify_init(struct ec_verify_context *ctx, const u8 *sig, u8 siglen) 58 { 59 return __bign_verify_init(ctx, sig, siglen, BIGN); 60 } 61 62 int _bign_verify_update(struct ec_verify_context *ctx, 63 const u8 *chunk, u32 chunklen) 64 { 65 return __bign_verify_update(ctx, chunk, chunklen, BIGN); 66 } 67 68 int _bign_verify_finalize(struct ec_verify_context *ctx) 69 { 70 return __bign_verify_finalize(ctx, BIGN); 71 } 72 73 #else /* WITH_SIG_BIGN */ 74 75 /* 76 * Dummy definition to avoid the empty translation unit ISO C warning 77 */ 78 typedef int dummy; 79 #endif /* WITH_SIG_BIGN */ 80