math/mpreduce.h: Missing include files.
[u/mdw/catacomb] / pub / bbs-fetch.c
CommitLineData
2bdb833f 1/* -*-c-*-
2 *
2bdb833f 3 * Key fetching for BBS public and private keys
4 *
5 * (c) 2000 Straylight/Edgeware
6 */
7
45c0fd36 8/*----- Licensing notice --------------------------------------------------*
2bdb833f 9 *
10 * This file is part of Catacomb.
11 *
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.
45c0fd36 16 *
2bdb833f 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.
45c0fd36 21 *
2bdb833f 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,
25 * MA 02111-1307, USA.
26 */
27
2bdb833f 28/*----- Header files ------------------------------------------------------*/
29
30#include "bbs.h"
31#include "key.h"
32
33/*----- Key fetching ------------------------------------------------------*/
34
35const key_fetchdef bbs_pubfetch[] = {
36 { "n", offsetof(bbs_pub, n), KENC_MP, 0 },
37 { 0, 0, 0, 0 }
38};
39
40static const key_fetchdef priv[] = {
41 { "p", offsetof(bbs_priv, p), KENC_MP, 0 },
42 { "q", offsetof(bbs_priv, q), KENC_MP, 0 },
43 { 0, 0, 0, 0 }
44};
45
46const key_fetchdef bbs_privfetch[] = {
47 { "n", offsetof(bbs_priv, n), KENC_MP, 0 },
48 { "private", 0, KENC_STRUCT, priv },
45c0fd36 49 { 0, 0, 0, 0 }
2bdb833f 50};
51
b92da8eb 52/* --- @bbs_pubfree@, @bbs_privfree@ --- *
53 *
54 * Arguments: @bbs_pub *bp@, @bbs_priv *bp@ = pointer to key block
55 *
56 * Returns: ---
57 *
58 * Use: Frees an RSA key block.
59 */
60
61void bbs_pubfree(bbs_pub *bp)
62{
63 mp_drop(bp->n);
64}
65
66void bbs_privfree(bbs_priv *bp)
67{
68 mp_drop(bp->n);
69 mp_drop(bp->p);
70 mp_drop(bp->q);
71}
72
2bdb833f 73/*----- That's all, folks -------------------------------------------------*/