1ba83484 |
1 | /* -*-c-*- |
2 | * |
b817bfc6 |
3 | * $Id: ec-keys.h,v 1.3 2004/04/08 01:36:15 mdw Exp $ |
1ba83484 |
4 | * |
5 | * Elliptic curve key-fetching |
6 | * |
7 | * (c) 2004 Straylight/Edgeware |
8 | */ |
9 | |
10 | /*----- Licensing notice --------------------------------------------------* |
11 | * |
12 | * This file is part of Catacomb. |
13 | * |
14 | * Catacomb is free software; you can redistribute it and/or modify |
15 | * it under the terms of the GNU Library General Public License as |
16 | * published by the Free Software Foundation; either version 2 of the |
17 | * License, or (at your option) any later version. |
18 | * |
19 | * Catacomb is distributed in the hope that it will be useful, |
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22 | * GNU Library General Public License for more details. |
23 | * |
24 | * You should have received a copy of the GNU Library General Public |
25 | * License along with Catacomb; if not, write to the Free |
26 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
27 | * MA 02111-1307, USA. |
28 | */ |
29 | |
1ba83484 |
30 | #ifndef CATACOMB_EC_KEYS_H |
31 | #define CATACOMB_EC_KEYS_H |
32 | |
33 | #ifdef __cplusplus |
34 | extern "C" { |
35 | #endif |
36 | |
37 | /*----- Header files ------------------------------------------------------*/ |
38 | |
39 | #ifndef CATACOMB_EC_H |
40 | # include "ec.h" |
41 | #endif |
42 | |
43 | #ifndef CATACOMB_KEY_H |
44 | # include "key.h" |
45 | #endif |
46 | |
47 | /*----- Key structures ----------------------------------------------------*/ |
48 | |
49 | typedef struct ec_param { |
50 | ec_info ei; /* Curve information */ |
51 | char *cstr; /* Curve definition string */ |
52 | } ec_param; |
53 | |
54 | typedef struct ec_pub { |
55 | ec_info ei; /* Curve information */ |
56 | char *cstr; /* Curve definition string */ |
57 | ec p; /* Public point */ |
58 | } ec_pub; |
59 | |
60 | typedef struct ec_priv { |
61 | ec_info ei; /* Curve information */ |
62 | char *cstr; /* Curve definition string */ |
63 | ec p; /* Public point */ |
64 | mp *x; /* Secret exponent */ |
65 | } ec_priv; |
66 | |
34e4f738 |
67 | extern const key_fetchdef ec_paramfetch[]; |
68 | #define EC_PARAMFETCHSZ 3 |
69 | |
70 | extern const key_fetchdef ec_pubfetch[]; |
71 | #define EC_PUBFETCHSZ 4 |
72 | |
73 | extern const key_fetchdef ec_privfetch[]; |
74 | #define EC_PRIVFETCHSZ 7 |
75 | |
76 | /*----- Functions provided ------------------------------------------------*/ |
77 | |
78 | /* --- @ec_paramfree@, @ec_pubfree@, @ec_privfree@ --- * |
79 | * |
80 | * Arguments: @ec_param *ep@, @ec_pub *ep@, @ec_priv *ep@ = pointer to |
81 | * key block to free |
82 | * |
83 | * Returns: --- |
84 | * |
85 | * Use: Frees an elliptic curve key block |
86 | */ |
87 | |
88 | extern void ec_paramfree(ec_param */*ep*/); |
89 | extern void ec_pubfree(ec_pub */*ep*/); |
90 | extern void ec_privfree(ec_priv */*ep*/); |
1ba83484 |
91 | |
92 | /*----- That's all, folks -------------------------------------------------*/ |
93 | |
94 | #ifdef __cplusplus |
95 | } |
96 | #endif |
97 | |
98 | #endif |