xref: /freebsd/crypto/libecc/include/libecc/sig/decdsa.h (revision f0865ec9906d5a18fa2a3b61381f22ce16e606ad)
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 #ifdef WITH_SIG_DECDSA
19 
20 #ifndef __DECDSA_H__
21 #define __DECDSA_H__
22 
23 #include <libecc/sig/ecdsa_common.h>
24 
25 ATTRIBUTE_WARN_UNUSED_RET int decdsa_init_pub_key(ec_pub_key *out_pub, const ec_priv_key *in_priv);
26 
27 ATTRIBUTE_WARN_UNUSED_RET int decdsa_siglen(u16 p_bit_len, u16 q_bit_len, u8 hsize, u8 blocksize, u8 *siglen);
28 
29 ATTRIBUTE_WARN_UNUSED_RET int _decdsa_sign_init(struct ec_sign_context *ctx);
30 
31 ATTRIBUTE_WARN_UNUSED_RET int _decdsa_sign_update(struct ec_sign_context *ctx,
32 		       const u8 *chunk, u32 chunklen);
33 
34 ATTRIBUTE_WARN_UNUSED_RET int _decdsa_sign_finalize(struct ec_sign_context *ctx, u8 *sig, u8 siglen);
35 
36 ATTRIBUTE_WARN_UNUSED_RET int _decdsa_verify_init(struct ec_verify_context *ctx,
37 		       const u8 *sig, u8 siglen);
38 
39 ATTRIBUTE_WARN_UNUSED_RET int _decdsa_verify_update(struct ec_verify_context *ctx,
40 			 const u8 *chunk, u32 chunklen);
41 
42 ATTRIBUTE_WARN_UNUSED_RET int _decdsa_verify_finalize(struct ec_verify_context *ctx);
43 
44 ATTRIBUTE_WARN_UNUSED_RET int decdsa_public_key_from_sig(ec_pub_key *out_pub1, ec_pub_key *out_pub2, const ec_params *params,
45                                 const u8 *sig, u8 siglen, const u8 *hash, u8 hsize);
46 
47 #endif /* __DECDSA_H__ */
48 #endif /* WITH_SIG_DECDSA */
49