3 * Key fetching for elliptic curve public and private keys
5 * (c) 2004 Straylight/Edgeware
8 /*----- Licensing notice --------------------------------------------------*
10 * This file is part of Catacomb.
12 * Catacomb is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Library General Public License as
14 * published by the Free Software Foundation; either version 2 of the
15 * License, or (at your option) any later version.
17 * Catacomb is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with Catacomb; if not, write to the Free
24 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
28 /*----- Header files ------------------------------------------------------*/
33 /*----- Key fetching ------------------------------------------------------*/
35 const key_fetchdef ec_paramfetch[] = {
36 { "curve", offsetof(ec_pub, cstr), KENC_STRING, 0 },
40 const key_fetchdef ec_pubfetch[] = {
41 { "curve", offsetof(ec_pub, cstr), KENC_STRING, 0 },
42 { "p", offsetof(ec_pub, p), KENC_EC, 0 },
46 static const key_fetchdef priv[] = {
47 { "x", offsetof(ec_priv, x), KENC_MP, 0 },
51 const key_fetchdef ec_privfetch[] = {
52 { "curve", offsetof(ec_pub, cstr), KENC_STRING, 0 },
53 { "p", offsetof(ec_pub, p), KENC_EC, 0 },
54 { "private", 0, KENC_STRUCT, priv },
58 /* --- @ec_paramfree@, @ec_pubfree@, @ec_privfree@ --- *
60 * Arguments: @ec_param *ep@, @ec_pub *ep@, @ec_priv *ep@ = pointer to
65 * Use: Frees an elliptic curve key block
68 void ec_paramfree(ec_param *ep)
70 if (ep->ei.c) ec_freeinfo(&ep->ei);
74 void ec_pubfree(ec_pub *ep)
76 if (ep->ei.c) ec_freeinfo(&ep->ei);
81 void ec_privfree(ec_priv *ep)
83 if (ep->ei.c) ec_freeinfo(&ep->ei);
89 /*----- That's all, folks -------------------------------------------------*/