summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto')
-rw-r--r--src/lib/libcrypto/Attic/Makefile2
-rw-r--r--src/lib/libcrypto/asn1/Makefile2
-rw-r--r--src/lib/libcrypto/bf/Makefile10
-rw-r--r--src/lib/libcrypto/bio/Makefile2
-rw-r--r--src/lib/libcrypto/bn/Makefile8
-rw-r--r--src/lib/libcrypto/bn/bntest.c56
-rw-r--r--src/lib/libcrypto/bn/expspeed.c2
-rw-r--r--src/lib/libcrypto/bn/exptest.c18
-rw-r--r--src/lib/libcrypto/buffer/Makefile2
-rw-r--r--src/lib/libcrypto/cast/Makefile9
-rw-r--r--src/lib/libcrypto/comp/Makefile2
-rw-r--r--src/lib/libcrypto/conf/Makefile2
-rw-r--r--src/lib/libcrypto/crypto-lib.com23
-rw-r--r--src/lib/libcrypto/des/Makefile2
-rw-r--r--src/lib/libcrypto/dh/Makefile2
-rw-r--r--src/lib/libcrypto/dh/dhtest.c4
-rw-r--r--src/lib/libcrypto/dsa/Makefile2
-rw-r--r--src/lib/libcrypto/dsa/dsatest.c9
-rw-r--r--src/lib/libcrypto/dso/Makefile2
-rw-r--r--src/lib/libcrypto/dso/dso_dl.c35
-rw-r--r--src/lib/libcrypto/dso/dso_win32.c21
-rw-r--r--src/lib/libcrypto/engine/hw_aep.c1
-rw-r--r--src/lib/libcrypto/engine/hw_atalla.c1
-rw-r--r--src/lib/libcrypto/engine/hw_cswift.c204
-rw-r--r--src/lib/libcrypto/engine/hw_ubsec.c1
-rw-r--r--src/lib/libcrypto/err/Makefile2
-rw-r--r--src/lib/libcrypto/evp/Makefile2
-rw-r--r--src/lib/libcrypto/evp/c_alld.c10
-rw-r--r--src/lib/libcrypto/evp/m_sha.c3
-rw-r--r--src/lib/libcrypto/hmac/Makefile2
-rw-r--r--src/lib/libcrypto/idea/Makefile10
-rw-r--r--src/lib/libcrypto/lhash/Makefile2
-rw-r--r--src/lib/libcrypto/md2/Makefile2
-rw-r--r--src/lib/libcrypto/md2/md2_one.c3
-rw-r--r--src/lib/libcrypto/md4/Makefile2
-rw-r--r--src/lib/libcrypto/md5/Makefile2
-rw-r--r--src/lib/libcrypto/mdc2/Makefile2
-rw-r--r--src/lib/libcrypto/objects/Makefile2
-rw-r--r--src/lib/libcrypto/objects/obj_dat.h99
-rw-r--r--src/lib/libcrypto/objects/obj_mac.h65
-rw-r--r--src/lib/libcrypto/pem/Makefile2
-rw-r--r--src/lib/libcrypto/perlasm/x86nasm.pl10
-rw-r--r--src/lib/libcrypto/pkcs12/Makefile2
-rw-r--r--src/lib/libcrypto/pkcs7/Makefile2
-rw-r--r--src/lib/libcrypto/rand/Makefile2
-rw-r--r--src/lib/libcrypto/rc2/Makefile4
-rw-r--r--src/lib/libcrypto/rc2/rc2speed.c6
-rw-r--r--src/lib/libcrypto/rc4/Makefile13
-rw-r--r--src/lib/libcrypto/rc4/asm/rc4-ia64.S65
-rw-r--r--src/lib/libcrypto/rc5/Makefile4
-rw-r--r--src/lib/libcrypto/ripemd/Makefile2
-rw-r--r--src/lib/libcrypto/rsa/Makefile36
-rw-r--r--src/lib/libcrypto/rsa/rsa_test.c5
-rw-r--r--src/lib/libcrypto/sha/Makefile2
-rw-r--r--src/lib/libcrypto/sha/sha_one.c3
-rw-r--r--src/lib/libcrypto/stack/Makefile2
-rw-r--r--src/lib/libcrypto/txt_db/Makefile2
-rw-r--r--src/lib/libcrypto/util/checkhash.pl222
-rw-r--r--src/lib/libcrypto/util/fipslink.pl78
-rw-r--r--src/lib/libcrypto/util/libeay.num42
-rw-r--r--src/lib/libcrypto/util/mk1mf.pl337
-rw-r--r--src/lib/libcrypto/util/mkdef.pl11
-rw-r--r--src/lib/libcrypto/util/mkfiles.pl17
-rw-r--r--src/lib/libcrypto/util/mklink.pl7
-rw-r--r--src/lib/libcrypto/util/pl/BC-32.pl14
-rw-r--r--src/lib/libcrypto/util/pl/OS2-EMX.pl1
-rw-r--r--src/lib/libcrypto/util/pl/VC-32-GMAKE.pl222
-rw-r--r--src/lib/libcrypto/util/pl/VC-32.pl99
-rw-r--r--src/lib/libcrypto/util/pod2man.pl1
-rw-r--r--src/lib/libcrypto/util/selftest.pl26
-rw-r--r--src/lib/libcrypto/x509/Makefile2
-rw-r--r--src/lib/libcrypto/x509v3/Makefile2
72 files changed, 1587 insertions, 286 deletions
diff --git a/src/lib/libcrypto/Attic/Makefile b/src/lib/libcrypto/Attic/Makefile
index cffaeedc5d..cda9de0ac9 100644
--- a/src/lib/libcrypto/Attic/Makefile
+++ b/src/lib/libcrypto/Attic/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/Makefile 2# OpenSSL/crypto/Makefile
3# 3#
4 4
5DIR= crypto 5DIR= crypto
diff --git a/src/lib/libcrypto/asn1/Makefile b/src/lib/libcrypto/asn1/Makefile
index b11298d621..d1c2d8f490 100644
--- a/src/lib/libcrypto/asn1/Makefile
+++ b/src/lib/libcrypto/asn1/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/asn1/Makefile 2# OpenSSL/crypto/asn1/Makefile
3# 3#
4 4
5DIR= asn1 5DIR= asn1
diff --git a/src/lib/libcrypto/bf/Makefile b/src/lib/libcrypto/bf/Makefile
index 0e2121efdc..42e2c050f8 100644
--- a/src/lib/libcrypto/bf/Makefile
+++ b/src/lib/libcrypto/bf/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/blowfish/Makefile 2# OpenSSL/crypto/blowfish/Makefile
3# 3#
4 4
5DIR= bf 5DIR= bf
@@ -110,7 +110,7 @@ bf_enc.o: ../../include/openssl/opensslconf.h bf_enc.c bf_locl.h
110bf_ofb64.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h 110bf_ofb64.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h
111bf_ofb64.o: ../../include/openssl/opensslconf.h bf_locl.h bf_ofb64.c 111bf_ofb64.o: ../../include/openssl/opensslconf.h bf_locl.h bf_ofb64.c
112bf_skey.o: ../../include/openssl/blowfish.h ../../include/openssl/crypto.h 112bf_skey.o: ../../include/openssl/blowfish.h ../../include/openssl/crypto.h
113bf_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h 113bf_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/fips.h
114bf_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 114bf_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
115bf_skey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 115bf_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
116bf_skey.o: bf_locl.h bf_pi.h bf_skey.c 116bf_skey.o: ../../include/openssl/symhacks.h bf_locl.h bf_pi.h bf_skey.c
diff --git a/src/lib/libcrypto/bio/Makefile b/src/lib/libcrypto/bio/Makefile
index 19d9350760..a565154499 100644
--- a/src/lib/libcrypto/bio/Makefile
+++ b/src/lib/libcrypto/bio/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/bio/Makefile 2# OpenSSL/crypto/bio/Makefile
3# 3#
4 4
5DIR= bio 5DIR= bio
diff --git a/src/lib/libcrypto/bn/Makefile b/src/lib/libcrypto/bn/Makefile
index f693d35d87..9969d242cc 100644
--- a/src/lib/libcrypto/bn/Makefile
+++ b/src/lib/libcrypto/bn/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/bn/Makefile 2# OpenSSL/crypto/bn/Makefile
3# 3#
4 4
5DIR= bn 5DIR= bn
@@ -31,12 +31,12 @@ LIB=$(TOP)/libcrypto.a
31LIBSRC= bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c bn_mod.c \ 31LIBSRC= bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c bn_mod.c \
32 bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \ 32 bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \
33 bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_asm.c \ 33 bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_asm.c \
34 bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c 34 bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_x931p.c
35 35
36LIBOBJ= bn_add.o bn_div.o bn_exp.o bn_lib.o bn_ctx.o bn_mul.o bn_mod.o \ 36LIBOBJ= bn_add.o bn_div.o bn_exp.o bn_lib.o bn_ctx.o bn_mul.o bn_mod.o \
37 bn_print.o bn_rand.o bn_shift.o bn_word.o bn_blind.o \ 37 bn_print.o bn_rand.o bn_shift.o bn_word.o bn_blind.o \
38 bn_kron.o bn_sqrt.o bn_gcd.o bn_prime.o bn_err.o bn_sqr.o $(BN_ASM) \ 38 bn_kron.o bn_sqrt.o bn_gcd.o bn_prime.o bn_err.o bn_sqr.o $(BN_ASM) \
39 bn_recp.o bn_mont.o bn_mpi.o bn_exp2.o 39 bn_recp.o bn_mont.o bn_mpi.o bn_exp2.o bn_x931p.o
40 40
41SRC= $(LIBSRC) 41SRC= $(LIBSRC)
42 42
@@ -329,3 +329,5 @@ bn_word.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
329bn_word.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 329bn_word.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
330bn_word.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 330bn_word.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
331bn_word.o: ../cryptlib.h bn_lcl.h bn_word.c 331bn_word.o: ../cryptlib.h bn_lcl.h bn_word.c
332bn_x931p.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h
333bn_x931p.o: ../../include/openssl/opensslconf.h bn_x931p.c
diff --git a/src/lib/libcrypto/bn/bntest.c b/src/lib/libcrypto/bn/bntest.c
index 28cd3339da..685007d330 100644
--- a/src/lib/libcrypto/bn/bntest.c
+++ b/src/lib/libcrypto/bn/bntest.c
@@ -86,6 +86,7 @@ int test_mont(BIO *bp,BN_CTX *ctx);
86int test_mod(BIO *bp,BN_CTX *ctx); 86int test_mod(BIO *bp,BN_CTX *ctx);
87int test_mod_mul(BIO *bp,BN_CTX *ctx); 87int test_mod_mul(BIO *bp,BN_CTX *ctx);
88int test_mod_exp(BIO *bp,BN_CTX *ctx); 88int test_mod_exp(BIO *bp,BN_CTX *ctx);
89int test_mod_exp_mont_consttime(BIO *bp,BN_CTX *ctx);
89int test_exp(BIO *bp,BN_CTX *ctx); 90int test_exp(BIO *bp,BN_CTX *ctx);
90int test_kron(BIO *bp,BN_CTX *ctx); 91int test_kron(BIO *bp,BN_CTX *ctx);
91int test_sqrt(BIO *bp,BN_CTX *ctx); 92int test_sqrt(BIO *bp,BN_CTX *ctx);
@@ -213,6 +214,10 @@ int main(int argc, char *argv[])
213 if (!test_mod_exp(out,ctx)) goto err; 214 if (!test_mod_exp(out,ctx)) goto err;
214 BIO_flush(out); 215 BIO_flush(out);
215 216
217 message(out,"BN_mod_exp_mont_consttime");
218 if (!test_mod_exp_mont_consttime(out,ctx)) goto err;
219 BIO_flush(out);
220
216 message(out,"BN_exp"); 221 message(out,"BN_exp");
217 if (!test_exp(out,ctx)) goto err; 222 if (!test_exp(out,ctx)) goto err;
218 BIO_flush(out); 223 BIO_flush(out);
@@ -813,6 +818,57 @@ int test_mod_exp(BIO *bp, BN_CTX *ctx)
813 return(1); 818 return(1);
814 } 819 }
815 820
821int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx)
822 {
823 BIGNUM *a,*b,*c,*d,*e;
824 int i;
825
826 a=BN_new();
827 b=BN_new();
828 c=BN_new();
829 d=BN_new();
830 e=BN_new();
831
832 BN_bntest_rand(c,30,0,1); /* must be odd for montgomery */
833 for (i=0; i<num2; i++)
834 {
835 BN_bntest_rand(a,20+i*5,0,0); /**/
836 BN_bntest_rand(b,2+i,0,0); /**/
837
838 if (!BN_mod_exp_mont_consttime(d,a,b,c,ctx,NULL))
839 return(00);
840
841 if (bp != NULL)
842 {
843 if (!results)
844 {
845 BN_print(bp,a);
846 BIO_puts(bp," ^ ");
847 BN_print(bp,b);
848 BIO_puts(bp," % ");
849 BN_print(bp,c);
850 BIO_puts(bp," - ");
851 }
852 BN_print(bp,d);
853 BIO_puts(bp,"\n");
854 }
855 BN_exp(e,a,b,ctx);
856 BN_sub(e,e,d);
857 BN_div(a,b,e,c,ctx);
858 if(!BN_is_zero(b))
859 {
860 fprintf(stderr,"Modulo exponentiation test failed!\n");
861 return 0;
862 }
863 }
864 BN_free(a);
865 BN_free(b);
866 BN_free(c);
867 BN_free(d);
868 BN_free(e);
869 return(1);
870 }
871
816int test_exp(BIO *bp, BN_CTX *ctx) 872int test_exp(BIO *bp, BN_CTX *ctx)
817 { 873 {
818 BIGNUM *a,*b,*d,*e,*one; 874 BIGNUM *a,*b,*d,*e,*one;
diff --git a/src/lib/libcrypto/bn/expspeed.c b/src/lib/libcrypto/bn/expspeed.c
index 07a1bcf51c..4d5f221f33 100644
--- a/src/lib/libcrypto/bn/expspeed.c
+++ b/src/lib/libcrypto/bn/expspeed.c
@@ -321,7 +321,7 @@ void do_mul_exp(BIGNUM *r, BIGNUM *a, BIGNUM *b, BIGNUM *c, BN_CTX *ctx)
321#else /* TEST_SQRT */ 321#else /* TEST_SQRT */
322 "2*sqrt [prime == %d (mod 64)] %4d %4d mod %4d" 322 "2*sqrt [prime == %d (mod 64)] %4d %4d mod %4d"
323#endif 323#endif
324 " -> %8.3fms %5.1f (%ld)\n", 324 " -> %8.6fms %5.1f (%ld)\n",
325#ifdef TEST_SQRT 325#ifdef TEST_SQRT
326 P_MOD_64, 326 P_MOD_64,
327#endif 327#endif
diff --git a/src/lib/libcrypto/bn/exptest.c b/src/lib/libcrypto/bn/exptest.c
index b09cf88705..28aaac2ac1 100644
--- a/src/lib/libcrypto/bn/exptest.c
+++ b/src/lib/libcrypto/bn/exptest.c
@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
77 BIO *out=NULL; 77 BIO *out=NULL;
78 int i,ret; 78 int i,ret;
79 unsigned char c; 79 unsigned char c;
80 BIGNUM *r_mont,*r_recp,*r_simple,*a,*b,*m; 80 BIGNUM *r_mont,*r_mont_const,*r_recp,*r_simple,*a,*b,*m;
81 81
82 RAND_seed(rnd_seed, sizeof rnd_seed); /* or BN_rand may fail, and we don't 82 RAND_seed(rnd_seed, sizeof rnd_seed); /* or BN_rand may fail, and we don't
83 * even check its return value 83 * even check its return value
@@ -88,6 +88,7 @@ int main(int argc, char *argv[])
88 ctx=BN_CTX_new(); 88 ctx=BN_CTX_new();
89 if (ctx == NULL) EXIT(1); 89 if (ctx == NULL) EXIT(1);
90 r_mont=BN_new(); 90 r_mont=BN_new();
91 r_mont_const=BN_new();
91 r_recp=BN_new(); 92 r_recp=BN_new();
92 r_simple=BN_new(); 93 r_simple=BN_new();
93 a=BN_new(); 94 a=BN_new();
@@ -143,8 +144,17 @@ int main(int argc, char *argv[])
143 EXIT(1); 144 EXIT(1);
144 } 145 }
145 146
147 ret=BN_mod_exp_mont_consttime(r_mont_const,a,b,m,ctx,NULL);
148 if (ret <= 0)
149 {
150 printf("BN_mod_exp_mont_consttime() problems\n");
151 ERR_print_errors(out);
152 EXIT(1);
153 }
154
146 if (BN_cmp(r_simple, r_mont) == 0 155 if (BN_cmp(r_simple, r_mont) == 0
147 && BN_cmp(r_simple,r_recp) == 0) 156 && BN_cmp(r_simple,r_recp) == 0
157 && BN_cmp(r_simple,r_mont_const) == 0)
148 { 158 {
149 printf("."); 159 printf(".");
150 fflush(stdout); 160 fflush(stdout);
@@ -153,6 +163,8 @@ int main(int argc, char *argv[])
153 { 163 {
154 if (BN_cmp(r_simple,r_mont) != 0) 164 if (BN_cmp(r_simple,r_mont) != 0)
155 printf("\nsimple and mont results differ\n"); 165 printf("\nsimple and mont results differ\n");
166 if (BN_cmp(r_simple,r_mont) != 0)
167 printf("\nsimple and mont const time results differ\n");
156 if (BN_cmp(r_simple,r_recp) != 0) 168 if (BN_cmp(r_simple,r_recp) != 0)
157 printf("\nsimple and recp results differ\n"); 169 printf("\nsimple and recp results differ\n");
158 170
@@ -162,11 +174,13 @@ int main(int argc, char *argv[])
162 printf("\nsimple ="); BN_print(out,r_simple); 174 printf("\nsimple ="); BN_print(out,r_simple);
163 printf("\nrecp ="); BN_print(out,r_recp); 175 printf("\nrecp ="); BN_print(out,r_recp);
164 printf("\nmont ="); BN_print(out,r_mont); 176 printf("\nmont ="); BN_print(out,r_mont);
177 printf("\nmont_ct ="); BN_print(out,r_mont_const);
165 printf("\n"); 178 printf("\n");
166 EXIT(1); 179 EXIT(1);
167 } 180 }
168 } 181 }
169 BN_free(r_mont); 182 BN_free(r_mont);
183 BN_free(r_mont_const);
170 BN_free(r_recp); 184 BN_free(r_recp);
171 BN_free(r_simple); 185 BN_free(r_simple);
172 BN_free(a); 186 BN_free(a);
diff --git a/src/lib/libcrypto/buffer/Makefile b/src/lib/libcrypto/buffer/Makefile
index 3911baf513..4b53c595a3 100644
--- a/src/lib/libcrypto/buffer/Makefile
+++ b/src/lib/libcrypto/buffer/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/buffer/Makefile 2# OpenSSL/crypto/buffer/Makefile
3# 3#
4 4
5DIR= buffer 5DIR= buffer
diff --git a/src/lib/libcrypto/cast/Makefile b/src/lib/libcrypto/cast/Makefile
index 8b0d04bb7c..b388f6271c 100644
--- a/src/lib/libcrypto/cast/Makefile
+++ b/src/lib/libcrypto/cast/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/cast/Makefile 2# OpenSSL/crypto/cast/Makefile
3# 3#
4 4
5DIR= cast 5DIR= cast
@@ -115,6 +115,7 @@ c_ofb64.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
115c_ofb64.o: c_ofb64.c cast_lcl.h 115c_ofb64.o: c_ofb64.c cast_lcl.h
116c_skey.o: ../../e_os.h ../../include/openssl/cast.h 116c_skey.o: ../../e_os.h ../../include/openssl/cast.h
117c_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h 117c_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
118c_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 118c_skey.o: ../../include/openssl/fips.h ../../include/openssl/opensslconf.h
119c_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 119c_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
120c_skey.o: ../../include/openssl/symhacks.h c_skey.c cast_lcl.h cast_s.h 120c_skey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
121c_skey.o: c_skey.c cast_lcl.h cast_s.h
diff --git a/src/lib/libcrypto/comp/Makefile b/src/lib/libcrypto/comp/Makefile
index 68109a8013..df1babec5c 100644
--- a/src/lib/libcrypto/comp/Makefile
+++ b/src/lib/libcrypto/comp/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/comp/Makefile 2# OpenSSL/crypto/comp/Makefile
3# 3#
4 4
5DIR= comp 5DIR= comp
diff --git a/src/lib/libcrypto/conf/Makefile b/src/lib/libcrypto/conf/Makefile
index 6d2f8ffd9a..403d12b28c 100644
--- a/src/lib/libcrypto/conf/Makefile
+++ b/src/lib/libcrypto/conf/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/conf/Makefile 2# OpenSSL/crypto/conf/Makefile
3# 3#
4 4
5DIR= conf 5DIR= conf
diff --git a/src/lib/libcrypto/crypto-lib.com b/src/lib/libcrypto/crypto-lib.com
index c044ce0099..427c321f25 100644
--- a/src/lib/libcrypto/crypto-lib.com
+++ b/src/lib/libcrypto/crypto-lib.com
@@ -184,10 +184,10 @@ $ IF F$TRNLNM("OPENSSL_NO_ASM").OR.ARCH.EQS."AXP" THEN LIB_BN_ASM = "bn_asm"
184$ LIB_BN = "bn_add,bn_div,bn_exp,bn_lib,bn_ctx,bn_mul,bn_mod,"+ - 184$ LIB_BN = "bn_add,bn_div,bn_exp,bn_lib,bn_ctx,bn_mul,bn_mod,"+ -
185 "bn_print,bn_rand,bn_shift,bn_word,bn_blind,"+ - 185 "bn_print,bn_rand,bn_shift,bn_word,bn_blind,"+ -
186 "bn_kron,bn_sqrt,bn_gcd,bn_prime,bn_err,bn_sqr,"+LIB_BN_ASM+","+ - 186 "bn_kron,bn_sqrt,bn_gcd,bn_prime,bn_err,bn_sqr,"+LIB_BN_ASM+","+ -
187 "bn_recp,bn_mont,bn_mpi,bn_exp2" 187 "bn_recp,bn_mont,bn_mpi,bn_exp2,bn_x931p"
188$ LIB_RSA = "rsa_eay,rsa_gen,rsa_lib,rsa_sign,rsa_saos,rsa_err,"+ - 188$ LIB_RSA = "rsa_eay,rsa_gen,rsa_lib,rsa_sign,rsa_saos,rsa_err,"+ -
189 "rsa_pk1,rsa_ssl,rsa_none,rsa_oaep,rsa_chk,rsa_null,"+ - 189 "rsa_pk1,rsa_ssl,rsa_none,rsa_oaep,rsa_chk,rsa_null,"+ -
190 "rsa_asn1" 190 "rsa_pss,rsa_x931,rsa_asn1"
191$ LIB_EC = "ec_lib,ecp_smpl,ecp_mont,ecp_recp,ecp_nist,ec_cvt,ec_mult,"+ - 191$ LIB_EC = "ec_lib,ecp_smpl,ecp_mont,ecp_recp,ecp_nist,ec_cvt,ec_mult,"+ -
192 "ec_err" 192 "ec_err"
193$ LIB_DSA = "dsa_gen,dsa_key,dsa_lib,dsa_asn1,dsa_vrf,dsa_sign,dsa_err,dsa_ossl" 193$ LIB_DSA = "dsa_gen,dsa_key,dsa_lib,dsa_asn1,dsa_vrf,dsa_sign,dsa_err,dsa_ossl"
@@ -265,10 +265,15 @@ $ LIB_KRB5 = "krb5_asn"
265$! 265$!
266$! Setup exceptional compilations 266$! Setup exceptional compilations
267$! 267$!
268$ ! Add definitions for no threads on OpenVMS 7.1 and higher
268$ COMPILEWITH_CC3 = ",bss_rtcp," 269$ COMPILEWITH_CC3 = ",bss_rtcp,"
270$ ! Disable the DOLLARID warning
269$ COMPILEWITH_CC4 = ",a_utctm,bss_log,o_time," 271$ COMPILEWITH_CC4 = ",a_utctm,bss_log,o_time,"
272$ ! Disable disjoint optimization
270$ COMPILEWITH_CC5 = ",md2_dgst,md4_dgst,md5_dgst,mdc2dgst," + - 273$ COMPILEWITH_CC5 = ",md2_dgst,md4_dgst,md5_dgst,mdc2dgst," + -
271 "sha_dgst,sha1dgst,rmd_dgst,bf_enc," 274 "sha_dgst,sha1dgst,rmd_dgst,bf_enc,"
275$ ! Disable the MIXLINKAGE warning
276$ COMPILEWITH_CC6 = ",enc_read,set_key,"
272$! 277$!
273$! Figure Out What Other Modules We Are To Build. 278$! Figure Out What Other Modules We Are To Build.
274$! 279$!
@@ -497,7 +502,12 @@ $ IF COMPILEWITH_CC5 - FILE_NAME0 .NES. COMPILEWITH_CC5
497$ THEN 502$ THEN
498$ CC5/OBJECT='OBJECT_FILE' 'SOURCE_FILE' 503$ CC5/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
499$ ELSE 504$ ELSE
500$ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE' 505$ IF COMPILEWITH_CC6 - FILE_NAME0 .NES. COMPILEWITH_CC6
506$ THEN
507$ CC6/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
508$ ELSE
509$ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
510$ ENDIF
501$ ENDIF 511$ ENDIF
502$ ENDIF 512$ ENDIF
503$ ENDIF 513$ ENDIF
@@ -960,7 +970,7 @@ $ CCDEFS = "TCPIP_TYPE_''P4',DSO_VMS"
960$ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS 970$ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS
961$ CCEXTRAFLAGS = "" 971$ CCEXTRAFLAGS = ""
962$ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS 972$ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS
963$ CCDISABLEWARNINGS = "LONGLONGTYPE,LONGLONGSUFX" 973$ CCDISABLEWARNINGS = "LONGLONGTYPE,LONGLONGSUFX,FOUNDCR"
964$ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN - 974$ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN -
965 CCDISABLEWARNINGS = CCDISABLEWARNINGS + "," + USER_CCDISABLEWARNINGS 975 CCDISABLEWARNINGS = CCDISABLEWARNINGS + "," + USER_CCDISABLEWARNINGS
966$! 976$!
@@ -1077,14 +1087,18 @@ $ THEN
1077$ IF CCDISABLEWARNINGS .EQS. "" 1087$ IF CCDISABLEWARNINGS .EQS. ""
1078$ THEN 1088$ THEN
1079$ CC4DISABLEWARNINGS = "DOLLARID" 1089$ CC4DISABLEWARNINGS = "DOLLARID"
1090$ CC6DISABLEWARNINGS = "MIXLINKAGE"
1080$ ELSE 1091$ ELSE
1081$ CC4DISABLEWARNINGS = CCDISABLEWARNINGS + ",DOLLARID" 1092$ CC4DISABLEWARNINGS = CCDISABLEWARNINGS + ",DOLLARID"
1093$ CC6DISABLEWARNINGS = CCDISABLEWARNINGS + ",MIXLINKAGE"
1082$ CCDISABLEWARNINGS = "/WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))" 1094$ CCDISABLEWARNINGS = "/WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))"
1083$ ENDIF 1095$ ENDIF
1084$ CC4DISABLEWARNINGS = "/WARNING=(DISABLE=(" + CC4DISABLEWARNINGS + "))" 1096$ CC4DISABLEWARNINGS = "/WARNING=(DISABLE=(" + CC4DISABLEWARNINGS + "))"
1097$ CC6DISABLEWARNINGS = "/WARNING=(DISABLE=(" + CC6DISABLEWARNINGS + "))"
1085$ ELSE 1098$ ELSE
1086$ CCDISABLEWARNINGS = "" 1099$ CCDISABLEWARNINGS = ""
1087$ CC4DISABLEWARNINGS = "" 1100$ CC4DISABLEWARNINGS = ""
1101$ CC6DISABLEWARNINGS = ""
1088$ ENDIF 1102$ ENDIF
1089$ CC3 = CC + "/DEFINE=(" + CCDEFS + ISSEVEN + ")" + CCDISABLEWARNINGS 1103$ CC3 = CC + "/DEFINE=(" + CCDEFS + ISSEVEN + ")" + CCDISABLEWARNINGS
1090$ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS 1104$ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS
@@ -1095,6 +1109,7 @@ $ ELSE
1095$ CC5 = CC + "/NOOPTIMIZE" 1109$ CC5 = CC + "/NOOPTIMIZE"
1096$ ENDIF 1110$ ENDIF
1097$ CC4 = CC - CCDISABLEWARNINGS + CC4DISABLEWARNINGS 1111$ CC4 = CC - CCDISABLEWARNINGS + CC4DISABLEWARNINGS
1112$ CC6 = CC - CCDISABLEWARNINGS + CC6DISABLEWARNINGS
1098$! 1113$!
1099$! Show user the result 1114$! Show user the result
1100$! 1115$!
diff --git a/src/lib/libcrypto/des/Makefile b/src/lib/libcrypto/des/Makefile
index 655f2ea1a8..800af0b123 100644
--- a/src/lib/libcrypto/des/Makefile
+++ b/src/lib/libcrypto/des/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/des/Makefile 2# OpenSSL/crypto/des/Makefile
3# 3#
4 4
5DIR= des 5DIR= des
diff --git a/src/lib/libcrypto/dh/Makefile b/src/lib/libcrypto/dh/Makefile
index c091a8130a..352678b94a 100644
--- a/src/lib/libcrypto/dh/Makefile
+++ b/src/lib/libcrypto/dh/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/dh/Makefile 2# OpenSSL/crypto/dh/Makefile
3# 3#
4 4
5DIR= dh 5DIR= dh
diff --git a/src/lib/libcrypto/dh/dhtest.c b/src/lib/libcrypto/dh/dhtest.c
index d75077f9fa..b76dede771 100644
--- a/src/lib/libcrypto/dh/dhtest.c
+++ b/src/lib/libcrypto/dh/dhtest.c
@@ -136,6 +136,10 @@ int main(int argc, char *argv[])
136 b->g=BN_dup(a->g); 136 b->g=BN_dup(a->g);
137 if ((b->p == NULL) || (b->g == NULL)) goto err; 137 if ((b->p == NULL) || (b->g == NULL)) goto err;
138 138
139 /* Set a to run with normal modexp and b to use constant time */
140 a->flags &= ~DH_FLAG_NO_EXP_CONSTTIME;
141 b->flags |= DH_FLAG_NO_EXP_CONSTTIME;
142
139 if (!DH_generate_key(a)) goto err; 143 if (!DH_generate_key(a)) goto err;
140 BIO_puts(out,"pri 1="); 144 BIO_puts(out,"pri 1=");
141 BN_print(out,a->priv_key); 145 BN_print(out,a->priv_key);
diff --git a/src/lib/libcrypto/dsa/Makefile b/src/lib/libcrypto/dsa/Makefile
index 3a55058973..4f10278039 100644
--- a/src/lib/libcrypto/dsa/Makefile
+++ b/src/lib/libcrypto/dsa/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/dsa/Makefile 2# OpenSSL/crypto/dsa/Makefile
3# 3#
4 4
5DIR= dsa 5DIR= dsa
diff --git a/src/lib/libcrypto/dsa/dsatest.c b/src/lib/libcrypto/dsa/dsatest.c
index 4734ce4af8..55a3756aff 100644
--- a/src/lib/libcrypto/dsa/dsatest.c
+++ b/src/lib/libcrypto/dsa/dsatest.c
@@ -194,10 +194,19 @@ int main(int argc, char **argv)
194 BIO_printf(bio_err,"g value is wrong\n"); 194 BIO_printf(bio_err,"g value is wrong\n");
195 goto end; 195 goto end;
196 } 196 }
197
198 dsa->flags |= DSA_FLAG_NO_EXP_CONSTTIME;
197 DSA_generate_key(dsa); 199 DSA_generate_key(dsa);
198 DSA_sign(0, str1, 20, sig, &siglen, dsa); 200 DSA_sign(0, str1, 20, sig, &siglen, dsa);
199 if (DSA_verify(0, str1, 20, sig, siglen, dsa) == 1) 201 if (DSA_verify(0, str1, 20, sig, siglen, dsa) == 1)
200 ret=1; 202 ret=1;
203
204 dsa->flags &= ~DSA_FLAG_NO_EXP_CONSTTIME;
205 DSA_generate_key(dsa);
206 DSA_sign(0, str1, 20, sig, &siglen, dsa);
207 if (DSA_verify(0, str1, 20, sig, siglen, dsa) == 1)
208 ret=1;
209
201end: 210end:
202 if (!ret) 211 if (!ret)
203 ERR_print_errors(bio_err); 212 ERR_print_errors(bio_err);
diff --git a/src/lib/libcrypto/dso/Makefile b/src/lib/libcrypto/dso/Makefile
index 168951bc3e..c16278c3ff 100644
--- a/src/lib/libcrypto/dso/Makefile
+++ b/src/lib/libcrypto/dso/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/dso/Makefile 2# OpenSSL/crypto/dso/Makefile
3# 3#
4 4
5DIR= dso 5DIR= dso
diff --git a/src/lib/libcrypto/dso/dso_dl.c b/src/lib/libcrypto/dso/dso_dl.c
index 79d2cb4d8c..f7b4dfc0c3 100644
--- a/src/lib/libcrypto/dso/dso_dl.c
+++ b/src/lib/libcrypto/dso/dso_dl.c
@@ -126,7 +126,8 @@ static int dl_load(DSO *dso)
126 DSOerr(DSO_F_DL_LOAD,DSO_R_NO_FILENAME); 126 DSOerr(DSO_F_DL_LOAD,DSO_R_NO_FILENAME);
127 goto err; 127 goto err;
128 } 128 }
129 ptr = shl_load(filename, BIND_IMMEDIATE|DYNAMIC_PATH, 0L); 129 ptr = shl_load(filename, BIND_IMMEDIATE |
130 (dso->flags&DSO_FLAG_NO_NAME_TRANSLATION?0:DYNAMIC_PATH), 0L);
130 if(ptr == NULL) 131 if(ptr == NULL)
131 { 132 {
132 DSOerr(DSO_F_DL_LOAD,DSO_R_LOAD_FAILED); 133 DSOerr(DSO_F_DL_LOAD,DSO_R_LOAD_FAILED);
@@ -281,4 +282,36 @@ static char *dl_name_converter(DSO *dso, const char *filename)
281 return(translated); 282 return(translated);
282 } 283 }
283 284
285#ifdef OPENSSL_FIPS
286static void dl_ref_point(){}
287
288int DSO_pathbyaddr(void *addr,char *path,int sz)
289 {
290 struct shl_descriptor inf;
291 int i,len;
292
293 if (addr == NULL)
294 {
295 union { void(*f)(); void *p; } t = { dl_ref_point };
296 addr = t.p;
297 }
298
299 for (i=-1;shl_get_r(i,&inf)==0;i++)
300 {
301 if (((size_t)addr >= inf.tstart && (size_t)addr < inf.tend) ||
302 ((size_t)addr >= inf.dstart && (size_t)addr < inf.dend))
303 {
304 len = (int)strlen(inf.filename);
305 if (sz <= 0) return len+1;
306 if (len >= sz) len=sz-1;
307 memcpy(path,inf.filename,len);
308 path[len++] = 0;
309 return len;
310 }
311 }
312
313 return -1;
314 }
315#endif
316
284#endif /* DSO_DL */ 317#endif /* DSO_DL */
diff --git a/src/lib/libcrypto/dso/dso_win32.c b/src/lib/libcrypto/dso/dso_win32.c
index 3fa90eb27c..cc4ac68696 100644
--- a/src/lib/libcrypto/dso/dso_win32.c
+++ b/src/lib/libcrypto/dso/dso_win32.c
@@ -68,6 +68,25 @@ DSO_METHOD *DSO_METHOD_win32(void)
68 } 68 }
69#else 69#else
70 70
71#ifdef _WIN32_WCE
72# if _WIN32_WCE < 300
73static FARPROC GetProcAddressA(HMODULE hModule,LPCSTR lpProcName)
74 {
75 WCHAR lpProcNameW[64];
76 int i;
77
78 for (i=0;lpProcName[i] && i<64;i++)
79 lpProcNameW[i] = (WCHAR)lpProcName[i];
80 if (i==64) return NULL;
81 lpProcNameW[i] = 0;
82
83 return GetProcAddressW(hModule,lpProcNameW);
84 }
85# endif
86# undef GetProcAddress
87# define GetProcAddress GetProcAddressA
88#endif
89
71/* Part of the hack in "win32_load" ... */ 90/* Part of the hack in "win32_load" ... */
72#define DSO_MAX_TRANSLATED_SIZE 256 91#define DSO_MAX_TRANSLATED_SIZE 256
73 92
@@ -122,7 +141,7 @@ static int win32_load(DSO *dso)
122 DSOerr(DSO_F_WIN32_LOAD,DSO_R_NO_FILENAME); 141 DSOerr(DSO_F_WIN32_LOAD,DSO_R_NO_FILENAME);
123 goto err; 142 goto err;
124 } 143 }
125 h = LoadLibrary(filename); 144 h = LoadLibraryA(filename);
126 if(h == NULL) 145 if(h == NULL)
127 { 146 {
128 DSOerr(DSO_F_WIN32_LOAD,DSO_R_LOAD_FAILED); 147 DSOerr(DSO_F_WIN32_LOAD,DSO_R_LOAD_FAILED);
diff --git a/src/lib/libcrypto/engine/hw_aep.c b/src/lib/libcrypto/engine/hw_aep.c
index 8b8380a582..5f1772ea99 100644
--- a/src/lib/libcrypto/engine/hw_aep.c
+++ b/src/lib/libcrypto/engine/hw_aep.c
@@ -474,6 +474,7 @@ static int aep_init(ENGINE *e)
474 474
475 if(aep_dso) 475 if(aep_dso)
476 DSO_free(aep_dso); 476 DSO_free(aep_dso);
477 aep_dso = NULL;
477 478
478 p_AEP_OpenConnection = NULL; 479 p_AEP_OpenConnection = NULL;
479 p_AEP_ModExp = NULL; 480 p_AEP_ModExp = NULL;
diff --git a/src/lib/libcrypto/engine/hw_atalla.c b/src/lib/libcrypto/engine/hw_atalla.c
index e9eff9fad1..2b8342bbdd 100644
--- a/src/lib/libcrypto/engine/hw_atalla.c
+++ b/src/lib/libcrypto/engine/hw_atalla.c
@@ -375,6 +375,7 @@ static int atalla_init(ENGINE *e)
375err: 375err:
376 if(atalla_dso) 376 if(atalla_dso)
377 DSO_free(atalla_dso); 377 DSO_free(atalla_dso);
378 atalla_dso = NULL;
378 p_Atalla_GetHardwareConfig = NULL; 379 p_Atalla_GetHardwareConfig = NULL;
379 p_Atalla_RSAPrivateKeyOpFn = NULL; 380 p_Atalla_RSAPrivateKeyOpFn = NULL;
380 p_Atalla_GetPerformanceStatistics = NULL; 381 p_Atalla_GetPerformanceStatistics = NULL;
diff --git a/src/lib/libcrypto/engine/hw_cswift.c b/src/lib/libcrypto/engine/hw_cswift.c
index f128ee5a68..1411fd8333 100644
--- a/src/lib/libcrypto/engine/hw_cswift.c
+++ b/src/lib/libcrypto/engine/hw_cswift.c
@@ -90,6 +90,7 @@ static int cswift_destroy(ENGINE *e);
90static int cswift_init(ENGINE *e); 90static int cswift_init(ENGINE *e);
91static int cswift_finish(ENGINE *e); 91static int cswift_finish(ENGINE *e);
92static int cswift_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()); 92static int cswift_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
93static int cswift_bn_32copy(SW_LARGENUMBER * out, const BIGNUM * in);
93 94
94/* BIGNUM stuff */ 95/* BIGNUM stuff */
95static int cswift_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 96static int cswift_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
@@ -403,7 +404,10 @@ static int cswift_init(ENGINE *e)
403 return 1; 404 return 1;
404err: 405err:
405 if(cswift_dso) 406 if(cswift_dso)
407 {
406 DSO_free(cswift_dso); 408 DSO_free(cswift_dso);
409 cswift_dso = NULL;
410 }
407 p_CSwift_AcquireAccContext = NULL; 411 p_CSwift_AcquireAccContext = NULL;
408 p_CSwift_AttachKeyParam = NULL; 412 p_CSwift_AttachKeyParam = NULL;
409 p_CSwift_SimpleRequest = NULL; 413 p_CSwift_SimpleRequest = NULL;
@@ -553,6 +557,29 @@ err:
553 return to_return; 557 return to_return;
554 } 558 }
555 559
560
561int cswift_bn_32copy(SW_LARGENUMBER * out, const BIGNUM * in)
562{
563 int mod;
564 int numbytes = BN_num_bytes(in);
565
566 mod = 0;
567 while( ((out->nbytes = (numbytes+mod)) % 32) )
568 {
569 mod++;
570 }
571 out->value = (unsigned char*)OPENSSL_malloc(out->nbytes);
572 if(!out->value)
573 {
574 return 0;
575 }
576 BN_bn2bin(in, &out->value[mod]);
577 if(mod)
578 memset(out->value, 0, mod);
579
580 return 1;
581}
582
556/* Un petit mod_exp chinois */ 583/* Un petit mod_exp chinois */
557static int cswift_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 584static int cswift_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
558 const BIGNUM *q, const BIGNUM *dmp1, 585 const BIGNUM *q, const BIGNUM *dmp1,
@@ -562,15 +589,16 @@ static int cswift_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
562 SW_LARGENUMBER arg, res; 589 SW_LARGENUMBER arg, res;
563 SW_PARAM sw_param; 590 SW_PARAM sw_param;
564 SW_CONTEXT_HANDLE hac; 591 SW_CONTEXT_HANDLE hac;
565 BIGNUM *rsa_p = NULL;
566 BIGNUM *rsa_q = NULL;
567 BIGNUM *rsa_dmp1 = NULL;
568 BIGNUM *rsa_dmq1 = NULL;
569 BIGNUM *rsa_iqmp = NULL;
570 BIGNUM *argument = NULL;
571 BIGNUM *result = NULL; 592 BIGNUM *result = NULL;
593 BIGNUM *argument = NULL;
572 int to_return = 0; /* expect failure */ 594 int to_return = 0; /* expect failure */
573 int acquired = 0; 595 int acquired = 0;
596
597 sw_param.up.crt.p.value = NULL;
598 sw_param.up.crt.q.value = NULL;
599 sw_param.up.crt.dmp1.value = NULL;
600 sw_param.up.crt.dmq1.value = NULL;
601 sw_param.up.crt.iqmp.value = NULL;
574 602
575 if(!get_context(&hac)) 603 if(!get_context(&hac))
576 { 604 {
@@ -578,44 +606,55 @@ static int cswift_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
578 goto err; 606 goto err;
579 } 607 }
580 acquired = 1; 608 acquired = 1;
609
581 /* Prepare the params */ 610 /* Prepare the params */
582 BN_CTX_start(ctx); 611 argument = BN_new();
583 rsa_p = BN_CTX_get(ctx); 612 result = BN_new();
584 rsa_q = BN_CTX_get(ctx); 613 if(!result || !argument)
585 rsa_dmp1 = BN_CTX_get(ctx);
586 rsa_dmq1 = BN_CTX_get(ctx);
587 rsa_iqmp = BN_CTX_get(ctx);
588 argument = BN_CTX_get(ctx);
589 result = BN_CTX_get(ctx);
590 if(!result)
591 { 614 {
592 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BN_CTX_FULL); 615 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BN_CTX_FULL);
593 goto err; 616 goto err;
594 } 617 }
595 if(!bn_wexpand(rsa_p, p->top) || !bn_wexpand(rsa_q, q->top) || 618
596 !bn_wexpand(rsa_dmp1, dmp1->top) || 619
597 !bn_wexpand(rsa_dmq1, dmq1->top) || 620 sw_param.type = SW_ALG_CRT;
598 !bn_wexpand(rsa_iqmp, iqmp->top) || 621 /************************************************************************/
599 !bn_wexpand(argument, a->top) || 622 /* 04/02/2003 */
623 /* Modified by Frederic Giudicelli (deny-all.com) to overcome the */
624 /* limitation of cswift with values not a multiple of 32 */
625 /************************************************************************/
626 if(!cswift_bn_32copy(&sw_param.up.crt.p, p))
627 {
628 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BN_EXPAND_FAIL);
629 goto err;
630 }
631 if(!cswift_bn_32copy(&sw_param.up.crt.q, q))
632 {
633 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BN_EXPAND_FAIL);
634 goto err;
635 }
636 if(!cswift_bn_32copy(&sw_param.up.crt.dmp1, dmp1))
637 {
638 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BN_EXPAND_FAIL);
639 goto err;
640 }
641 if(!cswift_bn_32copy(&sw_param.up.crt.dmq1, dmq1))
642 {
643 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BN_EXPAND_FAIL);
644 goto err;
645 }
646 if(!cswift_bn_32copy(&sw_param.up.crt.iqmp, iqmp))
647 {
648 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BN_EXPAND_FAIL);
649 goto err;
650 }
651 if( !bn_wexpand(argument, a->top) ||
600 !bn_wexpand(result, p->top + q->top)) 652 !bn_wexpand(result, p->top + q->top))
601 { 653 {
602 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BN_EXPAND_FAIL); 654 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BN_EXPAND_FAIL);
603 goto err; 655 goto err;
604 } 656 }
605 sw_param.type = SW_ALG_CRT; 657
606 sw_param.up.crt.p.nbytes = BN_bn2bin(p, (unsigned char *)rsa_p->d);
607 sw_param.up.crt.p.value = (unsigned char *)rsa_p->d;
608 sw_param.up.crt.q.nbytes = BN_bn2bin(q, (unsigned char *)rsa_q->d);
609 sw_param.up.crt.q.value = (unsigned char *)rsa_q->d;
610 sw_param.up.crt.dmp1.nbytes = BN_bn2bin(dmp1,
611 (unsigned char *)rsa_dmp1->d);
612 sw_param.up.crt.dmp1.value = (unsigned char *)rsa_dmp1->d;
613 sw_param.up.crt.dmq1.nbytes = BN_bn2bin(dmq1,
614 (unsigned char *)rsa_dmq1->d);
615 sw_param.up.crt.dmq1.value = (unsigned char *)rsa_dmq1->d;
616 sw_param.up.crt.iqmp.nbytes = BN_bn2bin(iqmp,
617 (unsigned char *)rsa_iqmp->d);
618 sw_param.up.crt.iqmp.value = (unsigned char *)rsa_iqmp->d;
619 /* Attach the key params */ 658 /* Attach the key params */
620 sw_status = p_CSwift_AttachKeyParam(hac, &sw_param); 659 sw_status = p_CSwift_AttachKeyParam(hac, &sw_param);
621 switch(sw_status) 660 switch(sw_status)
@@ -654,9 +693,22 @@ static int cswift_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
654 BN_bin2bn((unsigned char *)result->d, res.nbytes, r); 693 BN_bin2bn((unsigned char *)result->d, res.nbytes, r);
655 to_return = 1; 694 to_return = 1;
656err: 695err:
696 if(sw_param.up.crt.p.value)
697 OPENSSL_free(sw_param.up.crt.p.value);
698 if(sw_param.up.crt.q.value)
699 OPENSSL_free(sw_param.up.crt.q.value);
700 if(sw_param.up.crt.dmp1.value)
701 OPENSSL_free(sw_param.up.crt.dmp1.value);
702 if(sw_param.up.crt.dmq1.value)
703 OPENSSL_free(sw_param.up.crt.dmq1.value);
704 if(sw_param.up.crt.iqmp.value)
705 OPENSSL_free(sw_param.up.crt.iqmp.value);
706 if(result)
707 BN_free(result);
708 if(argument)
709 BN_free(argument);
657 if(acquired) 710 if(acquired)
658 release_context(hac); 711 release_context(hac);
659 BN_CTX_end(ctx);
660 return to_return; 712 return to_return;
661 } 713 }
662 714
@@ -665,6 +717,27 @@ static int cswift_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
665 { 717 {
666 BN_CTX *ctx; 718 BN_CTX *ctx;
667 int to_return = 0; 719 int to_return = 0;
720 const RSA_METHOD * def_rsa_method;
721
722 /* Try the limits of RSA (2048 bits) */
723 if(BN_num_bytes(rsa->p) > 128 ||
724 BN_num_bytes(rsa->q) > 128 ||
725 BN_num_bytes(rsa->dmp1) > 128 ||
726 BN_num_bytes(rsa->dmq1) > 128 ||
727 BN_num_bytes(rsa->iqmp) > 128)
728 {
729#ifdef RSA_NULL
730 def_rsa_method=RSA_null_method();
731#else
732#if 0
733 def_rsa_method=RSA_PKCS1_RSAref();
734#else
735 def_rsa_method=RSA_PKCS1_SSLeay();
736#endif
737#endif
738 if(def_rsa_method)
739 return def_rsa_method->rsa_mod_exp(r0, I, rsa);
740 }
668 741
669 if((ctx = BN_CTX_new()) == NULL) 742 if((ctx = BN_CTX_new()) == NULL)
670 goto err; 743 goto err;
@@ -686,6 +759,26 @@ err:
686static int cswift_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 759static int cswift_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
687 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) 760 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
688 { 761 {
762 const RSA_METHOD * def_rsa_method;
763
764 /* Try the limits of RSA (2048 bits) */
765 if(BN_num_bytes(r) > 256 ||
766 BN_num_bytes(a) > 256 ||
767 BN_num_bytes(m) > 256)
768 {
769#ifdef RSA_NULL
770 def_rsa_method=RSA_null_method();
771#else
772#if 0
773 def_rsa_method=RSA_PKCS1_RSAref();
774#else
775 def_rsa_method=RSA_PKCS1_SSLeay();
776#endif
777#endif
778 if(def_rsa_method)
779 return def_rsa_method->bn_mod_exp(r, a, p, m, ctx, m_ctx);
780 }
781
689 return cswift_mod_exp(r, a, p, m, ctx); 782 return cswift_mod_exp(r, a, p, m, ctx);
690 } 783 }
691 784
@@ -930,9 +1023,10 @@ static int cswift_rand_bytes(unsigned char *buf, int num)
930 SW_CONTEXT_HANDLE hac; 1023 SW_CONTEXT_HANDLE hac;
931 SW_STATUS swrc; 1024 SW_STATUS swrc;
932 SW_LARGENUMBER largenum; 1025 SW_LARGENUMBER largenum;
933 size_t nbytes = 0;
934 int acquired = 0; 1026 int acquired = 0;
935 int to_return = 0; /* assume failure */ 1027 int to_return = 0; /* assume failure */
1028 unsigned char buf32[1024];
1029
936 1030
937 if (!get_context(&hac)) 1031 if (!get_context(&hac))
938 { 1032 {
@@ -941,17 +1035,19 @@ static int cswift_rand_bytes(unsigned char *buf, int num)
941 } 1035 }
942 acquired = 1; 1036 acquired = 1;
943 1037
944 while (nbytes < (size_t)num) 1038 /************************************************************************/
1039 /* 04/02/2003 */
1040 /* Modified by Frederic Giudicelli (deny-all.com) to overcome the */
1041 /* limitation of cswift with values not a multiple of 32 */
1042 /************************************************************************/
1043
1044 while(num >= sizeof(buf32))
945 { 1045 {
1046 largenum.value = buf;
1047 largenum.nbytes = sizeof(buf32);
946 /* tell CryptoSwift how many bytes we want and where we want it. 1048 /* tell CryptoSwift how many bytes we want and where we want it.
947 * Note: - CryptoSwift cannot do more than 4096 bytes at a time. 1049 * Note: - CryptoSwift cannot do more than 4096 bytes at a time.
948 * - CryptoSwift can only do multiple of 32-bits. */ 1050 * - CryptoSwift can only do multiple of 32-bits. */
949 largenum.value = (SW_BYTE *) buf + nbytes;
950 if (4096 > num - nbytes)
951 largenum.nbytes = num - nbytes;
952 else
953 largenum.nbytes = 4096;
954
955 swrc = p_CSwift_SimpleRequest(hac, SW_CMD_RAND, NULL, 0, &largenum, 1); 1051 swrc = p_CSwift_SimpleRequest(hac, SW_CMD_RAND, NULL, 0, &largenum, 1);
956 if (swrc != SW_OK) 1052 if (swrc != SW_OK)
957 { 1053 {
@@ -961,14 +1057,30 @@ static int cswift_rand_bytes(unsigned char *buf, int num)
961 ERR_add_error_data(2, "CryptoSwift error number is ", tmpbuf); 1057 ERR_add_error_data(2, "CryptoSwift error number is ", tmpbuf);
962 goto err; 1058 goto err;
963 } 1059 }
964 1060 buf += sizeof(buf32);
965 nbytes += largenum.nbytes; 1061 num -= sizeof(buf32);
1062 }
1063 if(num)
1064 {
1065 largenum.nbytes = sizeof(buf32);
1066 largenum.value = buf32;
1067 swrc = p_CSwift_SimpleRequest(hac, SW_CMD_RAND, NULL, 0, &largenum, 1);
1068 if (swrc != SW_OK)
1069 {
1070 char tmpbuf[20];
1071 CSWIFTerr(CSWIFT_F_CSWIFT_CTRL, CSWIFT_R_REQUEST_FAILED);
1072 sprintf(tmpbuf, "%ld", swrc);
1073 ERR_add_error_data(2, "CryptoSwift error number is ", tmpbuf);
1074 goto err;
1075 }
1076 memcpy(buf, largenum.value, num);
966 } 1077 }
967 to_return = 1; /* success */
968 1078
1079 to_return = 1; /* success */
969err: 1080err:
970 if (acquired) 1081 if (acquired)
971 release_context(hac); 1082 release_context(hac);
1083
972 return to_return; 1084 return to_return;
973} 1085}
974 1086
diff --git a/src/lib/libcrypto/engine/hw_ubsec.c b/src/lib/libcrypto/engine/hw_ubsec.c
index 5234a08a07..8fb834af31 100644
--- a/src/lib/libcrypto/engine/hw_ubsec.c
+++ b/src/lib/libcrypto/engine/hw_ubsec.c
@@ -454,6 +454,7 @@ static int ubsec_init(ENGINE *e)
454err: 454err:
455 if(ubsec_dso) 455 if(ubsec_dso)
456 DSO_free(ubsec_dso); 456 DSO_free(ubsec_dso);
457 ubsec_dso = NULL;
457 p_UBSEC_ubsec_bytes_to_bits = NULL; 458 p_UBSEC_ubsec_bytes_to_bits = NULL;
458 p_UBSEC_ubsec_bits_to_bytes = NULL; 459 p_UBSEC_ubsec_bits_to_bytes = NULL;
459 p_UBSEC_ubsec_open = NULL; 460 p_UBSEC_ubsec_open = NULL;
diff --git a/src/lib/libcrypto/err/Makefile b/src/lib/libcrypto/err/Makefile
index 149f3e0eb9..4adec55302 100644
--- a/src/lib/libcrypto/err/Makefile
+++ b/src/lib/libcrypto/err/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/err/Makefile 2# OpenSSL/crypto/err/Makefile
3# 3#
4 4
5DIR= err 5DIR= err
diff --git a/src/lib/libcrypto/evp/Makefile b/src/lib/libcrypto/evp/Makefile
index 5027a3855a..d1c2a272bb 100644
--- a/src/lib/libcrypto/evp/Makefile
+++ b/src/lib/libcrypto/evp/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/evp/Makefile 2# OpenSSL/crypto/evp/Makefile
3# 3#
4 4
5DIR= evp 5DIR= evp
diff --git a/src/lib/libcrypto/evp/c_alld.c b/src/lib/libcrypto/evp/c_alld.c
index aae7bf7482..929ea56a3e 100644
--- a/src/lib/libcrypto/evp/c_alld.c
+++ b/src/lib/libcrypto/evp/c_alld.c
@@ -100,4 +100,14 @@ void OpenSSL_add_all_digests(void)
100 EVP_add_digest_alias(SN_ripemd160,"ripemd"); 100 EVP_add_digest_alias(SN_ripemd160,"ripemd");
101 EVP_add_digest_alias(SN_ripemd160,"rmd160"); 101 EVP_add_digest_alias(SN_ripemd160,"rmd160");
102#endif 102#endif
103#ifdef OPENSSL_FIPS
104#ifndef OPENSSL_NO_SHA256
105 EVP_add_digest(EVP_sha224());
106 EVP_add_digest(EVP_sha256());
107#endif
108#ifndef OPENSSL_NO_SHA512
109 EVP_add_digest(EVP_sha384());
110 EVP_add_digest(EVP_sha512());
111#endif
112#endif
103 } 113 }
diff --git a/src/lib/libcrypto/evp/m_sha.c b/src/lib/libcrypto/evp/m_sha.c
index d1785e5f74..ed54909b16 100644
--- a/src/lib/libcrypto/evp/m_sha.c
+++ b/src/lib/libcrypto/evp/m_sha.c
@@ -59,6 +59,9 @@
59#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0) 59#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0)
60#include <stdio.h> 60#include <stdio.h>
61#include "cryptlib.h" 61#include "cryptlib.h"
62/* Including sha.h prior evp.h masks FIPS SHA declarations, but that's
63 * exactly what we want to achieve here... */
64#include <openssl/sha.h>
62#include <openssl/evp.h> 65#include <openssl/evp.h>
63#include "evp_locl.h" 66#include "evp_locl.h"
64#include <openssl/objects.h> 67#include <openssl/objects.h>
diff --git a/src/lib/libcrypto/hmac/Makefile b/src/lib/libcrypto/hmac/Makefile
index f634dab79d..3d53d8240f 100644
--- a/src/lib/libcrypto/hmac/Makefile
+++ b/src/lib/libcrypto/hmac/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/md/Makefile 2# OpenSSL/crypto/md/Makefile
3# 3#
4 4
5DIR= hmac 5DIR= hmac
diff --git a/src/lib/libcrypto/idea/Makefile b/src/lib/libcrypto/idea/Makefile
index f652783027..6b8e530d9d 100644
--- a/src/lib/libcrypto/idea/Makefile
+++ b/src/lib/libcrypto/idea/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/idea/Makefile 2# OpenSSL/crypto/idea/Makefile
3# 3#
4 4
5DIR= idea 5DIR= idea
@@ -86,7 +86,7 @@ i_ecb.o: ../../include/openssl/opensslv.h i_ecb.c idea_lcl.h
86i_ofb64.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h 86i_ofb64.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
87i_ofb64.o: i_ofb64.c idea_lcl.h 87i_ofb64.o: i_ofb64.c idea_lcl.h
88i_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h 88i_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
89i_skey.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h 89i_skey.o: ../../include/openssl/fips.h ../../include/openssl/idea.h
90i_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 90i_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
91i_skey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 91i_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
92i_skey.o: i_skey.c idea_lcl.h 92i_skey.o: ../../include/openssl/symhacks.h i_skey.c idea_lcl.h
diff --git a/src/lib/libcrypto/lhash/Makefile b/src/lib/libcrypto/lhash/Makefile
index d325a1644d..cdb0e77fad 100644
--- a/src/lib/libcrypto/lhash/Makefile
+++ b/src/lib/libcrypto/lhash/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/lhash/Makefile 2# OpenSSL/crypto/lhash/Makefile
3# 3#
4 4
5DIR= lhash 5DIR= lhash
diff --git a/src/lib/libcrypto/md2/Makefile b/src/lib/libcrypto/md2/Makefile
index 90628511da..9d0351bb2f 100644
--- a/src/lib/libcrypto/md2/Makefile
+++ b/src/lib/libcrypto/md2/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/md/Makefile 2# OpenSSL/crypto/md/Makefile
3# 3#
4 4
5DIR= md2 5DIR= md2
diff --git a/src/lib/libcrypto/md2/md2_one.c b/src/lib/libcrypto/md2/md2_one.c
index 835160ef56..8c36ba5779 100644
--- a/src/lib/libcrypto/md2/md2_one.c
+++ b/src/lib/libcrypto/md2/md2_one.c
@@ -69,7 +69,8 @@ unsigned char *MD2(const unsigned char *d, unsigned long n, unsigned char *md)
69 static unsigned char m[MD2_DIGEST_LENGTH]; 69 static unsigned char m[MD2_DIGEST_LENGTH];
70 70
71 if (md == NULL) md=m; 71 if (md == NULL) md=m;
72 MD2_Init(&c); 72 if (!MD2_Init(&c))
73 return NULL;
73#ifndef CHARSET_EBCDIC 74#ifndef CHARSET_EBCDIC
74 MD2_Update(&c,d,n); 75 MD2_Update(&c,d,n);
75#else 76#else
diff --git a/src/lib/libcrypto/md4/Makefile b/src/lib/libcrypto/md4/Makefile
index 0b7c8d7ad8..eeb457f20f 100644
--- a/src/lib/libcrypto/md4/Makefile
+++ b/src/lib/libcrypto/md4/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/md4/Makefile 2# OpenSSL/crypto/md4/Makefile
3# 3#
4 4
5DIR= md4 5DIR= md4
diff --git a/src/lib/libcrypto/md5/Makefile b/src/lib/libcrypto/md5/Makefile
index 832446fff2..1ed018526f 100644
--- a/src/lib/libcrypto/md5/Makefile
+++ b/src/lib/libcrypto/md5/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/md5/Makefile 2# OpenSSL/crypto/md5/Makefile
3# 3#
4 4
5DIR= md5 5DIR= md5
diff --git a/src/lib/libcrypto/mdc2/Makefile b/src/lib/libcrypto/mdc2/Makefile
index 38c785bf95..b8e9a9a4fa 100644
--- a/src/lib/libcrypto/mdc2/Makefile
+++ b/src/lib/libcrypto/mdc2/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/mdc2/Makefile 2# OpenSSL/crypto/mdc2/Makefile
3# 3#
4 4
5DIR= mdc2 5DIR= mdc2
diff --git a/src/lib/libcrypto/objects/Makefile b/src/lib/libcrypto/objects/Makefile
index e449147129..23b2a69e6d 100644
--- a/src/lib/libcrypto/objects/Makefile
+++ b/src/lib/libcrypto/objects/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/objects/Makefile 2# OpenSSL/crypto/objects/Makefile
3# 3#
4 4
5DIR= objects 5DIR= objects
diff --git a/src/lib/libcrypto/objects/obj_dat.h b/src/lib/libcrypto/objects/obj_dat.h
index 8785127055..cc22152682 100644
--- a/src/lib/libcrypto/objects/obj_dat.h
+++ b/src/lib/libcrypto/objects/obj_dat.h
@@ -62,12 +62,12 @@
62 * [including the GNU Public Licence.] 62 * [including the GNU Public Licence.]
63 */ 63 */
64 64
65#define NUM_NID 668 65#define NUM_NID 676
66#define NUM_SN 660 66#define NUM_SN 669
67#define NUM_LN 660 67#define NUM_LN 669
68#define NUM_OBJ 624 68#define NUM_OBJ 633
69 69
70static unsigned char lvalues[4500]={ 70static unsigned char lvalues[4575]={
710x00, /* [ 0] OBJ_undef */ 710x00, /* [ 0] OBJ_undef */
720x2A,0x86,0x48,0x86,0xF7,0x0D, /* [ 1] OBJ_rsadsi */ 720x2A,0x86,0x48,0x86,0xF7,0x0D, /* [ 1] OBJ_rsadsi */
730x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, /* [ 7] OBJ_pkcs */ 730x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, /* [ 7] OBJ_pkcs */
@@ -330,9 +330,9 @@ static unsigned char lvalues[4500]={
3300x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x04, /* [2092] OBJ_ac_auditEntity */ 3300x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x04, /* [2092] OBJ_ac_auditEntity */
3310x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x05, /* [2100] OBJ_ac_targeting */ 3310x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x05, /* [2100] OBJ_ac_targeting */
3320x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x06, /* [2108] OBJ_aaControls */ 3320x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x06, /* [2108] OBJ_aaControls */
3330x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x07, /* [2116] OBJ_sbqp_ipAddrBlock */ 3330x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x07, /* [2116] OBJ_sbgp_ipAddrBlock */
3340x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x08, /* [2124] OBJ_sbqp_autonomousSysNum */ 3340x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x08, /* [2124] OBJ_sbgp_autonomousSysNum */
3350x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x09, /* [2132] OBJ_sbqp_routerIdentifier */ 3350x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x09, /* [2132] OBJ_sbgp_routerIdentifier */
3360x2B,0x06,0x01,0x05,0x05,0x07,0x02,0x03, /* [2140] OBJ_textNotice */ 3360x2B,0x06,0x01,0x05,0x05,0x07,0x02,0x03, /* [2140] OBJ_textNotice */
3370x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x05, /* [2148] OBJ_ipsecEndSystem */ 3370x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x05, /* [2148] OBJ_ipsecEndSystem */
3380x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x06, /* [2156] OBJ_ipsecTunnel */ 3380x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x06, /* [2156] OBJ_ipsecTunnel */
@@ -691,7 +691,16 @@ static unsigned char lvalues[4500]={
6910x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x0E, /* [4467] OBJ_proxyCertInfo */ 6910x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x0E, /* [4467] OBJ_proxyCertInfo */
6920x2B,0x06,0x01,0x05,0x05,0x07,0x15,0x00, /* [4475] OBJ_id_ppl_anyLanguage */ 6920x2B,0x06,0x01,0x05,0x05,0x07,0x15,0x00, /* [4475] OBJ_id_ppl_anyLanguage */
6930x2B,0x06,0x01,0x05,0x05,0x07,0x15,0x01, /* [4483] OBJ_id_ppl_inheritAll */ 6930x2B,0x06,0x01,0x05,0x05,0x07,0x15,0x01, /* [4483] OBJ_id_ppl_inheritAll */
6940x2B,0x06,0x01,0x05,0x05,0x07,0x15,0x02, /* [4491] OBJ_Independent */ 6940x55,0x1D,0x1E, /* [4491] OBJ_name_constraints */
6950x2B,0x06,0x01,0x05,0x05,0x07,0x15,0x02, /* [4494] OBJ_Independent */
6960x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,/* [4502] OBJ_sha256WithRSAEncryption */
6970x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0C,/* [4511] OBJ_sha384WithRSAEncryption */
6980x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0D,/* [4520] OBJ_sha512WithRSAEncryption */
6990x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0E,/* [4529] OBJ_sha224WithRSAEncryption */
7000x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,/* [4538] OBJ_sha256 */
7010x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x02,/* [4547] OBJ_sha384 */
7020x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x03,/* [4556] OBJ_sha512 */
7030x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x04,/* [4565] OBJ_sha224 */
695}; 704};
696 705
697static ASN1_OBJECT nid_objs[NUM_NID]={ 706static ASN1_OBJECT nid_objs[NUM_NID]={
@@ -1134,12 +1143,12 @@ static ASN1_OBJECT nid_objs[NUM_NID]={
1134 &(lvalues[2092]),0}, 1143 &(lvalues[2092]),0},
1135{"ac-targeting","ac-targeting",NID_ac_targeting,8,&(lvalues[2100]),0}, 1144{"ac-targeting","ac-targeting",NID_ac_targeting,8,&(lvalues[2100]),0},
1136{"aaControls","aaControls",NID_aaControls,8,&(lvalues[2108]),0}, 1145{"aaControls","aaControls",NID_aaControls,8,&(lvalues[2108]),0},
1137{"sbqp-ipAddrBlock","sbqp-ipAddrBlock",NID_sbqp_ipAddrBlock,8, 1146{"sbgp-ipAddrBlock","sbgp-ipAddrBlock",NID_sbgp_ipAddrBlock,8,
1138 &(lvalues[2116]),0}, 1147 &(lvalues[2116]),0},
1139{"sbqp-autonomousSysNum","sbqp-autonomousSysNum", 1148{"sbgp-autonomousSysNum","sbgp-autonomousSysNum",
1140 NID_sbqp_autonomousSysNum,8,&(lvalues[2124]),0}, 1149 NID_sbgp_autonomousSysNum,8,&(lvalues[2124]),0},
1141{"sbqp-routerIdentifier","sbqp-routerIdentifier", 1150{"sbgp-routerIdentifier","sbgp-routerIdentifier",
1142 NID_sbqp_routerIdentifier,8,&(lvalues[2132]),0}, 1151 NID_sbgp_routerIdentifier,8,&(lvalues[2132]),0},
1143{"textNotice","textNotice",NID_textNotice,8,&(lvalues[2140]),0}, 1152{"textNotice","textNotice",NID_textNotice,8,&(lvalues[2140]),0},
1144{"ipsecEndSystem","IPSec End System",NID_ipsecEndSystem,8, 1153{"ipsecEndSystem","IPSec End System",NID_ipsecEndSystem,8,
1145 &(lvalues[2148]),0}, 1154 &(lvalues[2148]),0},
@@ -1754,8 +1763,21 @@ static ASN1_OBJECT nid_objs[NUM_NID]={
1754 &(lvalues[4475]),0}, 1763 &(lvalues[4475]),0},
1755{"id-ppl-inheritAll","Inherit all",NID_id_ppl_inheritAll,8, 1764{"id-ppl-inheritAll","Inherit all",NID_id_ppl_inheritAll,8,
1756 &(lvalues[4483]),0}, 1765 &(lvalues[4483]),0},
1757{NULL,NULL,NID_undef,0,NULL}, 1766{"nameConstraints","X509v3 Name Constraints",NID_name_constraints,3,
1758{"id-ppl-independent","Independent",NID_Independent,8,&(lvalues[4491]),0}, 1767 &(lvalues[4491]),0},
1768{"id-ppl-independent","Independent",NID_Independent,8,&(lvalues[4494]),0},
1769{"RSA-SHA256","sha256WithRSAEncryption",NID_sha256WithRSAEncryption,9,
1770 &(lvalues[4502]),0},
1771{"RSA-SHA384","sha384WithRSAEncryption",NID_sha384WithRSAEncryption,9,
1772 &(lvalues[4511]),0},
1773{"RSA-SHA512","sha512WithRSAEncryption",NID_sha512WithRSAEncryption,9,
1774 &(lvalues[4520]),0},
1775{"RSA-SHA224","sha224WithRSAEncryption",NID_sha224WithRSAEncryption,9,
1776 &(lvalues[4529]),0},
1777{"SHA256","sha256",NID_sha256,9,&(lvalues[4538]),0},
1778{"SHA384","sha384",NID_sha384,9,&(lvalues[4547]),0},
1779{"SHA512","sha512",NID_sha512,9,&(lvalues[4556]),0},
1780{"SHA224","sha224",NID_sha224,9,&(lvalues[4565]),0},
1759}; 1781};
1760 1782
1761static ASN1_OBJECT *sn_objs[NUM_SN]={ 1783static ASN1_OBJECT *sn_objs[NUM_SN]={
@@ -1881,8 +1903,16 @@ static ASN1_OBJECT *sn_objs[NUM_SN]={
1881&(nid_objs[42]),/* "RSA-SHA" */ 1903&(nid_objs[42]),/* "RSA-SHA" */
1882&(nid_objs[65]),/* "RSA-SHA1" */ 1904&(nid_objs[65]),/* "RSA-SHA1" */
1883&(nid_objs[115]),/* "RSA-SHA1-2" */ 1905&(nid_objs[115]),/* "RSA-SHA1-2" */
1906&(nid_objs[671]),/* "RSA-SHA224" */
1907&(nid_objs[668]),/* "RSA-SHA256" */
1908&(nid_objs[669]),/* "RSA-SHA384" */
1909&(nid_objs[670]),/* "RSA-SHA512" */
1884&(nid_objs[41]),/* "SHA" */ 1910&(nid_objs[41]),/* "SHA" */
1885&(nid_objs[64]),/* "SHA1" */ 1911&(nid_objs[64]),/* "SHA1" */
1912&(nid_objs[675]),/* "SHA224" */
1913&(nid_objs[672]),/* "SHA256" */
1914&(nid_objs[673]),/* "SHA384" */
1915&(nid_objs[674]),/* "SHA512" */
1886&(nid_objs[188]),/* "SMIME" */ 1916&(nid_objs[188]),/* "SMIME" */
1887&(nid_objs[167]),/* "SMIME-CAPS" */ 1917&(nid_objs[167]),/* "SMIME-CAPS" */
1888&(nid_objs[100]),/* "SN" */ 1918&(nid_objs[100]),/* "SN" */
@@ -2182,6 +2212,7 @@ static ASN1_OBJECT *sn_objs[NUM_SN]={
2182&(nid_objs[649]),/* "msUPN" */ 2212&(nid_objs[649]),/* "msUPN" */
2183&(nid_objs[481]),/* "nSRecord" */ 2213&(nid_objs[481]),/* "nSRecord" */
2184&(nid_objs[173]),/* "name" */ 2214&(nid_objs[173]),/* "name" */
2215&(nid_objs[666]),/* "nameConstraints" */
2185&(nid_objs[369]),/* "noCheck" */ 2216&(nid_objs[369]),/* "noCheck" */
2186&(nid_objs[403]),/* "noRevAvail" */ 2217&(nid_objs[403]),/* "noRevAvail" */
2187&(nid_objs[72]),/* "nsBaseUrl" */ 2218&(nid_objs[72]),/* "nsBaseUrl" */
@@ -2254,9 +2285,9 @@ static ASN1_OBJECT *sn_objs[NUM_SN]={
2254&(nid_objs[ 1]),/* "rsadsi" */ 2285&(nid_objs[ 1]),/* "rsadsi" */
2255&(nid_objs[482]),/* "sOARecord" */ 2286&(nid_objs[482]),/* "sOARecord" */
2256&(nid_objs[155]),/* "safeContentsBag" */ 2287&(nid_objs[155]),/* "safeContentsBag" */
2257&(nid_objs[291]),/* "sbqp-autonomousSysNum" */ 2288&(nid_objs[291]),/* "sbgp-autonomousSysNum" */
2258&(nid_objs[290]),/* "sbqp-ipAddrBlock" */ 2289&(nid_objs[290]),/* "sbgp-ipAddrBlock" */
2259&(nid_objs[292]),/* "sbqp-routerIdentifier" */ 2290&(nid_objs[292]),/* "sbgp-routerIdentifier" */
2260&(nid_objs[159]),/* "sdsiCertificate" */ 2291&(nid_objs[159]),/* "sdsiCertificate" */
2261&(nid_objs[154]),/* "secretBag" */ 2292&(nid_objs[154]),/* "secretBag" */
2262&(nid_objs[474]),/* "secretary" */ 2293&(nid_objs[474]),/* "secretary" */
@@ -2517,6 +2548,7 @@ static ASN1_OBJECT *ln_objs[NUM_LN]={
2517&(nid_objs[126]),/* "X509v3 Extended Key Usage" */ 2548&(nid_objs[126]),/* "X509v3 Extended Key Usage" */
2518&(nid_objs[86]),/* "X509v3 Issuer Alternative Name" */ 2549&(nid_objs[86]),/* "X509v3 Issuer Alternative Name" */
2519&(nid_objs[83]),/* "X509v3 Key Usage" */ 2550&(nid_objs[83]),/* "X509v3 Key Usage" */
2551&(nid_objs[666]),/* "X509v3 Name Constraints" */
2520&(nid_objs[403]),/* "X509v3 No Revocation Available" */ 2552&(nid_objs[403]),/* "X509v3 No Revocation Available" */
2521&(nid_objs[401]),/* "X509v3 Policy Constraints" */ 2553&(nid_objs[401]),/* "X509v3 Policy Constraints" */
2522&(nid_objs[84]),/* "X509v3 Private Key Usage Period" */ 2554&(nid_objs[84]),/* "X509v3 Private Key Usage Period" */
@@ -2930,9 +2962,9 @@ static ASN1_OBJECT *ln_objs[NUM_LN]={
2930&(nid_objs[124]),/* "run length compression" */ 2962&(nid_objs[124]),/* "run length compression" */
2931&(nid_objs[482]),/* "sOARecord" */ 2963&(nid_objs[482]),/* "sOARecord" */
2932&(nid_objs[155]),/* "safeContentsBag" */ 2964&(nid_objs[155]),/* "safeContentsBag" */
2933&(nid_objs[291]),/* "sbqp-autonomousSysNum" */ 2965&(nid_objs[291]),/* "sbgp-autonomousSysNum" */
2934&(nid_objs[290]),/* "sbqp-ipAddrBlock" */ 2966&(nid_objs[290]),/* "sbgp-ipAddrBlock" */
2935&(nid_objs[292]),/* "sbqp-routerIdentifier" */ 2967&(nid_objs[292]),/* "sbgp-routerIdentifier" */
2936&(nid_objs[159]),/* "sdsiCertificate" */ 2968&(nid_objs[159]),/* "sdsiCertificate" */
2937&(nid_objs[154]),/* "secretBag" */ 2969&(nid_objs[154]),/* "secretBag" */
2938&(nid_objs[474]),/* "secretary" */ 2970&(nid_objs[474]),/* "secretary" */
@@ -3059,6 +3091,14 @@ static ASN1_OBJECT *ln_objs[NUM_LN]={
3059&(nid_objs[64]),/* "sha1" */ 3091&(nid_objs[64]),/* "sha1" */
3060&(nid_objs[115]),/* "sha1WithRSA" */ 3092&(nid_objs[115]),/* "sha1WithRSA" */
3061&(nid_objs[65]),/* "sha1WithRSAEncryption" */ 3093&(nid_objs[65]),/* "sha1WithRSAEncryption" */
3094&(nid_objs[675]),/* "sha224" */
3095&(nid_objs[671]),/* "sha224WithRSAEncryption" */
3096&(nid_objs[672]),/* "sha256" */
3097&(nid_objs[668]),/* "sha256WithRSAEncryption" */
3098&(nid_objs[673]),/* "sha384" */
3099&(nid_objs[669]),/* "sha384WithRSAEncryption" */
3100&(nid_objs[674]),/* "sha512" */
3101&(nid_objs[670]),/* "sha512WithRSAEncryption" */
3062&(nid_objs[42]),/* "shaWithRSAEncryption" */ 3102&(nid_objs[42]),/* "shaWithRSAEncryption" */
3063&(nid_objs[52]),/* "signingTime" */ 3103&(nid_objs[52]),/* "signingTime" */
3064&(nid_objs[454]),/* "simpleSecurityObject" */ 3104&(nid_objs[454]),/* "simpleSecurityObject" */
@@ -3133,6 +3173,7 @@ static ASN1_OBJECT *obj_objs[NUM_OBJ]={
3133&(nid_objs[430]),/* OBJ_hold_instruction_code 2 5 29 23 */ 3173&(nid_objs[430]),/* OBJ_hold_instruction_code 2 5 29 23 */
3134&(nid_objs[142]),/* OBJ_invalidity_date 2 5 29 24 */ 3174&(nid_objs[142]),/* OBJ_invalidity_date 2 5 29 24 */
3135&(nid_objs[140]),/* OBJ_delta_crl 2 5 29 27 */ 3175&(nid_objs[140]),/* OBJ_delta_crl 2 5 29 27 */
3176&(nid_objs[666]),/* OBJ_name_constraints 2 5 29 30 */
3136&(nid_objs[103]),/* OBJ_crl_distribution_points 2 5 29 31 */ 3177&(nid_objs[103]),/* OBJ_crl_distribution_points 2 5 29 31 */
3137&(nid_objs[89]),/* OBJ_certificate_policies 2 5 29 32 */ 3178&(nid_objs[89]),/* OBJ_certificate_policies 2 5 29 32 */
3138&(nid_objs[90]),/* OBJ_authority_key_identifier 2 5 29 35 */ 3179&(nid_objs[90]),/* OBJ_authority_key_identifier 2 5 29 35 */
@@ -3383,9 +3424,9 @@ static ASN1_OBJECT *obj_objs[NUM_OBJ]={
3383&(nid_objs[287]),/* OBJ_ac_auditEntity 1 3 6 1 5 5 7 1 4 */ 3424&(nid_objs[287]),/* OBJ_ac_auditEntity 1 3 6 1 5 5 7 1 4 */
3384&(nid_objs[288]),/* OBJ_ac_targeting 1 3 6 1 5 5 7 1 5 */ 3425&(nid_objs[288]),/* OBJ_ac_targeting 1 3 6 1 5 5 7 1 5 */
3385&(nid_objs[289]),/* OBJ_aaControls 1 3 6 1 5 5 7 1 6 */ 3426&(nid_objs[289]),/* OBJ_aaControls 1 3 6 1 5 5 7 1 6 */
3386&(nid_objs[290]),/* OBJ_sbqp_ipAddrBlock 1 3 6 1 5 5 7 1 7 */ 3427&(nid_objs[290]),/* OBJ_sbgp_ipAddrBlock 1 3 6 1 5 5 7 1 7 */
3387&(nid_objs[291]),/* OBJ_sbqp_autonomousSysNum 1 3 6 1 5 5 7 1 8 */ 3428&(nid_objs[291]),/* OBJ_sbgp_autonomousSysNum 1 3 6 1 5 5 7 1 8 */
3388&(nid_objs[292]),/* OBJ_sbqp_routerIdentifier 1 3 6 1 5 5 7 1 9 */ 3429&(nid_objs[292]),/* OBJ_sbgp_routerIdentifier 1 3 6 1 5 5 7 1 9 */
3389&(nid_objs[397]),/* OBJ_ac_proxying 1 3 6 1 5 5 7 1 10 */ 3430&(nid_objs[397]),/* OBJ_ac_proxying 1 3 6 1 5 5 7 1 10 */
3390&(nid_objs[398]),/* OBJ_sinfo_access 1 3 6 1 5 5 7 1 11 */ 3431&(nid_objs[398]),/* OBJ_sinfo_access 1 3 6 1 5 5 7 1 11 */
3391&(nid_objs[663]),/* OBJ_proxyCertInfo 1 3 6 1 5 5 7 1 14 */ 3432&(nid_objs[663]),/* OBJ_proxyCertInfo 1 3 6 1 5 5 7 1 14 */
@@ -3480,6 +3521,10 @@ static ASN1_OBJECT *obj_objs[NUM_OBJ]={
3480&(nid_objs[ 8]),/* OBJ_md5WithRSAEncryption 1 2 840 113549 1 1 4 */ 3521&(nid_objs[ 8]),/* OBJ_md5WithRSAEncryption 1 2 840 113549 1 1 4 */
3481&(nid_objs[65]),/* OBJ_sha1WithRSAEncryption 1 2 840 113549 1 1 5 */ 3522&(nid_objs[65]),/* OBJ_sha1WithRSAEncryption 1 2 840 113549 1 1 5 */
3482&(nid_objs[644]),/* OBJ_rsaOAEPEncryptionSET 1 2 840 113549 1 1 6 */ 3523&(nid_objs[644]),/* OBJ_rsaOAEPEncryptionSET 1 2 840 113549 1 1 6 */
3524&(nid_objs[668]),/* OBJ_sha256WithRSAEncryption 1 2 840 113549 1 1 11 */
3525&(nid_objs[669]),/* OBJ_sha384WithRSAEncryption 1 2 840 113549 1 1 12 */
3526&(nid_objs[670]),/* OBJ_sha512WithRSAEncryption 1 2 840 113549 1 1 13 */
3527&(nid_objs[671]),/* OBJ_sha224WithRSAEncryption 1 2 840 113549 1 1 14 */
3483&(nid_objs[28]),/* OBJ_dhKeyAgreement 1 2 840 113549 1 3 1 */ 3528&(nid_objs[28]),/* OBJ_dhKeyAgreement 1 2 840 113549 1 3 1 */
3484&(nid_objs[ 9]),/* OBJ_pbeWithMD2AndDES_CBC 1 2 840 113549 1 5 1 */ 3529&(nid_objs[ 9]),/* OBJ_pbeWithMD2AndDES_CBC 1 2 840 113549 1 5 1 */
3485&(nid_objs[10]),/* OBJ_pbeWithMD5AndDES_CBC 1 2 840 113549 1 5 3 */ 3530&(nid_objs[10]),/* OBJ_pbeWithMD5AndDES_CBC 1 2 840 113549 1 5 3 */
@@ -3544,6 +3589,10 @@ static ASN1_OBJECT *obj_objs[NUM_OBJ]={
3544&(nid_objs[427]),/* OBJ_aes_256_cbc 2 16 840 1 101 3 4 1 42 */ 3589&(nid_objs[427]),/* OBJ_aes_256_cbc 2 16 840 1 101 3 4 1 42 */
3545&(nid_objs[428]),/* OBJ_aes_256_ofb128 2 16 840 1 101 3 4 1 43 */ 3590&(nid_objs[428]),/* OBJ_aes_256_ofb128 2 16 840 1 101 3 4 1 43 */
3546&(nid_objs[429]),/* OBJ_aes_256_cfb128 2 16 840 1 101 3 4 1 44 */ 3591&(nid_objs[429]),/* OBJ_aes_256_cfb128 2 16 840 1 101 3 4 1 44 */
3592&(nid_objs[672]),/* OBJ_sha256 2 16 840 1 101 3 4 2 1 */
3593&(nid_objs[673]),/* OBJ_sha384 2 16 840 1 101 3 4 2 2 */
3594&(nid_objs[674]),/* OBJ_sha512 2 16 840 1 101 3 4 2 3 */
3595&(nid_objs[675]),/* OBJ_sha224 2 16 840 1 101 3 4 2 4 */
3547&(nid_objs[71]),/* OBJ_netscape_cert_type 2 16 840 1 113730 1 1 */ 3596&(nid_objs[71]),/* OBJ_netscape_cert_type 2 16 840 1 113730 1 1 */
3548&(nid_objs[72]),/* OBJ_netscape_base_url 2 16 840 1 113730 1 2 */ 3597&(nid_objs[72]),/* OBJ_netscape_base_url 2 16 840 1 113730 1 2 */
3549&(nid_objs[73]),/* OBJ_netscape_revocation_url 2 16 840 1 113730 1 3 */ 3598&(nid_objs[73]),/* OBJ_netscape_revocation_url 2 16 840 1 113730 1 3 */
diff --git a/src/lib/libcrypto/objects/obj_mac.h b/src/lib/libcrypto/objects/obj_mac.h
index d28894cf41..51bb50047f 100644
--- a/src/lib/libcrypto/objects/obj_mac.h
+++ b/src/lib/libcrypto/objects/obj_mac.h
@@ -241,6 +241,26 @@
241#define NID_sha1WithRSAEncryption 65 241#define NID_sha1WithRSAEncryption 65
242#define OBJ_sha1WithRSAEncryption OBJ_pkcs1,5L 242#define OBJ_sha1WithRSAEncryption OBJ_pkcs1,5L
243 243
244#define SN_sha256WithRSAEncryption "RSA-SHA256"
245#define LN_sha256WithRSAEncryption "sha256WithRSAEncryption"
246#define NID_sha256WithRSAEncryption 668
247#define OBJ_sha256WithRSAEncryption OBJ_pkcs1,11L
248
249#define SN_sha384WithRSAEncryption "RSA-SHA384"
250#define LN_sha384WithRSAEncryption "sha384WithRSAEncryption"
251#define NID_sha384WithRSAEncryption 669
252#define OBJ_sha384WithRSAEncryption OBJ_pkcs1,12L
253
254#define SN_sha512WithRSAEncryption "RSA-SHA512"
255#define LN_sha512WithRSAEncryption "sha512WithRSAEncryption"
256#define NID_sha512WithRSAEncryption 670
257#define OBJ_sha512WithRSAEncryption OBJ_pkcs1,13L
258
259#define SN_sha224WithRSAEncryption "RSA-SHA224"
260#define LN_sha224WithRSAEncryption "sha224WithRSAEncryption"
261#define NID_sha224WithRSAEncryption 671
262#define OBJ_sha224WithRSAEncryption OBJ_pkcs1,14L
263
244#define SN_pkcs3 "pkcs3" 264#define SN_pkcs3 "pkcs3"
245#define NID_pkcs3 27 265#define NID_pkcs3 27
246#define OBJ_pkcs3 OBJ_pkcs,3L 266#define OBJ_pkcs3 OBJ_pkcs,3L
@@ -1048,17 +1068,17 @@
1048#define NID_aaControls 289 1068#define NID_aaControls 289
1049#define OBJ_aaControls OBJ_id_pe,6L 1069#define OBJ_aaControls OBJ_id_pe,6L
1050 1070
1051#define SN_sbqp_ipAddrBlock "sbqp-ipAddrBlock" 1071#define SN_sbgp_ipAddrBlock "sbgp-ipAddrBlock"
1052#define NID_sbqp_ipAddrBlock 290 1072#define NID_sbgp_ipAddrBlock 290
1053#define OBJ_sbqp_ipAddrBlock OBJ_id_pe,7L 1073#define OBJ_sbgp_ipAddrBlock OBJ_id_pe,7L
1054 1074
1055#define SN_sbqp_autonomousSysNum "sbqp-autonomousSysNum" 1075#define SN_sbgp_autonomousSysNum "sbgp-autonomousSysNum"
1056#define NID_sbqp_autonomousSysNum 291 1076#define NID_sbgp_autonomousSysNum 291
1057#define OBJ_sbqp_autonomousSysNum OBJ_id_pe,8L 1077#define OBJ_sbgp_autonomousSysNum OBJ_id_pe,8L
1058 1078
1059#define SN_sbqp_routerIdentifier "sbqp-routerIdentifier" 1079#define SN_sbgp_routerIdentifier "sbgp-routerIdentifier"
1060#define NID_sbqp_routerIdentifier 292 1080#define NID_sbgp_routerIdentifier 292
1061#define OBJ_sbqp_routerIdentifier OBJ_id_pe,9L 1081#define OBJ_sbgp_routerIdentifier OBJ_id_pe,9L
1062 1082
1063#define SN_ac_proxying "ac-proxying" 1083#define SN_ac_proxying "ac-proxying"
1064#define NID_ac_proxying 397 1084#define NID_ac_proxying 397
@@ -1779,6 +1799,11 @@
1779#define NID_delta_crl 140 1799#define NID_delta_crl 140
1780#define OBJ_delta_crl OBJ_id_ce,27L 1800#define OBJ_delta_crl OBJ_id_ce,27L
1781 1801
1802#define SN_name_constraints "nameConstraints"
1803#define LN_name_constraints "X509v3 Name Constraints"
1804#define NID_name_constraints 666
1805#define OBJ_name_constraints OBJ_id_ce,30L
1806
1782#define SN_crl_distribution_points "crlDistributionPoints" 1807#define SN_crl_distribution_points "crlDistributionPoints"
1783#define LN_crl_distribution_points "X509v3 CRL Distribution Points" 1808#define LN_crl_distribution_points "X509v3 CRL Distribution Points"
1784#define NID_crl_distribution_points 103 1809#define NID_crl_distribution_points 103
@@ -2081,6 +2106,28 @@
2081#define LN_des_ede3_cfb8 "des-ede3-cfb8" 2106#define LN_des_ede3_cfb8 "des-ede3-cfb8"
2082#define NID_des_ede3_cfb8 659 2107#define NID_des_ede3_cfb8 659
2083 2108
2109#define OBJ_nist_hashalgs OBJ_nistAlgorithms,2L
2110
2111#define SN_sha256 "SHA256"
2112#define LN_sha256 "sha256"
2113#define NID_sha256 672
2114#define OBJ_sha256 OBJ_nist_hashalgs,1L
2115
2116#define SN_sha384 "SHA384"
2117#define LN_sha384 "sha384"
2118#define NID_sha384 673
2119#define OBJ_sha384 OBJ_nist_hashalgs,2L
2120
2121#define SN_sha512 "SHA512"
2122#define LN_sha512 "sha512"
2123#define NID_sha512 674
2124#define OBJ_sha512 OBJ_nist_hashalgs,3L
2125
2126#define SN_sha224 "SHA224"
2127#define LN_sha224 "sha224"
2128#define NID_sha224 675
2129#define OBJ_sha224 OBJ_nist_hashalgs,4L
2130
2084#define SN_hold_instruction_code "holdInstructionCode" 2131#define SN_hold_instruction_code "holdInstructionCode"
2085#define LN_hold_instruction_code "Hold Instruction Code" 2132#define LN_hold_instruction_code "Hold Instruction Code"
2086#define NID_hold_instruction_code 430 2133#define NID_hold_instruction_code 430
diff --git a/src/lib/libcrypto/pem/Makefile b/src/lib/libcrypto/pem/Makefile
index f3dfea2ac8..fbc2b5d056 100644
--- a/src/lib/libcrypto/pem/Makefile
+++ b/src/lib/libcrypto/pem/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/pem/Makefile 2# OpenSSL/crypto/pem/Makefile
3# 3#
4 4
5DIR= pem 5DIR= pem
diff --git a/src/lib/libcrypto/perlasm/x86nasm.pl b/src/lib/libcrypto/perlasm/x86nasm.pl
index 5009acb4b3..4bdb3fe180 100644
--- a/src/lib/libcrypto/perlasm/x86nasm.pl
+++ b/src/lib/libcrypto/perlasm/x86nasm.pl
@@ -221,7 +221,15 @@ sub using486
221 221
222sub main'file 222sub main'file
223 { 223 {
224 push(@out, "segment .text use32\n"); 224 local $tmp;
225 $tmp=<<___;
226%ifdef __omf__
227section code use32 class=code
228%else
229section .text
230%endif
231___
232 push(@out,$tmp);
225 } 233 }
226 234
227sub main'function_begin 235sub main'function_begin
diff --git a/src/lib/libcrypto/pkcs12/Makefile b/src/lib/libcrypto/pkcs12/Makefile
index 854b641f7c..bef4f27912 100644
--- a/src/lib/libcrypto/pkcs12/Makefile
+++ b/src/lib/libcrypto/pkcs12/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/pkcs12/Makefile 2# OpenSSL/crypto/pkcs12/Makefile
3# 3#
4 4
5DIR= pkcs12 5DIR= pkcs12
diff --git a/src/lib/libcrypto/pkcs7/Makefile b/src/lib/libcrypto/pkcs7/Makefile
index f15c65f690..a213ae2227 100644
--- a/src/lib/libcrypto/pkcs7/Makefile
+++ b/src/lib/libcrypto/pkcs7/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/pkcs7/Makefile 2# OpenSSL/crypto/pkcs7/Makefile
3# 3#
4 4
5DIR= pkcs7 5DIR= pkcs7
diff --git a/src/lib/libcrypto/rand/Makefile b/src/lib/libcrypto/rand/Makefile
index 665eaa18e5..b1d1a75f98 100644
--- a/src/lib/libcrypto/rand/Makefile
+++ b/src/lib/libcrypto/rand/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/rand/Makefile 2# OpenSSL/crypto/rand/Makefile
3# 3#
4 4
5DIR= rand 5DIR= rand
diff --git a/src/lib/libcrypto/rc2/Makefile b/src/lib/libcrypto/rc2/Makefile
index 18edaca6c6..34080ab741 100644
--- a/src/lib/libcrypto/rc2/Makefile
+++ b/src/lib/libcrypto/rc2/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/rc2/Makefile 2# OpenSSL/crypto/rc2/Makefile
3# 3#
4 4
5DIR= rc2 5DIR= rc2
@@ -82,7 +82,7 @@ rc2_cbc.o: rc2_cbc.c rc2_locl.h
82rc2_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 82rc2_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
83rc2_ecb.o: ../../include/openssl/rc2.h rc2_ecb.c rc2_locl.h 83rc2_ecb.o: ../../include/openssl/rc2.h rc2_ecb.c rc2_locl.h
84rc2_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h 84rc2_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
85rc2_skey.o: ../../include/openssl/opensslconf.h 85rc2_skey.o: ../../include/openssl/fips.h ../../include/openssl/opensslconf.h
86rc2_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h 86rc2_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h
87rc2_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 87rc2_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
88rc2_skey.o: ../../include/openssl/symhacks.h rc2_locl.h rc2_skey.c 88rc2_skey.o: ../../include/openssl/symhacks.h rc2_locl.h rc2_skey.c
diff --git a/src/lib/libcrypto/rc2/rc2speed.c b/src/lib/libcrypto/rc2/rc2speed.c
index 47d34b444e..4d0e1242ea 100644
--- a/src/lib/libcrypto/rc2/rc2speed.c
+++ b/src/lib/libcrypto/rc2/rc2speed.c
@@ -102,10 +102,10 @@ OPENSSL_DECLARE_EXIT
102#ifndef HZ 102#ifndef HZ
103#ifndef CLK_TCK 103#ifndef CLK_TCK
104#define HZ 100.0 104#define HZ 100.0
105#endif 105#else /* CLK_TCK */
106#else /* CLK_TCK */
107#define HZ ((double)CLK_TCK) 106#define HZ ((double)CLK_TCK)
108#endif 107#endif /* CLK_TCK */
108#endif /* HZ */
109 109
110#define BUFSIZE ((long)1024) 110#define BUFSIZE ((long)1024)
111long run=0; 111long run=0;
diff --git a/src/lib/libcrypto/rc4/Makefile b/src/lib/libcrypto/rc4/Makefile
index 64e06924f4..20d078ec87 100644
--- a/src/lib/libcrypto/rc4/Makefile
+++ b/src/lib/libcrypto/rc4/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/rc4/Makefile 2# OpenSSL/crypto/rc4/Makefile
3# 3#
4 4
5DIR= rc4 5DIR= rc4
@@ -66,10 +66,14 @@ asm/rx86bsdi.o: asm/rx86unix.cpp
66asm/rx86unix.cpp: asm/rc4-586.pl ../perlasm/x86asm.pl 66asm/rx86unix.cpp: asm/rc4-586.pl ../perlasm/x86asm.pl
67 (cd asm; $(PERL) rc4-586.pl cpp >rx86unix.cpp) 67 (cd asm; $(PERL) rc4-586.pl cpp >rx86unix.cpp)
68 68
69asm/rc4-amd64.s: asm/rc4-amd64.pl; $(PERL) asm/rc4-amd64.pl $@ 69asm/rc4-x86_64.s: asm/rc4-x86_64.pl; $(PERL) asm/rc4-x86_64.pl $@
70 70
71asm/rc4-ia64.s: asm/rc4-ia64.S 71asm/rc4-ia64.s: asm/rc4-ia64.S
72 $(CC) $(CFLAGS) -E asm/rc4-ia64.S > $@ 72 @case `awk '/^#define RC4_INT/{print$$NF}' $(TOP)/include/openssl/opensslconf.h` in \
73 int) set -x; $(CC) $(CFLAGS) -DSZ=4 -E asm/rc4-ia64.S > $@ ;; \
74 char) set -x; $(CC) $(CFLAGS) -DSZ=1 -E asm/rc4-ia64.S > $@ ;; \
75 *) exit 1 ;; \
76 esac
73 77
74files: 78files:
75 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO 79 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
@@ -116,7 +120,8 @@ rc4_enc.o: ../../include/openssl/symhacks.h ../cryptlib.h rc4_enc.c rc4_locl.h
116rc4_skey.o: ../../e_os.h ../../include/openssl/bio.h 120rc4_skey.o: ../../e_os.h ../../include/openssl/bio.h
117rc4_skey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 121rc4_skey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
118rc4_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 122rc4_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
119rc4_skey.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 123rc4_skey.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
124rc4_skey.o: ../../include/openssl/opensslconf.h
120rc4_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/rc4.h 125rc4_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/rc4.h
121rc4_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 126rc4_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
122rc4_skey.o: ../../include/openssl/symhacks.h ../cryptlib.h rc4_locl.h 127rc4_skey.o: ../../include/openssl/symhacks.h ../cryptlib.h rc4_locl.h
diff --git a/src/lib/libcrypto/rc4/asm/rc4-ia64.S b/src/lib/libcrypto/rc4/asm/rc4-ia64.S
index b517d2e88f..a322d0c718 100644
--- a/src/lib/libcrypto/rc4/asm/rc4-ia64.S
+++ b/src/lib/libcrypto/rc4/asm/rc4-ia64.S
@@ -7,7 +7,7 @@
7// disclaimed. 7// disclaimed.
8// ==================================================================== 8// ====================================================================
9 9
10.ident "rc4-ia64.S, Version 1.1" 10.ident "rc4-ia64.S, Version 2.0"
11.ident "IA-64 ISA artwork by Andy Polyakov <appro@fy.chalmers.se>" 11.ident "IA-64 ISA artwork by Andy Polyakov <appro@fy.chalmers.se>"
12 12
13// What's wrong with compiler generated code? Because of the nature of 13// What's wrong with compiler generated code? Because of the nature of
@@ -27,17 +27,10 @@
27// Legitimate "collisions" do occur within every 256^2 bytes window. 27// Legitimate "collisions" do occur within every 256^2 bytes window.
28// Fortunately there're enough free instruction slots to keep prior 28// Fortunately there're enough free instruction slots to keep prior
29// reference to key[x+1], detect "collision" and compensate for it. 29// reference to key[x+1], detect "collision" and compensate for it.
30// All this without sacrificing a single clock cycle:-) 30// All this without sacrificing a single clock cycle:-) Throughput is
31// Furthermore. In order to compress loop body to the minimum, I chose 31// ~210MBps on 900MHz CPU, which is is >3x faster than gcc generated
32// to deploy deposit instruction, which substitutes for the whole 32// code and +30% - if compared to HP-UX C. Unrolling loop below should
33// key->data+((x&255)<<log2(sizeof(key->data[0]))). This unfortunately 33// give >30% on top of that...
34// requires key->data to be aligned at sizeof(key->data) boundary.
35// This is why you'll find "RC4_INT pad[512-256-2];" addenum to RC4_KEY
36// and "d=(RC4_INT *)(((size_t)(d+255))&~(sizeof(key->data)-1));" in
37// rc4_skey.c [and rc4_enc.c, where it's retained for debugging
38// purposes]. Throughput is ~210MBps on 900MHz CPU, which is is >3x
39// faster than gcc generated code and +30% - if compared to HP-UX C.
40// Unrolling loop below should give >30% on top of that...
41 34
42.text 35.text
43.explicit 36.explicit
@@ -48,7 +41,9 @@
48# define ADDP add 41# define ADDP add
49#endif 42#endif
50 43
44#ifndef SZ
51#define SZ 4 // this is set to sizeof(RC4_INT) 45#define SZ 4 // this is set to sizeof(RC4_INT)
46#endif
52// SZ==4 seems to be optimal. At least SZ==8 is not any faster, not for 47// SZ==4 seems to be optimal. At least SZ==8 is not any faster, not for
53// assembler implementation, while SZ==1 code is ~30% slower. 48// assembler implementation, while SZ==1 code is ~30% slower.
54#if SZ==1 // RC4_INT is unsigned char 49#if SZ==1 // RC4_INT is unsigned char
@@ -101,45 +96,53 @@ RC4:
101 ADDP out=0,in3 96 ADDP out=0,in3
102 brp.loop.imp .Ltop,.Lexit-16 };; 97 brp.loop.imp .Ltop,.Lexit-16 };;
103{ .mmi; LDKEY yy=[key] // load key->y 98{ .mmi; LDKEY yy=[key] // load key->y
104 add ksch=(255+1)*SZ,key // as ksch will be used with 99 add ksch=SZ,key
105 // deposit instruction only,
106 // I don't have to &~255...
107 mov ar.lc=in1 } 100 mov ar.lc=in1 }
108{ .mmi; mov key_y[1]=r0 // guarantee inequality 101{ .mmi; mov key_y[1]=r0 // guarantee inequality
109 // in first iteration 102 // in first iteration
110 add xx=1,xx 103 add xx=1,xx
111 mov pr.rot=1<<16 };; 104 mov pr.rot=1<<16 };;
112{ .mii; nop.m 0 105{ .mii; nop.m 0
113 dep key_x[1]=xx,ksch,OFF,8 106 dep key_x[1]=xx,r0,OFF,8
114 mov ar.ec=3 };; // note that epilogue counter 107 mov ar.ec=3 };; // note that epilogue counter
115 // is off by 1. I compensate 108 // is off by 1. I compensate
116 // for this at exit... 109 // for this at exit...
117.Ltop: 110.Ltop:
118// The loop is scheduled for 3*(n+2) spin-rate on Itanium 2, which 111// The loop is scheduled for 4*(n+2) spin-rate on Itanium 2, which
119// theoretically gives asymptotic performance of clock frequency 112// theoretically gives asymptotic performance of clock frequency
120// divided by 3 bytes per seconds, or 500MBps on 1.5GHz CPU. Measured 113// divided by 4 bytes per seconds, or 400MBps on 1.6GHz CPU. This is
121// performance however is distinctly lower than 1/4:-( The culplrit 114// for sizeof(RC4_INT)==4. For smaller RC4_INT STKEY inadvertently
122// seems to be *(out++)=dat, which inadvertently splits the bundle, 115// splits the last bundle and you end up with 5*n spin-rate:-(
123// even though there is M-port available... Unrolling is due... 116// Originally the loop was scheduled for 3*n and relied on key
124// Unrolled loop should collect output with variable shift instruction 117// schedule to be aligned at 256*sizeof(RC4_INT) boundary. But
125// in order to avoid starvation for integer shifter... It should be 118// *(out++)=dat, which maps to st1, had same effect [inadvertent
126// possible to get pretty close to theoretical peak... 119// bundle split] and holded the loop back. Rescheduling for 4*n
127{ .mmi; (p16) LDKEY tx[0]=[key_x[1]] // tx=key[xx] 120// made it possible to eliminate dependence on specific alignment
128 (p17) LDKEY ty[0]=[key_y[1]] // ty=key[yy] 121// and allow OpenSSH keep "abusing" our API. Reaching for 3*n would
129 (p18) dep rnd[1]=rnd[1],ksch,OFF,8} // &key[(tx+ty)&255] 122// require unrolling, sticking to variable shift instruction for
123// collecting output [to avoid starvation for integer shifter] and
124// copying of key schedule to controlled place in stack [so that
125// deposit instruction can serve as substitute for whole
126// key->data+((x&255)<<log2(sizeof(key->data[0])))]...
130{ .mmi; (p19) st1 [out]=dat[3],1 // *(out++)=dat 127{ .mmi; (p19) st1 [out]=dat[3],1 // *(out++)=dat
131 (p16) add xx=1,xx // x++ 128 (p16) add xx=1,xx // x++
132 (p16) cmp.ne.unc p20,p21=key_x[1],key_y[1] };; 129 (p18) dep rnd[1]=rnd[1],r0,OFF,8 } // ((tx+ty)&255)<<OFF
130{ .mmi; (p16) add key_x[1]=ksch,key_x[1] // &key[xx&255]
131 (p17) add key_y[1]=ksch,key_y[1] };; // &key[yy&255]
132{ .mmi; (p16) LDKEY tx[0]=[key_x[1]] // tx=key[xx]
133 (p17) LDKEY ty[0]=[key_y[1]] // ty=key[yy]
134 (p16) dep key_x[0]=xx,r0,OFF,8 } // (xx&255)<<OFF
135{ .mmi; (p18) add rnd[1]=ksch,rnd[1] // &key[(tx+ty)&255]
136 (p16) cmp.ne.unc p20,p21=key_x[1],key_y[1] };;
133{ .mmi; (p18) LDKEY rnd[1]=[rnd[1]] // rnd=key[(tx+ty)&255] 137{ .mmi; (p18) LDKEY rnd[1]=[rnd[1]] // rnd=key[(tx+ty)&255]
134 (p16) ld1 dat[0]=[inp],1 // dat=*(inp++) 138 (p16) ld1 dat[0]=[inp],1 } // dat=*(inp++)
135 (p16) dep key_x[0]=xx,ksch,OFF,8 } // &key[xx&255]
136.pred.rel "mutex",p20,p21 139.pred.rel "mutex",p20,p21
137{ .mmi; (p21) add yy=yy,tx[1] // (p16) 140{ .mmi; (p21) add yy=yy,tx[1] // (p16)
138 (p20) add yy=yy,tx[0] // (p16) y+=tx 141 (p20) add yy=yy,tx[0] // (p16) y+=tx
139 (p21) mov tx[0]=tx[1] };; // (p16) 142 (p21) mov tx[0]=tx[1] };; // (p16)
140{ .mmi; (p17) STKEY [key_y[1]]=tx[1] // key[yy]=tx 143{ .mmi; (p17) STKEY [key_y[1]]=tx[1] // key[yy]=tx
141 (p17) STKEY [key_x[2]]=ty[0] // key[xx]=ty 144 (p17) STKEY [key_x[2]]=ty[0] // key[xx]=ty
142 (p16) dep key_y[0]=yy,ksch,OFF,8 } // &key[yy&255] 145 (p16) dep key_y[0]=yy,r0,OFF,8 } // &key[yy&255]
143{ .mmb; (p17) add rnd[0]=tx[1],ty[0] // tx+=ty 146{ .mmb; (p17) add rnd[0]=tx[1],ty[0] // tx+=ty
144 (p18) xor dat[2]=dat[2],rnd[1] // dat^=rnd 147 (p18) xor dat[2]=dat[2],rnd[1] // dat^=rnd
145 br.ctop.sptk .Ltop };; 148 br.ctop.sptk .Ltop };;
diff --git a/src/lib/libcrypto/rc5/Makefile b/src/lib/libcrypto/rc5/Makefile
index 3a8d309b29..16e6a60017 100644
--- a/src/lib/libcrypto/rc5/Makefile
+++ b/src/lib/libcrypto/rc5/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/rc5/Makefile 2# OpenSSL/crypto/rc5/Makefile
3# 3#
4 4
5DIR= rc5 5DIR= rc5
@@ -102,7 +102,7 @@ rc5_ecb.o: ../../include/openssl/opensslv.h ../../include/openssl/rc5.h
102rc5_ecb.o: rc5_ecb.c rc5_locl.h 102rc5_ecb.o: rc5_ecb.c rc5_locl.h
103rc5_enc.o: ../../include/openssl/rc5.h rc5_enc.c rc5_locl.h 103rc5_enc.o: ../../include/openssl/rc5.h rc5_enc.c rc5_locl.h
104rc5_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h 104rc5_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
105rc5_skey.o: ../../include/openssl/opensslconf.h 105rc5_skey.o: ../../include/openssl/fips.h ../../include/openssl/opensslconf.h
106rc5_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/rc5.h 106rc5_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/rc5.h
107rc5_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 107rc5_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
108rc5_skey.o: ../../include/openssl/symhacks.h rc5_locl.h rc5_skey.c 108rc5_skey.o: ../../include/openssl/symhacks.h rc5_locl.h rc5_skey.c
diff --git a/src/lib/libcrypto/ripemd/Makefile b/src/lib/libcrypto/ripemd/Makefile
index dc086e3434..20c8b4d8db 100644
--- a/src/lib/libcrypto/ripemd/Makefile
+++ b/src/lib/libcrypto/ripemd/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/ripemd/Makefile 2# OpenSSL/crypto/ripemd/Makefile
3# 3#
4 4
5DIR= ripemd 5DIR= ripemd
diff --git a/src/lib/libcrypto/rsa/Makefile b/src/lib/libcrypto/rsa/Makefile
index 5748b0d3d0..8851825250 100644
--- a/src/lib/libcrypto/rsa/Makefile
+++ b/src/lib/libcrypto/rsa/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/rsa/Makefile 2# OpenSSL/crypto/rsa/Makefile
3# 3#
4 4
5DIR= rsa 5DIR= rsa
@@ -24,10 +24,10 @@ APPS=
24LIB=$(TOP)/libcrypto.a 24LIB=$(TOP)/libcrypto.a
25LIBSRC= rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c rsa_saos.c rsa_err.c \ 25LIBSRC= rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c rsa_saos.c rsa_err.c \
26 rsa_pk1.c rsa_ssl.c rsa_none.c rsa_oaep.c rsa_chk.c rsa_null.c \ 26 rsa_pk1.c rsa_ssl.c rsa_none.c rsa_oaep.c rsa_chk.c rsa_null.c \
27 rsa_asn1.c 27 rsa_pss.c rsa_x931.c rsa_asn1.c
28LIBOBJ= rsa_eay.o rsa_gen.o rsa_lib.o rsa_sign.o rsa_saos.o rsa_err.o \ 28LIBOBJ= rsa_eay.o rsa_gen.o rsa_lib.o rsa_sign.o rsa_saos.o rsa_err.o \
29 rsa_pk1.o rsa_ssl.o rsa_none.o rsa_oaep.o rsa_chk.o rsa_null.o \ 29 rsa_pk1.o rsa_ssl.o rsa_none.o rsa_oaep.o rsa_chk.o rsa_null.o \
30 rsa_asn1.o 30 rsa_pss.o rsa_x931.o rsa_asn1.o
31 31
32SRC= $(LIBSRC) 32SRC= $(LIBSRC)
33 33
@@ -184,6 +184,26 @@ rsa_pk1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
184rsa_pk1.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h 184rsa_pk1.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
185rsa_pk1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 185rsa_pk1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
186rsa_pk1.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_pk1.c 186rsa_pk1.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_pk1.c
187rsa_pss.o: ../../e_os.h ../../include/openssl/aes.h
188rsa_pss.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
189rsa_pss.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
190rsa_pss.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
191rsa_pss.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
192rsa_pss.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
193rsa_pss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
194rsa_pss.o: ../../include/openssl/err.h ../../include/openssl/evp.h
195rsa_pss.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
196rsa_pss.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
197rsa_pss.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
198rsa_pss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
199rsa_pss.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
200rsa_pss.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
201rsa_pss.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
202rsa_pss.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
203rsa_pss.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
204rsa_pss.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
205rsa_pss.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
206rsa_pss.o: ../../include/openssl/ui_compat.h ../cryptlib.h rsa_pss.c
187rsa_saos.o: ../../e_os.h ../../include/openssl/aes.h 207rsa_saos.o: ../../e_os.h ../../include/openssl/aes.h
188rsa_saos.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 208rsa_saos.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
189rsa_saos.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 209rsa_saos.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
@@ -237,3 +257,13 @@ rsa_ssl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
237rsa_ssl.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h 257rsa_ssl.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
238rsa_ssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 258rsa_ssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
239rsa_ssl.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_ssl.c 259rsa_ssl.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_ssl.c
260rsa_x931.o: ../../e_os.h ../../include/openssl/asn1.h
261rsa_x931.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
262rsa_x931.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
263rsa_x931.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
264rsa_x931.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
265rsa_x931.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
266rsa_x931.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
267rsa_x931.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
268rsa_x931.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
269rsa_x931.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_x931.c
diff --git a/src/lib/libcrypto/rsa/rsa_test.c b/src/lib/libcrypto/rsa/rsa_test.c
index 924e9ad1f6..218bb2a39b 100644
--- a/src/lib/libcrypto/rsa/rsa_test.c
+++ b/src/lib/libcrypto/rsa/rsa_test.c
@@ -227,10 +227,10 @@ int main(int argc, char *argv[])
227 227
228 plen = sizeof(ptext_ex) - 1; 228 plen = sizeof(ptext_ex) - 1;
229 229
230 for (v = 0; v < 3; v++) 230 for (v = 0; v < 6; v++)
231 { 231 {
232 key = RSA_new(); 232 key = RSA_new();
233 switch (v) { 233 switch (v%3) {
234 case 0: 234 case 0:
235 clen = key1(key, ctext_ex); 235 clen = key1(key, ctext_ex);
236 break; 236 break;
@@ -241,6 +241,7 @@ int main(int argc, char *argv[])
241 clen = key3(key, ctext_ex); 241 clen = key3(key, ctext_ex);
242 break; 242 break;
243 } 243 }
244 if (v/3 > 1) key->flags |= RSA_FLAG_NO_EXP_CONSTTIME;
244 245
245 num = RSA_public_encrypt(plen, ptext_ex, ctext, key, 246 num = RSA_public_encrypt(plen, ptext_ex, ctext, key,
246 RSA_PKCS1_PADDING); 247 RSA_PKCS1_PADDING);
diff --git a/src/lib/libcrypto/sha/Makefile b/src/lib/libcrypto/sha/Makefile
index 0426786aa0..46103bbc83 100644
--- a/src/lib/libcrypto/sha/Makefile
+++ b/src/lib/libcrypto/sha/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/sha/Makefile 2# OpenSSL/crypto/sha/Makefile
3# 3#
4 4
5DIR= sha 5DIR= sha
diff --git a/src/lib/libcrypto/sha/sha_one.c b/src/lib/libcrypto/sha/sha_one.c
index e61c63f3e9..d4f4d344df 100644
--- a/src/lib/libcrypto/sha/sha_one.c
+++ b/src/lib/libcrypto/sha/sha_one.c
@@ -68,7 +68,8 @@ unsigned char *SHA(const unsigned char *d, unsigned long n, unsigned char *md)
68 static unsigned char m[SHA_DIGEST_LENGTH]; 68 static unsigned char m[SHA_DIGEST_LENGTH];
69 69
70 if (md == NULL) md=m; 70 if (md == NULL) md=m;
71 SHA_Init(&c); 71 if (!SHA_Init(&c))
72 return NULL;
72 SHA_Update(&c,d,n); 73 SHA_Update(&c,d,n);
73 SHA_Final(md,&c); 74 SHA_Final(md,&c);
74 OPENSSL_cleanse(&c,sizeof(c)); 75 OPENSSL_cleanse(&c,sizeof(c));
diff --git a/src/lib/libcrypto/stack/Makefile b/src/lib/libcrypto/stack/Makefile
index 4d5199a000..711b16832a 100644
--- a/src/lib/libcrypto/stack/Makefile
+++ b/src/lib/libcrypto/stack/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/stack/Makefile 2# OpenSSL/crypto/stack/Makefile
3# 3#
4 4
5DIR= stack 5DIR= stack
diff --git a/src/lib/libcrypto/txt_db/Makefile b/src/lib/libcrypto/txt_db/Makefile
index f91a08f006..3cb550a795 100644
--- a/src/lib/libcrypto/txt_db/Makefile
+++ b/src/lib/libcrypto/txt_db/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/txt_db/Makefile 2# OpenSSL/crypto/txt_db/Makefile
3# 3#
4 4
5DIR= txt_db 5DIR= txt_db
diff --git a/src/lib/libcrypto/util/checkhash.pl b/src/lib/libcrypto/util/checkhash.pl
new file mode 100644
index 0000000000..c61fa72178
--- /dev/null
+++ b/src/lib/libcrypto/util/checkhash.pl
@@ -0,0 +1,222 @@
1#!/usr/bin/env perl -w
2
3my $package = caller;
4
5if (!(defined $package))
6 {
7 my $retval = check_hashes(@ARGV);
8 exit $retval;
9 }
10
111;
12
13sub check_hashes
14 {
15
16 my @args = @_;
17
18 my $change_dir = "";
19 my $check_program = "sha/fips_standalone_sha1";
20
21 my $verbose = 0;
22 my $badfiles = 0;
23 my $rebuild = 0;
24 my $force_rewrite = 0;
25 my $hash_file = "fipshashes.c";
26 my $recurse = 0;
27
28 my @fingerprint_files;
29
30 while (@args)
31 {
32 my $arg = $args[0];
33 if ($arg eq "-chdir")
34 {
35 shift @args;
36 $change_dir = shift @args;
37 }
38 elsif ($arg eq "-rebuild")
39 {
40 shift @args;
41 $rebuild = 1;
42 }
43 elsif ($arg eq "-verbose")
44 {
45 shift @args;
46 $verbose = 1;
47 }
48 elsif ($arg eq "-force-rewrite")
49 {
50 shift @args;
51 $force_rewrite = 1;
52 }
53 elsif ($arg eq "-hash_file")
54 {
55 shift @args;
56 $hash_file = shift @args;
57 }
58 elsif ($arg eq "-recurse")
59 {
60 shift @args;
61 $recurse = 1;
62 }
63 elsif ($arg eq "-program_path")
64 {
65 shift @args;
66 $check_program = shift @args;
67 }
68 else
69 {
70 print STDERR "Unknown Option $arg";
71 return 1;
72 }
73
74 }
75
76 chdir $change_dir if $change_dir ne "";
77
78 if ($recurse)
79 {
80 @fingerprint_files = ("fingerprint.sha1",
81 <*/fingerprint.sha1>);
82 }
83 else
84 {
85 push @fingerprint_files, $hash_file;
86 }
87
88 foreach $fp (@fingerprint_files)
89 {
90 if (!open(IN, "$fp"))
91 {
92 print STDERR "Can't open file $fp";
93 return 1;
94 }
95 print STDERR "Opening Fingerprint file $fp\n" if $verbose;
96 my $dir = $fp;
97 $dir =~ s/[^\/]*$//;
98 while (<IN>)
99 {
100 chomp;
101 if (!(($file, $hash) = /^\"HMAC-SHA1\((.*)\)\s*=\s*(\w*)\",$/))
102 {
103 /^\"/ || next;
104 print STDERR "FATAL: Invalid syntax in file $fp\n";
105 print STDERR "Line:\n$_\n";
106 fatal_error();
107 return 1;
108 }
109 if (!$rebuild && length($hash) != 40)
110 {
111 print STDERR "FATAL: Invalid hash length in $fp for file $file\n";
112 fatal_error();
113 return 1;
114 }
115 push @hashed_files, "$dir$file";
116 if (exists $hashes{"$dir$file"})
117 {
118 print STDERR "FATAL: Duplicate Hash file $dir$file\n";
119 fatal_error();
120 return 1;
121 }
122 if (! -r "$dir$file")
123 {
124 print STDERR "FATAL: Can't access $dir$file\n";
125 fatal_error();
126 return 1;
127 }
128 $hashes{"$dir$file"} = $hash;
129 }
130 close IN;
131 }
132
133 @checked_hashes = `$check_program @hashed_files`;
134
135 if ($? != 0)
136 {
137 print STDERR "Error running hash program $check_program\n";
138 fatal_error();
139 return 1;
140 }
141
142 if (@checked_hashes != @hashed_files)
143 {
144 print STDERR "FATAL: hash count incorrect\n";
145 fatal_error();
146 return 1;
147 }
148
149 foreach (@checked_hashes)
150 {
151 chomp;
152 if (!(($file, $hash) = /^HMAC-SHA1\((.*)\)\s*=\s*(\w*)$/))
153 {
154 print STDERR "FATAL: Invalid syntax in file $fp\n";
155 print STDERR "Line:\n$_\n";
156 fatal_error();
157 return 1;
158 }
159 if (length($hash) != 40)
160 {
161 print STDERR "FATAL: Invalid hash length for file $file\n";
162 fatal_error();
163 return 1;
164 }
165 if ($hash ne $hashes{$file})
166 {
167 if ($rebuild)
168 {
169 print STDERR "Updating hash on file $file\n";
170 $hashes{$file} = $hash;
171 }
172 else
173 {
174 print STDERR "Hash check failed for file $file\n";
175 }
176 $badfiles++;
177 }
178 elsif ($verbose)
179 { print "Hash Check OK for $file\n";}
180 }
181
182
183 if ($badfiles && !$rebuild)
184 {
185 print STDERR "FATAL: hash mismatch on $badfiles files\n";
186 fatal_error();
187 return 1;
188 }
189
190 if ($badfiles || $force_rewrite)
191 {
192 print "Updating Hash file $hash_file\n";
193 if (!open(OUT, ">$hash_file"))
194 {
195 print STDERR "Error rewriting $hash_file";
196 return 1;
197 }
198 print OUT "const char * const FIPS_source_hashes[] = {\n";
199 foreach (@hashed_files)
200 {
201 print OUT "\"HMAC-SHA1($_)= $hashes{$_}\",\n";
202 }
203 print OUT "};\n";
204 close OUT;
205 }
206
207 if (!$badfiles)
208 {
209 print "FIPS hash check successful\n";
210 }
211
212 return 0;
213
214 }
215
216
217sub fatal_error
218 {
219 print STDERR "*** Your source code does not match the FIPS validated source ***\n";
220 }
221
222
diff --git a/src/lib/libcrypto/util/fipslink.pl b/src/lib/libcrypto/util/fipslink.pl
new file mode 100644
index 0000000000..a893833c5c
--- /dev/null
+++ b/src/lib/libcrypto/util/fipslink.pl
@@ -0,0 +1,78 @@
1#!/usr/bin/perl
2
3sub check_env
4 {
5 my @ret;
6 foreach (@_)
7 {
8 die "Environment variable $_ not defined!\n" unless exists $ENV{$_};
9 push @ret, $ENV{$_};
10 }
11 return @ret;
12 }
13
14
15my ($fips_cc,$fips_cc_args, $fips_link,$fips_target, $fips_libdir, $sha1_exe)
16 = check_env("FIPS_CC", "FIPS_CC_ARGS", "FIPS_LINK", "FIPS_TARGET",
17 "FIPSLIB_D", "FIPS_SHA1_EXE");
18
19
20
21if (exists $ENV{"PREMAIN_DSO_EXE"})
22 {
23 $fips_premain_dso = $ENV{"PREMAIN_DSO_EXE"};
24 }
25 else
26 {
27 $fips_premain_dso = "";
28 }
29
30check_hash($sha1_exe, "fips_premain.c");
31check_hash($sha1_exe, "fipscanister.o");
32
33
34print "Integrity check OK\n";
35
36print "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c\n";
37system "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c";
38die "First stage Compile failure" if $? != 0;
39
40print "$fips_link @ARGV\n";
41system "$fips_link @ARGV";
42die "First stage Link failure" if $? != 0;
43
44
45print "$fips_premain_dso $fips_target\n";
46$fips_hash=`$fips_premain_dso $fips_target`;
47chomp $fips_hash;
48die "Get hash failure" if $? != 0;
49
50
51print "$fips_cc -DHMAC_SHA1_SIG=\\\"$fips_hash\\\" $fips_cc_args $fips_libdir/fips_premain.c\n";
52system "$fips_cc -DHMAC_SHA1_SIG=\\\"$fips_hash\\\" $fips_cc_args $fips_libdir/fips_premain.c";
53die "Second stage Compile failure" if $? != 0;
54
55
56print "$fips_link @ARGV\n";
57system "$fips_link @ARGV";
58die "Second stage Link failure" if $? != 0;
59
60sub check_hash
61 {
62 my ($sha1_exe, $filename) = @_;
63 my ($hashfile, $hashval);
64
65 open(IN, "${fips_libdir}/${filename}.sha1") || die "Cannot open file hash file ${fips_libdir}/${filename}.sha1";
66 $hashfile = <IN>;
67 close IN;
68 $hashval = `$sha1_exe ${fips_libdir}/$filename`;
69 chomp $hashfile;
70 chomp $hashval;
71 $hashfile =~ s/^.*=\s+//;
72 $hashval =~ s/^.*=\s+//;
73 die "Invalid hash syntax in file" if (length($hashfile) != 40);
74 die "Invalid hash received for file" if (length($hashval) != 40);
75 die "***HASH VALUE MISMATCH FOR FILE $filename ***" if ($hashval ne $hashfile);
76 }
77
78
diff --git a/src/lib/libcrypto/util/libeay.num b/src/lib/libcrypto/util/libeay.num
index 56fb7446e0..4222bef6d6 100644
--- a/src/lib/libcrypto/util/libeay.num
+++ b/src/lib/libcrypto/util/libeay.num
@@ -2811,7 +2811,7 @@ EVP_aes_192_cfb8 3252 EXIST::FUNCTION:AES
2811FIPS_mode_set 3253 EXIST:OPENSSL_FIPS:FUNCTION: 2811FIPS_mode_set 3253 EXIST:OPENSSL_FIPS:FUNCTION:
2812FIPS_selftest_dsa 3254 EXIST:OPENSSL_FIPS:FUNCTION: 2812FIPS_selftest_dsa 3254 EXIST:OPENSSL_FIPS:FUNCTION:
2813EVP_aes_256_cfb8 3255 EXIST::FUNCTION:AES 2813EVP_aes_256_cfb8 3255 EXIST::FUNCTION:AES
2814FIPS_allow_md5 3256 EXIST:OPENSSL_FIPS:FUNCTION: 2814FIPS_allow_md5 3256 NOEXIST::FUNCTION:
2815DES_ede3_cfb_encrypt 3257 EXIST::FUNCTION:DES 2815DES_ede3_cfb_encrypt 3257 EXIST::FUNCTION:DES
2816EVP_des_ede3_cfb8 3258 EXIST::FUNCTION:DES 2816EVP_des_ede3_cfb8 3258 EXIST::FUNCTION:DES
2817FIPS_rand_seeded 3259 EXIST:OPENSSL_FIPS:FUNCTION: 2817FIPS_rand_seeded 3259 EXIST:OPENSSL_FIPS:FUNCTION:
@@ -2837,7 +2837,7 @@ FIPS_dsa_check 3278 EXIST:OPENSSL_FIPS:FUNCTION:
2837AES_cfb1_encrypt 3279 EXIST::FUNCTION:AES 2837AES_cfb1_encrypt 3279 EXIST::FUNCTION:AES
2838EVP_des_ede3_cfb1 3280 EXIST::FUNCTION:DES 2838EVP_des_ede3_cfb1 3280 EXIST::FUNCTION:DES
2839FIPS_rand_check 3281 EXIST:OPENSSL_FIPS:FUNCTION: 2839FIPS_rand_check 3281 EXIST:OPENSSL_FIPS:FUNCTION:
2840FIPS_md5_allowed 3282 EXIST:OPENSSL_FIPS:FUNCTION: 2840FIPS_md5_allowed 3282 NOEXIST::FUNCTION:
2841FIPS_mode 3283 EXIST:OPENSSL_FIPS:FUNCTION: 2841FIPS_mode 3283 EXIST:OPENSSL_FIPS:FUNCTION:
2842FIPS_selftest_failed 3284 EXIST:OPENSSL_FIPS:FUNCTION: 2842FIPS_selftest_failed 3284 EXIST:OPENSSL_FIPS:FUNCTION:
2843sk_is_sorted 3285 EXIST::FUNCTION: 2843sk_is_sorted 3285 EXIST::FUNCTION:
@@ -2867,3 +2867,41 @@ PROXY_CERT_INFO_EXTENSION_it 3307 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIA
2867PROXY_CERT_INFO_EXTENSION_it 3307 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: 2867PROXY_CERT_INFO_EXTENSION_it 3307 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2868PROXY_POLICY_free 3308 EXIST::FUNCTION: 2868PROXY_POLICY_free 3308 EXIST::FUNCTION:
2869PROXY_POLICY_new 3309 EXIST::FUNCTION: 2869PROXY_POLICY_new 3309 EXIST::FUNCTION:
2870BN_MONT_CTX_set_locked 3310 EXIST::FUNCTION:
2871FIPS_selftest_rng 3311 EXIST:OPENSSL_FIPS:FUNCTION:
2872EVP_sha384 3312 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512
2873EVP_sha512 3313 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512
2874EVP_sha224 3314 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256
2875EVP_sha256 3315 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256
2876FIPS_selftest_hmac 3316 EXIST:OPENSSL_FIPS:FUNCTION:
2877FIPS_corrupt_rng 3317 EXIST:OPENSSL_FIPS:FUNCTION:
2878BN_mod_exp_mont_consttime 3318 EXIST::FUNCTION:
2879RSA_X931_hash_id 3319 EXIST::FUNCTION:RSA
2880RSA_padding_check_X931 3320 EXIST::FUNCTION:RSA
2881RSA_verify_PKCS1_PSS 3321 EXIST::FUNCTION:RSA
2882RSA_padding_add_X931 3322 EXIST::FUNCTION:RSA
2883RSA_padding_add_PKCS1_PSS 3323 EXIST::FUNCTION:RSA
2884PKCS1_MGF1 3324 EXIST::FUNCTION:RSA
2885BN_X931_generate_Xpq 3325 EXIST:OPENSSL_FIPS:FUNCTION:
2886RSA_X931_generate_key 3326 EXIST:OPENSSL_FIPS:FUNCTION:RSA
2887BN_X931_derive_prime 3327 EXIST:OPENSSL_FIPS:FUNCTION:
2888BN_X931_generate_prime 3328 EXIST:OPENSSL_FIPS:FUNCTION:
2889RSA_X931_derive 3329 EXIST:OPENSSL_FIPS:FUNCTION:RSA
2890SHA512_Update 3356 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512
2891SHA256_Init 3479 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256
2892SHA224 3510 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256
2893SHA384_Update 3551 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512
2894SHA224_Final 3560 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256
2895SHA224_Update 3562 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256
2896SHA512_Final 3581 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512
2897SHA224_Init 3631 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256
2898SHA512_Init 3633 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512
2899SHA256 3654 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256
2900SHA256_Transform 3664 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256
2901SHA512 3669 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512
2902SHA512_Transform 3675 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512
2903SHA256_Final 3712 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256
2904SHA384_Init 3737 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512
2905SHA384_Final 3740 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512
2906SHA384 3745 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512
2907SHA256_Update 3765 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256
diff --git a/src/lib/libcrypto/util/mk1mf.pl b/src/lib/libcrypto/util/mk1mf.pl
index 957264c6b5..05a6086164 100644
--- a/src/lib/libcrypto/util/mk1mf.pl
+++ b/src/lib/libcrypto/util/mk1mf.pl
@@ -10,6 +10,20 @@ $OPTIONS="";
10$ssl_version=""; 10$ssl_version="";
11$banner="\t\@echo Building OpenSSL"; 11$banner="\t\@echo Building OpenSSL";
12 12
13local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic
14local $zlib_lib = "";
15
16my $fips_canister_path = "";
17my $fips_premain_dso_exe_path = "";
18my $fips_premain_c_path = "";
19my $fips_sha1_exe_path = "";
20
21my $fipslibdir = "";
22my $baseaddr = "";
23
24my $ex_l_libs = "";
25
26
13open(IN,"<Makefile") || die "unable to open Makefile!\n"; 27open(IN,"<Makefile") || die "unable to open Makefile!\n";
14while(<IN>) { 28while(<IN>) {
15 $ssl_version=$1 if (/^VERSION=(.*)$/); 29 $ssl_version=$1 if (/^VERSION=(.*)$/);
@@ -24,6 +38,7 @@ $infile="MINFO";
24 38
25%ops=( 39%ops=(
26 "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X", 40 "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X",
41 "VC-WIN32-GMAKE", "Microsoft Visual C++ [4-6] - Windows NT or 9X, GNU make",
27 "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY", 42 "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY",
28 "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", 43 "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY",
29 "VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286", 44 "VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286",
@@ -43,6 +58,7 @@ $infile="MINFO";
43 ); 58 );
44 59
45$platform=""; 60$platform="";
61my $xcflags="";
46foreach (@ARGV) 62foreach (@ARGV)
47 { 63 {
48 if (!&read_options && !defined($ops{$_})) 64 if (!&read_options && !defined($ops{$_}))
@@ -104,8 +120,12 @@ $inc_def="outinc";
104$tmp_def="tmp"; 120$tmp_def="tmp";
105 121
106$mkdir="-mkdir"; 122$mkdir="-mkdir";
123$mkcanister="ld -r -o";
124
125$ex_build_targets = "";
107 126
108($ssl,$crypto)=("ssl","crypto"); 127($ssl,$crypto)=("ssl","crypto");
128$cryptocompat = "";
109$ranlib="echo ranlib"; 129$ranlib="echo ranlib";
110 130
111$cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc'; 131$cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc';
@@ -140,6 +160,10 @@ elsif (($platform eq "VC-WIN32") || ($platform eq "VC-NT"))
140 $NT = 1 if $platform eq "VC-NT"; 160 $NT = 1 if $platform eq "VC-NT";
141 require 'VC-32.pl'; 161 require 'VC-32.pl';
142 } 162 }
163elsif ($platform eq "VC-WIN32-GMAKE")
164 {
165 require 'VC-32-GMAKE.pl';
166 }
143elsif ($platform eq "VC-CE") 167elsif ($platform eq "VC-CE")
144 { 168 {
145 require 'VC-CE.pl'; 169 require 'VC-CE.pl';
@@ -210,6 +234,8 @@ $inc_dir=(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def;
210 234
211$bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq '')); 235$bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq ''));
212 236
237$cflags= "$xcflags$cflags" if $xcflags ne "";
238
213$cflags.=" -DOPENSSL_NO_IDEA" if $no_idea; 239$cflags.=" -DOPENSSL_NO_IDEA" if $no_idea;
214$cflags.=" -DOPENSSL_NO_AES" if $no_aes; 240$cflags.=" -DOPENSSL_NO_AES" if $no_aes;
215$cflags.=" -DOPENSSL_NO_RC2" if $no_rc2; 241$cflags.=" -DOPENSSL_NO_RC2" if $no_rc2;
@@ -239,6 +265,9 @@ $cflags.=" -DOPENSSL_NO_HW" if $no_hw;
239$cflags.=" -DOPENSSL_FIPS" if $fips; 265$cflags.=" -DOPENSSL_FIPS" if $fips;
240#$cflags.=" -DRSAref" if $rsaref ne ""; 266#$cflags.=" -DRSAref" if $rsaref ne "";
241 267
268$cflags.= " -DZLIB" if $zlib_opt;
269$cflags.= " -DZLIB_SHARED" if $zlib_opt == 2;
270
242## if ($unix) 271## if ($unix)
243## { $cflags="$c_flags" if ($c_flags ne ""); } 272## { $cflags="$c_flags" if ($c_flags ne ""); }
244##else 273##else
@@ -246,6 +275,7 @@ $cflags.=" -DOPENSSL_FIPS" if $fips;
246 275
247$ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); 276$ex_libs="$l_flags$ex_libs" if ($l_flags ne "");
248 277
278
249%shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", 279%shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL",
250 "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); 280 "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO");
251 281
@@ -262,6 +292,135 @@ $link="$bin_dir$link" if ($link !~ /^\$/);
262 292
263$INSTALLTOP =~ s|/|$o|g; 293$INSTALLTOP =~ s|/|$o|g;
264 294
295#############################################
296# We parse in input file and 'store' info for later printing.
297open(IN,"<$infile") || die "unable to open $infile:$!\n";
298$_=<IN>;
299for (;;)
300 {
301 chop;
302
303 ($key,$val)=/^([^=]+)=(.*)/;
304 if ($key eq "RELATIVE_DIRECTORY")
305 {
306 if ($lib ne "")
307 {
308 if ($fips && $dir =~ /^fips/)
309 {
310 $uc = "FIPS";
311 }
312 else
313 {
314 $uc=$lib;
315 $uc =~ s/^lib(.*)\.a/$1/;
316 $uc =~ tr/a-z/A-Z/;
317 }
318 if (($uc ne "FIPS") || $fips_canister_build)
319 {
320 $lib_nam{$uc}=$uc;
321 $lib_obj{$uc}.=$libobj." ";
322 }
323 }
324 last if ($val eq "FINISHED");
325 $lib="";
326 $libobj="";
327 $dir=$val;
328 }
329
330 if ($key eq "KRB5_INCLUDES")
331 { $cflags .= " $val";}
332
333 if ($key eq "ZLIB_INCLUDE")
334 { $cflags .= " $val" if $val ne "";}
335
336 if ($key eq "LIBZLIB")
337 { $zlib_lib = "$val" if $val ne "";}
338
339 if ($key eq "LIBKRB5")
340 { $ex_libs .= " $val" if $val ne "";}
341
342 if ($key eq "TEST")
343 { $test.=&var_add($dir,$val); }
344
345 if (($key eq "PROGS") || ($key eq "E_OBJ"))
346 { $e_exe.=&var_add($dir,$val); }
347
348 if ($key eq "LIB")
349 {
350 $lib=$val;
351 $lib =~ s/^.*\/([^\/]+)$/$1/;
352 }
353
354 if ($key eq "EXHEADER")
355 { $exheader.=&var_add($dir,$val); }
356
357 if ($key eq "HEADER")
358 { $header.=&var_add($dir,$val); }
359
360 if ($key eq "LIBOBJ")
361 { $libobj=&var_add($dir,$val); }
362
363 if ($key eq "FIPSLIBDIR")
364 { $fipslibdir=$val;}
365
366 if ($key eq "BASEADDR")
367 { $baseaddr=$val;}
368
369 if (!($_=<IN>))
370 { $_="RELATIVE_DIRECTORY=FINISHED\n"; }
371 }
372close(IN);
373
374if ($fips_canister_path eq "")
375 {
376 $fips_canister_path = "\$(FIPSLIB_D)${o}fipscanister.o";
377 }
378
379if ($fips_premain_c_path eq "")
380 {
381 $fips_premain_c_path = "\$(FIPSLIB_D)${o}fips_premain.c";
382 }
383
384if ($fips)
385 {
386 if ($fips_sha1_exe_path eq "")
387 {
388 $fips_sha1_exe_path =
389 "\$(BIN_D)${o}fips_standalone_sha1$exep";
390 }
391 }
392 else
393 {
394 $fips_sha1_exe_path = "";
395 }
396
397if ($fips_premain_dso_exe_path eq "")
398 {
399 $fips_premain_dso_exe_path = "\$(BIN_D)${o}fips_premain_dso$exep";
400 }
401
402# $ex_build_targets .= "\$(BIN_D)${o}\$(E_PREMAIN_DSO)$exep" if ($fips);
403
404if ($fips)
405 {
406 if (!$shlib)
407 {
408 $ex_build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)";
409 $ex_l_libs .= " \$(O_FIPSCANISTER)";
410 }
411 if ($fipslibdir eq "")
412 {
413 open (IN, "util/fipslib_path.txt") || fipslib_error();
414 $fipslibdir = <IN>;
415 chomp $fipslibdir;
416 close IN;
417 }
418 fips_check_files($fipslibdir,
419 "fipscanister.o", "fipscanister.o.sha1",
420 "fips_premain.c", "fips_premain.c.sha1");
421 }
422
423
265$defs= <<"EOF"; 424$defs= <<"EOF";
266# This makefile has been automatically generated from the OpenSSL distribution. 425# This makefile has been automatically generated from the OpenSSL distribution.
267# This single makefile will build the complete OpenSSL distribution and 426# This single makefile will build the complete OpenSSL distribution and
@@ -286,6 +445,7 @@ if ($platform eq "VC-CE")
286!INCLUDE <\$(WCECOMPAT)/wcedefs.mak> 445!INCLUDE <\$(WCECOMPAT)/wcedefs.mak>
287 446
288EOF 447EOF
448 $ex_libs .= " $zlib_lib" if $zlib_opt == 1;
289 } 449 }
290 450
291$defs.= <<"EOF"; 451$defs.= <<"EOF";
@@ -308,6 +468,8 @@ EX_LIBS=$ex_libs
308SRC_D=$src_dir 468SRC_D=$src_dir
309 469
310LINK=$link 470LINK=$link
471PERL=perl
472FIPSLINK=\$(PERL) util${o}fipslink.pl
311LFLAGS=$lflags 473LFLAGS=$lflags
312 474
313BN_ASM_OBJ=$bn_asm_obj 475BN_ASM_OBJ=$bn_asm_obj
@@ -339,6 +501,9 @@ TMP_D=$tmp_dir
339INC_D=$inc_dir 501INC_D=$inc_dir
340INCO_D=$inc_dir${o}openssl 502INCO_D=$inc_dir${o}openssl
341 503
504# Directory containing FIPS module
505
506
342CP=$cp 507CP=$cp
343RM=$rm 508RM=$rm
344RANLIB=$ranlib 509RANLIB=$ranlib
@@ -346,6 +511,18 @@ MKDIR=$mkdir
346MKLIB=$bin_dir$mklib 511MKLIB=$bin_dir$mklib
347MLFLAGS=$mlflags 512MLFLAGS=$mlflags
348ASM=$bin_dir$asm 513ASM=$bin_dir$asm
514MKCANISTER=$mkcanister
515
516# FIPS validated module and support file locations
517
518E_PREMAIN_DSO=fips_premain_dso
519
520FIPSLIB_D=$fipslibdir
521BASEADDR=$baseaddr
522FIPS_PREMAIN_SRC=$fips_premain_c_path
523O_FIPSCANISTER=$fips_canister_path
524FIPS_SHA1_EXE=$fips_sha1_exe_path
525PREMAIN_DSO_EXE=$fips_premain_dso_exe_path
349 526
350###################################################### 527######################################################
351# You should not need to touch anything below this point 528# You should not need to touch anything below this point
@@ -377,7 +554,7 @@ SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp
377L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp 554L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp
378L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp 555L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp
379 556
380L_LIBS= \$(L_SSL) \$(L_CRYPTO) 557L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs
381 558
382###################################################### 559######################################################
383# Don't touch anything below this point 560# Don't touch anything below this point
@@ -387,13 +564,13 @@ INC=-I\$(INC_D) -I\$(INCL_D)
387APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) 564APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG)
388LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) 565LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG)
389SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) 566SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG)
390LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) 567LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) $ex_libs_dep
391 568
392############################################# 569#############################################
393EOF 570EOF
394 571
395$rules=<<"EOF"; 572$rules=<<"EOF";
396all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe 573all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers \$(FIPS_SHA1_EXE) lib exe $ex_build_targets
397 574
398banner: 575banner:
399$banner 576$banner
@@ -479,57 +656,6 @@ printf OUT " #define DATE \"%s\"\n", scalar gmtime();
479printf OUT "#endif\n"; 656printf OUT "#endif\n";
480close(OUT); 657close(OUT);
481 658
482#############################################
483# We parse in input file and 'store' info for later printing.
484open(IN,"<$infile") || die "unable to open $infile:$!\n";
485$_=<IN>;
486for (;;)
487 {
488 chop;
489
490 ($key,$val)=/^([^=]+)=(.*)/;
491 if ($key eq "RELATIVE_DIRECTORY")
492 {
493 if ($lib ne "")
494 {
495 $uc=$lib;
496 $uc =~ s/^lib(.*)\.a/$1/;
497 $uc =~ tr/a-z/A-Z/;
498 $lib_nam{$uc}=$uc;
499 $lib_obj{$uc}.=$libobj." ";
500 }
501 last if ($val eq "FINISHED");
502 $lib="";
503 $libobj="";
504 $dir=$val;
505 }
506
507 if ($key eq "TEST")
508 { $test.=&var_add($dir,$val); }
509
510 if (($key eq "PROGS") || ($key eq "E_OBJ"))
511 { $e_exe.=&var_add($dir,$val); }
512
513 if ($key eq "LIB")
514 {
515 $lib=$val;
516 $lib =~ s/^.*\/([^\/]+)$/$1/;
517 }
518
519 if ($key eq "EXHEADER")
520 { $exheader.=&var_add($dir,$val); }
521
522 if ($key eq "HEADER")
523 { $header.=&var_add($dir,$val); }
524
525 if ($key eq "LIBOBJ")
526 { $libobj=&var_add($dir,$val); }
527
528 if (!($_=<IN>))
529 { $_="RELATIVE_DIRECTORY=FINISHED\n"; }
530 }
531close(IN);
532
533# Strip of trailing ' ' 659# Strip of trailing ' '
534foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); } 660foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); }
535$test=&clean_up_ws($test); 661$test=&clean_up_ws($test);
@@ -554,6 +680,29 @@ $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)");
554$defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); 680$defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj);
555$rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); 681$rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)');
556 682
683# Special case rules for fips_start and fips_end fips_premain_dso
684
685if ($fips)
686 {
687 if ($fips_canister_build)
688 {
689 $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_start$obj",
690 "fips-1.0${o}fips_canister.c",
691 "-DFIPS_START \$(SHLIB_CFLAGS)");
692 $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_end$obj",
693 "fips-1.0${o}fips_canister.c", "\$(SHLIB_CFLAGS)");
694 }
695 $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_standalone_sha1$obj",
696 "fips-1.0${o}sha${o}fips_standalone_sha1.c",
697 "\$(SHLIB_CFLAGS)");
698 $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_sha1dgst$obj",
699 "fips-1.0${o}sha${o}fips_sha1dgst.c",
700 "\$(SHLIB_CFLAGS)") unless $fips_canister_build;
701 $rules.=&cc_compile_target("\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj",
702 "fips-1.0${o}fips_premain.c",
703 "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(SHLIB_CFLAGS)");
704 }
705
557foreach (values %lib_nam) 706foreach (values %lib_nam)
558 { 707 {
559 $lib_obj=$lib_obj{$_}; 708 $lib_obj=$lib_obj{$_};
@@ -630,16 +779,42 @@ foreach (split(/\s+/,$test))
630 } 779 }
631 780
632$rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); 781$rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)");
633$rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)"); 782
634 783
635if ($fips) 784if ($fips)
636 { 785 {
637 $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)","\$(BIN_D)$o.sha1","\$(BIN_D)$o\$(E_EXE)$exep"); 786 if ($shlib)
787 {
788 $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)",
789 "\$(O_CRYPTO)",
790 "$crypto",
791 $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)");
792 }
793 else
794 {
795 $rules.= &do_lib_rule("\$(CRYPTOOBJ)",
796 "\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)", "");
797 $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)",
798 "\$(LIB_D)$o$crypto_compat",$crypto,$shlib,"\$(SO_CRYPTO)", "");
799 }
638 } 800 }
639else 801 else
640 { 802 {
641 $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); 803 $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,
804 "\$(SO_CRYPTO)");
642 } 805 }
806
807
808if ($fips)
809 {
810 $rules.= &do_rlink_rule("\$(O_FIPSCANISTER)", "\$(OBJ_D)${o}fips_start$obj \$(FIPSOBJ) \$(OBJ_D)${o}fips_end$obj", "\$(FIPSLIB_D)${o}fips_standalone_sha1$exep", "") if $fips_canister_build;
811 $rules.=&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1);
812
813 $rules.=&do_link_rule("\$(FIPS_SHA1_EXE)","\$(OBJ_D)${o}fips_standalone_sha1$obj \$(OBJ_D)${o}fips_sha1dgst$obj","","", 1);
814 }
815
816 $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)",0);
817
643print $defs; 818print $defs;
644 819
645if ($platform eq "linux-elf") { 820if ($platform eq "linux-elf") {
@@ -935,6 +1110,24 @@ sub read_options
935 elsif (/^shlib$/) { $shlib=1; } 1110 elsif (/^shlib$/) { $shlib=1; }
936 elsif (/^dll$/) { $shlib=1; } 1111 elsif (/^dll$/) { $shlib=1; }
937 elsif (/^shared$/) { } # We just need to ignore it for now... 1112 elsif (/^shared$/) { } # We just need to ignore it for now...
1113 elsif (/^zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 }
1114 elsif (/^zlib-dynamic$/){ $zlib_opt = 2; }
1115 elsif (/^--with-krb5-flavor=(.*)$/)
1116 {
1117 my $krb5_flavor = $1;
1118 if ($krb5_flavor =~ /^force-[Hh]eimdal$/)
1119 {
1120 $xcflags="-DKRB5_HEIMDAL $xcflags";
1121 }
1122 elsif ($krb5_flavor =~ /^MIT/i)
1123 {
1124 $xcflags="-DKRB5_MIT $xcflags";
1125 if ($krb5_flavor =~ /^MIT[._-]*1[._-]*[01]/i)
1126 {
1127 $xcflags="-DKRB5_MIT_OLD11 $xcflags"
1128 }
1129 }
1130 }
938 elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } 1131 elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; }
939 elsif (/^-[lL].*$/) { $l_flags.="$_ "; } 1132 elsif (/^-[lL].*$/) { $l_flags.="$_ "; }
940 elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) 1133 elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/)
@@ -942,3 +1135,31 @@ sub read_options
942 else { return(0); } 1135 else { return(0); }
943 return(1); 1136 return(1);
944 } 1137 }
1138
1139sub fipslib_error
1140 {
1141 print STDERR "***FIPS module directory sanity check failed***\n";
1142 print STDERR "FIPS module build failed, or was deleted\n";
1143 print STDERR "Please rebuild FIPS module.\n";
1144 exit 1;
1145 }
1146
1147sub fips_check_files
1148 {
1149 my $dir = shift @_;
1150 my $ret = 1;
1151 if (!-d $dir)
1152 {
1153 print STDERR "FIPS module directory $dir does not exist\n";
1154 fipslib_error();
1155 }
1156 foreach (@_)
1157 {
1158 if (!-f "$dir${o}$_")
1159 {
1160 print STDERR "FIPS module file $_ does not exist!\n";
1161 $ret = 0;
1162 }
1163 }
1164 fipslib_error() if ($ret == 0);
1165 }
diff --git a/src/lib/libcrypto/util/mkdef.pl b/src/lib/libcrypto/util/mkdef.pl
index 9918c3d549..6c1e53bb14 100644
--- a/src/lib/libcrypto/util/mkdef.pl
+++ b/src/lib/libcrypto/util/mkdef.pl
@@ -83,7 +83,7 @@ my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT",
83my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" ); 83my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" );
84my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", 84my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF",
85 "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1", 85 "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1",
86 "RIPEMD", 86 "SHA256", "SHA512", "RIPEMD",
87 "MDC2", "RSA", "DSA", "DH", "EC", "HMAC", "AES", 87 "MDC2", "RSA", "DSA", "DH", "EC", "HMAC", "AES",
88 # Envelope "algorithms" 88 # Envelope "algorithms"
89 "EVP", "X509", "ASN1_TYPEDEFS", 89 "EVP", "X509", "ASN1_TYPEDEFS",
@@ -267,7 +267,7 @@ $crypto.=" crypto/ocsp/ocsp.h";
267$crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h"; 267$crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h";
268$crypto.=" crypto/krb5/krb5_asn.h"; 268$crypto.=" crypto/krb5/krb5_asn.h";
269$crypto.=" crypto/tmdiff.h"; 269$crypto.=" crypto/tmdiff.h";
270$crypto.=" fips/fips.h fips/rand/fips_rand.h"; 270$crypto.=" fips-1.0/fips.h fips-1.0/rand/fips_rand.h fips-1.0/sha/fips_sha.h";
271 271
272my $symhacks="crypto/symhacks.h"; 272my $symhacks="crypto/symhacks.h";
273 273
@@ -864,6 +864,9 @@ sub do_defs
864 $a .= ",RSA" if($s =~ /PEM_Seal(Final|Init|Update)/); 864 $a .= ",RSA" if($s =~ /PEM_Seal(Final|Init|Update)/);
865 $a .= ",RSA" if($s =~ /RSAPrivateKey/); 865 $a .= ",RSA" if($s =~ /RSAPrivateKey/);
866 $a .= ",RSA" if($s =~ /SSLv23?_((client|server)_)?method/); 866 $a .= ",RSA" if($s =~ /SSLv23?_((client|server)_)?method/);
867 # SHA2 algorithms only defined in FIPS mode for
868 # OpenSSL 0.9.7
869 $p .= "OPENSSL_FIPS" if($s =~ /SHA[235]/);
867 870
868 $platform{$s} = 871 $platform{$s} =
869 &reduce_platforms((defined($platform{$s})?$platform{$s}.',':"").$p); 872 &reduce_platforms((defined($platform{$s})?$platform{$s}.',':"").$p);
@@ -1011,7 +1014,7 @@ sub is_valid
1011{ 1014{
1012 my ($keywords_txt,$platforms) = @_; 1015 my ($keywords_txt,$platforms) = @_;
1013 my (@keywords) = split /,/,$keywords_txt; 1016 my (@keywords) = split /,/,$keywords_txt;
1014 my ($falsesum, $truesum) = (0, !grep(/^[^!]/,@keywords)); 1017 my ($falsesum, $truesum) = (0, 1);
1015 1018
1016 # Param: one keyword 1019 # Param: one keyword
1017 sub recognise 1020 sub recognise
@@ -1079,7 +1082,7 @@ sub is_valid
1079 if ($k =~ /^!(.*)$/) { 1082 if ($k =~ /^!(.*)$/) {
1080 $falsesum += &recognise($1,$platforms); 1083 $falsesum += &recognise($1,$platforms);
1081 } else { 1084 } else {
1082 $truesum += &recognise($k,$platforms); 1085 $truesum *= &recognise($k,$platforms);
1083 } 1086 }
1084 } 1087 }
1085 print STDERR "DEBUG: [",$#keywords,",",$#keywords < 0,"] is_valid($keywords_txt) => (\!$falsesum) && $truesum = ",(!$falsesum) && $truesum,"\n" if $debug; 1088 print STDERR "DEBUG: [",$#keywords,",",$#keywords < 0,"] is_valid($keywords_txt) => (\!$falsesum) && $truesum = ",(!$falsesum) && $truesum,"\n" if $debug;
diff --git a/src/lib/libcrypto/util/mkfiles.pl b/src/lib/libcrypto/util/mkfiles.pl
index 928a274303..bc78510f56 100644
--- a/src/lib/libcrypto/util/mkfiles.pl
+++ b/src/lib/libcrypto/util/mkfiles.pl
@@ -51,14 +51,15 @@ my @dirs = (
51"crypto/ocsp", 51"crypto/ocsp",
52"crypto/ui", 52"crypto/ui",
53"crypto/krb5", 53"crypto/krb5",
54"fips", 54"fips-1.0",
55"fips/aes", 55"fips-1.0/aes",
56"fips/des", 56"fips-1.0/des",
57"fips/dsa", 57"fips-1.0/dsa",
58"fips/dh", 58"fips-1.0/dh",
59"fips/rand", 59"fips-1.0/hmac",
60"fips/rsa", 60"fips-1.0/rand",
61"fips/sha1", 61"fips-1.0/rsa",
62"fips-1.0/sha",
62"ssl", 63"ssl",
63"apps", 64"apps",
64"test", 65"test",
diff --git a/src/lib/libcrypto/util/mklink.pl b/src/lib/libcrypto/util/mklink.pl
index c8653cecc3..182732d959 100644
--- a/src/lib/libcrypto/util/mklink.pl
+++ b/src/lib/libcrypto/util/mklink.pl
@@ -14,13 +14,16 @@
14# not contain symbolic links and that the parent of / is never referenced. 14# not contain symbolic links and that the parent of / is never referenced.
15# Apart from this, this script should be able to handle even the most 15# Apart from this, this script should be able to handle even the most
16# pathological cases. 16# pathological cases.
17#
18
19use Cwd;
17 20
18my $from = shift; 21my $from = shift;
19my @files = @ARGV; 22my @files = @ARGV;
20 23
21my @from_path = split(/[\\\/]/, $from); 24my @from_path = split(/[\\\/]/, $from);
22my $pwd = `pwd`; 25my $pwd = getcwd();
23chop($pwd); 26chomp($pwd);
24my @pwd_path = split(/[\\\/]/, $pwd); 27my @pwd_path = split(/[\\\/]/, $pwd);
25 28
26my @to_path = (); 29my @to_path = ();
diff --git a/src/lib/libcrypto/util/pl/BC-32.pl b/src/lib/libcrypto/util/pl/BC-32.pl
index 897ae9d824..28869c868d 100644
--- a/src/lib/libcrypto/util/pl/BC-32.pl
+++ b/src/lib/libcrypto/util/pl/BC-32.pl
@@ -18,7 +18,7 @@ $out_def="out32";
18$tmp_def="tmp32"; 18$tmp_def="tmp32";
19$inc_def="inc32"; 19$inc_def="inc32";
20#enable max error messages, disable most common warnings 20#enable max error messages, disable most common warnings
21$cflags="-DWIN32_LEAN_AND_MEAN -q -w-aus -w-par -w-inl -c -tWC -tWM -DOPENSSL_SYSNAME_WIN32 -DL_ENDIAN -DDSO_WIN32 -D_stricmp=stricmp "; 21$cflags="-DWIN32_LEAN_AND_MEAN -q -w-ccc -w-rch -w-pia -w-aus -w-par -w-inl -c -tWC -tWM -DOPENSSL_SYSNAME_WIN32 -DL_ENDIAN -DDSO_WIN32 -D_stricmp=stricmp -D_strnicmp=strnicmp ";
22if ($debug) 22if ($debug)
23{ 23{
24 $cflags.="-Od -y -v -vi- -D_DEBUG"; 24 $cflags.="-Od -y -v -vi- -D_DEBUG";
@@ -51,7 +51,7 @@ $lfile='';
51$shlib_ex_obj=""; 51$shlib_ex_obj="";
52$app_ex_obj="c0x32.obj"; 52$app_ex_obj="c0x32.obj";
53 53
54$asm='nasmw -f obj'; 54$asm='nasmw -f obj -d__omf__';
55$asm.=" /Zi" if $debug; 55$asm.=" /Zi" if $debug;
56$afile='-o'; 56$afile='-o';
57 57
@@ -106,9 +106,13 @@ sub do_lib_rule
106 $ret.="$target: $objs\n"; 106 $ret.="$target: $objs\n";
107 if (!$shlib) 107 if (!$shlib)
108 { 108 {
109 # $ret.="\t\$(RM) \$(O_$Name)\n"; 109 $ret.=<<___;
110 $ret.="\techo LIB $<\n"; 110 -\$(RM) $lfile$target
111 $ret.="\t&\$(MKLIB) $lfile$target -+\$**\n"; 111 \$(MKLIB) $lfile$target \@&&!
112+\$(**: = &^
113+)
114!
115___
112 } 116 }
113 else 117 else
114 { 118 {
diff --git a/src/lib/libcrypto/util/pl/OS2-EMX.pl b/src/lib/libcrypto/util/pl/OS2-EMX.pl
index 75d72ebbcb..8dbeaa7a08 100644
--- a/src/lib/libcrypto/util/pl/OS2-EMX.pl
+++ b/src/lib/libcrypto/util/pl/OS2-EMX.pl
@@ -68,6 +68,7 @@ if (!$no_asm && !$fips)
68 $sha1_asm_src="crypto/sha/asm/s1-os2.asm"; 68 $sha1_asm_src="crypto/sha/asm/s1-os2.asm";
69 $rmd160_asm_obj="crypto/ripemd/asm/rm-os2$obj"; 69 $rmd160_asm_obj="crypto/ripemd/asm/rm-os2$obj";
70 $rmd160_asm_src="crypto/ripemd/asm/rm-os2.asm"; 70 $rmd160_asm_src="crypto/ripemd/asm/rm-os2.asm";
71 $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_PART_WORDS";
71 } 72 }
72 73
73if ($shlib) 74if ($shlib)
diff --git a/src/lib/libcrypto/util/pl/VC-32-GMAKE.pl b/src/lib/libcrypto/util/pl/VC-32-GMAKE.pl
new file mode 100644
index 0000000000..b5bbcac6c2
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/VC-32-GMAKE.pl
@@ -0,0 +1,222 @@
1#!/usr/local/bin/perl
2# VCw32lib.pl - the file for Visual C++ 4.[01] for windows NT, static libraries
3#
4
5
6if ($fips && !$shlib)
7 {
8 $crypto="libeayfips32";
9 $crypto_compat = "libeaycompat32.lib";
10 }
11else
12 {
13 $crypto="libeay32";
14 }
15$ssl= "ssleay32";
16
17$o='/';
18#$cp='copy nul+'; # Timestamps get stuffed otherwise
19#$rm='del';
20
21$cp='cp';
22$rm='rm';
23
24$zlib_lib="zlib1.lib";
25
26# C compiler stuff
27$cc='cl';
28$cflags=' -MD -W3 -WX -Ox -O2 -Ob2 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32';
29$cflags.=' -D_CRT_SECURE_NO_DEPRECATE'; # shut up VC8
30$cflags.=' -D_CRT_NONSTDC_NO_DEPRECATE'; # shut up VC8
31$lflags="-nologo -subsystem:console -machine:I386 -opt:ref";
32$mlflags='';
33
34$out_def="gmout32";
35$tmp_def="gmtmp32";
36$inc_def="gminc32";
37
38if ($debug)
39 {
40 $cflags=" -MDd -W3 -WX -Zi -Yd -Od -nologo -DOPENSSL_SYSNAME_WIN32 -D_DEBUG -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DDEBUG -DDSO_WIN32";
41 $lflags.=" -debug";
42 $mlflags.=' -debug';
43 }
44$cflags .= " -DOPENSSL_SYSNAME_WINNT" if $NT == 1;
45
46$obj='.obj';
47$ofile="-Fo";
48
49# EXE linking stuff
50$link="link";
51$efile="-out:";
52$exep='.exe';
53if ($no_sock)
54 { $ex_libs=""; }
55else { $ex_libs="wsock32.lib user32.lib gdi32.lib"; }
56
57# static library stuff
58$mklib='lib';
59$ranlib='';
60$plib="";
61$libp=".lib";
62$shlibp=($shlib)?".dll":".lib";
63$lfile='-out:';
64
65$shlib_ex_obj="";
66$app_ex_obj="setargv.obj";
67if ($nasm) {
68 $asm='nasmw -f win32';
69 $afile='-o ';
70} else {
71 $asm='ml -Cp -coff -c -Cx';
72 $asm.=" -Zi" if $debug;
73 $afile='-Fo';
74}
75
76$bn_asm_obj='';
77$bn_asm_src='';
78$des_enc_obj='';
79$des_enc_src='';
80$bf_enc_obj='';
81$bf_enc_src='';
82
83if (!$no_asm && !$fips)
84 {
85 $bn_asm_obj='crypto/bn/asm/bn_win32.obj';
86 $bn_asm_src='crypto/bn/asm/bn_win32.asm';
87 $des_enc_obj='crypto/des/asm/d_win32.obj crypto/des/asm/y_win32.obj';
88 $des_enc_src='crypto/des/asm/d_win32.asm crypto/des/asm/y_win32.asm';
89 $bf_enc_obj='crypto/bf/asm/b_win32.obj';
90 $bf_enc_src='crypto/bf/asm/b_win32.asm';
91 $cast_enc_obj='crypto/cast/asm/c_win32.obj';
92 $cast_enc_src='crypto/cast/asm/c_win32.asm';
93 $rc4_enc_obj='crypto/rc4/asm/r4_win32.obj';
94 $rc4_enc_src='crypto/rc4/asm/r4_win32.asm';
95 $rc5_enc_obj='crypto/rc5/asm/r5_win32.obj';
96 $rc5_enc_src='crypto/rc5/asm/r5_win32.asm';
97 $md5_asm_obj='crypto/md5/asm/m5_win32.obj';
98 $md5_asm_src='crypto/md5/asm/m5_win32.asm';
99 $sha1_asm_obj='crypto/sha/asm/s1_win32.obj';
100 $sha1_asm_src='crypto/sha/asm/s1_win32.asm';
101 $rmd160_asm_obj='crypto/ripemd/asm/rm_win32.obj';
102 $rmd160_asm_src='crypto/ripemd/asm/rm_win32.asm';
103 $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
104 }
105
106if ($shlib)
107 {
108 $mlflags.=" $lflags -dll";
109# $cflags =~ s| -MD| -MT|;
110 $lib_cflag=" -D_WINDLL";
111 $out_def="gmout32dll";
112 $tmp_def="gmtmp32dll";
113 }
114
115$cflags.=" -Fd$out_def";
116
117sub do_lib_rule
118 {
119 local($objs,$target,$name,$shlib,$ign,$base_addr, $fips_get_sig, $fips_premain_src)=@_;
120 local($ret,$Name);
121
122 $taget =~ s/\//$o/g if $o ne '/';
123 ($Name=$name) =~ tr/a-z/A-Z/;
124 my $base_arg;
125 if ($base_addr ne "")
126 {
127 $base_arg= " -base:$base_addr";
128 }
129 else
130 {
131 $base_arg = "";
132 }
133
134
135# $target="\$(LIB_D)$o$target";
136 if (!$shlib)
137 {
138# $ret.="\t\$(RM) \$(O_$Name)\n";
139 $ret.="$target: $objs\n";
140 $ex =' advapi32.lib';
141 $ret.="\t\$(MKLIB) $lfile$target $objs $ex\n\n";
142 }
143 else
144 {
145 local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
146 $ex.=' wsock32.lib gdi32.lib advapi32.lib user32.lib';
147 $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/;
148 if (defined $fips_get_sig)
149 {
150 $ret.="$target: \$(O_FIPSCANISTER) $objs $fips_get_sig\n";
151 $ret.="\tFIPS_LINK=\$(LINK) ";
152 $ret.="FIPS_CC=\$(CC) ";
153 $ret.="FIPS_CC_ARGS=\"-Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\" ";
154 $ret.="FIPS_PREMAIN_DSO=$fips_get_sig ";
155 $ret.="FIPS_TARGET=$target ";
156 $ret.="FIPS_LIBDIR=\$(FIPSLIB_D) ";
157 $ret.="\$(FIPSLINK) \$(MLFLAGS) $base_arg $efile$target ";
158 $ret.="-def:ms/${Name}.def \$(SHLIB_EX_OBJ) $objs ";
159 $ret.="\$(OBJ_D)${o}fips_premain.obj $ex\n\n";
160 }
161 else
162 {
163 $ret.="$target: $objs\n";
164 $ret.="\t\$(LINK) \$(MLFLAGS) $base_arg $efile$target /def:ms/${Name}.def \$(SHLIB_EX_OBJ) $objs $ex\n\n";
165 }
166 }
167 $ret.="\n";
168 return($ret);
169 }
170
171sub do_link_rule
172 {
173 local($target,$files,$dep_libs,$libs,$standalone)=@_;
174 local($ret,$_);
175 $file =~ s/\//$o/g if $o ne '/';
176 $n=&bname($targer);
177 if ($standalone)
178 {
179 $ret.="$target: $files $dep_libs\n";
180 $ret.="\t\$(LINK) \$(LFLAGS) $efile$target ";
181 $ret.="$files $libs\n\n";
182 }
183 elsif ($fips && !$shlib)
184 {
185 $ret.="$target: \$(O_FIPSCANISTER) $files $dep_libs\n";
186 $ret.="\tFIPS_LINK=\$(LINK) ";
187 $ret.="FIPS_CC=\$(CC) ";
188 $ret.="FIPS_CC_ARGS=\"-Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\" ";
189 $ret.="FIPS_PREMAIN_DSO= ";
190 $ret.="FIPS_TARGET=$target ";
191 $ret.="FIPS_LIBDIR=\$(FIPSLIB_D) ";
192 $ret.=" \$(FIPSLINK) \$(LFLAGS) $efile$target ";
193 $ret.="\$(APP_EX_OBJ) $files \$(OBJ_D)${o}fips_premain.obj $libs\n\n";
194 }
195 else
196 {
197 $ret.="$target: $files $dep_libs\n";
198 $ret.="\t\$(LINK) \$(LFLAGS) $efile$target ";
199 $ret.="\$(APP_EX_OBJ) $files $libs\n\n";
200 }
201 $ret.="\n";
202 return($ret);
203 }
204
205sub do_rlink_rule
206 {
207 local($target,$files,$check_hash, $deps)=@_;
208 local($ret,$_);
209
210 $file =~ s/\//$o/g if $o ne '/';
211 $n=&bname($targer);
212 $ret.="$target: $check_hash $files $deps\n";
213 $ret.="\t\$(PERL) util${o}checkhash.pl -chdir fips-1.0 -program_path ..$o$check_hash\n";
214 $ret.="\t\$(MKCANISTER) $target $files\n";
215 $ret.="\t$check_hash $target > $target.sha1\n";
216 $ret.="\t\$(CP) fips-1.0${o}fips_premain.c \$(FIPSLIB_D)\n";
217 $ret.="\t$check_hash \$(FIPSLIB_D)${o}fips_premain.c > \$(FIPSLIB_D)${o}fips_premain.c.sha1\n\n";
218 return($ret);
219 }
220
221
2221;
diff --git a/src/lib/libcrypto/util/pl/VC-32.pl b/src/lib/libcrypto/util/pl/VC-32.pl
index cf689b9feb..4e97dfa9af 100644
--- a/src/lib/libcrypto/util/pl/VC-32.pl
+++ b/src/lib/libcrypto/util/pl/VC-32.pl
@@ -3,15 +3,28 @@
3# 3#
4 4
5$ssl= "ssleay32"; 5$ssl= "ssleay32";
6$crypto="libeay32"; 6
7if ($fips && !$shlib)
8 {
9 $crypto="libeayfips32";
10 $crypto_compat = "libeaycompat32.lib";
11 }
12else
13 {
14 $crypto="libeay32";
15 }
7 16
8$o='\\'; 17$o='\\';
9$cp='copy nul+'; # Timestamps get stuffed otherwise 18$cp='copy nul+'; # Timestamps get stuffed otherwise
10$rm='del'; 19$rm='del';
11 20
21$zlib_lib="zlib1.lib";
22
12# C compiler stuff 23# C compiler stuff
13$cc='cl'; 24$cc='cl';
14$cflags=' /MD /W3 /WX /G5 /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32'; 25$cflags=' /MD /W3 /WX /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32';
26$cflags.=' -D_CRT_SECURE_NO_DEPRECATE'; # shut up VC8
27$cflags.=' -D_CRT_NONSTDC_NO_DEPRECATE'; # shut up VC8
15$lflags="/nologo /subsystem:console /machine:I386 /opt:ref"; 28$lflags="/nologo /subsystem:console /machine:I386 /opt:ref";
16$mlflags=''; 29$mlflags='';
17 30
@@ -100,25 +113,56 @@ $cflags.=" /Fd$out_def";
100 113
101sub do_lib_rule 114sub do_lib_rule
102 { 115 {
103 local($objs,$target,$name,$shlib)=@_; 116 local($objs,$target,$name,$shlib,$ign,$base_addr) = @_;
104 local($ret,$Name); 117 local($ret,$Name);
105 118
106 $taget =~ s/\//$o/g if $o ne '/'; 119 $taget =~ s/\//$o/g if $o ne '/';
107 ($Name=$name) =~ tr/a-z/A-Z/; 120 ($Name=$name) =~ tr/a-z/A-Z/;
121 my $base_arg;
122 if ($base_addr ne "")
123 {
124 $base_arg= " /base:$base_addr";
125 }
126 else
127 {
128 $base_arg = "";
129 }
130
108 131
109# $target="\$(LIB_D)$o$target"; 132# $target="\$(LIB_D)$o$target";
110 $ret.="$target: $objs\n";
111 if (!$shlib) 133 if (!$shlib)
112 { 134 {
113# $ret.="\t\$(RM) \$(O_$Name)\n"; 135# $ret.="\t\$(RM) \$(O_$Name)\n";
136 $ret.="$target: $objs\n";
114 $ex =' advapi32.lib'; 137 $ex =' advapi32.lib';
138 $ex.=" \$(FIPSLIB_D)${o}_chkstk.o" if $fips && $target =~ /O_CRYPTO/;
115 $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n"; 139 $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n";
116 } 140 }
117 else 141 else
118 { 142 {
119 local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; 143 local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
120 $ex.=' wsock32.lib gdi32.lib advapi32.lib'; 144 $ex.=' wsock32.lib gdi32.lib advapi32.lib user32.lib';
121 $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n"; 145 $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/;
146 if ($fips && $target =~ /O_CRYPTO/)
147 {
148 $ex.=" \$(FIPSLIB_D)${o}_chkstk.o";
149 $ret.="$target: $objs \$(PREMAIN_DSO_EXE)\n";
150 $ret.="\tSET FIPS_LINK=\$(LINK)\n";
151 $ret.="\tSET FIPS_CC=\$(CC)\n";
152 $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n";
153 $ret.="\tSET PREMAIN_DSO_EXE=\$(PREMAIN_DSO_EXE)\n";
154 $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n";
155 $ret.="\tSET FIPS_TARGET=$target\n";
156 $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n";
157 $ret.="\t\$(FIPSLINK) \$(MLFLAGS) $base_arg $efile$target ";
158 $ret.="/def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs ";
159 $ret.="\$(OBJ_D)${o}fips_premain.obj $ex\n<<\n";
160 }
161 else
162 {
163 $ret.="$target: $objs\n";
164 $ret.="\t\$(LINK) \$(MLFLAGS) $base_arg $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
165 }
122 } 166 }
123 $ret.="\n"; 167 $ret.="\n";
124 return($ret); 168 return($ret);
@@ -126,20 +170,51 @@ sub do_lib_rule
126 170
127sub do_link_rule 171sub do_link_rule
128 { 172 {
129 local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; 173 local($target,$files,$dep_libs,$libs,$standalone)=@_;
130 local($ret,$_); 174 local($ret,$_);
131
132 $file =~ s/\//$o/g if $o ne '/'; 175 $file =~ s/\//$o/g if $o ne '/';
133 $n=&bname($targer); 176 $n=&bname($targer);
134 $ret.="$target: $files $dep_libs\n"; 177 $ret.="$target: $files $dep_libs\n";
135 $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n"; 178 if ($standalone)
136 $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n"; 179 {
137 if (defined $sha1file) 180 $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n\t";
181 $ret.="\$(FIPSLIB_D)${o}_chkstk.o " if ($files =~ /O_FIPSCANISTER/);
182 $ret.="$files $libs\n<<\n";
183 }
184 elsif ($fips && !$shlib)
138 { 185 {
139 $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; 186 $ret.="\tSET FIPS_LINK=\$(LINK)\n";
187 $ret.="\tSET FIPS_CC=\$(CC)\n";
188 $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n";
189 $ret.="\tSET PREMAIN_DSO_EXE=\n";
190 $ret.="\tSET FIPS_TARGET=$target\n";
191 $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n";
192 $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n";
193 $ret.=" \$(FIPSLINK) \$(LFLAGS) $efile$target @<<\n";
194 $ret.=" \$(APP_EX_OBJ) $files \$(OBJ_D)${o}fips_premain.obj $libs\n<<\n";
140 } 195 }
196 else
197 {
198 $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n";
199 $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n";
200 }
201 $ret.="\n";
202 return($ret);
203 }
204
205sub do_rlink_rule
206 {
207 local($target,$files,$dep_libs,$libs)=@_;
208 local($ret,$_);
209
210 $file =~ s/\//$o/g if $o ne '/';
211 $n=&bname($targer);
212 $ret.="$target: $files $dep_libs\n";
213 $ret.=" \$(MKCANISTER) $target <<\n";
214 $ret.="INPUT($files)\n<<\n";
141 $ret.="\n"; 215 $ret.="\n";
142 return($ret); 216 return($ret);
143 } 217 }
144 218
219
1451; 2201;
diff --git a/src/lib/libcrypto/util/pod2man.pl b/src/lib/libcrypto/util/pod2man.pl
index 657e4e264e..546d1ec186 100644
--- a/src/lib/libcrypto/util/pod2man.pl
+++ b/src/lib/libcrypto/util/pod2man.pl
@@ -425,6 +425,7 @@ if ($name ne 'something') {
425 } 425 }
426 next if /^=cut\b/; # DB_File and Net::Ping have =cut before NAME 426 next if /^=cut\b/; # DB_File and Net::Ping have =cut before NAME
427 next if /^=pod\b/; # It is OK to have =pod before NAME 427 next if /^=pod\b/; # It is OK to have =pod before NAME
428 next if /^=for\s+comment\b/; # It is OK to have =for comment before NAME
428 die "$0: Invalid man page - 1st pod line is not NAME in $ARGV[0]\n" unless $lax; 429 die "$0: Invalid man page - 1st pod line is not NAME in $ARGV[0]\n" unless $lax;
429 } 430 }
430 die "$0: Invalid man page - no documentation in $ARGV[0]\n" unless $lax; 431 die "$0: Invalid man page - no documentation in $ARGV[0]\n" unless $lax;
diff --git a/src/lib/libcrypto/util/selftest.pl b/src/lib/libcrypto/util/selftest.pl
index e9d5aa8938..4778c5ab01 100644
--- a/src/lib/libcrypto/util/selftest.pl
+++ b/src/lib/libcrypto/util/selftest.pl
@@ -49,7 +49,7 @@ if (open(IN,"<Makefile")) {
49} 49}
50 50
51$cversion=`$cc -v 2>&1`; 51$cversion=`$cc -v 2>&1`;
52$cversion=`$cc -V 2>&1` if $cversion =~ "usage"; 52$cversion=`$cc -V 2>&1` if $cversion =~ "[Uu]sage";
53$cversion=`$cc -V |head -1` if $cversion =~ "Error"; 53$cversion=`$cc -V |head -1` if $cversion =~ "Error";
54$cversion=`$cc --version` if $cversion eq ""; 54$cversion=`$cc --version` if $cversion eq "";
55$cversion =~ s/Reading specs.*\n//; 55$cversion =~ s/Reading specs.*\n//;
@@ -130,15 +130,21 @@ if (system("make 2>&1 | tee make.log") > 255) {
130 goto err; 130 goto err;
131} 131}
132 132
133$_=$options; 133# Not sure why this is here. The tests themselves can detect if their
134s/no-asm//; 134# particular feature isn't included, and should therefore skip themselves.
135s/no-shared//; 135# To skip *all* tests just because one algorithm isn't included is like
136s/no-krb5//; 136# shooting mosquito with an elephant gun...
137if (/no-/) 137# -- Richard Levitte, inspired by problem report 1089
138{ 138#
139 print OUT "Test skipped.\n"; 139#$_=$options;
140 goto err; 140#s/no-asm//;
141} 141#s/no-shared//;
142#s/no-krb5//;
143#if (/no-/)
144#{
145# print OUT "Test skipped.\n";
146# goto err;
147#}
142 148
143print "Running make test...\n"; 149print "Running make test...\n";
144if (system("make test 2>&1 | tee maketest.log") > 255) 150if (system("make test 2>&1 | tee maketest.log") > 255)
diff --git a/src/lib/libcrypto/x509/Makefile b/src/lib/libcrypto/x509/Makefile
index 5fb774f1c7..ee3f8a4a23 100644
--- a/src/lib/libcrypto/x509/Makefile
+++ b/src/lib/libcrypto/x509/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/x509/Makefile 2# OpenSSL/crypto/x509/Makefile
3# 3#
4 4
5DIR= x509 5DIR= x509
diff --git a/src/lib/libcrypto/x509v3/Makefile b/src/lib/libcrypto/x509v3/Makefile
index ed2f91cbb3..49423f39f7 100644
--- a/src/lib/libcrypto/x509v3/Makefile
+++ b/src/lib/libcrypto/x509v3/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# SSLeay/crypto/x509v3/Makefile 2# OpenSSL/crypto/x509v3/Makefile
3# 3#
4 4
5DIR= x509v3 5DIR= x509v3