chiark / gitweb /
math/fgoldi.[ch]: Implement the extra operations needed for Ed448.
[catacomb] / math / buf.h
CommitLineData
6b80b6c4 1/* -*-c-*-
5ff5e658 2 *
3 * Reading and writing packet buffers
6b80b6c4 4 *
6b80b6c4 5 * (c) 2001 Straylight/Edgeware
6 */
7
45c0fd36 8/*----- Licensing notice --------------------------------------------------*
6b80b6c4 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 *
6b80b6c4 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 *
6b80b6c4 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
5ff5e658 28#ifndef CATACOMB_BUF_H
29#define CATACOMB_BUF_H
6b80b6c4 30
31#ifdef __cplusplus
32 extern "C" {
33#endif
34
35/*----- Header files ------------------------------------------------------*/
36
6b80b6c4 37#include <mLib/bits.h>
f387fcb1 38#include <mLib/buf.h>
6b80b6c4 39
5ff5e658 40#ifndef CATACOMB_MP_H
41# include "mp.h"
42#endif
6b80b6c4 43
34e4f738 44#ifndef CATACOMB_EC_H
45# include "ec.h"
46#endif
47
6b80b6c4 48/*----- Functions provided ------------------------------------------------*/
49
6b80b6c4 50/* --- @buf_getmp@ --- *
51 *
52 * Arguments: @buf *b@ = pointer to a buffer block
53 *
54 * Returns: A multiprecision integer, or null if there wasn't one there.
55 *
56 * Use: Gets a multiprecision integer from a buffer.
57 */
58
59extern mp *buf_getmp(buf */*b*/);
60
61/* --- @buf_putmp@ --- *
62 *
63 * Arguments: @buf *b@ = pointer to a buffer block
64 * @mp *m@ = a multiprecision integer
65 *
66 * Returns: Zero if it worked, nonzero if there wasn't enough space.
67 *
68 * Use: Puts a multiprecision integer to a buffer.
69 */
70
71extern int buf_putmp(buf */*b*/, mp */*m*/);
72
34e4f738 73/* --- @buf_getec@ --- *
74 *
75 * Arguments: @buf *b@ = pointer to a buffer block
76 * @ec *p@ = where to put the point
77 *
78 * Returns: Zero if it worked, nonzero if it failed.
79 *
80 * Use: Gets a multiprecision integer from a buffer. The point must
81 * be initialized.
82 */
83
84extern int buf_getec(buf */*b*/, ec */*p*/);
85
86/* --- @buf_putec@ --- *
87 *
88 * Arguments: @buf *b@ = pointer to a buffer block
89 * @ec *p@ = an elliptic curve point
90 *
91 * Returns: Zero if it worked, nonzero if there wasn't enough space.
92 *
93 * Use: Puts an elliptic curve point to a buffer.
94 */
95
96extern int buf_putec(buf */*b*/, ec */*p*/);
97
6b80b6c4 98/*----- That's all, folks -------------------------------------------------*/
99
100#ifdef __cplusplus
101 }
102#endif
103
104#endif