summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2005-04-08 19:19:40 +0000
committerHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2005-04-08 19:19:40 +0000
commitc3e5ea6383ccc7749e35670ccf210707f5fceb8f (patch)
treefd33707f3845bf0335450cbba08b2db9e9e6091a /sbin
parent36660d77e44461f6827dbe72048823908f1c7512 (diff)
remove gmp, no binary change
Diffstat (limited to 'sbin')
-rw-r--r--sbin/isakmpd/Makefile4
-rw-r--r--sbin/isakmpd/apps/certpatch/Makefile10
-rw-r--r--sbin/isakmpd/gmp_util.c33
-rw-r--r--sbin/isakmpd/math_group.c41
-rw-r--r--sbin/isakmpd/math_mp.h19
5 files changed, 5 insertions, 102 deletions
diff --git a/sbin/isakmpd/Makefile b/sbin/isakmpd/Makefile
index baee24bc5e0..0998fb5d4e2 100644
--- a/sbin/isakmpd/Makefile
+++ b/sbin/isakmpd/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.72 2005/04/08 19:08:23 deraadt Exp $
+# $OpenBSD: Makefile,v 1.73 2005/04/08 19:19:39 hshoexer Exp $
# $EOM: Makefile,v 1.78 2000/10/15 21:33:42 niklas Exp $
#
@@ -98,8 +98,6 @@ SUBDIR+= samples
.endif
.endfor
-CFLAGS+= -DMP_FLAVOUR=MP_FLAVOUR_OPENSSL
-
SRCS+= ${DNSSEC} \
pf_key_v2.c policy.c math_ec2n.c ike_aggressive.c isakmp_cfg.c \
dpd.c monitor.c monitor_fdpass.c nat_traversal.c udp_encap.c
diff --git a/sbin/isakmpd/apps/certpatch/Makefile b/sbin/isakmpd/apps/certpatch/Makefile
index 71f8ed518c6..819a0cf1554 100644
--- a/sbin/isakmpd/apps/certpatch/Makefile
+++ b/sbin/isakmpd/apps/certpatch/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.8 2005/04/08 19:05:15 deraadt Exp $
+# $OpenBSD: Makefile,v 1.9 2005/04/08 19:19:39 hshoexer Exp $
# $EOM: Makefile,v 1.6 2000/03/28 21:22:06 ho Exp $
#
@@ -43,14 +43,6 @@ LDADD+= -lcrypto
DPADD+= ${LIBCRYPTO}
MAN= certpatch.8
-.if ${FEATURES:Mgmp} == "gmp"
-CFLAGS+= -DMP_FLAVOUR=MP_FLAVOUR_GMP
-LDADD+= -lgmp
-DPADD+= ${LIBGMP}
-.else
-CFLAGS+= -DMP_FLAVOUR=MP_FLAVOUR_OPENSSL
-.endif
-
# Override LIBSYSDEPDIR definition from Makefile.sysdep
LIBSYSDEPDIR= ${TOPSRC}/sysdep/common/libsysdep
diff --git a/sbin/isakmpd/gmp_util.c b/sbin/isakmpd/gmp_util.c
index 2a338d266df..f48f1d735ed 100644
--- a/sbin/isakmpd/gmp_util.c
+++ b/sbin/isakmpd/gmp_util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gmp_util.c,v 1.11 2004/04/15 18:39:25 deraadt Exp $ */
+/* $OpenBSD: gmp_util.c,v 1.12 2005/04/08 19:19:39 hshoexer Exp $ */
/* $EOM: gmp_util.c,v 1.7 2000/09/18 00:01:47 ho Exp $ */
/*
@@ -43,11 +43,7 @@
u_int32_t
mpz_sizeinoctets(math_mp_t a)
{
-#if MP_FLAVOUR == MP_FLAVOUR_GMP
- return (7 + mpz_sizeinbase(a, 2)) >> 3;
-#elif MP_FLAVOUR == MP_FLAVOUR_OPENSSL
return BN_num_bytes(a);
-#endif
}
void
@@ -55,30 +51,13 @@ mpz_getraw(u_int8_t *raw, math_mp_t v, u_int32_t len)
{
math_mp_t a;
-#if MP_FLAVOUR == MP_FLAVOUR_GMP
- math_mp_t tmp;
-
- /* XXX mpz_get_str (raw, BASE, v); ? */
- mpz_init_set(a, v);
- mpz_init(tmp);
-#elif MP_FLAVOUR == MP_FLAVOUR_OPENSSL
/* XXX bn2bin? */
a = BN_dup(v);
-#endif
while (len-- > 0)
-#if MP_FLAVOUR == MP_FLAVOUR_GMP
- raw[len] = mpz_fdiv_qr_ui(a, tmp, a, 256);
-#elif MP_FLAVOUR == MP_FLAVOUR_OPENSSL
raw[len] = BN_div_word(a, 256);
-#endif
-#if MP_FLAVOUR == MP_FLAVOUR_GMP
- mpz_clear(a);
- mpz_clear(tmp);
-#elif MP_FLAVOUR == MP_FLAVOUR_OPENSSL
BN_clear_free(a);
-#endif
}
void
@@ -86,20 +65,10 @@ mpz_setraw(math_mp_t d, u_int8_t *s, u_int32_t l)
{
u_int32_t i;
-#if MP_FLAVOUR == MP_FLAVOUR_GMP
- /* XXX mpz_set_str (d, s, 0); */
- mpz_set_si(d, 0);
-#elif MP_FLAVOUR == MP_FLAVOUR_OPENSSL
/* XXX bin2bn? */
BN_set_word(d, 0);
-#endif
for (i = 0; i < l; i++) {
-#if MP_FLAVOUR == MP_FLAVOUR_GMP
- mpz_mul_ui(d, d, 256);
- mpz_add_ui(d, d, s[i]);
-#elif MP_FLAVOUR == MP_FLAVOUR_OPENSSL
BN_mul_word(d, 256);
BN_add_word(d, s[i]);
-#endif
}
}
diff --git a/sbin/isakmpd/math_group.c b/sbin/isakmpd/math_group.c
index aeb8f708905..4e5eeed3fa3 100644
--- a/sbin/isakmpd/math_group.c
+++ b/sbin/isakmpd/math_group.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: math_group.c,v 1.24 2005/04/08 16:18:59 deraadt Exp $ */
+/* $OpenBSD: math_group.c,v 1.25 2005/04/08 19:19:39 hshoexer Exp $ */
/* $EOM: math_group.c,v 1.25 2000/04/07 19:53:26 niklas Exp $ */
/*
@@ -506,21 +506,12 @@ modp_clone(struct group *new, struct group *clone)
memcpy(new, clone, sizeof(struct group));
new->group = new_grp;
-#if MP_FLAVOUR == MP_FLAVOUR_GMP
- mpz_init_set(new_grp->p, clone_grp->p);
- mpz_init_set(new_grp->gen, clone_grp->gen);
-
- mpz_init(new_grp->a);
- mpz_init(new_grp->b);
- mpz_init(new_grp->c);
-#elif MP_FLAVOUR == MP_FLAVOUR_OPENSSL
new_grp->p = BN_dup(clone_grp->p);
new_grp->gen = BN_dup(clone_grp->gen);
new_grp->a = BN_new();
new_grp->b = BN_new();
new_grp->c = BN_new();
-#endif
new->gen = new_grp->gen;
new->a = new_grp->a;
@@ -535,19 +526,11 @@ modp_free(struct group *old)
{
struct modp_group *grp = old->group;
-#if MP_FLAVOUR == MP_FLAVOUR_GMP
- mpz_clear(grp->p);
- mpz_clear(grp->gen);
- mpz_clear(grp->a);
- mpz_clear(grp->b);
- mpz_clear(grp->c);
-#elif MP_FLAVOUR == MP_FLAVOUR_OPENSSL
BN_clear_free(grp->p);
BN_clear_free(grp->gen);
BN_clear_free(grp->a);
BN_clear_free(grp->b);
BN_clear_free(grp->c);
-#endif
free(grp);
}
@@ -565,14 +548,6 @@ modp_init(struct group *group)
group->bits = dscr->bits;
-#if MP_FLAVOUR == MP_FLAVOUR_GMP
- mpz_init_set_str(grp->p, dscr->prime, 0);
- mpz_init_set_str(grp->gen, dscr->gen, 0);
-
- mpz_init(grp->a);
- mpz_init(grp->b);
- mpz_init(grp->c);
-#elif MP_FLAVOUR == MP_FLAVOUR_OPENSSL
grp->p = BN_new();
BN_hex2bn(&grp->p, dscr->prime + 2);
grp->gen = BN_new();
@@ -581,7 +556,6 @@ modp_init(struct group *group)
grp->a = BN_new();
grp->b = BN_new();
grp->c = BN_new();
-#endif
group->gen = grp->gen;
group->a = grp->a;
@@ -726,23 +700,14 @@ modp_setrandom(struct group *grp, math_mp_t d)
int i, l = grp->getlen(grp);
u_int32_t tmp = 0;
-#if MP_FLAVOUR == MP_FLAVOUR_GMP
- mpz_set_ui(d, 0);
-#elif MP_FLAVOUR == MP_FLAVOUR_OPENSSL
BN_set_word(d, 0);
-#endif
for (i = 0; i < l; i++) {
if (i % 4)
tmp = sysdep_random();
-#if MP_FLAVOUR == MP_FLAVOUR_GMP
- mpz_mul_2exp(d, d, 8);
- mpz_add_ui(d, d, tmp & 0xFF);
-#elif MP_FLAVOUR == MP_FLAVOUR_OPENSSL
BN_lshift(d, d, 8);
BN_add_word(d, tmp & 0xFF);
-#endif
tmp >>= 8;
}
return 0;
@@ -753,13 +718,9 @@ modp_operation(struct group *group, math_mp_t d, math_mp_t a, math_mp_t e)
{
struct modp_group *grp = (struct modp_group *)group->group;
-#if MP_FLAVOUR == MP_FLAVOUR_GMP
- mpz_powm(d, a, e, grp->p);
-#elif MP_FLAVOUR == MP_FLAVOUR_OPENSSL
BN_CTX *ctx = BN_CTX_new();
BN_mod_exp(d, a, e, grp->p, ctx);
BN_CTX_free(ctx);
-#endif
return 0;
}
diff --git a/sbin/isakmpd/math_mp.h b/sbin/isakmpd/math_mp.h
index ed554fc23a4..44887245b53 100644
--- a/sbin/isakmpd/math_mp.h
+++ b/sbin/isakmpd/math_mp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: math_mp.h,v 1.6 2004/04/15 18:39:26 deraadt Exp $ */
+/* $OpenBSD: math_mp.h,v 1.7 2005/04/08 19:19:39 hshoexer Exp $ */
/* $EOM: math_mp.h,v 1.4 2000/09/16 09:41:43 ho Exp $ */
/*
@@ -32,25 +32,8 @@
#ifndef _MATH_MP_H_
#define _MATH_MP_H_
-#define MP_FLAVOUR_GMP 1
-#define MP_FLAVOUR_OPENSSL 2
-
-#if MP_FLAVOUR == MP_FLAVOUR_GMP
-
-#include <gmp.h>
-
-#define math_mp_t mpz_t
-
-#elif MP_FLAVOUR == MP_FLAVOUR_OPENSSL
-
#include <openssl/bn.h>
typedef BIGNUM *math_mp_t;
-#else
-
-#error "No multiprecision math library chosen."
-
-#endif
-
#endif /* _MATH_MP_H_ */