diff options
Diffstat (limited to 'src/lib/libcrypto/dh')
-rw-r--r-- | src/lib/libcrypto/dh/Makefile | 63 | ||||
-rw-r--r-- | src/lib/libcrypto/dh/Makefile.ssl | 133 | ||||
-rw-r--r-- | src/lib/libcrypto/dh/dh.h | 41 | ||||
-rw-r--r-- | src/lib/libcrypto/dh/dh_asn1.c | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/dh/dh_check.c | 8 | ||||
-rw-r--r-- | src/lib/libcrypto/dh/dh_err.c | 21 | ||||
-rw-r--r-- | src/lib/libcrypto/dh/dh_gen.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/dh/dh_key.c | 4 |
8 files changed, 105 insertions, 179 deletions
diff --git a/src/lib/libcrypto/dh/Makefile b/src/lib/libcrypto/dh/Makefile index d01fa960eb..f23b4f7fde 100644 --- a/src/lib/libcrypto/dh/Makefile +++ b/src/lib/libcrypto/dh/Makefile | |||
@@ -17,8 +17,10 @@ TEST= dhtest.c | |||
17 | APPS= | 17 | APPS= |
18 | 18 | ||
19 | LIB=$(TOP)/libcrypto.a | 19 | LIB=$(TOP)/libcrypto.a |
20 | LIBSRC= dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c dh_depr.c | 20 | LIBSRC= dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c dh_depr.c \ |
21 | LIBOBJ= dh_asn1.o dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o dh_depr.o | 21 | dh_ameth.c dh_pmeth.c dh_prn.c |
22 | LIBOBJ= dh_asn1.o dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o dh_depr.o \ | ||
23 | dh_ameth.o dh_pmeth.o dh_prn.o | ||
22 | 24 | ||
23 | SRC= $(LIBSRC) | 25 | SRC= $(LIBSRC) |
24 | 26 | ||
@@ -33,7 +35,7 @@ top: | |||
33 | all: lib | 35 | all: lib |
34 | 36 | ||
35 | lib: $(LIBOBJ) | 37 | lib: $(LIBOBJ) |
36 | $(ARX) $(LIB) $(LIBOBJ) | 38 | $(AR) $(LIB) $(LIBOBJ) |
37 | $(RANLIB) $(LIB) || echo Never mind. | 39 | $(RANLIB) $(LIB) || echo Never mind. |
38 | @touch lib | 40 | @touch lib |
39 | 41 | ||
@@ -74,6 +76,21 @@ clean: | |||
74 | 76 | ||
75 | # DO NOT DELETE THIS LINE -- make depend depends on it. | 77 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
76 | 78 | ||
79 | dh_ameth.o: ../../e_os.h ../../include/openssl/asn1.h | ||
80 | dh_ameth.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
81 | dh_ameth.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
82 | dh_ameth.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h | ||
83 | dh_ameth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
84 | dh_ameth.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
85 | dh_ameth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
86 | dh_ameth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
87 | dh_ameth.o: ../../include/openssl/opensslconf.h | ||
88 | dh_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
89 | dh_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
90 | dh_ameth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
91 | dh_ameth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
92 | dh_ameth.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptlib.h | ||
93 | dh_ameth.o: dh_ameth.c | ||
77 | dh_asn1.o: ../../e_os.h ../../include/openssl/asn1.h | 94 | dh_asn1.o: ../../e_os.h ../../include/openssl/asn1.h |
78 | dh_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | 95 | dh_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h |
79 | dh_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | 96 | dh_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h |
@@ -129,11 +146,35 @@ dh_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | |||
129 | dh_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 146 | dh_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
130 | dh_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 147 | dh_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
131 | dh_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h | 148 | dh_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
132 | dh_lib.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 149 | dh_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
133 | dh_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 150 | dh_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
134 | dh_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 151 | dh_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
135 | dh_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 152 | dh_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
136 | dh_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 153 | dh_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
137 | dh_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 154 | dh_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
138 | dh_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 155 | dh_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
139 | dh_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h dh_lib.c | 156 | dh_lib.o: ../cryptlib.h dh_lib.c |
157 | dh_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h | ||
158 | dh_pmeth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
159 | dh_pmeth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
160 | dh_pmeth.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
161 | dh_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
162 | dh_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
163 | dh_pmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
164 | dh_pmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
165 | dh_pmeth.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
166 | dh_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
167 | dh_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
168 | dh_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
169 | dh_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
170 | dh_pmeth.o: ../../include/openssl/x509_vfy.h ../cryptlib.h ../evp/evp_locl.h | ||
171 | dh_pmeth.o: dh_pmeth.c | ||
172 | dh_prn.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
173 | dh_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
174 | dh_prn.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h | ||
175 | dh_prn.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
176 | dh_prn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
177 | dh_prn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
178 | dh_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
179 | dh_prn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
180 | dh_prn.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_prn.c | ||
diff --git a/src/lib/libcrypto/dh/Makefile.ssl b/src/lib/libcrypto/dh/Makefile.ssl deleted file mode 100644 index e05fc01a12..0000000000 --- a/src/lib/libcrypto/dh/Makefile.ssl +++ /dev/null | |||
@@ -1,133 +0,0 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/dh/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= dh | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALL_PREFIX= | ||
11 | OPENSSLDIR= /usr/local/ssl | ||
12 | INSTALLTOP=/usr/local/ssl | ||
13 | MAKE= make -f Makefile.ssl | ||
14 | MAKEDEPPROG= makedepend | ||
15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
16 | MAKEFILE= Makefile.ssl | ||
17 | AR= ar r | ||
18 | |||
19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
20 | |||
21 | GENERAL=Makefile | ||
22 | TEST= dhtest.c | ||
23 | APPS= | ||
24 | |||
25 | LIB=$(TOP)/libcrypto.a | ||
26 | LIBSRC= dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c | ||
27 | LIBOBJ= dh_asn1.o dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o | ||
28 | |||
29 | SRC= $(LIBSRC) | ||
30 | |||
31 | EXHEADER= dh.h | ||
32 | HEADER= $(EXHEADER) | ||
33 | |||
34 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
35 | |||
36 | top: | ||
37 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
38 | |||
39 | all: lib | ||
40 | |||
41 | lib: $(LIBOBJ) | ||
42 | $(AR) $(LIB) $(LIBOBJ) | ||
43 | $(RANLIB) $(LIB) || echo Never mind. | ||
44 | @touch lib | ||
45 | |||
46 | files: | ||
47 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
48 | |||
49 | links: | ||
50 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
51 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
52 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
53 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
54 | |||
55 | install: | ||
56 | @for i in $(EXHEADER) ; \ | ||
57 | do \ | ||
58 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
59 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
60 | done; | ||
61 | |||
62 | tags: | ||
63 | ctags $(SRC) | ||
64 | |||
65 | tests: | ||
66 | |||
67 | lint: | ||
68 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
69 | |||
70 | depend: | ||
71 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
72 | |||
73 | dclean: | ||
74 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
75 | mv -f Makefile.new $(MAKEFILE) | ||
76 | |||
77 | clean: | ||
78 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
79 | |||
80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
81 | |||
82 | dh_asn1.o: ../../e_os.h ../../include/openssl/asn1.h | ||
83 | dh_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
84 | dh_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
85 | dh_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
86 | dh_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
87 | dh_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
88 | dh_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
89 | dh_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
90 | dh_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
91 | dh_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_asn1.c | ||
92 | dh_check.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
93 | dh_check.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
94 | dh_check.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h | ||
95 | dh_check.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
96 | dh_check.o: ../../include/openssl/opensslconf.h | ||
97 | dh_check.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
98 | dh_check.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
99 | dh_check.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_check.c | ||
100 | dh_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
101 | dh_err.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
102 | dh_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
103 | dh_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
104 | dh_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
105 | dh_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
106 | dh_err.o: ../../include/openssl/symhacks.h dh_err.c | ||
107 | dh_gen.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
108 | dh_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
109 | dh_gen.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h | ||
110 | dh_gen.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
111 | dh_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
112 | dh_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
113 | dh_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
114 | dh_gen.o: ../cryptlib.h dh_gen.c | ||
115 | dh_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
116 | dh_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
117 | dh_key.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h | ||
118 | dh_key.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
119 | dh_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
120 | dh_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
121 | dh_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
122 | dh_key.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_key.c | ||
123 | dh_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
124 | dh_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
125 | dh_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
126 | dh_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
127 | dh_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
128 | dh_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
129 | dh_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
130 | dh_lib.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
131 | dh_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
132 | dh_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
133 | dh_lib.o: ../cryptlib.h dh_lib.c | ||
diff --git a/src/lib/libcrypto/dh/dh.h b/src/lib/libcrypto/dh/dh.h index 10475ac4b3..849309a489 100644 --- a/src/lib/libcrypto/dh/dh.h +++ b/src/lib/libcrypto/dh/dh.h | |||
@@ -77,8 +77,6 @@ | |||
77 | # define OPENSSL_DH_MAX_MODULUS_BITS 10000 | 77 | # define OPENSSL_DH_MAX_MODULUS_BITS 10000 |
78 | #endif | 78 | #endif |
79 | 79 | ||
80 | #define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024 | ||
81 | |||
82 | #define DH_FLAG_CACHE_MONT_P 0x01 | 80 | #define DH_FLAG_CACHE_MONT_P 0x01 |
83 | #define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH | 81 | #define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH |
84 | * implementation now uses constant time | 82 | * implementation now uses constant time |
@@ -159,7 +157,6 @@ struct dh_st | |||
159 | this for backward compatibility: */ | 157 | this for backward compatibility: */ |
160 | #define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME | 158 | #define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME |
161 | 159 | ||
162 | #define DHparams_dup(x) ASN1_dup_of_const(DH,i2d_DHparams,d2i_DHparams,x) | ||
163 | #define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ | 160 | #define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ |
164 | (char *(*)())d2i_DHparams,(fp),(unsigned char **)(x)) | 161 | (char *(*)())d2i_DHparams,(fp),(unsigned char **)(x)) |
165 | #define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \ | 162 | #define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \ |
@@ -167,12 +164,9 @@ struct dh_st | |||
167 | #define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x) | 164 | #define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x) |
168 | #define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x) | 165 | #define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x) |
169 | 166 | ||
170 | const DH_METHOD *DH_OpenSSL(void); | 167 | DH *DHparams_dup(DH *); |
171 | 168 | ||
172 | #ifdef OPENSSL_FIPS | 169 | const DH_METHOD *DH_OpenSSL(void); |
173 | DH * FIPS_dh_new(void); | ||
174 | void FIPS_dh_free(DH *dh); | ||
175 | #endif | ||
176 | 170 | ||
177 | void DH_set_default_method(const DH_METHOD *meth); | 171 | void DH_set_default_method(const DH_METHOD *meth); |
178 | const DH_METHOD *DH_get_default_method(void); | 172 | const DH_METHOD *DH_get_default_method(void); |
@@ -212,6 +206,18 @@ int DHparams_print(BIO *bp, const DH *x); | |||
212 | int DHparams_print(char *bp, const DH *x); | 206 | int DHparams_print(char *bp, const DH *x); |
213 | #endif | 207 | #endif |
214 | 208 | ||
209 | #define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \ | ||
210 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ | ||
211 | EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, len, NULL) | ||
212 | |||
213 | #define EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, gen) \ | ||
214 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ | ||
215 | EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL) | ||
216 | |||
217 | #define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1) | ||
218 | #define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2) | ||
219 | |||
220 | |||
215 | /* BEGIN ERROR CODES */ | 221 | /* BEGIN ERROR CODES */ |
216 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 222 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
217 | * made after this point may be overwritten when the script is next run. | 223 | * made after this point may be overwritten when the script is next run. |
@@ -222,22 +228,31 @@ void ERR_load_DH_strings(void); | |||
222 | 228 | ||
223 | /* Function codes. */ | 229 | /* Function codes. */ |
224 | #define DH_F_COMPUTE_KEY 102 | 230 | #define DH_F_COMPUTE_KEY 102 |
225 | #define DH_F_DHPARAMS_PRINT 100 | ||
226 | #define DH_F_DHPARAMS_PRINT_FP 101 | 231 | #define DH_F_DHPARAMS_PRINT_FP 101 |
227 | #define DH_F_DH_BUILTIN_GENPARAMS 106 | 232 | #define DH_F_DH_BUILTIN_GENPARAMS 106 |
228 | #define DH_F_DH_COMPUTE_KEY 107 | ||
229 | #define DH_F_DH_GENERATE_KEY 108 | ||
230 | #define DH_F_DH_GENERATE_PARAMETERS 109 | ||
231 | #define DH_F_DH_NEW_METHOD 105 | 233 | #define DH_F_DH_NEW_METHOD 105 |
234 | #define DH_F_DH_PARAM_DECODE 107 | ||
235 | #define DH_F_DH_PRIV_DECODE 110 | ||
236 | #define DH_F_DH_PRIV_ENCODE 111 | ||
237 | #define DH_F_DH_PUB_DECODE 108 | ||
238 | #define DH_F_DH_PUB_ENCODE 109 | ||
239 | #define DH_F_DO_DH_PRINT 100 | ||
232 | #define DH_F_GENERATE_KEY 103 | 240 | #define DH_F_GENERATE_KEY 103 |
233 | #define DH_F_GENERATE_PARAMETERS 104 | 241 | #define DH_F_GENERATE_PARAMETERS 104 |
242 | #define DH_F_PKEY_DH_DERIVE 112 | ||
243 | #define DH_F_PKEY_DH_KEYGEN 113 | ||
234 | 244 | ||
235 | /* Reason codes. */ | 245 | /* Reason codes. */ |
236 | #define DH_R_BAD_GENERATOR 101 | 246 | #define DH_R_BAD_GENERATOR 101 |
247 | #define DH_R_BN_DECODE_ERROR 109 | ||
248 | #define DH_R_BN_ERROR 106 | ||
249 | #define DH_R_DECODE_ERROR 104 | ||
237 | #define DH_R_INVALID_PUBKEY 102 | 250 | #define DH_R_INVALID_PUBKEY 102 |
238 | #define DH_R_KEY_SIZE_TOO_SMALL 104 | 251 | #define DH_R_KEYS_NOT_SET 108 |
239 | #define DH_R_MODULUS_TOO_LARGE 103 | 252 | #define DH_R_MODULUS_TOO_LARGE 103 |
253 | #define DH_R_NO_PARAMETERS_SET 107 | ||
240 | #define DH_R_NO_PRIVATE_VALUE 100 | 254 | #define DH_R_NO_PRIVATE_VALUE 100 |
255 | #define DH_R_PARAMETER_ENCODING_ERROR 105 | ||
241 | 256 | ||
242 | #ifdef __cplusplus | 257 | #ifdef __cplusplus |
243 | } | 258 | } |
diff --git a/src/lib/libcrypto/dh/dh_asn1.c b/src/lib/libcrypto/dh/dh_asn1.c index 76740af2bd..0b4357d605 100644 --- a/src/lib/libcrypto/dh/dh_asn1.c +++ b/src/lib/libcrypto/dh/dh_asn1.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
5 | /* ==================================================================== | 5 | /* ==================================================================== |
6 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
@@ -64,7 +64,8 @@ | |||
64 | #include <openssl/asn1t.h> | 64 | #include <openssl/asn1t.h> |
65 | 65 | ||
66 | /* Override the default free and new methods */ | 66 | /* Override the default free and new methods */ |
67 | static int dh_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | 67 | static int dh_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, |
68 | void *exarg) | ||
68 | { | 69 | { |
69 | if(operation == ASN1_OP_NEW_PRE) { | 70 | if(operation == ASN1_OP_NEW_PRE) { |
70 | *pval = (ASN1_VALUE *)DH_new(); | 71 | *pval = (ASN1_VALUE *)DH_new(); |
@@ -85,3 +86,8 @@ ASN1_SEQUENCE_cb(DHparams, dh_cb) = { | |||
85 | } ASN1_SEQUENCE_END_cb(DH, DHparams) | 86 | } ASN1_SEQUENCE_END_cb(DH, DHparams) |
86 | 87 | ||
87 | IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DH, DHparams, DHparams) | 88 | IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DH, DHparams, DHparams) |
89 | |||
90 | DH *DHparams_dup(DH *dh) | ||
91 | { | ||
92 | return ASN1_item_dup(ASN1_ITEM_rptr(DHparams), dh); | ||
93 | } | ||
diff --git a/src/lib/libcrypto/dh/dh_check.c b/src/lib/libcrypto/dh/dh_check.c index 316cb9221d..066898174e 100644 --- a/src/lib/libcrypto/dh/dh_check.c +++ b/src/lib/libcrypto/dh/dh_check.c | |||
@@ -70,8 +70,6 @@ | |||
70 | * should hold. | 70 | * should hold. |
71 | */ | 71 | */ |
72 | 72 | ||
73 | #ifndef OPENSSL_FIPS | ||
74 | |||
75 | int DH_check(const DH *dh, int *ret) | 73 | int DH_check(const DH *dh, int *ret) |
76 | { | 74 | { |
77 | int ok=0; | 75 | int ok=0; |
@@ -130,11 +128,11 @@ int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret) | |||
130 | q=BN_new(); | 128 | q=BN_new(); |
131 | if (q == NULL) goto err; | 129 | if (q == NULL) goto err; |
132 | BN_set_word(q,1); | 130 | BN_set_word(q,1); |
133 | if (BN_cmp(pub_key,q) <= 0) | 131 | if (BN_cmp(pub_key,q)<=0) |
134 | *ret|=DH_CHECK_PUBKEY_TOO_SMALL; | 132 | *ret|=DH_CHECK_PUBKEY_TOO_SMALL; |
135 | BN_copy(q,dh->p); | 133 | BN_copy(q,dh->p); |
136 | BN_sub_word(q,1); | 134 | BN_sub_word(q,1); |
137 | if (BN_cmp(pub_key,q) >= 0) | 135 | if (BN_cmp(pub_key,q)>=0) |
138 | *ret|=DH_CHECK_PUBKEY_TOO_LARGE; | 136 | *ret|=DH_CHECK_PUBKEY_TOO_LARGE; |
139 | 137 | ||
140 | ok = 1; | 138 | ok = 1; |
@@ -142,5 +140,3 @@ err: | |||
142 | if (q != NULL) BN_free(q); | 140 | if (q != NULL) BN_free(q); |
143 | return(ok); | 141 | return(ok); |
144 | } | 142 | } |
145 | |||
146 | #endif | ||
diff --git a/src/lib/libcrypto/dh/dh_err.c b/src/lib/libcrypto/dh/dh_err.c index 13263c81c1..d5cf0c22a3 100644 --- a/src/lib/libcrypto/dh/dh_err.c +++ b/src/lib/libcrypto/dh/dh_err.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* crypto/dh/dh_err.c */ | 1 | /* crypto/dh/dh_err.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
@@ -71,25 +71,34 @@ | |||
71 | static ERR_STRING_DATA DH_str_functs[]= | 71 | static ERR_STRING_DATA DH_str_functs[]= |
72 | { | 72 | { |
73 | {ERR_FUNC(DH_F_COMPUTE_KEY), "COMPUTE_KEY"}, | 73 | {ERR_FUNC(DH_F_COMPUTE_KEY), "COMPUTE_KEY"}, |
74 | {ERR_FUNC(DH_F_DHPARAMS_PRINT), "DHparams_print"}, | ||
75 | {ERR_FUNC(DH_F_DHPARAMS_PRINT_FP), "DHparams_print_fp"}, | 74 | {ERR_FUNC(DH_F_DHPARAMS_PRINT_FP), "DHparams_print_fp"}, |
76 | {ERR_FUNC(DH_F_DH_BUILTIN_GENPARAMS), "DH_BUILTIN_GENPARAMS"}, | 75 | {ERR_FUNC(DH_F_DH_BUILTIN_GENPARAMS), "DH_BUILTIN_GENPARAMS"}, |
77 | {ERR_FUNC(DH_F_DH_COMPUTE_KEY), "DH_compute_key"}, | ||
78 | {ERR_FUNC(DH_F_DH_GENERATE_KEY), "DH_generate_key"}, | ||
79 | {ERR_FUNC(DH_F_DH_GENERATE_PARAMETERS), "DH_generate_parameters"}, | ||
80 | {ERR_FUNC(DH_F_DH_NEW_METHOD), "DH_new_method"}, | 76 | {ERR_FUNC(DH_F_DH_NEW_METHOD), "DH_new_method"}, |
77 | {ERR_FUNC(DH_F_DH_PARAM_DECODE), "DH_PARAM_DECODE"}, | ||
78 | {ERR_FUNC(DH_F_DH_PRIV_DECODE), "DH_PRIV_DECODE"}, | ||
79 | {ERR_FUNC(DH_F_DH_PRIV_ENCODE), "DH_PRIV_ENCODE"}, | ||
80 | {ERR_FUNC(DH_F_DH_PUB_DECODE), "DH_PUB_DECODE"}, | ||
81 | {ERR_FUNC(DH_F_DH_PUB_ENCODE), "DH_PUB_ENCODE"}, | ||
82 | {ERR_FUNC(DH_F_DO_DH_PRINT), "DO_DH_PRINT"}, | ||
81 | {ERR_FUNC(DH_F_GENERATE_KEY), "GENERATE_KEY"}, | 83 | {ERR_FUNC(DH_F_GENERATE_KEY), "GENERATE_KEY"}, |
82 | {ERR_FUNC(DH_F_GENERATE_PARAMETERS), "GENERATE_PARAMETERS"}, | 84 | {ERR_FUNC(DH_F_GENERATE_PARAMETERS), "GENERATE_PARAMETERS"}, |
85 | {ERR_FUNC(DH_F_PKEY_DH_DERIVE), "PKEY_DH_DERIVE"}, | ||
86 | {ERR_FUNC(DH_F_PKEY_DH_KEYGEN), "PKEY_DH_KEYGEN"}, | ||
83 | {0,NULL} | 87 | {0,NULL} |
84 | }; | 88 | }; |
85 | 89 | ||
86 | static ERR_STRING_DATA DH_str_reasons[]= | 90 | static ERR_STRING_DATA DH_str_reasons[]= |
87 | { | 91 | { |
88 | {ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"}, | 92 | {ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"}, |
93 | {ERR_REASON(DH_R_BN_DECODE_ERROR) ,"bn decode error"}, | ||
94 | {ERR_REASON(DH_R_BN_ERROR) ,"bn error"}, | ||
95 | {ERR_REASON(DH_R_DECODE_ERROR) ,"decode error"}, | ||
89 | {ERR_REASON(DH_R_INVALID_PUBKEY) ,"invalid public key"}, | 96 | {ERR_REASON(DH_R_INVALID_PUBKEY) ,"invalid public key"}, |
90 | {ERR_REASON(DH_R_KEY_SIZE_TOO_SMALL) ,"key size too small"}, | 97 | {ERR_REASON(DH_R_KEYS_NOT_SET) ,"keys not set"}, |
91 | {ERR_REASON(DH_R_MODULUS_TOO_LARGE) ,"modulus too large"}, | 98 | {ERR_REASON(DH_R_MODULUS_TOO_LARGE) ,"modulus too large"}, |
99 | {ERR_REASON(DH_R_NO_PARAMETERS_SET) ,"no parameters set"}, | ||
92 | {ERR_REASON(DH_R_NO_PRIVATE_VALUE) ,"no private value"}, | 100 | {ERR_REASON(DH_R_NO_PRIVATE_VALUE) ,"no private value"}, |
101 | {ERR_REASON(DH_R_PARAMETER_ENCODING_ERROR),"parameter encoding error"}, | ||
93 | {0,NULL} | 102 | {0,NULL} |
94 | }; | 103 | }; |
95 | 104 | ||
diff --git a/src/lib/libcrypto/dh/dh_gen.c b/src/lib/libcrypto/dh/dh_gen.c index 999e1deb40..cfd5b11868 100644 --- a/src/lib/libcrypto/dh/dh_gen.c +++ b/src/lib/libcrypto/dh/dh_gen.c | |||
@@ -66,8 +66,6 @@ | |||
66 | #include <openssl/bn.h> | 66 | #include <openssl/bn.h> |
67 | #include <openssl/dh.h> | 67 | #include <openssl/dh.h> |
68 | 68 | ||
69 | #ifndef OPENSSL_FIPS | ||
70 | |||
71 | static int dh_builtin_genparams(DH *ret, int prime_len, int generator, BN_GENCB *cb); | 69 | static int dh_builtin_genparams(DH *ret, int prime_len, int generator, BN_GENCB *cb); |
72 | 70 | ||
73 | int DH_generate_parameters_ex(DH *ret, int prime_len, int generator, BN_GENCB *cb) | 71 | int DH_generate_parameters_ex(DH *ret, int prime_len, int generator, BN_GENCB *cb) |
@@ -175,5 +173,3 @@ err: | |||
175 | } | 173 | } |
176 | return ok; | 174 | return ok; |
177 | } | 175 | } |
178 | |||
179 | #endif | ||
diff --git a/src/lib/libcrypto/dh/dh_key.c b/src/lib/libcrypto/dh/dh_key.c index 79dd331863..e7db440342 100644 --- a/src/lib/libcrypto/dh/dh_key.c +++ b/src/lib/libcrypto/dh/dh_key.c | |||
@@ -62,8 +62,6 @@ | |||
62 | #include <openssl/rand.h> | 62 | #include <openssl/rand.h> |
63 | #include <openssl/dh.h> | 63 | #include <openssl/dh.h> |
64 | 64 | ||
65 | #ifndef OPENSSL_FIPS | ||
66 | |||
67 | static int generate_key(DH *dh); | 65 | static int generate_key(DH *dh); |
68 | static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); | 66 | static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); |
69 | static int dh_bn_mod_exp(const DH *dh, BIGNUM *r, | 67 | static int dh_bn_mod_exp(const DH *dh, BIGNUM *r, |
@@ -263,5 +261,3 @@ static int dh_finish(DH *dh) | |||
263 | BN_MONT_CTX_free(dh->method_mont_p); | 261 | BN_MONT_CTX_free(dh->method_mont_p); |
264 | return(1); | 262 | return(1); |
265 | } | 263 | } |
266 | |||
267 | #endif | ||