3 * $Id: ec-fetch.c,v 1.1 2004/03/28 01:58:47 mdw Exp $
5 * Key fetching for elliptic curve public and private keys
7 * (c) 2004 Straylight/Edgeware
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of Catacomb.
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.
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.
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,
30 /*----- Revision history --------------------------------------------------*
32 * $Log: ec-fetch.c,v $
33 * Revision 1.1 2004/03/28 01:58:47 mdw
34 * Generate, store and retreive elliptic curve keys.
38 /*----- Header files ------------------------------------------------------*/
43 /*----- Key fetching ------------------------------------------------------*/
45 const key_fetchdef ec_paramfetch
[] = {
46 { "curve", offsetof(ec_pub
, cstr
), KENC_STRING
, 0 },
50 const key_fetchdef ec_pubfetch
[] = {
51 { "curve", offsetof(ec_pub
, cstr
), KENC_STRING
, 0 },
52 { "p", offsetof(ec_pub
, p
), KENC_EC
, 0 },
56 static const key_fetchdef priv
[] = {
57 { "x", offsetof(ec_priv
, x
), KENC_MP
, 0 },
61 const key_fetchdef ec_privfetch
[] = {
62 { "curve", offsetof(ec_pub
, cstr
), KENC_STRING
, 0 },
63 { "p", offsetof(ec_pub
, p
), KENC_EC
, 0 },
64 { "private", 0, KENC_STRUCT
, priv
},
68 /* --- @ec_paramfree@, @ec_pubfree@, @ec_privfree@ --- *
70 * Arguments: @ec_param *ep@, @ec_pub *ep@, @ec_priv *ep@ = pointer to
75 * Use: Frees an elliptic curve key block
78 void ec_paramfree(ec_param
*ep
)
80 if (ep
->ei
.c
) ec_freeinfo(&ep
->ei
);
84 void ec_pubfree(ec_pub
*ep
)
86 if (ep
->ei
.c
) ec_freeinfo(&ep
->ei
);
91 void ec_privfree(ec_priv
*ep
)
93 if (ep
->ei
.c
) ec_freeinfo(&ep
->ei
);
99 /*----- That's all, folks -------------------------------------------------*/