diff options
Diffstat (limited to 'src/lib/libcrypto/dsa')
-rw-r--r-- | src/lib/libcrypto/dsa/Makefile | 77 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_utl.c | 95 |
2 files changed, 145 insertions, 27 deletions
diff --git a/src/lib/libcrypto/dsa/Makefile b/src/lib/libcrypto/dsa/Makefile index 676baf7d49..2cc45cdc62 100644 --- a/src/lib/libcrypto/dsa/Makefile +++ b/src/lib/libcrypto/dsa/Makefile | |||
@@ -18,9 +18,9 @@ APPS= | |||
18 | 18 | ||
19 | LIB=$(TOP)/libcrypto.a | 19 | LIB=$(TOP)/libcrypto.a |
20 | LIBSRC= dsa_gen.c dsa_key.c dsa_lib.c dsa_asn1.c dsa_vrf.c dsa_sign.c \ | 20 | LIBSRC= dsa_gen.c dsa_key.c dsa_lib.c dsa_asn1.c dsa_vrf.c dsa_sign.c \ |
21 | dsa_err.c dsa_ossl.c dsa_depr.c | 21 | dsa_err.c dsa_ossl.c dsa_depr.c dsa_utl.c |
22 | LIBOBJ= dsa_gen.o dsa_key.o dsa_lib.o dsa_asn1.o dsa_vrf.o dsa_sign.o \ | 22 | LIBOBJ= dsa_gen.o dsa_key.o dsa_lib.o dsa_asn1.o dsa_vrf.o dsa_sign.o \ |
23 | dsa_err.o dsa_ossl.o dsa_depr.o | 23 | dsa_err.o dsa_ossl.o dsa_depr.o dsa_utl.o |
24 | 24 | ||
25 | SRC= $(LIBSRC) | 25 | SRC= $(LIBSRC) |
26 | 26 | ||
@@ -35,7 +35,7 @@ top: | |||
35 | all: lib | 35 | all: lib |
36 | 36 | ||
37 | lib: $(LIBOBJ) | 37 | lib: $(LIBOBJ) |
38 | $(AR) $(LIB) $(LIBOBJ) | 38 | $(ARX) $(LIB) $(LIBOBJ) |
39 | $(RANLIB) $(LIB) || echo Never mind. | 39 | $(RANLIB) $(LIB) || echo Never mind. |
40 | @touch lib | 40 | @touch lib |
41 | 41 | ||
@@ -78,9 +78,10 @@ clean: | |||
78 | 78 | ||
79 | dsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h | 79 | dsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h |
80 | dsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | 80 | dsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h |
81 | dsa_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 81 | dsa_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h |
82 | dsa_asn1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 82 | dsa_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h |
83 | dsa_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | 83 | dsa_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
84 | dsa_asn1.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | ||
84 | dsa_asn1.o: ../../include/openssl/opensslconf.h | 85 | dsa_asn1.o: ../../include/openssl/opensslconf.h |
85 | dsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 86 | dsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
86 | dsa_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 87 | dsa_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
@@ -90,8 +91,9 @@ dsa_depr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | |||
90 | dsa_depr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 91 | dsa_depr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
91 | dsa_depr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 92 | dsa_depr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
92 | dsa_depr.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 93 | dsa_depr.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
93 | dsa_depr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 94 | dsa_depr.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h |
94 | dsa_depr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 95 | dsa_depr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
96 | dsa_depr.o: ../../include/openssl/opensslconf.h | ||
95 | dsa_depr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 97 | dsa_depr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
96 | dsa_depr.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 98 | dsa_depr.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h |
97 | dsa_depr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 99 | dsa_depr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
@@ -108,12 +110,13 @@ dsa_gen.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | |||
108 | dsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 110 | dsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
109 | dsa_gen.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 111 | dsa_gen.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
110 | dsa_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 112 | dsa_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
111 | dsa_gen.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 113 | dsa_gen.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h |
112 | dsa_gen.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 114 | dsa_gen.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
113 | dsa_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 115 | dsa_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
114 | dsa_gen.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 116 | dsa_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h |
115 | dsa_gen.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 117 | dsa_gen.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
116 | dsa_gen.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_gen.c | 118 | dsa_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
119 | dsa_gen.o: ../cryptlib.h dsa_gen.c | ||
117 | dsa_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | 120 | dsa_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h |
118 | dsa_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 121 | dsa_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
119 | dsa_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 122 | dsa_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
@@ -126,12 +129,17 @@ dsa_lib.o: ../../e_os.h ../../include/openssl/asn1.h | |||
126 | dsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | 129 | dsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h |
127 | dsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 130 | dsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
128 | dsa_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | 131 | dsa_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h |
129 | dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | 132 | dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
130 | dsa_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | 133 | dsa_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
131 | dsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 134 | dsa_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
132 | dsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | 135 | dsa_lib.o: ../../include/openssl/evp.h ../../include/openssl/fips.h |
133 | dsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 136 | dsa_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
134 | dsa_lib.o: ../cryptlib.h dsa_lib.c | 137 | dsa_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
138 | dsa_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
139 | dsa_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
140 | dsa_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
141 | dsa_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
142 | dsa_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h dsa_lib.c | ||
135 | dsa_ossl.o: ../../e_os.h ../../include/openssl/asn1.h | 143 | dsa_ossl.o: ../../e_os.h ../../include/openssl/asn1.h |
136 | dsa_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | 144 | dsa_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h |
137 | dsa_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 145 | dsa_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
@@ -146,19 +154,34 @@ dsa_sign.o: ../../e_os.h ../../include/openssl/asn1.h | |||
146 | dsa_sign.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | 154 | dsa_sign.o: ../../include/openssl/bio.h ../../include/openssl/bn.h |
147 | dsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 155 | dsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
148 | dsa_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 156 | dsa_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
149 | dsa_sign.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | 157 | dsa_sign.o: ../../include/openssl/err.h ../../include/openssl/fips.h |
150 | dsa_sign.o: ../../include/openssl/opensslconf.h | 158 | dsa_sign.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h |
151 | dsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 159 | dsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
152 | dsa_sign.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 160 | dsa_sign.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h |
153 | dsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 161 | dsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
154 | dsa_sign.o: ../cryptlib.h dsa_sign.c | 162 | dsa_sign.o: ../cryptlib.h dsa_sign.c |
163 | dsa_utl.o: ../../e_os.h ../../include/openssl/asn1.h | ||
164 | dsa_utl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
165 | dsa_utl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
166 | dsa_utl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
167 | dsa_utl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
168 | dsa_utl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
169 | dsa_utl.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
170 | dsa_utl.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | ||
171 | dsa_utl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
172 | dsa_utl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
173 | dsa_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
174 | dsa_utl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
175 | dsa_utl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
176 | dsa_utl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
177 | dsa_utl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h dsa_utl.c | ||
155 | dsa_vrf.o: ../../e_os.h ../../include/openssl/asn1.h | 178 | dsa_vrf.o: ../../e_os.h ../../include/openssl/asn1.h |
156 | dsa_vrf.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | 179 | dsa_vrf.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h |
157 | dsa_vrf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | 180 | dsa_vrf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h |
158 | dsa_vrf.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h | 181 | dsa_vrf.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h |
159 | dsa_vrf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 182 | dsa_vrf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
160 | dsa_vrf.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | 183 | dsa_vrf.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h |
161 | dsa_vrf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 184 | dsa_vrf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
162 | dsa_vrf.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 185 | dsa_vrf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h |
163 | dsa_vrf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 186 | dsa_vrf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
164 | dsa_vrf.o: ../cryptlib.h dsa_vrf.c | 187 | dsa_vrf.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_vrf.c |
diff --git a/src/lib/libcrypto/dsa/dsa_utl.c b/src/lib/libcrypto/dsa/dsa_utl.c new file mode 100644 index 0000000000..24c021d120 --- /dev/null +++ b/src/lib/libcrypto/dsa/dsa_utl.c | |||
@@ -0,0 +1,95 @@ | |||
1 | /* crypto/dsa/dsa_lib.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 | /* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include "cryptlib.h" | ||
63 | #include <openssl/bn.h> | ||
64 | #include <openssl/dsa.h> | ||
65 | #include <openssl/asn1.h> | ||
66 | #ifndef OPENSSL_NO_ENGINE | ||
67 | #include <openssl/engine.h> | ||
68 | #endif | ||
69 | #ifndef OPENSSL_NO_DH | ||
70 | #include <openssl/dh.h> | ||
71 | #endif | ||
72 | |||
73 | DSA_SIG *DSA_SIG_new(void) | ||
74 | { | ||
75 | DSA_SIG *sig; | ||
76 | sig = OPENSSL_malloc(sizeof(DSA_SIG)); | ||
77 | if (!sig) | ||
78 | return NULL; | ||
79 | sig->r = NULL; | ||
80 | sig->s = NULL; | ||
81 | return sig; | ||
82 | } | ||
83 | |||
84 | void DSA_SIG_free(DSA_SIG *sig) | ||
85 | { | ||
86 | if (sig) | ||
87 | { | ||
88 | if (sig->r) | ||
89 | BN_free(sig->r); | ||
90 | if (sig->s) | ||
91 | BN_free(sig->s); | ||
92 | OPENSSL_free(sig); | ||
93 | } | ||
94 | } | ||
95 | |||