X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/2bdb833f485d3c985a0f930865452fcaafdf95dd..95ccefe3ce59a0773f915aca6948d5b6f1f7c882:/dh-fetch.c diff --git a/dh-fetch.c b/dh-fetch.c index 7a7e18c..57439d2 100644 --- a/dh-fetch.c +++ b/dh-fetch.c @@ -1,13 +1,13 @@ /* -*-c-*- * - * $Id: dh-fetch.c,v 1.1 2000/06/17 10:41:45 mdw Exp $ + * $Id: dh-fetch.c,v 1.3 2004/04/08 01:36:15 mdw Exp $ * * Key fetching for Diffie-Hellman public and private keys * * (c) 2000 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of Catacomb. * @@ -15,26 +15,18 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * Catacomb is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with Catacomb; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: dh-fetch.c,v $ - * Revision 1.1 2000/06/17 10:41:45 mdw - * Table for driving key data extraction. - * - */ - /*----- Header files ------------------------------------------------------*/ #include "dh.h" @@ -68,7 +60,41 @@ const key_fetchdef dh_privfetch[] = { { "g", offsetof(dh_priv, dp.g), KENC_MP, 0 }, { "y", offsetof(dh_priv, y), KENC_MP, 0 }, { "private", 0, KENC_STRUCT, priv }, - { 0, 0, 0, 0 } + { 0, 0, 0, 0 } }; +/* --- @dh_paramfree@, @dh_pubfree@, @dh_privfree@ --- * + * + * Arguments: @dh_param *dp@, @dh_pub *dp@, @dh_priv *dp@ = pointer + * to key block to free + * + * Returns: --- + * + * Use: Frees a Diffie-Hellman key block. + */ + +void dh_paramfree(dh_param *dp) +{ + mp_drop(dp->p); + mp_drop(dp->q); + mp_drop(dp->g); +} + +void dh_pubfree(dh_pub *dp) +{ + mp_drop(dp->dp.p); + mp_drop(dp->dp.q); + mp_drop(dp->dp.g); + mp_drop(dp->y); +} + +void dh_privfree(dh_priv *dp) +{ + mp_drop(dp->dp.p); + mp_drop(dp->dp.q); + mp_drop(dp->dp.g); + mp_drop(dp->y); + mp_drop(dp->x); +} + /*----- That's all, folks -------------------------------------------------*/