summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2005-12-28 10:57:36 +0000
committerHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2005-12-28 10:57:36 +0000
commit208c81a4ea08249e396df5b74d38250b9d7c95d2 (patch)
treec502957f1ea3b961107530ddc55ccf7c478296f9 /sbin
parent5414b2466a4950f675c607c5e81859ab1dce2df1 (diff)
remove some unused functions and an unused variable found by lint.
ok markus@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/isakmpd/conf.c87
-rw-r--r--sbin/isakmpd/conf.h3
-rw-r--r--sbin/isakmpd/math_2n.c155
-rw-r--r--sbin/isakmpd/math_2n.h6
-rw-r--r--sbin/isakmpd/transport.c12
-rw-r--r--sbin/isakmpd/transport.h3
-rw-r--r--sbin/isakmpd/util.c38
-rw-r--r--sbin/isakmpd/util.h5
8 files changed, 8 insertions, 301 deletions
diff --git a/sbin/isakmpd/conf.c b/sbin/isakmpd/conf.c
index 04abf876ed0..4cdeed53749 100644
--- a/sbin/isakmpd/conf.c
+++ b/sbin/isakmpd/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.85 2005/11/14 23:25:11 deraadt Exp $ */
+/* $OpenBSD: conf.c,v 1.86 2005/12/28 10:57:35 hshoexer Exp $ */
/* $EOM: conf.c,v 1.48 2000/12/04 02:04:29 angelos Exp $ */
/*
@@ -74,32 +74,6 @@ struct conf_trans {
TAILQ_HEAD(conf_trans_head, conf_trans) conf_trans_queue;
-/*
- * Radix-64 Encoding.
- */
-const u_int8_t bin2asc[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-const u_int8_t asc2bin[] =
-{
- 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 62, 255, 255, 255, 63,
- 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 61, 255, 255, 255, 255, 255, 255,
- 255, 0, 1, 2, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22,
- 23, 24, 25, 255, 255, 255, 255, 255,
- 255, 26, 27, 28, 29, 30, 31, 32,
- 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48,
- 49, 50, 51, 255, 255, 255, 255, 255
-};
-
struct conf_binding {
LIST_ENTRY(conf_binding) link;
char *section;
@@ -801,65 +775,6 @@ cleanup:
return 0;
}
-/* Decode a PEM encoded buffer. */
-int
-conf_decode_base64(u_int8_t *out, u_int32_t *len, u_char *buf)
-{
- u_int32_t c = 0;
- u_int8_t c1, c2, c3, c4;
-
- while (*buf) {
- if (*buf > 127 || (c1 = asc2bin[*buf]) == 255)
- return 0;
- buf++;
-
- if (*buf > 127 || (c2 = asc2bin[*buf]) == 255)
- return 0;
- buf++;
-
- if (*buf == '=') {
- c3 = c4 = 0;
- c++;
-
- /* Check last four bit */
- if (c2 & 0xF)
- return 0;
-
- if (strcmp((char *)buf, "==") == 0)
- buf++;
- else
- return 0;
- } else if (*buf > 127 || (c3 = asc2bin[*buf]) == 255)
- return 0;
- else {
- if (*++buf == '=') {
- c4 = 0;
- c += 2;
-
- /* Check last two bit */
- if (c3 & 3)
- return 0;
-
- if (strcmp((char *)buf, "="))
- return 0;
-
- } else if (*buf > 127 || (c4 = asc2bin[*buf]) == 255)
- return 0;
- else
- c += 3;
- }
-
- buf++;
- *out++ = (c1 << 2) | (c2 >> 4);
- *out++ = (c2 << 4) | (c3 >> 2);
- *out++ = (c3 << 6) | c4;
- }
-
- *len = c;
- return 1;
-
-}
-
void
conf_free_list(struct conf_list *list)
{
diff --git a/sbin/isakmpd/conf.h b/sbin/isakmpd/conf.h
index 7c66620d4b6..d7c7ddbd9e3 100644
--- a/sbin/isakmpd/conf.h
+++ b/sbin/isakmpd/conf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.h,v 1.30 2004/06/25 20:25:34 hshoexer Exp $ */
+/* $OpenBSD: conf.h,v 1.31 2005/12/28 10:57:35 hshoexer Exp $ */
/* $EOM: conf.h,v 1.13 2000/09/18 00:01:47 ho Exp $ */
/*
@@ -84,7 +84,6 @@ struct conf_list {
extern char *conf_path;
extern int conf_begin(void);
-extern int conf_decode_base64(u_int8_t *, u_int32_t *, u_char *);
extern int conf_end(int, int);
extern void conf_free_list(struct conf_list *);
extern struct sockaddr *conf_get_address(char *, char *);
diff --git a/sbin/isakmpd/math_2n.c b/sbin/isakmpd/math_2n.c
index 7c4ba46bdc3..ebcc18144a2 100644
--- a/sbin/isakmpd/math_2n.c
+++ b/sbin/isakmpd/math_2n.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: math_2n.c,v 1.23 2005/05/03 13:50:44 moritz Exp $ */
+/* $OpenBSD: math_2n.c,v 1.24 2005/12/28 10:57:35 hshoexer Exp $ */
/* $EOM: math_2n.c,v 1.15 1999/04/20 09:23:30 niklas Exp $ */
/*
@@ -513,18 +513,6 @@ b2n_square(b2n_ptr d, b2n_ptr n)
* These functions are far from optimal in speed.
*/
int
-b2n_div_q(b2n_ptr d, b2n_ptr n, b2n_ptr m)
-{
- b2n_t r;
- int rv;
-
- b2n_init(r);
- rv = b2n_div(d, r, n, m);
- b2n_clear(r);
- return rv;
-}
-
-int
b2n_div_r(b2n_ptr r, b2n_ptr n, b2n_ptr m)
{
b2n_t q;
@@ -639,36 +627,6 @@ b2n_mod(b2n_ptr m, b2n_ptr n, b2n_ptr p)
}
int
-b2n_gcd(b2n_ptr e, b2n_ptr go, b2n_ptr ho)
-{
- b2n_t g, h;
-
- b2n_init(g);
- b2n_init(h);
- if (b2n_set(g, go))
- goto fail;
- if (b2n_set(h, ho))
- goto fail;
-
- while (b2n_cmp_null(h)) {
- if (b2n_mod(g, g, h))
- goto fail;
- B2N_SWAP(g, h);
- }
-
- B2N_SWAP(e, g);
-
- b2n_clear(g);
- b2n_clear(h);
- return 0;
-
-fail:
- b2n_clear(g);
- b2n_clear(h);
- return -1;
-}
-
-int
b2n_mul_inv(b2n_ptr ga, b2n_ptr be, b2n_ptr p)
{
b2n_t a;
@@ -750,41 +708,6 @@ fail:
}
/*
- * The trace tells us if there do exist any square roots
- * for 'a' in GF(2)[x]/p(x). The number of square roots is
- * 2 - 2*Trace.
- * If z is a square root, z + 1 is the other.
- */
-int
-b2n_trace(b2n_ptr ho, b2n_ptr a, b2n_ptr p)
-{
- int i, m = b2n_sigbit(p) - 1;
- b2n_t h;
-
- b2n_init(h);
- if (b2n_set(h, a))
- goto fail;
-
- for (i = 0; i < m - 1; i++) {
- if (b2n_square(h, h))
- goto fail;
- if (b2n_mod(h, h, p))
- goto fail;
-
- if (b2n_add(h, h, a))
- goto fail;
- }
- B2N_SWAP(ho, h);
-
- b2n_clear(h);
- return 0;
-
-fail:
- b2n_clear(h);
- return -1;
-}
-
-/*
* The halftrace yields the square root if the degree of the
* irreduceable polynomial is odd.
*/
@@ -890,45 +813,6 @@ fail:
return -1;
}
-/* Exponentiation modulo a polynomial. */
-int
-b2n_exp_mod(b2n_ptr d, b2n_ptr b0, u_int32_t e, b2n_ptr p)
-{
- b2n_t u, b;
-
- b2n_init(u);
- b2n_init(b);
- if (b2n_set_ui(u, 1))
- goto fail;
- if (b2n_mod(b, b0, p))
- goto fail;
-
- while (e) {
- if (e & 1) {
- if (b2n_mul(u, u, b))
- goto fail;
- if (b2n_mod(u, u, p))
- goto fail;
- }
- if (b2n_square(b, b))
- goto fail;
- if (b2n_mod(b, b, p))
- goto fail;
- e >>= 1;
- }
-
- B2N_SWAP(d, u);
-
- b2n_clear(u);
- b2n_clear(b);
- return 0;
-
-fail:
- b2n_clear(u);
- b2n_clear(b);
- return -1;
-}
-
/*
* Low-level function to speed up scalar multiplication with
* elliptic curves.
@@ -978,43 +862,6 @@ b2n_nadd(b2n_ptr d0, b2n_ptr a0, b2n_ptr b0)
return 0;
}
-/* Very special sub, a > b. */
-int
-b2n_nsub(b2n_ptr d0, b2n_ptr a, b2n_ptr b)
-{
- int i, carry;
- b2n_t d;
-
- if (b2n_cmp(a, b) <= 0)
- return b2n_set_null(d0);
-
- b2n_init(d);
- if (b2n_resize(d, a->chunks)) {
- b2n_clear(d);
- return -1;
- }
- for (carry = i = 0; i < b->chunks; i++) {
- d->limp[i] = a->limp[i] - b->limp[i] - carry;
- carry = (d->limp[i] > a->limp[i] ? 1 : 0);
- }
-
- for (; i < a->chunks && carry; i++) {
- d->limp[i] = a->limp[i] - carry;
- carry = (d->limp[i] > a->limp[i] ? 1 : 0);
- }
-
- if (i < a->chunks)
- memcpy(d->limp + i, a->limp + i,
- CHUNK_BYTES * (a->chunks - i));
-
- d->dirty = 1;
-
- B2N_SWAP(d0, d);
-
- b2n_clear(d);
- return 0;
-}
-
int
b2n_3mul(b2n_ptr d0, b2n_ptr e)
{
diff --git a/sbin/isakmpd/math_2n.h b/sbin/isakmpd/math_2n.h
index dc8b804b843..d3249e1fc74 100644
--- a/sbin/isakmpd/math_2n.h
+++ b/sbin/isakmpd/math_2n.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: math_2n.h,v 1.8 2005/04/21 01:23:07 cloder Exp $ */
+/* $OpenBSD: math_2n.h,v 1.9 2005/12/28 10:57:35 hshoexer Exp $ */
/* $EOM: math_2n.h,v 1.9 1999/04/17 23:20:32 niklas Exp $ */
/*
@@ -101,9 +101,7 @@ int b2n_cmp(b2n_ptr, b2n_ptr);
int b2n_cmp_null(b2n_ptr);
int b2n_div(b2n_ptr, b2n_ptr, b2n_ptr, b2n_ptr);
int b2n_div_mod(b2n_ptr, b2n_ptr, b2n_ptr, b2n_ptr);
-int b2n_div_q(b2n_ptr, b2n_ptr, b2n_ptr);
int b2n_div_r(b2n_ptr, b2n_ptr, b2n_ptr);
-int b2n_exp_mod(b2n_ptr, b2n_ptr, u_int32_t, b2n_ptr);
void b2n_init(b2n_ptr);
void b2n_clear(b2n_ptr);
int b2n_gcd(b2n_ptr, b2n_ptr, b2n_ptr);
@@ -113,7 +111,6 @@ int b2n_mod(b2n_ptr, b2n_ptr, b2n_ptr);
int b2n_mul(b2n_ptr, b2n_ptr, b2n_ptr);
int b2n_mul_inv(b2n_ptr, b2n_ptr, b2n_ptr);
int b2n_nadd(b2n_ptr, b2n_ptr, b2n_ptr);
-int b2n_nsub(b2n_ptr, b2n_ptr, b2n_ptr);
int b2n_random(b2n_ptr, u_int32_t);
int b2n_resize(b2n_ptr, unsigned int);
int b2n_rshift(b2n_ptr, b2n_ptr, unsigned int);
@@ -125,6 +122,5 @@ u_int32_t b2n_sigbit(b2n_ptr);
int b2n_sqrt(b2n_ptr, b2n_ptr, b2n_ptr);
int b2n_square(b2n_ptr, b2n_ptr);
#define b2n_sub b2n_add
-int b2n_trace(b2n_ptr, b2n_ptr, b2n_ptr);
#endif /* _MATH_2N_H_ */
diff --git a/sbin/isakmpd/transport.c b/sbin/isakmpd/transport.c
index 2201e3169ee..b1cd1b96890 100644
--- a/sbin/isakmpd/transport.c
+++ b/sbin/isakmpd/transport.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: transport.c,v 1.34 2005/10/27 08:19:59 hshoexer Exp $ */
+/* $OpenBSD: transport.c,v 1.35 2005/12/28 10:57:35 hshoexer Exp $ */
/* $EOM: transport.c,v 1.43 2000/10/10 12:36:39 provos Exp $ */
/*
@@ -169,16 +169,6 @@ transport_method_add(struct transport_vtbl *t)
LIST_INSERT_HEAD(&transport_method_list, t, link);
}
-/* Apply a function FUNC on all registered (non-toplevel) transports. */
-void
-transport_map(void (*func) (struct transport *))
-{
- struct transport *t;
-
- for (t = LIST_FIRST(&transport_list); t; t = LIST_NEXT(t, link))
- (*func) (t);
-}
-
/*
* Build up a file descriptor set FDS with all transport descriptors we want
* to read from. Return the number of file descriptors select(2) needs to
diff --git a/sbin/isakmpd/transport.h b/sbin/isakmpd/transport.h
index a957cb6a125..35c0cc701df 100644
--- a/sbin/isakmpd/transport.h
+++ b/sbin/isakmpd/transport.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: transport.h,v 1.16 2005/10/27 08:19:59 hshoexer Exp $ */
+/* $OpenBSD: transport.h,v 1.17 2005/12/28 10:57:35 hshoexer Exp $ */
/* $EOM: transport.h,v 1.16 2000/07/17 18:57:59 provos Exp $ */
/*
@@ -148,7 +148,6 @@ extern struct transport *transport_create(char *, char *);
extern int transport_fd_set(fd_set *);
extern void transport_handle_messages(fd_set *);
extern void transport_init(void);
-extern void transport_map(void (*) (struct transport *));
extern void transport_method_add(struct transport_vtbl *);
extern int transport_pending_wfd_set(fd_set *);
extern int transport_prio_sendqs_empty(void);
diff --git a/sbin/isakmpd/util.c b/sbin/isakmpd/util.c
index dfc08aa0095..0747351d140 100644
--- a/sbin/isakmpd/util.c
+++ b/sbin/isakmpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.59 2005/11/15 21:49:04 cloder Exp $ */
+/* $OpenBSD: util.c,v 1.60 2005/12/28 10:57:35 hshoexer Exp $ */
/* $EOM: util.c,v 1.23 2000/11/23 12:22:08 niklas Exp $ */
/*
@@ -67,11 +67,6 @@ int regrand = 0;
#endif
/*
- * If in regression-test mode, this is the seed used.
- */
-u_long seed;
-
-/*
* XXX These might be turned into inlines or macros, maybe even
* machine-dependent ones, for performance reasons.
*/
@@ -87,14 +82,6 @@ decode_32(u_int8_t *cp)
return cp[0] << 24 | cp[1] << 16 | cp[2] << 8 | cp[3];
}
-u_int64_t
-decode_64(u_int8_t *cp)
-{
- return (u_int64_t) cp[0] << 56 | (u_int64_t) cp[1] << 48 |
- (u_int64_t) cp[2] << 40 | (u_int64_t) cp[3] << 32 |
- cp[4] << 24 | cp[5] << 16 | cp[6] << 8 | cp[7];
-}
-
void
encode_16(u_int8_t *cp, u_int16_t x)
{
@@ -111,19 +98,6 @@ encode_32(u_int8_t *cp, u_int32_t x)
*cp = x & 0xff;
}
-void
-encode_64(u_int8_t *cp, u_int64_t x)
-{
- *cp++ = x >> 56;
- *cp++ = (x >> 48) & 0xff;
- *cp++ = (x >> 40) & 0xff;
- *cp++ = (x >> 32) & 0xff;
- *cp++ = (x >> 24) & 0xff;
- *cp++ = (x >> 16) & 0xff;
- *cp++ = (x >> 8) & 0xff;
- *cp = x & 0xff;
-}
-
/* Check a buffer for all zeroes. */
int
zero_test(const u_int8_t *p, size_t sz)
@@ -134,16 +108,6 @@ zero_test(const u_int8_t *p, size_t sz)
return 1;
}
-/* Check a buffer for all ones. */
-int
-ones_test(const u_int8_t *p, size_t sz)
-{
- while (sz-- > 0)
- if (*p++ != 0xff)
- return 0;
- return 1;
-}
-
/*
* Generate 32 bits of random data. If compiled with INSECURE_RAND
* and -r option is specified, then return deterministic data.
diff --git a/sbin/isakmpd/util.h b/sbin/isakmpd/util.h
index 04674af5f91..f466a360d71 100644
--- a/sbin/isakmpd/util.h
+++ b/sbin/isakmpd/util.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.h,v 1.27 2005/11/15 21:49:04 cloder Exp $ */
+/* $OpenBSD: util.h,v 1.28 2005/12/28 10:57:35 hshoexer Exp $ */
/* $EOM: util.h,v 1.10 2000/10/24 13:33:39 niklas Exp $ */
/*
@@ -46,15 +46,12 @@ struct sockaddr;
extern int check_file_secrecy_fd(int, char *, size_t *);
extern u_int16_t decode_16(u_int8_t *);
extern u_int32_t decode_32(u_int8_t *);
-extern u_int64_t decode_64(u_int8_t *);
extern void encode_16(u_int8_t *, u_int16_t);
extern void encode_32(u_int8_t *, u_int32_t);
-extern void encode_64(u_int8_t *, u_int64_t);
extern u_int32_t rand_32(void);
extern u_int8_t *getrandom(u_int8_t *, size_t);
extern int hex2raw(char *, u_int8_t *, size_t);
extern char *raw2hex(u_int8_t *, size_t);
-extern int ones_test(const u_int8_t *, size_t);
extern int sockaddr2text(struct sockaddr *, char **, int);
extern u_int8_t *sockaddr_addrdata(struct sockaddr *);
extern int sockaddr_addrlen(struct sockaddr *);