offline pcap reading working
[netsniff-ng.git] / src / ecc.h
bloba1a4fc79727fafd5186afe1d0c8d15da328804bf
1 /*
2 * netsniff-ng - the packet sniffing beast
3 * By Daniel Borkmann <daniel@netsniff-ng.org>
4 * Copyright 2011 Daniel Borkmann <dborkma@tik.ee.ethz.ch>,
5 * Swiss federal institute of technology (ETH Zurich)
6 * Subject to the GPL.
7 */
9 /*
10 * seccure - Copyright 2009 B. Poettering
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU 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 * This program 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 GNU
20 * General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
25 * 02111-1307 USA
28 /*
29 * SECCURE Elliptic Curve Crypto Utility for Reliable Encryption
31 * http://point-at-infinity.org/seccure/
34 * seccure implements a selection of asymmetric algorithms based on
35 * elliptic curve cryptography (ECC). See the manpage or the project's
36 * homepage for further details.
38 * This code links against the GNU gcrypt library "libgcrypt" (which
39 * is part of the GnuPG project). Use the included Makefile to build
40 * the binary.
42 * Report bugs to: seccure AT point-at-infinity.org
46 #ifndef ECC_H
47 #define ECC_H
49 #include <gcrypt.h>
51 struct affine_point {
52 gcry_mpi_t x, y;
55 struct jacobian_point {
56 gcry_mpi_t x, y, z;
59 struct domain_params {
60 gcry_mpi_t a, b, m, order;
61 struct affine_point base;
62 int cofactor;
65 extern struct affine_point point_new(void);
66 extern void point_release(struct affine_point *p);
67 extern void point_set(struct affine_point *p1, const struct affine_point *p2);
68 extern void point_load_zero(struct affine_point *p);
69 extern int point_is_zero(const struct affine_point *p);
70 extern int point_on_curve(const struct affine_point *p,
71 const struct domain_params *dp);
72 extern int point_compress(const struct affine_point *p);
73 extern int point_decompress(struct affine_point *p, const gcry_mpi_t x,
74 int yflag, const struct domain_params *dp);
75 extern void point_double(struct affine_point *p,
76 const struct domain_params *dp);
77 extern void point_add(struct affine_point *p1, const struct affine_point *p2,
78 const struct domain_params *dp);
79 extern struct jacobian_point jacobian_new(void);
80 extern void jacobian_release(struct jacobian_point *p);
81 extern void jacobian_load_affine(struct jacobian_point *p1,
82 const struct affine_point *p2);
83 extern void jacobian_load_zero(struct jacobian_point *p);
84 extern int jacobian_is_zero(const struct jacobian_point *p);
85 extern void jacobian_double(struct jacobian_point *p,
86 const struct domain_params *dp);
87 extern void jacobian_affine_point_add(struct jacobian_point *p1,
88 const struct affine_point *p2,
89 const struct domain_params *dp);
90 extern struct affine_point jacobian_to_affine(const struct jacobian_point *p,
91 const struct domain_params *dp);
92 extern struct affine_point pointmul(const struct affine_point *p,
93 const gcry_mpi_t exp,
94 const struct domain_params *dp);
95 extern int embedded_key_validation(const struct affine_point *p,
96 const struct domain_params *dp);
97 extern int full_key_validation(const struct affine_point *p,
98 const struct domain_params *dp);
100 #endif /* ECC_H */