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 #include <libecc/lib_ecc_types.h> 18 #if (defined(WITH_SIG_ECSDSA) || defined(WITH_SIG_ECOSDSA)) 19 20 #ifndef __ECSDSA_COMMON_H__ 21 #define __ECSDSA_COMMON_H__ 22 23 #include <libecc/words/words.h> 24 #include <libecc/sig/ec_key.h> 25 #include <libecc/hash/hash_algs.h> 26 #include <libecc/sig/sig_algs.h> 27 #include <libecc/curves/curves.h> 28 #include <libecc/utils/utils.h> 29 30 struct ec_sign_context; 31 32 ATTRIBUTE_WARN_UNUSED_RET int __ecsdsa_init_pub_key(ec_pub_key *out_pub, const ec_priv_key *in_priv, 33 ec_alg_type key_type); 34 ATTRIBUTE_WARN_UNUSED_RET int __ecsdsa_siglen(u16 p_bit_len, u16 q_bit_len, u8 hsize, u8 blocksize, 35 u8 *siglen); 36 37 ATTRIBUTE_WARN_UNUSED_RET int __ecsdsa_sign_init(struct ec_sign_context *ctx, 38 ec_alg_type key_type, int optimized); 39 ATTRIBUTE_WARN_UNUSED_RET int __ecsdsa_sign_update(struct ec_sign_context *ctx, 40 const u8 *chunk, u32 chunklen); 41 ATTRIBUTE_WARN_UNUSED_RET int __ecsdsa_sign_finalize(struct ec_sign_context *ctx, u8 *sig, u8 siglen); 42 43 ATTRIBUTE_WARN_UNUSED_RET int __ecsdsa_verify_init(struct ec_verify_context *ctx, 44 const u8 *sig, u8 siglen, 45 ec_alg_type key_type, int optimized); 46 ATTRIBUTE_WARN_UNUSED_RET int __ecsdsa_verify_update(struct ec_verify_context *ctx, 47 const u8 *chunk, u32 chunklen); 48 ATTRIBUTE_WARN_UNUSED_RET int __ecsdsa_verify_finalize(struct ec_verify_context *ctx); 49 50 #endif /* __ECSDSA_COMMON_H__ */ 51 #endif /* (defined(WITH_SIG_ECSDSA) || defined(WITH_SIG_ECOSDSA)) */ 52