diff options
author | Chad Loder <cloder@cvs.openbsd.org> | 2005-04-21 01:23:08 +0000 |
---|---|---|
committer | Chad Loder <cloder@cvs.openbsd.org> | 2005-04-21 01:23:08 +0000 |
commit | acbfd33112467b34d7042db9b5225aed2998bfd9 (patch) | |
tree | 0a1028fc594ae4c8c2f89949af929e722cc59176 /sbin | |
parent | e3c40c5b6a10b6b3c50d6984b8d6fd0a1d74e9d8 (diff) |
Rather than try to fix b2n_print and b2n_snprint, which are not used, send
them to the attic. OK beck
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/isakmpd/math_2n.c | 68 | ||||
-rw-r--r-- | sbin/isakmpd/math_2n.h | 4 |
2 files changed, 2 insertions, 70 deletions
diff --git a/sbin/isakmpd/math_2n.c b/sbin/isakmpd/math_2n.c index 0ad09d2ae60..153aef4ff6a 100644 --- a/sbin/isakmpd/math_2n.c +++ b/sbin/isakmpd/math_2n.c @@ -1,4 +1,4 @@ -/* $OpenBSD: math_2n.c,v 1.21 2005/04/09 00:42:27 deraadt Exp $ */ +/* $OpenBSD: math_2n.c,v 1.22 2005/04/21 01:23:06 cloder Exp $ */ /* $EOM: math_2n.c,v 1.15 1999/04/20 09:23:30 niklas Exp $ */ /* @@ -229,72 +229,6 @@ b2n_set_str(b2n_ptr n, char *str) return 0; } -/* Output function, mainly for debugging purposes. */ -void -b2n_print(b2n_ptr n) -{ - int i, j, w, flag = 0; - int left; - char buffer[2 * CHUNK_BYTES]; - CHUNK_TYPE tmp; - - left = ((((7 + b2n_sigbit(n)) >> 3) - 1) % CHUNK_BYTES) + 1; - printf("0x"); - for (i = 0; i < n->chunks; i++) { - tmp = n->limp[n->chunks - 1 - i]; - memset(buffer, '0', sizeof(buffer)); - for (w = 0, j = (i == 0 ? left : CHUNK_BYTES); j > 0; j--) { - buffer[w++] = int2hex[(tmp >> 4) & 0xf]; - buffer[w++] = int2hex[tmp & 0xf]; - tmp >>= 8; - } - - for (j = (i == 0 ? left - 1 : CHUNK_BYTES - 1); j >= 0; j--) - if (flag || (i == n->chunks - 1 && j == 0) || - buffer[2 * j] != '0' || buffer[2 * j + 1] != '0') { - putchar(buffer[2 * j]); - putchar(buffer[2 * j + 1]); - flag = 1; - } - } - printf("\n"); -} - -int -b2n_snprint(char *buf, size_t sz, b2n_ptr n) -{ - int i, j, w, flag = 0; - size_t k; - int left; - char buffer[2 * CHUNK_BYTES]; - CHUNK_TYPE tmp; - - left = ((((7 + b2n_sigbit(n)) >> 3) - 1) % CHUNK_BYTES) + 1; - - k = strlcpy(buf, "0x", sz); - for (i = 0; i < n->chunks && k < sz - 1; i++) { - tmp = n->limp[n->chunks - 1 - i]; - memset(buffer, '0', sizeof(buffer)); - for (w = 0, j = (i == 0 ? left : CHUNK_BYTES); j > 0; j--) { - buffer[w++] = int2hex[(tmp >> 4) & 0xf]; - buffer[w++] = int2hex[tmp & 0xf]; - tmp >>= 8; - } - - for (j = (i == 0 ? left - 1 : CHUNK_BYTES - 1); j >= 0 && - k < sz - 3; j--) - if (flag || (i == n->chunks - 1 && j == 0) || - buffer[2 * j] != '0' || buffer[2 * j + 1] != '0') { - buf[k++] = buffer[2 * j]; - buf[k++] = buffer[2 * j + 1]; - flag = 1; - } - } - - buf[k++] = 0; - return k; -} - /* Arithmetic functions. */ u_int32_t diff --git a/sbin/isakmpd/math_2n.h b/sbin/isakmpd/math_2n.h index 0515199cf59..dc8b804b843 100644 --- a/sbin/isakmpd/math_2n.h +++ b/sbin/isakmpd/math_2n.h @@ -1,4 +1,4 @@ -/* $OpenBSD: math_2n.h,v 1.7 2004/04/15 18:39:26 deraadt Exp $ */ +/* $OpenBSD: math_2n.h,v 1.8 2005/04/21 01:23:07 cloder Exp $ */ /* $EOM: math_2n.h,v 1.9 1999/04/17 23:20:32 niklas Exp $ */ /* @@ -114,7 +114,6 @@ 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); -void b2n_print(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); @@ -123,7 +122,6 @@ int b2n_set_null(b2n_ptr); int b2n_set_str(b2n_ptr, char *); int b2n_set_ui(b2n_ptr, unsigned int); u_int32_t b2n_sigbit(b2n_ptr); -int b2n_snprint(char *, size_t, b2n_ptr); int b2n_sqrt(b2n_ptr, b2n_ptr, b2n_ptr); int b2n_square(b2n_ptr, b2n_ptr); #define b2n_sub b2n_add |