3 * $Id: ec-fetch.c,v 1.2 2004/04/08 01:36:15 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 /*----- Header files ------------------------------------------------------*/
35 /*----- Key fetching ------------------------------------------------------*/
37 const key_fetchdef ec_paramfetch[] = {
38 { "curve", offsetof(ec_pub, cstr), KENC_STRING, 0 },
42 const key_fetchdef ec_pubfetch[] = {
43 { "curve", offsetof(ec_pub, cstr), KENC_STRING, 0 },
44 { "p", offsetof(ec_pub, p), KENC_EC, 0 },
48 static const key_fetchdef priv[] = {
49 { "x", offsetof(ec_priv, x), KENC_MP, 0 },
53 const key_fetchdef ec_privfetch[] = {
54 { "curve", offsetof(ec_pub, cstr), KENC_STRING, 0 },
55 { "p", offsetof(ec_pub, p), KENC_EC, 0 },
56 { "private", 0, KENC_STRUCT, priv },
60 /* --- @ec_paramfree@, @ec_pubfree@, @ec_privfree@ --- *
62 * Arguments: @ec_param *ep@, @ec_pub *ep@, @ec_priv *ep@ = pointer to
67 * Use: Frees an elliptic curve key block
70 void ec_paramfree(ec_param *ep)
72 if (ep->ei.c) ec_freeinfo(&ep->ei);
76 void ec_pubfree(ec_pub *ep)
78 if (ep->ei.c) ec_freeinfo(&ep->ei);
83 void ec_privfree(ec_priv *ep)
85 if (ep->ei.c) ec_freeinfo(&ep->ei);
91 /*----- That's all, folks -------------------------------------------------*/