summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dh
diff options
context:
space:
mode:
authormarkus <>2003-05-12 02:18:40 +0000
committermarkus <>2003-05-12 02:18:40 +0000
commitd4fcd82bb7f6d603bd61e19a81ba97337b89dfca (patch)
treed52e3a0f1f08f65ad283027e560e17ed0d720462 /src/lib/libcrypto/dh
parent582bbd139cd2afd58d10dc051c5b0b989b441074 (diff)
downloadopenbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.tar.gz
openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.tar.bz2
openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.zip
merge 0.9.7b with local changes; crank majors for libssl/libcrypto
Diffstat (limited to 'src/lib/libcrypto/dh')
-rw-r--r--src/lib/libcrypto/dh/Makefile.ssl19
-rw-r--r--src/lib/libcrypto/dh/dh_key.c1
-rw-r--r--src/lib/libcrypto/dh/dh_lib.c10
-rw-r--r--src/lib/libcrypto/dh/dhtest.c14
4 files changed, 23 insertions, 21 deletions
diff --git a/src/lib/libcrypto/dh/Makefile.ssl b/src/lib/libcrypto/dh/Makefile.ssl
index 5e1aaae160..e05fc01a12 100644
--- a/src/lib/libcrypto/dh/Makefile.ssl
+++ b/src/lib/libcrypto/dh/Makefile.ssl
@@ -68,7 +68,7 @@ lint:
68 lint -DLINT $(INCLUDES) $(SRC)>fluff 68 lint -DLINT $(INCLUDES) $(SRC)>fluff
69 69
70depend: 70depend:
71 $(MAKEDEPEND) $(CFLAG) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC) 71 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
72 72
73dclean: 73dclean:
74 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new 74 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
@@ -112,17 +112,14 @@ dh_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
112dh_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h 112dh_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
113dh_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 113dh_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
114dh_gen.o: ../cryptlib.h dh_gen.c 114dh_gen.o: ../cryptlib.h dh_gen.c
115dh_key.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h 115dh_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
116dh_key.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 116dh_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
117dh_key.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h 117dh_key.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
118dh_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h 118dh_key.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
119dh_key.o: ../../include/openssl/engine.h ../../include/openssl/err.h 119dh_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
120dh_key.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 120dh_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
121dh_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
122dh_key.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
123dh_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 121dh_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
124dh_key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h 122dh_key.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_key.c
125dh_key.o: ../cryptlib.h dh_key.c
126dh_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h 123dh_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
127dh_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 124dh_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
128dh_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h 125dh_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
diff --git a/src/lib/libcrypto/dh/dh_key.c b/src/lib/libcrypto/dh/dh_key.c
index 1a0efca2c4..77f2f50b51 100644
--- a/src/lib/libcrypto/dh/dh_key.c
+++ b/src/lib/libcrypto/dh/dh_key.c
@@ -61,7 +61,6 @@
61#include <openssl/bn.h> 61#include <openssl/bn.h>
62#include <openssl/rand.h> 62#include <openssl/rand.h>
63#include <openssl/dh.h> 63#include <openssl/dh.h>
64#include <openssl/engine.h>
65 64
66static int generate_key(DH *dh); 65static int generate_key(DH *dh);
67static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); 66static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh);
diff --git a/src/lib/libcrypto/dh/dh_lib.c b/src/lib/libcrypto/dh/dh_lib.c
index ba5fd41057..09965ee2ea 100644
--- a/src/lib/libcrypto/dh/dh_lib.c
+++ b/src/lib/libcrypto/dh/dh_lib.c
@@ -60,7 +60,9 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/bn.h> 61#include <openssl/bn.h>
62#include <openssl/dh.h> 62#include <openssl/dh.h>
63#ifndef OPENSSL_NO_ENGINE
63#include <openssl/engine.h> 64#include <openssl/engine.h>
65#endif
64 66
65const char *DH_version="Diffie-Hellman" OPENSSL_VERSION_PTEXT; 67const char *DH_version="Diffie-Hellman" OPENSSL_VERSION_PTEXT;
66 68
@@ -85,11 +87,13 @@ int DH_set_method(DH *dh, const DH_METHOD *meth)
85 const DH_METHOD *mtmp; 87 const DH_METHOD *mtmp;
86 mtmp = dh->meth; 88 mtmp = dh->meth;
87 if (mtmp->finish) mtmp->finish(dh); 89 if (mtmp->finish) mtmp->finish(dh);
90#ifndef OPENSSL_NO_ENGINE
88 if (dh->engine) 91 if (dh->engine)
89 { 92 {
90 ENGINE_finish(dh->engine); 93 ENGINE_finish(dh->engine);
91 dh->engine = NULL; 94 dh->engine = NULL;
92 } 95 }
96#endif
93 dh->meth = meth; 97 dh->meth = meth;
94 if (meth->init) meth->init(dh); 98 if (meth->init) meth->init(dh);
95 return 1; 99 return 1;
@@ -112,6 +116,7 @@ DH *DH_new_method(ENGINE *engine)
112 } 116 }
113 117
114 ret->meth = DH_get_default_method(); 118 ret->meth = DH_get_default_method();
119#ifndef OPENSSL_NO_ENGINE
115 if (engine) 120 if (engine)
116 { 121 {
117 if (!ENGINE_init(engine)) 122 if (!ENGINE_init(engine))
@@ -135,6 +140,7 @@ DH *DH_new_method(ENGINE *engine)
135 return NULL; 140 return NULL;
136 } 141 }
137 } 142 }
143#endif
138 144
139 ret->pad=0; 145 ret->pad=0;
140 ret->version=0; 146 ret->version=0;
@@ -154,8 +160,10 @@ DH *DH_new_method(ENGINE *engine)
154 CRYPTO_new_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data); 160 CRYPTO_new_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data);
155 if ((ret->meth->init != NULL) && !ret->meth->init(ret)) 161 if ((ret->meth->init != NULL) && !ret->meth->init(ret))
156 { 162 {
163#ifndef OPENSSL_NO_ENGINE
157 if (ret->engine) 164 if (ret->engine)
158 ENGINE_finish(ret->engine); 165 ENGINE_finish(ret->engine);
166#endif
159 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data); 167 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data);
160 OPENSSL_free(ret); 168 OPENSSL_free(ret);
161 ret=NULL; 169 ret=NULL;
@@ -182,8 +190,10 @@ void DH_free(DH *r)
182 190
183 if (r->meth->finish) 191 if (r->meth->finish)
184 r->meth->finish(r); 192 r->meth->finish(r);
193#ifndef OPENSSL_NO_ENGINE
185 if (r->engine) 194 if (r->engine)
186 ENGINE_finish(r->engine); 195 ENGINE_finish(r->engine);
196#endif
187 197
188 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, r, &r->ex_data); 198 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, r, &r->ex_data);
189 199
diff --git a/src/lib/libcrypto/dh/dhtest.c b/src/lib/libcrypto/dh/dhtest.c
index 34894ced73..d75077f9fa 100644
--- a/src/lib/libcrypto/dh/dhtest.c
+++ b/src/lib/libcrypto/dh/dhtest.c
@@ -59,9 +59,9 @@
59#include <stdio.h> 59#include <stdio.h>
60#include <stdlib.h> 60#include <stdlib.h>
61#include <string.h> 61#include <string.h>
62#ifdef OPENSSL_SYS_WINDOWS 62
63#include "../bio/bss_file.c" 63#include "../e_os.h"
64#endif 64
65#include <openssl/crypto.h> 65#include <openssl/crypto.h>
66#include <openssl/bio.h> 66#include <openssl/bio.h>
67#include <openssl/bn.h> 67#include <openssl/bn.h>
@@ -84,10 +84,6 @@ int main(int argc, char *argv[])
84#endif 84#endif
85 85
86static void MS_CALLBACK cb(int p, int n, void *arg); 86static void MS_CALLBACK cb(int p, int n, void *arg);
87#ifdef OPENSSL_NO_STDIO
88#define APPS_WIN16
89#include "bss_file.c"
90#endif
91 87
92static const char rnd_seed[] = "string to make the random number generator think it has entropy"; 88static const char rnd_seed[] = "string to make the random number generator think it has entropy";
93 89
@@ -111,7 +107,7 @@ int main(int argc, char *argv[])
111 RAND_seed(rnd_seed, sizeof rnd_seed); 107 RAND_seed(rnd_seed, sizeof rnd_seed);
112 108
113 out=BIO_new(BIO_s_file()); 109 out=BIO_new(BIO_s_file());
114 if (out == NULL) exit(1); 110 if (out == NULL) EXIT(1);
115 BIO_set_fp(out,stdout,BIO_NOCLOSE); 111 BIO_set_fp(out,stdout,BIO_NOCLOSE);
116 112
117 a=DH_generate_parameters(64,DH_GENERATOR_5,cb,out); 113 a=DH_generate_parameters(64,DH_GENERATOR_5,cb,out);
@@ -195,7 +191,7 @@ err:
195 CRYPTO_cleanup_all_ex_data(); 191 CRYPTO_cleanup_all_ex_data();
196 ERR_remove_state(0); 192 ERR_remove_state(0);
197 CRYPTO_mem_leaks_fp(stderr); 193 CRYPTO_mem_leaks_fp(stderr);
198 exit(ret); 194 EXIT(ret);
199 return(ret); 195 return(ret);
200 } 196 }
201 197