summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2005-04-08 20:04:58 +0000
committerHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2005-04-08 20:04:58 +0000
commit6ae197dff1cae3924cfab9868d086c0e749e49de (patch)
treecc3d03a70005c9e57d7dff1c91996e24fa469a6f /sbin
parente5f646ab41f78c463cbbfce458b2c74600fe9213 (diff)
kill gmp
Diffstat (limited to 'sbin')
-rw-r--r--sbin/isakmpd/Makefile4
-rw-r--r--sbin/isakmpd/gmp_util.c74
-rw-r--r--sbin/isakmpd/gmp_util.h42
-rw-r--r--sbin/isakmpd/ike_auth.c3
-rw-r--r--sbin/isakmpd/math_group.c27
5 files changed, 25 insertions, 125 deletions
diff --git a/sbin/isakmpd/Makefile b/sbin/isakmpd/Makefile
index bb049968fe3..7fd011adc54 100644
--- a/sbin/isakmpd/Makefile
+++ b/sbin/isakmpd/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.74 2005/04/08 19:40:02 deraadt Exp $
+# $OpenBSD: Makefile,v 1.75 2005/04/08 20:04:57 hshoexer Exp $
# $EOM: Makefile,v 1.78 2000/10/15 21:33:42 niklas Exp $
#
@@ -47,7 +47,7 @@ FEATURES+=
PROG= isakmpd
SRCS= app.c attribute.c cert.c connection.c constants.c conf.c \
cookie.c crypto.c dh.c doi.c exchange.c exchange_num.c \
- field.c gmp_util.c hash.c if.c ike_auth.c ike_main_mode.c \
+ field.c hash.c if.c ike_auth.c ike_main_mode.c \
ike_phase_1.c ike_quick_mode.c init.c ipsec.c ipsec_fld.c \
ipsec_num.c isakmpd.c isakmp_doi.c isakmp_fld.c isakmp_num.c \
key.c libcrypto.c log.c message.c math_2n.c math_group.c \
diff --git a/sbin/isakmpd/gmp_util.c b/sbin/isakmpd/gmp_util.c
deleted file mode 100644
index f48f1d735ed..00000000000
--- a/sbin/isakmpd/gmp_util.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $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 $ */
-
-/*
- * Copyright (c) 1998 Niels Provos. All rights reserved.
- * Copyright (c) 1999, 2000 Niklas Hallqvist. All rights reserved.
- * Copyright (c) 2000 Håkan Olsson. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This code was written under funding by Ericsson Radio Systems.
- */
-
-#include <sys/param.h>
-
-#include "sysdep.h"
-
-#include "gmp_util.h"
-#include "math_mp.h"
-
-/* Various utility functions for gmp, used in more than one module */
-
-u_int32_t
-mpz_sizeinoctets(math_mp_t a)
-{
- return BN_num_bytes(a);
-}
-
-void
-mpz_getraw(u_int8_t *raw, math_mp_t v, u_int32_t len)
-{
- math_mp_t a;
-
- /* XXX bn2bin? */
- a = BN_dup(v);
-
- while (len-- > 0)
- raw[len] = BN_div_word(a, 256);
-
- BN_clear_free(a);
-}
-
-void
-mpz_setraw(math_mp_t d, u_int8_t *s, u_int32_t l)
-{
- u_int32_t i;
-
- /* XXX bin2bn? */
- BN_set_word(d, 0);
- for (i = 0; i < l; i++) {
- BN_mul_word(d, 256);
- BN_add_word(d, s[i]);
- }
-}
diff --git a/sbin/isakmpd/gmp_util.h b/sbin/isakmpd/gmp_util.h
deleted file mode 100644
index 826c6cab354..00000000000
--- a/sbin/isakmpd/gmp_util.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $OpenBSD: gmp_util.h,v 1.8 2004/04/15 18:39:25 deraadt Exp $ */
-/* $EOM: gmp_util.h,v 1.4 2000/05/08 13:42:11 ho Exp $ */
-
-/*
- * Copyright (c) 1998 Niels Provos. All rights reserved.
- * Copyright (c) 2000 Niklas Hallqvist. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This code was written under funding by Ericsson Radio Systems.
- */
-
-#ifndef _GMP_UTIL_H_
-#define _GMP_UTIL_H_
-
-#include "math_mp.h"
-
-u_int32_t mpz_sizeinoctets(math_mp_t);
-void mpz_getraw(u_int8_t *, math_mp_t, u_int32_t);
-void mpz_setraw(math_mp_t, u_int8_t *, u_int32_t);
-
-#endif /* _GMP_UTIL_H_ */
diff --git a/sbin/isakmpd/ike_auth.c b/sbin/isakmpd/ike_auth.c
index 4d0557b5f7a..b8f4b934a8c 100644
--- a/sbin/isakmpd/ike_auth.c
+++ b/sbin/isakmpd/ike_auth.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ike_auth.c,v 1.100 2005/04/08 18:35:37 deraadt Exp $ */
+/* $OpenBSD: ike_auth.c,v 1.101 2005/04/08 20:04:57 hshoexer Exp $ */
/* $EOM: ike_auth.c,v 1.59 2000/11/21 00:21:31 angelos Exp $ */
/*
@@ -55,7 +55,6 @@
#include "dnssec.h"
#endif
#include "exchange.h"
-#include "gmp_util.h"
#include "hash.h"
#include "ike_auth.h"
#include "ipsec.h"
diff --git a/sbin/isakmpd/math_group.c b/sbin/isakmpd/math_group.c
index 4e5eeed3fa3..2a2964bebaf 100644
--- a/sbin/isakmpd/math_group.c
+++ b/sbin/isakmpd/math_group.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: math_group.c,v 1.25 2005/04/08 19:19:39 hshoexer Exp $ */
+/* $OpenBSD: math_group.c,v 1.26 2005/04/08 20:04:57 hshoexer Exp $ */
/* $EOM: math_group.c,v 1.25 2000/04/07 19:53:26 niklas Exp $ */
/*
@@ -36,7 +36,6 @@
#include "sysdep.h"
-#include "gmp_util.h"
#include "log.h"
#include "math_2n.h"
#include "math_ec2n.h"
@@ -678,19 +677,37 @@ modp_getlen(struct group *group)
{
struct modp_group *grp = (struct modp_group *)group->group;
- return mpz_sizeinoctets(grp->p);
+ return BN_num_bytes(grp->p);
}
void
modp_getraw(struct group *grp, math_mp_t v, u_int8_t *d)
{
- mpz_getraw(d, v, grp->getlen(grp));
+ math_mp_t a;
+ int len;
+
+ len = grp->getlen(grp);
+
+ /* XXX bn2bin? */
+ a = BN_dup(v);
+
+ while (len-- > 0)
+ d[len] = BN_div_word(a, 256);
+
+ BN_clear_free(a);
}
int
modp_setraw(struct group *grp, math_mp_t d, u_int8_t *s, int l)
{
- mpz_setraw(d, s, l);
+ u_int32_t i;
+
+ /* XXX bin2bn? */
+ BN_set_word(d, 0);
+ for (i = 0; i < l; i++) {
+ BN_mul_word(d, 256);
+ BN_add_word(d, s[i]);
+ }
return 0;
}