summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dsa
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/dsa')
-rw-r--r--src/lib/libcrypto/dsa/Makefile77
-rw-r--r--src/lib/libcrypto/dsa/dsa_utl.c95
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
19LIB=$(TOP)/libcrypto.a 19LIB=$(TOP)/libcrypto.a
20LIBSRC= dsa_gen.c dsa_key.c dsa_lib.c dsa_asn1.c dsa_vrf.c dsa_sign.c \ 20LIBSRC= 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
22LIBOBJ= dsa_gen.o dsa_key.o dsa_lib.o dsa_asn1.o dsa_vrf.o dsa_sign.o \ 22LIBOBJ= 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
25SRC= $(LIBSRC) 25SRC= $(LIBSRC)
26 26
@@ -35,7 +35,7 @@ top:
35all: lib 35all: lib
36 36
37lib: $(LIBOBJ) 37lib: $(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
79dsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h 79dsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
80dsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h 80dsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
81dsa_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 81dsa_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
82dsa_asn1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h 82dsa_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
83dsa_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h 83dsa_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
84dsa_asn1.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
84dsa_asn1.o: ../../include/openssl/opensslconf.h 85dsa_asn1.o: ../../include/openssl/opensslconf.h
85dsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h 86dsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
86dsa_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 87dsa_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
90dsa_depr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 91dsa_depr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
91dsa_depr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h 92dsa_depr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
92dsa_depr.o: ../../include/openssl/err.h ../../include/openssl/evp.h 93dsa_depr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
93dsa_depr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h 94dsa_depr.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
94dsa_depr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 95dsa_depr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
96dsa_depr.o: ../../include/openssl/opensslconf.h
95dsa_depr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h 97dsa_depr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
96dsa_depr.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h 98dsa_depr.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
97dsa_depr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 99dsa_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
108dsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 110dsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
109dsa_gen.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h 111dsa_gen.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
110dsa_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h 112dsa_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h
111dsa_gen.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h 113dsa_gen.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
112dsa_gen.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 114dsa_gen.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
113dsa_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h 115dsa_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
114dsa_gen.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h 116dsa_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
115dsa_gen.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 117dsa_gen.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
116dsa_gen.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_gen.c 118dsa_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
119dsa_gen.o: ../cryptlib.h dsa_gen.c
117dsa_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h 120dsa_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
118dsa_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 121dsa_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
119dsa_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h 122dsa_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
126dsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h 129dsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
127dsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 130dsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
128dsa_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 131dsa_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
129dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h 132dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
130dsa_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h 133dsa_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
131dsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 134dsa_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
132dsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h 135dsa_lib.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
133dsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 136dsa_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
134dsa_lib.o: ../cryptlib.h dsa_lib.c 137dsa_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
138dsa_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
139dsa_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
140dsa_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
141dsa_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
142dsa_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h dsa_lib.c
135dsa_ossl.o: ../../e_os.h ../../include/openssl/asn1.h 143dsa_ossl.o: ../../e_os.h ../../include/openssl/asn1.h
136dsa_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h 144dsa_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
137dsa_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 145dsa_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
@@ -146,19 +154,34 @@ dsa_sign.o: ../../e_os.h ../../include/openssl/asn1.h
146dsa_sign.o: ../../include/openssl/bio.h ../../include/openssl/bn.h 154dsa_sign.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
147dsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 155dsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
148dsa_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h 156dsa_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
149dsa_sign.o: ../../include/openssl/err.h ../../include/openssl/lhash.h 157dsa_sign.o: ../../include/openssl/err.h ../../include/openssl/fips.h
150dsa_sign.o: ../../include/openssl/opensslconf.h 158dsa_sign.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
151dsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h 159dsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
152dsa_sign.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h 160dsa_sign.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
153dsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 161dsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
154dsa_sign.o: ../cryptlib.h dsa_sign.c 162dsa_sign.o: ../cryptlib.h dsa_sign.c
163dsa_utl.o: ../../e_os.h ../../include/openssl/asn1.h
164dsa_utl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
165dsa_utl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
166dsa_utl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
167dsa_utl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
168dsa_utl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
169dsa_utl.o: ../../include/openssl/engine.h ../../include/openssl/err.h
170dsa_utl.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
171dsa_utl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
172dsa_utl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
173dsa_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
174dsa_utl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
175dsa_utl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
176dsa_utl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
177dsa_utl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h dsa_utl.c
155dsa_vrf.o: ../../e_os.h ../../include/openssl/asn1.h 178dsa_vrf.o: ../../e_os.h ../../include/openssl/asn1.h
156dsa_vrf.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h 179dsa_vrf.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
157dsa_vrf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 180dsa_vrf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
158dsa_vrf.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h 181dsa_vrf.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
159dsa_vrf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 182dsa_vrf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
160dsa_vrf.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 183dsa_vrf.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
161dsa_vrf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h 184dsa_vrf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
162dsa_vrf.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h 185dsa_vrf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
163dsa_vrf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 186dsa_vrf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
164dsa_vrf.o: ../cryptlib.h dsa_vrf.c 187dsa_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
73DSA_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
84void 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