diff options
author | djm <> | 2009-01-09 12:14:09 +0000 |
---|---|---|
committer | djm <> | 2009-01-09 12:14:09 +0000 |
commit | 76dd4d55fdccad54d20608e7caf577b9d67b216f (patch) | |
tree | 9b645adc5cf0aa0820e1501ee5c6f2c41c454e7c /src/lib/libcrypto/bn | |
parent | f1625f274acf5dcd5601f6cb5e29e233b2a441a3 (diff) | |
download | openbsd-76dd4d55fdccad54d20608e7caf577b9d67b216f.tar.gz openbsd-76dd4d55fdccad54d20608e7caf577b9d67b216f.tar.bz2 openbsd-76dd4d55fdccad54d20608e7caf577b9d67b216f.zip |
import openssl-0.9.8j
Diffstat (limited to 'src/lib/libcrypto/bn')
-rw-r--r-- | src/lib/libcrypto/bn/Makefile | 17 | ||||
-rw-r--r-- | src/lib/libcrypto/bn/bn_opt.c | 87 |
2 files changed, 101 insertions, 3 deletions
diff --git a/src/lib/libcrypto/bn/Makefile b/src/lib/libcrypto/bn/Makefile index e97c751390..f5e8f65a46 100644 --- a/src/lib/libcrypto/bn/Makefile +++ b/src/lib/libcrypto/bn/Makefile | |||
@@ -28,13 +28,13 @@ LIBSRC= bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c bn_mod.c \ | |||
28 | bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \ | 28 | bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \ |
29 | bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_asm.c \ | 29 | bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_asm.c \ |
30 | bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_gf2m.c bn_nist.c \ | 30 | bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_gf2m.c bn_nist.c \ |
31 | bn_depr.c bn_const.c | 31 | bn_depr.c bn_x931p.c bn_const.c bn_opt.c |
32 | 32 | ||
33 | LIBOBJ= bn_add.o bn_div.o bn_exp.o bn_lib.o bn_ctx.o bn_mul.o bn_mod.o \ | 33 | LIBOBJ= bn_add.o bn_div.o bn_exp.o bn_lib.o bn_ctx.o bn_mul.o bn_mod.o \ |
34 | bn_print.o bn_rand.o bn_shift.o bn_word.o bn_blind.o \ | 34 | bn_print.o bn_rand.o bn_shift.o bn_word.o bn_blind.o \ |
35 | bn_kron.o bn_sqrt.o bn_gcd.o bn_prime.o bn_err.o bn_sqr.o $(BN_ASM) \ | 35 | bn_kron.o bn_sqrt.o bn_gcd.o bn_prime.o bn_err.o bn_sqr.o $(BN_ASM) \ |
36 | bn_recp.o bn_mont.o bn_mpi.o bn_exp2.o bn_gf2m.o bn_nist.o \ | 36 | bn_recp.o bn_mont.o bn_mpi.o bn_exp2.o bn_gf2m.o bn_nist.o \ |
37 | bn_depr.o bn_const.o | 37 | bn_depr.o bn_x931p.o bn_const.o bn_opt.o |
38 | 38 | ||
39 | SRC= $(LIBSRC) | 39 | SRC= $(LIBSRC) |
40 | 40 | ||
@@ -58,7 +58,7 @@ bnbug: bnbug.c ../../libcrypto.a top | |||
58 | cc -g -I../../include bnbug.c -o bnbug ../../libcrypto.a | 58 | cc -g -I../../include bnbug.c -o bnbug ../../libcrypto.a |
59 | 59 | ||
60 | lib: $(LIBOBJ) | 60 | lib: $(LIBOBJ) |
61 | $(AR) $(LIB) $(LIBOBJ) | 61 | $(ARX) $(LIB) $(LIBOBJ) |
62 | $(RANLIB) $(LIB) || echo Never mind. | 62 | $(RANLIB) $(LIB) || echo Never mind. |
63 | @touch lib | 63 | @touch lib |
64 | 64 | ||
@@ -116,6 +116,7 @@ linux_ppc64.s: asm/ppc.pl; $(PERL) $< $@ | |||
116 | aix_ppc32.s: asm/ppc.pl; $(PERL) asm/ppc.pl $@ | 116 | aix_ppc32.s: asm/ppc.pl; $(PERL) asm/ppc.pl $@ |
117 | aix_ppc64.s: asm/ppc.pl; $(PERL) asm/ppc.pl $@ | 117 | aix_ppc64.s: asm/ppc.pl; $(PERL) asm/ppc.pl $@ |
118 | osx_ppc32.s: asm/ppc.pl; $(PERL) $< $@ | 118 | osx_ppc32.s: asm/ppc.pl; $(PERL) $< $@ |
119 | osx_ppc64.s: asm/ppc.pl; $(PERL) $< $@ | ||
119 | 120 | ||
120 | files: | 121 | files: |
121 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | 122 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO |
@@ -291,6 +292,13 @@ bn_nist.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | |||
291 | bn_nist.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 292 | bn_nist.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
292 | bn_nist.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 293 | bn_nist.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
293 | bn_nist.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_nist.c | 294 | bn_nist.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_nist.c |
295 | bn_opt.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
296 | bn_opt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
297 | bn_opt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
298 | bn_opt.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
299 | bn_opt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
300 | bn_opt.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
301 | bn_opt.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_opt.c | ||
294 | bn_prime.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | 302 | bn_prime.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h |
295 | bn_prime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 303 | bn_prime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
296 | bn_prime.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 304 | bn_prime.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
@@ -349,3 +357,6 @@ bn_word.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | |||
349 | bn_word.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 357 | bn_word.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
350 | bn_word.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 358 | bn_word.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
351 | bn_word.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_word.c | 359 | bn_word.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_word.c |
360 | bn_x931p.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h | ||
361 | bn_x931p.o: ../../include/openssl/opensslconf.h | ||
362 | bn_x931p.o: ../../include/openssl/ossl_typ.h bn_x931p.c | ||
diff --git a/src/lib/libcrypto/bn/bn_opt.c b/src/lib/libcrypto/bn/bn_opt.c new file mode 100644 index 0000000000..21cbb38f62 --- /dev/null +++ b/src/lib/libcrypto/bn/bn_opt.c | |||
@@ -0,0 +1,87 @@ | |||
1 | /* crypto/bn/bn_opt.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #ifndef BN_DEBUG | ||
60 | # undef NDEBUG /* avoid conflicting definitions */ | ||
61 | # define NDEBUG | ||
62 | #endif | ||
63 | |||
64 | #include <assert.h> | ||
65 | #include <limits.h> | ||
66 | #include <stdio.h> | ||
67 | #include "cryptlib.h" | ||
68 | #include "bn_lcl.h" | ||
69 | |||
70 | char *BN_options(void) | ||
71 | { | ||
72 | static int init=0; | ||
73 | static char data[16]; | ||
74 | |||
75 | if (!init) | ||
76 | { | ||
77 | init++; | ||
78 | #ifdef BN_LLONG | ||
79 | BIO_snprintf(data,sizeof data,"bn(%d,%d)", | ||
80 | (int)sizeof(BN_ULLONG)*8,(int)sizeof(BN_ULONG)*8); | ||
81 | #else | ||
82 | BIO_snprintf(data,sizeof data,"bn(%d,%d)", | ||
83 | (int)sizeof(BN_ULONG)*8,(int)sizeof(BN_ULONG)*8); | ||
84 | #endif | ||
85 | } | ||
86 | return(data); | ||
87 | } | ||