forked from ANSSI-FR/libecc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecosdsa.c
76 lines (65 loc) · 1.89 KB
/
ecosdsa.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* Copyright (C) 2017 - This file is part of libecc project
*
* Authors:
* Ryad BENADJILA <[email protected]>
* Arnaud EBALARD <[email protected]>
* Jean-Pierre FLORI <[email protected]>
*
* Contributors:
* Nicolas VIVET <[email protected]>
* Karim KHALFALLAH <[email protected]>
*
* This software is licensed under a dual BSD and GPL v2 license.
* See LICENSE file at the root folder of the project.
*/
#include "../lib_ecc_config.h"
#ifdef WITH_SIG_ECOSDSA
#include "ecsdsa_common.h"
#include "sig_algs_internal.h"
#include "ec_key.h"
#ifdef VERBOSE_INNER_VALUES
#define EC_SIG_ALG "ECOSDSA"
#endif
#include "../utils/dbg_sig.h"
void ecosdsa_init_pub_key(ec_pub_key *out_pub, ec_priv_key *in_priv)
{
__ecsdsa_init_pub_key(out_pub, in_priv, ECOSDSA);
}
u8 ecosdsa_siglen(u16 p_bit_len, u16 q_bit_len, u8 hsize, u8 blocksize)
{
return __ecsdsa_siglen(p_bit_len, q_bit_len, hsize, blocksize);
}
int _ecosdsa_sign_init(struct ec_sign_context *ctx)
{
return __ecsdsa_sign_init(ctx, ECOSDSA, 1);
}
int _ecosdsa_sign_update(struct ec_sign_context *ctx,
const u8 *chunk, u32 chunklen)
{
return __ecsdsa_sign_update(ctx, chunk, chunklen);
}
int _ecosdsa_sign_finalize(struct ec_sign_context *ctx, u8 *sig, u8 siglen)
{
return __ecsdsa_sign_finalize(ctx, sig, siglen);
}
int _ecosdsa_verify_init(struct ec_verify_context *ctx,
const u8 *sig, u8 siglen)
{
return __ecsdsa_verify_init(ctx, sig, siglen, ECOSDSA, 1);
}
int _ecosdsa_verify_update(struct ec_verify_context *ctx,
const u8 *chunk, u32 chunklen)
{
return __ecsdsa_verify_update(ctx, chunk, chunklen);
}
int _ecosdsa_verify_finalize(struct ec_verify_context *ctx)
{
return __ecsdsa_verify_finalize(ctx);
}
#else /* WITH_SIG_ECOSDSA */
/*
* Dummy definition to avoid the empty translation unit ISO C warning
*/
typedef int dummy;
#endif /* WITH_SIG_ECOSDSA */