Recent changes from 0.9.6-stable
authorRichard Levitte <levitte@openssl.org>
Thu, 5 Dec 2002 01:18:41 +0000 (01:18 +0000)
committerRichard Levitte <levitte@openssl.org>
Thu, 5 Dec 2002 01:18:41 +0000 (01:18 +0000)
19 files changed:
PROBLEMS
apps/ca.c
apps/s_server.c
apps/s_time.c
crypto/des/read2pwd.c
crypto/des/str2key.c
crypto/md2/md2_dgst.c
crypto/md4/md4_one.c
crypto/md5/md5_one.c
crypto/rand/rand_egd.c
crypto/rand/rand_win.c
crypto/ripemd/rmd_one.c
crypto/sha/sha1_one.c
crypto/sha/sha_one.c
crypto/threads/mttest.c
crypto/tmdiff.c
crypto/uid.c
doc/ssl/SSL_CTX_set_verify.pod
test/Makefile.ssl

index 7e6af8ad4d8756e0541ba3a2c056ed2ee32d0079..5cb7f87de6b43e628f28fa919ed3c2e803884847 100644 (file)
--- a/PROBLEMS
+++ b/PROBLEMS
@@ -40,3 +40,19 @@ scripts use the same name for output and input files, which means different
 will interfere with each other and lead to test failure.
 
 The solution is simple for now: don't run parallell make when testing.
+
+
+* Bugs in gcc 3.0 triggered
+
+According to a problem report, there are bugs in gcc 3.0 that are
+triggered by some of the code in OpenSSL, more specifically in
+PEM_get_EVP_CIPHER_INFO().  The triggering code is the following:
+
+       header+=11;
+       if (*header != '4') return(0); header++;
+       if (*header != ',') return(0); header++;
+
+What happens is that gcc might optimize a little too agressively, and
+you end up with an extra incrementation when *header != '4'.
+
+We recommend that you upgrade gcc to as high a 3.x version as you can.
index b315f3f346c8f4bae0d8415649931c01d8791a85..11b5d4ac7803875a109a18af19535bd47113814f 100644 (file)
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -633,12 +633,14 @@ bad:
               that to access().  However, time's too short to do that just
               now.
             */
+#ifndef VXWORKS
                if (access(outdir,R_OK|W_OK|X_OK) != 0)
                        {
                        BIO_printf(bio_err,"I am unable to access the %s directory\n",outdir);
                        perror(outdir);
                        goto err;
                        }
+#endif
 
                if (stat(outdir,&sb) != 0)
                        {
index f81a206245f982827902adf97b4df633ccbdc850..955e11dac443df2c3562ad448b33a42037707f55 100644 (file)
@@ -1284,7 +1284,7 @@ static int www_body(char *hostname, int s, unsigned char *context)
                        else
                                {
                                BIO_printf(bio_s_out,"read R BLOCK\n");
-#ifndef MSDOS
+#if !defined(MSDOS) && !defined(VXWORKS)
                                sleep(1);
 #endif
                                continue;
index c8719a6a2200fcbce411cac6dc0d9781d2e143f5..895741d4cde77618943913ffe9005e5cb07b65c8 100644 (file)
 #include <sys/param.h>
 #endif
 
+#ifdef VXWORKS
+#include <tickLib.h>
+#undef SIGALRM
+#endif
+
 /* The following if from times(3) man page.  It may need to be changed
 */
 #ifndef HZ
index 25d3c63131e42589607d0c67b1bbf7c3426419a8..115132deecbd35c707b4c593219fb0828190ad40 100644 (file)
@@ -57,6 +57,7 @@
  */
 
 #include "des_locl.h"
+#include <openssl/crypto.h>
 
 int des_read_password(des_cblock *key, const char *prompt, int verify)
        {
index fc5b96ee874483005e482d11b3143de189cb408b..10e1dc174d93f2639509d087307c28737f6896fb 100644 (file)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#include <openssl/crypto.h>
 #include "des_locl.h"
 
 void des_string_to_key(const char *str, des_cblock *key)
index 458a3fad7fb854c4eec1ed203cf92489e293c3cf..fc25280469a4b9e3ca55780a9ef2a6409117fcc8 100644 (file)
@@ -61,6 +61,7 @@
 #include <string.h>
 #include <openssl/md2.h>
 #include <openssl/opensslv.h>
+#include <openssl/crypto.h>
 
 const char *MD2_version="MD2" OPENSSL_VERSION_PTEXT;
 
index 53efd430ec01640c9ee76d3ce90f9bd8ee3433fc..00565507e4bb2154d3c088739f67f421212a1d9a 100644 (file)
@@ -59,6 +59,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <openssl/md4.h>
+#include <openssl/crypto.h>
 
 #ifdef CHARSET_EBCDIC
 #include <openssl/ebcdic.h>
index c67eb795ca76398aa8c58ab03575c6960d743c41..c5dd2d81db49373db908cb14814b2eeb2363ce9d 100644 (file)
@@ -59,6 +59,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <openssl/md5.h>
+#include <openssl/crypto.h>
 
 #ifdef CHARSET_EBCDIC
 #include <openssl/ebcdic.h>
index e17060fe9098b1c3e0f105515ad089e093840b6d..ce169367857a5c38a52eb6db86da2ea31845f533 100644 (file)
@@ -59,7 +59,7 @@
 /* Query the EGD <URL: http://www.lothar.com/tech/crypto/>.
  */
 
-#if defined(WIN32) || defined(MSDOS) || defined(VMS) || defined(__VMS)
+#if defined(WIN32) || defined(MSDOS) || defined(VMS) || defined(__VMS) || defined(VXWORKS)
 int RAND_egd(const char *path)
        {
        return(-1);
index 92befcd798cfcdecd5df4483e50ea458ab3e628f..3e148ad4d2547f1520550226e497f5af0d91978d 100644 (file)
@@ -732,8 +732,10 @@ int RAND_poll(void)
        /* put in some default random data, we need more than just this */
        l=curr_pid;
        RAND_add(&l,sizeof(l),0);
+#ifndef VXWORKS
        l=getuid();
        RAND_add(&l,sizeof(l),0);
+#endif
 
        l=time(NULL);
        RAND_add(&l,sizeof(l),0);
index a78328228281537351b0302d852f2ad7e11d41c5..f8b580c33a3a128591f0a051c260e3fbcdda5c2a 100644 (file)
@@ -59,6 +59,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <openssl/ripemd.h>
+#include <openssl/crypto.h>
 
 unsigned char *RIPEMD160(const unsigned char *d, unsigned long n,
             unsigned char *md)
index e32847ef6c95b66ffadd13eccbab93ffff8df05d..acf3e92ff22bd754d472923d21c5da8beb63a93c 100644 (file)
@@ -59,6 +59,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <openssl/sha.h>
+#include <openssl/crypto.h>
 
 #ifndef NO_SHA1
 unsigned char *SHA1(const unsigned char *d, unsigned long n, unsigned char *md)
index 65e15befb73306cff58f0fd2fd8cc52cf6f4225a..ece37146c21dc1334a63956ced5f7acdb4bacc42 100644 (file)
@@ -59,6 +59,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <openssl/sha.h>
+#include <openssl/crypto.h>
 
 #ifndef NO_SHA0
 unsigned char *SHA(const unsigned char *d, unsigned long n, unsigned char *md)
index 100165948c028f9ff4d3380368c4b8474ebee169..3d1b212b1c74f1170708e12b229c563967972dd7 100644 (file)
 #ifdef PTHREADS
 #include <pthread.h>
 #endif
+#ifdef VXWORKS
+#include <taskLib.h>
+#include <semLib.h>
+#endif
 #include <openssl/lhash.h>
 #include <openssl/crypto.h>
 #include <openssl/buffer.h>
@@ -105,10 +109,12 @@ void irix_locking_callback(int mode,int type,char *file,int line);
 void solaris_locking_callback(int mode,int type,char *file,int line);
 void win32_locking_callback(int mode,int type,char *file,int line);
 void pthreads_locking_callback(int mode,int type,char *file,int line);
+void vxworks_locking_callback(int mode,int type,char *file,int line);
 
 unsigned long irix_thread_id(void );
 unsigned long solaris_thread_id(void );
 unsigned long pthreads_thread_id(void );
+unsigned long vxworks_thread_id(void );
 
 BIO *bio_err=NULL;
 BIO *bio_stdout=NULL;
@@ -1097,4 +1103,119 @@ unsigned long pthreads_thread_id(void)
 #endif /* PTHREADS */
 
 
+#ifdef VXWORKS
+
+#define DEFAULT_TASK_NAME               NULL
+#define DEFAULT_TASK_PRIORITY           100
+#define DEFAULT_TASK_OPTIONS            0
+#define DEFAULT_TASK_STACK_BYTES        32768
+
+static SEM_ID *lock_cs;
+static long *lock_count;
+
+extern int sysClkRateGet();
+
+void thread_setup(void)
+       {
+       int i;
+
+       lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(SEM_ID));
+       lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
+       for (i=0; i<CRYPTO_num_locks(); i++)
+               {
+               lock_count[i]=0;
+               lock_cs[i] = semMCreate(SEM_Q_PRIORITY | SEM_INVERSION_SAFE);
+               }
+
+       CRYPTO_set_id_callback((unsigned long (*)())vxworks_thread_id);
+       CRYPTO_set_locking_callback((void (*)())vxworks_locking_callback);
+       }
+
+void thread_cleanup(void)
+       {
+       int i;
+
+       CRYPTO_set_locking_callback(NULL);
+       fprintf(stderr,"cleanup\n");
+       for (i=0; i<CRYPTO_num_locks(); i++)
+               {
+               semDelete(lock_cs[i]);
+               fprintf(stderr,"%8ld:%s\n",lock_count[i],
+                       CRYPTO_get_lock_name(i));
+               }
+       OPENSSL_free(lock_cs);
+       OPENSSL_free(lock_count);
+
+       fprintf(stderr,"done cleanup\n");
+       }
+
+void vxworks_locking_callback(int mode, int type, char *file, int line)
+      {
+#ifdef undef
+       fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n",
+               CRYPTO_thread_id(),
+               (mode&CRYPTO_LOCK)?"l":"u",
+               (type&CRYPTO_READ)?"r":"w",file,line);
+#endif
+/*
+       if (CRYPTO_LOCK_SSL_CERT == type)
+               fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n",
+               CRYPTO_thread_id(),
+               mode,file,line);
+*/
+       if (mode & CRYPTO_LOCK)
+               {
+               semTake(lock_cs[type], WAIT_FOREVER);
+               lock_count[type]++;
+               }
+       else
+               {
+               semGive(lock_cs[type]);
+               }
+       }
+
+
+void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
+       {
+       SSL_CTX *ssl_ctx[2];
+       int thread_ctx[MAX_THREAD_NUMBER];
+       int i;
+
+       ssl_ctx[0]=s_ctx;
+       ssl_ctx[1]=c_ctx;
+
+       /*
+       thr_setconcurrency(thread_number);
+       */
+       for (i=0; i<thread_number; i++)
+               {
+               thread_ctx[i] = taskSpawn(DEFAULT_TASK_NAME,
+                               DEFAULT_TASK_PRIORITY,
+                               DEFAULT_TASK_OPTIONS,
+                               DEFAULT_TASK_STACK_BYTES,
+                               (FUNCPTR)ndoit,
+                               (int)ssl_ctx, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+
+               printf("Spawned task %d (%x)\n", i, thread_ctx[i]);
+               }
+
+       printf("reaping\n");
+       for (i=0; i<thread_number; i++)
+               {
+               while(taskIdVerify(thread_ctx[i]) != ERROR)
+                       {
+                       taskDelay(sysClkRateGet()/10);
+                       }
+               printf("Reaped task %d (%x)\n", i, thread_ctx[i]);
+               }
+
+       printf("vxworks threads done (%d,%d)\n",
+               s_ctx->references,c_ctx->references);
+       }
+
+unsigned long vxworks_thread_id(void)
+       {
+       return((unsigned long)taskIdSelf());
+       }
 
+#endif /* VXWORKS */
index 830092210f420b3f707de71f312c9b7b127f521e..fc38e139a71daa7c7e5ee9c5dd75a737db0ffe29 100644 (file)
 #include <windows.h>
 #endif
 
+#ifdef VXWORKS
+#include <tickLib.h>
+#include <drv/timer/timerDev.h>
+#endif
+
 /* The following if from times(3) man page.  It may need to be changed */
 #ifndef HZ
 # ifndef CLK_TCK
index b5b61b76d4e35e1c9dc85729e945213f75994906..4bd283592ca8bc47df86c8147cc331df43d8b2b3 100644 (file)
@@ -64,7 +64,7 @@ int OPENSSL_issetugid(void)
        return issetugid();
        }
 
-#elif defined(WIN32)
+#elif defined(WIN32) || defined(VXWORKS)
 
 int OPENSSL_issetugid(void)
        {
index 5bb21ca5357012ff5a1d5760854b31aa102829c5..d15b2a3a1a5bc9f405e69040bf41e615c6df67e2 100644 (file)
@@ -235,7 +235,7 @@ L<SSL_get_ex_data_X509_STORE_CTX_idx(3)|SSL_get_ex_data_X509_STORE_CTX_idx(3)>).
      * At this point, err contains the last verification error. We can use
      * it for something special
      */
-    if (!preverify_ok && (err == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT)
+    if (!preverify_ok && (err == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT))
     {
       X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert), buf, 256);
       printf("issuer= %s\n", buf);
index 0a84b09bf5625adc6bce83af88d81d58decf33ab..307d1dd4c02ba8428068a35fce6397c116b22c83 100644 (file)
@@ -334,7 +334,8 @@ dummytest: dummytest.o $(DLIBCRYPTO)
 
 # DO NOT DELETE THIS LINE -- make depend depends on it.
 
-bftest.o: ../include/openssl/blowfish.h
+bftest.o: ../e_os.h ../include/openssl/blowfish.h ../include/openssl/e_os2.h
+bftest.o: ../include/openssl/opensslconf.h
 bntest.o: ../include/openssl/asn1.h ../include/openssl/bio.h
 bntest.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
 bntest.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@@ -354,22 +355,24 @@ bntest.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
 bntest.o: ../include/openssl/sha.h ../include/openssl/stack.h
 bntest.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
 bntest.o: ../include/openssl/x509_vfy.h
-casttest.o: ../include/openssl/cast.h
+casttest.o: ../e_os.h ../include/openssl/cast.h ../include/openssl/e_os2.h
+casttest.o: ../include/openssl/opensslconf.h
 destest.o: ../include/openssl/des.h ../include/openssl/e_os2.h
 destest.o: ../include/openssl/opensslconf.h
-dhtest.o: ../include/openssl/bio.h ../include/openssl/bn.h
+dhtest.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/bn.h
 dhtest.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-dhtest.o: ../include/openssl/err.h ../include/openssl/lhash.h
-dhtest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-dhtest.o: ../include/openssl/rand.h ../include/openssl/safestack.h
-dhtest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-dsatest.o: ../include/openssl/bio.h ../include/openssl/bn.h
+dhtest.o: ../include/openssl/e_os2.h ../include/openssl/err.h
+dhtest.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
+dhtest.o: ../include/openssl/opensslv.h ../include/openssl/rand.h
+dhtest.o: ../include/openssl/safestack.h ../include/openssl/stack.h
+dhtest.o: ../include/openssl/symhacks.h
+dsatest.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/bn.h
 dsatest.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-dsatest.o: ../include/openssl/dsa.h ../include/openssl/err.h
-dsatest.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
-dsatest.o: ../include/openssl/opensslv.h ../include/openssl/rand.h
-dsatest.o: ../include/openssl/safestack.h ../include/openssl/stack.h
-dsatest.o: ../include/openssl/symhacks.h
+dsatest.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+dsatest.o: ../include/openssl/err.h ../include/openssl/lhash.h
+dsatest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+dsatest.o: ../include/openssl/rand.h ../include/openssl/safestack.h
+dsatest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 enginetest.o: ../include/openssl/asn1.h ../include/openssl/bio.h
 enginetest.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
 enginetest.o: ../include/openssl/buffer.h ../include/openssl/cast.h
@@ -387,13 +390,13 @@ enginetest.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
 enginetest.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
 enginetest.o: ../include/openssl/safestack.h ../include/openssl/sha.h
 enginetest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-exptest.o: ../include/openssl/bio.h ../include/openssl/bn.h
-exptest.o: ../include/openssl/crypto.h ../include/openssl/err.h
-exptest.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
-exptest.o: ../include/openssl/opensslv.h ../include/openssl/rand.h
-exptest.o: ../include/openssl/safestack.h ../include/openssl/stack.h
-exptest.o: ../include/openssl/symhacks.h
-hmactest.o: ../include/openssl/asn1.h ../include/openssl/bio.h
+exptest.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/bn.h
+exptest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
+exptest.o: ../include/openssl/err.h ../include/openssl/lhash.h
+exptest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+exptest.o: ../include/openssl/rand.h ../include/openssl/safestack.h
+exptest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+hmactest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
 hmactest.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
 hmactest.o: ../include/openssl/cast.h ../include/openssl/crypto.h
 hmactest.o: ../include/openssl/des.h ../include/openssl/dh.h
@@ -408,17 +411,26 @@ hmactest.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
 hmactest.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
 hmactest.o: ../include/openssl/safestack.h ../include/openssl/sha.h
 hmactest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-ideatest.o: ../include/openssl/idea.h ../include/openssl/opensslconf.h
-md2test.o: ../include/openssl/md2.h ../include/openssl/opensslconf.h
-md4test.o: ../include/openssl/md4.h
-md5test.o: ../include/openssl/md5.h
-mdc2test.o: ../include/openssl/des.h ../include/openssl/e_os2.h
+ideatest.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/idea.h
+ideatest.o: ../include/openssl/opensslconf.h
+md2test.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/md2.h
+md2test.o: ../include/openssl/opensslconf.h
+md4test.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/md4.h
+md4test.o: ../include/openssl/opensslconf.h
+md5test.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/md5.h
+md5test.o: ../include/openssl/opensslconf.h
+mdc2test.o: ../e_os.h ../include/openssl/des.h ../include/openssl/e_os2.h
 mdc2test.o: ../include/openssl/mdc2.h ../include/openssl/opensslconf.h
-randtest.o: ../include/openssl/rand.h
+randtest.o: ../e_os.h ../include/openssl/e_os2.h
+randtest.o: ../include/openssl/opensslconf.h ../include/openssl/rand.h
+rc2test.o: ../e_os.h ../include/openssl/e_os2.h
 rc2test.o: ../include/openssl/opensslconf.h ../include/openssl/rc2.h
+rc4test.o: ../e_os.h ../include/openssl/e_os2.h
 rc4test.o: ../include/openssl/opensslconf.h ../include/openssl/rc4.h
-rc5test.o: ../include/openssl/rc5.h
-rmdtest.o: ../include/openssl/ripemd.h
+rc5test.o: ../e_os.h ../include/openssl/e_os2.h
+rc5test.o: ../include/openssl/opensslconf.h ../include/openssl/rc5.h
+rmdtest.o: ../e_os.h ../include/openssl/e_os2.h
+rmdtest.o: ../include/openssl/opensslconf.h ../include/openssl/ripemd.h
 rsa_test.o: ../include/openssl/bio.h ../include/openssl/bn.h
 rsa_test.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
 rsa_test.o: ../include/openssl/e_os2.h ../include/openssl/err.h
@@ -426,8 +438,10 @@ rsa_test.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
 rsa_test.o: ../include/openssl/opensslv.h ../include/openssl/rand.h
 rsa_test.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
 rsa_test.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-sha1test.o: ../include/openssl/sha.h
-shatest.o: ../include/openssl/sha.h
+sha1test.o: ../e_os.h ../include/openssl/e_os2.h
+sha1test.o: ../include/openssl/opensslconf.h ../include/openssl/sha.h
+shatest.o: ../e_os.h ../include/openssl/e_os2.h
+shatest.o: ../include/openssl/opensslconf.h ../include/openssl/sha.h
 ssltest.o: ../include/openssl/asn1.h ../include/openssl/bio.h
 ssltest.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
 ssltest.o: ../include/openssl/buffer.h ../include/openssl/cast.h