diff options
| author | djm <> | 2012-01-05 22:59:11 +0000 |
|---|---|---|
| committer | djm <> | 2012-01-05 22:59:11 +0000 |
| commit | dd489e85d1735eb58774a1c57c6f586cede35b5d (patch) | |
| tree | 0c50d3b723171826a4202f7e4541b3e47db37631 /src | |
| parent | 027d47f36d5e77b24a925d19c987fc43151baa17 (diff) | |
| download | openbsd-dd489e85d1735eb58774a1c57c6f586cede35b5d.tar.gz openbsd-dd489e85d1735eb58774a1c57c6f586cede35b5d.tar.bz2 openbsd-dd489e85d1735eb58774a1c57c6f586cede35b5d.zip | |
OpenSSL 1.0.0f: import upstream source
Diffstat (limited to '')
35 files changed, 432 insertions, 149 deletions
diff --git a/src/lib/libcrypto/rand/rand_unix.c b/src/lib/libcrypto/rand/rand_unix.c index e9ead3a529..e3a65571c8 100644 --- a/src/lib/libcrypto/rand/rand_unix.c +++ b/src/lib/libcrypto/rand/rand_unix.c | |||
| @@ -133,47 +133,87 @@ | |||
| 133 | # define FD_SETSIZE (8*sizeof(fd_set)) | 133 | # define FD_SETSIZE (8*sizeof(fd_set)) |
| 134 | #endif | 134 | #endif |
| 135 | 135 | ||
| 136 | #ifdef __VOS__ | 136 | #if defined(OPENSSL_SYS_VOS) |
| 137 | |||
| 138 | /* The following algorithm repeatedly samples the real-time clock | ||
| 139 | (RTC) to generate a sequence of unpredictable data. The algorithm | ||
| 140 | relies upon the uneven execution speed of the code (due to factors | ||
| 141 | such as cache misses, interrupts, bus activity, and scheduling) and | ||
| 142 | upon the rather large relative difference between the speed of the | ||
| 143 | clock and the rate at which it can be read. | ||
| 144 | |||
| 145 | If this code is ported to an environment where execution speed is | ||
| 146 | more constant or where the RTC ticks at a much slower rate, or the | ||
| 147 | clock can be read with fewer instructions, it is likely that the | ||
| 148 | results would be far more predictable. | ||
| 149 | |||
| 150 | As a precaution, we generate 4 times the minimum required amount of | ||
| 151 | seed data. */ | ||
| 152 | |||
| 137 | int RAND_poll(void) | 153 | int RAND_poll(void) |
| 138 | { | 154 | { |
| 139 | unsigned char buf[ENTROPY_NEEDED]; | 155 | short int code; |
| 156 | gid_t curr_gid; | ||
| 140 | pid_t curr_pid; | 157 | pid_t curr_pid; |
| 141 | uid_t curr_uid; | 158 | uid_t curr_uid; |
| 142 | static int first=1; | 159 | int i, k; |
| 143 | int i; | ||
| 144 | long rnd = 0; | ||
| 145 | struct timespec ts; | 160 | struct timespec ts; |
| 146 | unsigned seed; | 161 | unsigned char v; |
| 147 | |||
| 148 | /* The VOS random() function starts from a static seed so its | ||
| 149 | initial value is predictable. If random() returns the | ||
| 150 | initial value, reseed it with dynamic data. The VOS | ||
| 151 | real-time clock has a granularity of 1 nsec so it should be | ||
| 152 | reasonably difficult to predict its exact value. Do not | ||
| 153 | gratuitously reseed the PRNG because other code in this | ||
| 154 | process or thread may be using it. */ | ||
| 155 | |||
| 156 | if (first) { | ||
| 157 | first = 0; | ||
| 158 | rnd = random (); | ||
| 159 | if (rnd == 1804289383) { | ||
| 160 | clock_gettime (CLOCK_REALTIME, &ts); | ||
| 161 | curr_pid = getpid(); | ||
| 162 | curr_uid = getuid(); | ||
| 163 | seed = ts.tv_sec ^ ts.tv_nsec ^ curr_pid ^ curr_uid; | ||
| 164 | srandom (seed); | ||
| 165 | } | ||
| 166 | } | ||
| 167 | 162 | ||
| 168 | for (i = 0; i < sizeof(buf); i++) { | 163 | #ifdef OPENSSL_SYS_VOS_HPPA |
| 169 | if (i % 4 == 0) | 164 | long duration; |
| 170 | rnd = random(); | 165 | extern void s$sleep (long *_duration, short int *_code); |
| 171 | buf[i] = rnd; | 166 | #else |
| 172 | rnd >>= 8; | 167 | #ifdef OPENSSL_SYS_VOS_IA32 |
| 173 | } | 168 | long long duration; |
| 174 | RAND_add(buf, sizeof(buf), ENTROPY_NEEDED); | 169 | extern void s$sleep2 (long long *_duration, short int *_code); |
| 175 | memset(buf, 0, sizeof(buf)); | 170 | #else |
| 171 | #error "Unsupported Platform." | ||
| 172 | #endif /* OPENSSL_SYS_VOS_IA32 */ | ||
| 173 | #endif /* OPENSSL_SYS_VOS_HPPA */ | ||
| 174 | |||
| 175 | /* Seed with the gid, pid, and uid, to ensure *some* | ||
| 176 | variation between different processes. */ | ||
| 177 | |||
| 178 | curr_gid = getgid(); | ||
| 179 | RAND_add (&curr_gid, sizeof curr_gid, 1); | ||
| 180 | curr_gid = 0; | ||
| 181 | |||
| 182 | curr_pid = getpid(); | ||
| 183 | RAND_add (&curr_pid, sizeof curr_pid, 1); | ||
| 184 | curr_pid = 0; | ||
| 185 | |||
| 186 | curr_uid = getuid(); | ||
| 187 | RAND_add (&curr_uid, sizeof curr_uid, 1); | ||
| 188 | curr_uid = 0; | ||
| 176 | 189 | ||
| 190 | for (i=0; i<(ENTROPY_NEEDED*4); i++) | ||
| 191 | { | ||
| 192 | /* burn some cpu; hope for interrupts, cache | ||
| 193 | collisions, bus interference, etc. */ | ||
| 194 | for (k=0; k<99; k++) | ||
| 195 | ts.tv_nsec = random (); | ||
| 196 | |||
| 197 | #ifdef OPENSSL_SYS_VOS_HPPA | ||
| 198 | /* sleep for 1/1024 of a second (976 us). */ | ||
| 199 | duration = 1; | ||
| 200 | s$sleep (&duration, &code); | ||
| 201 | #else | ||
| 202 | #ifdef OPENSSL_SYS_VOS_IA32 | ||
| 203 | /* sleep for 1/65536 of a second (15 us). */ | ||
| 204 | duration = 1; | ||
| 205 | s$sleep2 (&duration, &code); | ||
| 206 | #endif /* OPENSSL_SYS_VOS_IA32 */ | ||
| 207 | #endif /* OPENSSL_SYS_VOS_HPPA */ | ||
| 208 | |||
| 209 | /* get wall clock time. */ | ||
| 210 | clock_gettime (CLOCK_REALTIME, &ts); | ||
| 211 | |||
| 212 | /* take 8 bits */ | ||
| 213 | v = (unsigned char) (ts.tv_nsec % 256); | ||
| 214 | RAND_add (&v, sizeof v, 1); | ||
| 215 | v = 0; | ||
| 216 | } | ||
| 177 | return 1; | 217 | return 1; |
| 178 | } | 218 | } |
| 179 | #elif defined __OpenBSD__ | 219 | #elif defined __OpenBSD__ |
diff --git a/src/lib/libssl/src/CHANGES b/src/lib/libssl/src/CHANGES index a0de5abb60..03e744a049 100644 --- a/src/lib/libssl/src/CHANGES +++ b/src/lib/libssl/src/CHANGES | |||
| @@ -2,6 +2,63 @@ | |||
| 2 | OpenSSL CHANGES | 2 | OpenSSL CHANGES |
| 3 | _______________ | 3 | _______________ |
| 4 | 4 | ||
| 5 | Changes between 1.0.0e and 1.0.0f [4 Jan 2012] | ||
| 6 | |||
| 7 | *) Nadhem Alfardan and Kenny Paterson have discovered an extension | ||
| 8 | of the Vaudenay padding oracle attack on CBC mode encryption | ||
| 9 | which enables an efficient plaintext recovery attack against | ||
| 10 | the OpenSSL implementation of DTLS. Their attack exploits timing | ||
| 11 | differences arising during decryption processing. A research | ||
| 12 | paper describing this attack can be found at: | ||
| 13 | http://www.isg.rhul.ac.uk/~kp/dtls.pdf | ||
| 14 | Thanks go to Nadhem Alfardan and Kenny Paterson of the Information | ||
| 15 | Security Group at Royal Holloway, University of London | ||
| 16 | (www.isg.rhul.ac.uk) for discovering this flaw and to Robin Seggelmann | ||
| 17 | <seggelmann@fh-muenster.de> and Michael Tuexen <tuexen@fh-muenster.de> | ||
| 18 | for preparing the fix. (CVE-2011-4108) | ||
| 19 | [Robin Seggelmann, Michael Tuexen] | ||
| 20 | |||
| 21 | *) Clear bytes used for block padding of SSL 3.0 records. | ||
| 22 | (CVE-2011-4576) | ||
| 23 | [Adam Langley (Google)] | ||
| 24 | |||
| 25 | *) Only allow one SGC handshake restart for SSL/TLS. (CVE-2011-4619) | ||
| 26 | [Adam Langley (Google)] | ||
| 27 | |||
| 28 | *) Check parameters are not NULL in GOST ENGINE. (CVE-2012-0027) | ||
| 29 | [Andrey Kulikov <amdeich@gmail.com>] | ||
| 30 | |||
| 31 | *) Prevent malformed RFC3779 data triggering an assertion failure. | ||
| 32 | Thanks to Andrew Chi, BBN Technologies, for discovering the flaw | ||
| 33 | and Rob Austein <sra@hactrn.net> for fixing it. (CVE-2011-4577) | ||
| 34 | [Rob Austein <sra@hactrn.net>] | ||
| 35 | |||
| 36 | *) Improved PRNG seeding for VOS. | ||
| 37 | [Paul Green <Paul.Green@stratus.com>] | ||
| 38 | |||
| 39 | *) Fix ssl_ciph.c set-up race. | ||
| 40 | [Adam Langley (Google)] | ||
| 41 | |||
| 42 | *) Fix spurious failures in ecdsatest.c. | ||
| 43 | [Emilia Käsper (Google)] | ||
| 44 | |||
| 45 | *) Fix the BIO_f_buffer() implementation (which was mixing different | ||
| 46 | interpretations of the '..._len' fields). | ||
| 47 | [Adam Langley (Google)] | ||
| 48 | |||
| 49 | *) Fix handling of BN_BLINDING: now BN_BLINDING_invert_ex (rather than | ||
| 50 | BN_BLINDING_invert_ex) calls BN_BLINDING_update, ensuring that concurrent | ||
| 51 | threads won't reuse the same blinding coefficients. | ||
| 52 | |||
| 53 | This also avoids the need to obtain the CRYPTO_LOCK_RSA_BLINDING | ||
| 54 | lock to call BN_BLINDING_invert_ex, and avoids one use of | ||
| 55 | BN_BLINDING_update for each BN_BLINDING structure (previously, | ||
| 56 | the last update always remained unused). | ||
| 57 | [Emilia Käsper (Google)] | ||
| 58 | |||
| 59 | *) In ssl3_clear, preserve s3->init_extra along with s3->rbuf. | ||
| 60 | [Bob Buckholz (Google)] | ||
| 61 | |||
| 5 | Changes between 1.0.0d and 1.0.0e [6 Sep 2011] | 62 | Changes between 1.0.0d and 1.0.0e [6 Sep 2011] |
| 6 | 63 | ||
| 7 | *) Fix bug where CRLs with nextUpdate in the past are sometimes accepted | 64 | *) Fix bug where CRLs with nextUpdate in the past are sometimes accepted |
| @@ -909,6 +966,26 @@ | |||
| 909 | 966 | ||
| 910 | Changes between 0.9.8r and 0.9.8s [xx XXX xxxx] | 967 | Changes between 0.9.8r and 0.9.8s [xx XXX xxxx] |
| 911 | 968 | ||
| 969 | *) Fix ssl_ciph.c set-up race. | ||
| 970 | [Adam Langley (Google)] | ||
| 971 | |||
| 972 | *) Fix spurious failures in ecdsatest.c. | ||
| 973 | [Emilia Käsper (Google)] | ||
| 974 | |||
| 975 | *) Fix the BIO_f_buffer() implementation (which was mixing different | ||
| 976 | interpretations of the '..._len' fields). | ||
| 977 | [Adam Langley (Google)] | ||
| 978 | |||
| 979 | *) Fix handling of BN_BLINDING: now BN_BLINDING_invert_ex (rather than | ||
| 980 | BN_BLINDING_invert_ex) calls BN_BLINDING_update, ensuring that concurrent | ||
| 981 | threads won't reuse the same blinding coefficients. | ||
| 982 | |||
| 983 | This also avoids the need to obtain the CRYPTO_LOCK_RSA_BLINDING | ||
| 984 | lock to call BN_BLINDING_invert_ex, and avoids one use of | ||
| 985 | BN_BLINDING_update for each BN_BLINDING structure (previously, | ||
| 986 | the last update always remained unused). | ||
| 987 | [Emilia Käsper (Google)] | ||
| 988 | |||
| 912 | *) Fix SSL memory handling for (EC)DH ciphersuites, in particular | 989 | *) Fix SSL memory handling for (EC)DH ciphersuites, in particular |
| 913 | for multi-threaded use of ECDH. | 990 | for multi-threaded use of ECDH. |
| 914 | [Adam Langley (Google)] | 991 | [Adam Langley (Google)] |
diff --git a/src/lib/libssl/src/Configure b/src/lib/libssl/src/Configure index 429ab2e5eb..7941c93f64 100644 --- a/src/lib/libssl/src/Configure +++ b/src/lib/libssl/src/Configure | |||
| @@ -196,8 +196,8 @@ my %table=( | |||
| 196 | "cc", "cc:-O::(unknown)::::::", | 196 | "cc", "cc:-O::(unknown)::::::", |
| 197 | 197 | ||
| 198 | ####VOS Configurations | 198 | ####VOS Configurations |
| 199 | "vos-gcc","gcc:-O3 -Wall -D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:", | 199 | "vos-gcc","gcc:-O3 -Wall -DOPENSSL_SYSNAME_VOS -D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:", |
| 200 | "debug-vos-gcc","gcc:-O0 -g -Wall -D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:", | 200 | "debug-vos-gcc","gcc:-O0 -g -Wall -DOPENSSL_SYSNAME_VOS -D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:", |
| 201 | 201 | ||
| 202 | #### Solaris x86 with GNU C setups | 202 | #### Solaris x86 with GNU C setups |
| 203 | # -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it | 203 | # -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it |
| @@ -553,7 +553,7 @@ my %table=( | |||
| 553 | "darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", | 553 | "darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", |
| 554 | "darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", | 554 | "darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", |
| 555 | "debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", | 555 | "debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", |
| 556 | "darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -DMD32_REG_T=int -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", | 556 | "darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -DMD32_REG_T=int -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", |
| 557 | "debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", | 557 | "debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", |
| 558 | 558 | ||
| 559 | ##### A/UX | 559 | ##### A/UX |
diff --git a/src/lib/libssl/src/FAQ b/src/lib/libssl/src/FAQ index fe54856a62..3b07cd363d 100644 --- a/src/lib/libssl/src/FAQ +++ b/src/lib/libssl/src/FAQ | |||
| @@ -82,7 +82,7 @@ OpenSSL - Frequently Asked Questions | |||
| 82 | * Which is the current version of OpenSSL? | 82 | * Which is the current version of OpenSSL? |
| 83 | 83 | ||
| 84 | The current version is available from <URL: http://www.openssl.org>. | 84 | The current version is available from <URL: http://www.openssl.org>. |
| 85 | OpenSSL 1.0.0e was released on Sep 6th, 2011. | 85 | OpenSSL 1.0.0f was released on Jan 4th, 2012. |
| 86 | 86 | ||
| 87 | In addition to the current stable release, you can also access daily | 87 | In addition to the current stable release, you can also access daily |
| 88 | snapshots of the OpenSSL development version at <URL: | 88 | snapshots of the OpenSSL development version at <URL: |
diff --git a/src/lib/libssl/src/Makefile b/src/lib/libssl/src/Makefile index 445e15d671..8fe888587e 100644 --- a/src/lib/libssl/src/Makefile +++ b/src/lib/libssl/src/Makefile | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | ## Makefile for OpenSSL | 4 | ## Makefile for OpenSSL |
| 5 | ## | 5 | ## |
| 6 | 6 | ||
| 7 | VERSION=1.0.0e | 7 | VERSION=1.0.0f |
| 8 | MAJOR=1 | 8 | MAJOR=1 |
| 9 | MINOR=0.0 | 9 | MINOR=0.0 |
| 10 | SHLIB_VERSION_NUMBER=1.0.0 | 10 | SHLIB_VERSION_NUMBER=1.0.0 |
diff --git a/src/lib/libssl/src/NEWS b/src/lib/libssl/src/NEWS index 672810dcc7..1fb25c626c 100644 --- a/src/lib/libssl/src/NEWS +++ b/src/lib/libssl/src/NEWS | |||
| @@ -5,6 +5,14 @@ | |||
| 5 | This file gives a brief overview of the major changes between each OpenSSL | 5 | This file gives a brief overview of the major changes between each OpenSSL |
| 6 | release. For more details please read the CHANGES file. | 6 | release. For more details please read the CHANGES file. |
| 7 | 7 | ||
| 8 | Major changes between OpenSSL 1.0.0e and OpenSSL 1.0.0f: | ||
| 9 | |||
| 10 | o Fix for DTLS plaintext recovery attack CVE-2011-4108 | ||
| 11 | o Clear block padding bytes of SSL 3.0 records CVE-2011-4576 | ||
| 12 | o Only allow one SGC handshake restart for SSL/TLS CVE-2011-4619 | ||
| 13 | o Check parameters are not NULL in GOST ENGINE CVE-2012-0027 | ||
| 14 | o Check for malformed RFC3779 data CVE-2011-4577 | ||
| 15 | |||
| 8 | Major changes between OpenSSL 1.0.0d and OpenSSL 1.0.0e: | 16 | Major changes between OpenSSL 1.0.0d and OpenSSL 1.0.0e: |
| 9 | 17 | ||
| 10 | o Fix for CRL vulnerability issue CVE-2011-3207 | 18 | o Fix for CRL vulnerability issue CVE-2011-3207 |
diff --git a/src/lib/libssl/src/README b/src/lib/libssl/src/README index 898437989a..50d54d5706 100644 --- a/src/lib/libssl/src/README +++ b/src/lib/libssl/src/README | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | OpenSSL 1.0.0e 6 Sep 2011 | 2 | OpenSSL 1.0.0f 4 Jan 2012 |
| 3 | 3 | ||
| 4 | Copyright (c) 1998-2011 The OpenSSL Project | 4 | Copyright (c) 1998-2011 The OpenSSL Project |
| 5 | Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson | 5 | Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson |
diff --git a/src/lib/libssl/src/VMS/mkshared.com b/src/lib/libssl/src/VMS/mkshared.com index 794e1de62a..b0d1fdaac3 100644 --- a/src/lib/libssl/src/VMS/mkshared.com +++ b/src/lib/libssl/src/VMS/mkshared.com | |||
| @@ -6,6 +6,7 @@ $! P2: Zlib object library path (optional). | |||
| 6 | $! | 6 | $! |
| 7 | $! Input: [.UTIL]LIBEAY.NUM,[.xxx.EXE.CRYPTO]SSL_LIBCRYPTO[32].OLB | 7 | $! Input: [.UTIL]LIBEAY.NUM,[.xxx.EXE.CRYPTO]SSL_LIBCRYPTO[32].OLB |
| 8 | $! [.UTIL]SSLEAY.NUM,[.xxx.EXE.SSL]SSL_LIBSSL[32].OLB | 8 | $! [.UTIL]SSLEAY.NUM,[.xxx.EXE.SSL]SSL_LIBSSL[32].OLB |
| 9 | $! [.CRYPTO.xxx]OPENSSLCONF.H | ||
| 9 | $! Output: [.xxx.EXE.CRYPTO]SSL_LIBCRYPTO_SHR[32].OPT,.MAP,.EXE | 10 | $! Output: [.xxx.EXE.CRYPTO]SSL_LIBCRYPTO_SHR[32].OPT,.MAP,.EXE |
| 10 | $! [.xxx.EXE.SSL]SSL_LIBSSL_SRH[32].OPT,.MAP,.EXE | 11 | $! [.xxx.EXE.SSL]SSL_LIBSSL_SRH[32].OPT,.MAP,.EXE |
| 11 | $! | 12 | $! |
| @@ -70,6 +71,9 @@ $ endif | |||
| 70 | $ endif | 71 | $ endif |
| 71 | $ endif | 72 | $ endif |
| 72 | $! | 73 | $! |
| 74 | $! ----- Prepare info for processing: disabled algorithms info | ||
| 75 | $ gosub read_disabled_algorithms_info | ||
| 76 | $! | ||
| 73 | $ ZLIB = p2 | 77 | $ ZLIB = p2 |
| 74 | $ zlib_lib = "" | 78 | $ zlib_lib = "" |
| 75 | $ if (ZLIB .nes. "") | 79 | $ if (ZLIB .nes. "") |
| @@ -384,8 +388,7 @@ $ alg_i = alg_i + 1 | |||
| 384 | $ if alg_entry .eqs. "" then goto loop2 | 388 | $ if alg_entry .eqs. "" then goto loop2 |
| 385 | $ if alg_entry .nes. "," | 389 | $ if alg_entry .nes. "," |
| 386 | $ then | 390 | $ then |
| 387 | $ if alg_entry .eqs. "KRB5" then goto loop ! Special for now | 391 | $ if disabled_algorithms - ("," + alg_entry + ",") .nes disabled_algorithms then goto loop |
| 388 | $ if alg_entry .eqs. "STATIC_ENGINE" then goto loop ! Special for now | ||
| 389 | $ if f$trnlnm("OPENSSL_NO_"+alg_entry) .nes. "" then goto loop | 392 | $ if f$trnlnm("OPENSSL_NO_"+alg_entry) .nes. "" then goto loop |
| 390 | $ goto loop2 | 393 | $ goto loop2 |
| 391 | $ endif | 394 | $ endif |
| @@ -452,3 +455,22 @@ $ endif | |||
| 452 | $ endloop_rvi: | 455 | $ endloop_rvi: |
| 453 | $ close vf | 456 | $ close vf |
| 454 | $ return | 457 | $ return |
| 458 | $ | ||
| 459 | $! The disabled algorithms reader | ||
| 460 | $ read_disabled_algorithms_info: | ||
| 461 | $ disabled_algorithms = "," | ||
| 462 | $ open /read cf [.CRYPTO.'ARCH']OPENSSLCONF.H | ||
| 463 | $ loop_rci: | ||
| 464 | $ read/err=endloop_rci/end=endloop_rci cf rci_line | ||
| 465 | $ rci_line = f$edit(rci_line,"TRIM,COMPRESS") | ||
| 466 | $ rci_ei = 0 | ||
| 467 | $ if f$extract(0,9,rci_line) .eqs. "# define " then rci_ei = 2 | ||
| 468 | $ if f$extract(0,8,rci_line) .eqs. "#define " then rci_ei = 1 | ||
| 469 | $ if rci_ei .eq. 0 then goto loop_rci | ||
| 470 | $ rci_e = f$element(rci_ei," ",rci_line) | ||
| 471 | $ if f$extract(0,11,rci_e) .nes. "OPENSSL_NO_" then goto loop_rci | ||
| 472 | $ disabled_algorithms = disabled_algorithms + f$extract(11,999,rci_e) + "," | ||
| 473 | $ goto loop_rci | ||
| 474 | $ endloop_rci: | ||
| 475 | $ close cf | ||
| 476 | $ return | ||
diff --git a/src/lib/libssl/src/apps/openssl-vms.cnf b/src/lib/libssl/src/apps/openssl-vms.cnf index 20ed61bc3e..45e46a0fb4 100644 --- a/src/lib/libssl/src/apps/openssl-vms.cnf +++ b/src/lib/libssl/src/apps/openssl-vms.cnf | |||
| @@ -145,7 +145,7 @@ localityName = Locality Name (eg, city) | |||
| 145 | organizationalUnitName = Organizational Unit Name (eg, section) | 145 | organizationalUnitName = Organizational Unit Name (eg, section) |
| 146 | #organizationalUnitName_default = | 146 | #organizationalUnitName_default = |
| 147 | 147 | ||
| 148 | commonName = Common Name (eg, YOUR name) | 148 | commonName = Common Name (e.g. server FQDN or YOUR name) |
| 149 | commonName_max = 64 | 149 | commonName_max = 64 |
| 150 | 150 | ||
| 151 | emailAddress = Email Address | 151 | emailAddress = Email Address |
diff --git a/src/lib/libssl/src/apps/openssl.cnf b/src/lib/libssl/src/apps/openssl.cnf index 9d2cd5bfa5..18760c6e67 100644 --- a/src/lib/libssl/src/apps/openssl.cnf +++ b/src/lib/libssl/src/apps/openssl.cnf | |||
| @@ -145,7 +145,7 @@ localityName = Locality Name (eg, city) | |||
| 145 | organizationalUnitName = Organizational Unit Name (eg, section) | 145 | organizationalUnitName = Organizational Unit Name (eg, section) |
| 146 | #organizationalUnitName_default = | 146 | #organizationalUnitName_default = |
| 147 | 147 | ||
| 148 | commonName = Common Name (eg, YOUR name) | 148 | commonName = Common Name (e.g. server FQDN or YOUR name) |
| 149 | commonName_max = 64 | 149 | commonName_max = 64 |
| 150 | 150 | ||
| 151 | emailAddress = Email Address | 151 | emailAddress = Email Address |
diff --git a/src/lib/libssl/src/apps/x509.c b/src/lib/libssl/src/apps/x509.c index ed1e8c69ad..9f5eaeb6be 100644 --- a/src/lib/libssl/src/apps/x509.c +++ b/src/lib/libssl/src/apps/x509.c | |||
| @@ -987,7 +987,7 @@ bad: | |||
| 987 | else | 987 | else |
| 988 | { | 988 | { |
| 989 | pk=load_key(bio_err, | 989 | pk=load_key(bio_err, |
| 990 | keyfile, FORMAT_PEM, 0, | 990 | keyfile, keyformat, 0, |
| 991 | passin, e, "request key"); | 991 | passin, e, "request key"); |
| 992 | if (pk == NULL) goto end; | 992 | if (pk == NULL) goto end; |
| 993 | } | 993 | } |
diff --git a/src/lib/libssl/src/crypto/bio/bf_buff.c b/src/lib/libssl/src/crypto/bio/bf_buff.c index c1fd75aaad..4b5a132d8a 100644 --- a/src/lib/libssl/src/crypto/bio/bf_buff.c +++ b/src/lib/libssl/src/crypto/bio/bf_buff.c | |||
| @@ -209,7 +209,7 @@ start: | |||
| 209 | /* add to buffer and return */ | 209 | /* add to buffer and return */ |
| 210 | if (i >= inl) | 210 | if (i >= inl) |
| 211 | { | 211 | { |
| 212 | memcpy(&(ctx->obuf[ctx->obuf_len]),in,inl); | 212 | memcpy(&(ctx->obuf[ctx->obuf_off+ctx->obuf_len]),in,inl); |
| 213 | ctx->obuf_len+=inl; | 213 | ctx->obuf_len+=inl; |
| 214 | return(num+inl); | 214 | return(num+inl); |
| 215 | } | 215 | } |
| @@ -219,7 +219,7 @@ start: | |||
| 219 | { | 219 | { |
| 220 | if (i > 0) /* lets fill it up if we can */ | 220 | if (i > 0) /* lets fill it up if we can */ |
| 221 | { | 221 | { |
| 222 | memcpy(&(ctx->obuf[ctx->obuf_len]),in,i); | 222 | memcpy(&(ctx->obuf[ctx->obuf_off+ctx->obuf_len]),in,i); |
| 223 | in+=i; | 223 | in+=i; |
| 224 | inl-=i; | 224 | inl-=i; |
| 225 | num+=i; | 225 | num+=i; |
| @@ -294,9 +294,9 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 294 | case BIO_C_GET_BUFF_NUM_LINES: | 294 | case BIO_C_GET_BUFF_NUM_LINES: |
| 295 | ret=0; | 295 | ret=0; |
| 296 | p1=ctx->ibuf; | 296 | p1=ctx->ibuf; |
| 297 | for (i=ctx->ibuf_off; i<ctx->ibuf_len; i++) | 297 | for (i=0; i<ctx->ibuf_len; i++) |
| 298 | { | 298 | { |
| 299 | if (p1[i] == '\n') ret++; | 299 | if (p1[ctx->ibuf_off + i] == '\n') ret++; |
| 300 | } | 300 | } |
| 301 | break; | 301 | break; |
| 302 | case BIO_CTRL_WPENDING: | 302 | case BIO_CTRL_WPENDING: |
| @@ -399,17 +399,18 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 399 | for (;;) | 399 | for (;;) |
| 400 | { | 400 | { |
| 401 | BIO_clear_retry_flags(b); | 401 | BIO_clear_retry_flags(b); |
| 402 | if (ctx->obuf_len > ctx->obuf_off) | 402 | if (ctx->obuf_len > 0) |
| 403 | { | 403 | { |
| 404 | r=BIO_write(b->next_bio, | 404 | r=BIO_write(b->next_bio, |
| 405 | &(ctx->obuf[ctx->obuf_off]), | 405 | &(ctx->obuf[ctx->obuf_off]), |
| 406 | ctx->obuf_len-ctx->obuf_off); | 406 | ctx->obuf_len); |
| 407 | #if 0 | 407 | #if 0 |
| 408 | fprintf(stderr,"FLUSH [%3d] %3d -> %3d\n",ctx->obuf_off,ctx->obuf_len-ctx->obuf_off,r); | 408 | fprintf(stderr,"FLUSH [%3d] %3d -> %3d\n",ctx->obuf_off,ctx->obuf_len,r); |
| 409 | #endif | 409 | #endif |
| 410 | BIO_copy_next_retry(b); | 410 | BIO_copy_next_retry(b); |
| 411 | if (r <= 0) return((long)r); | 411 | if (r <= 0) return((long)r); |
| 412 | ctx->obuf_off+=r; | 412 | ctx->obuf_off+=r; |
| 413 | ctx->obuf_len-=r; | ||
| 413 | } | 414 | } |
| 414 | else | 415 | else |
| 415 | { | 416 | { |
diff --git a/src/lib/libssl/src/crypto/bio/bio.h b/src/lib/libssl/src/crypto/bio/bio.h index 152802fbdf..ab47abcf14 100644 --- a/src/lib/libssl/src/crypto/bio/bio.h +++ b/src/lib/libssl/src/crypto/bio/bio.h | |||
| @@ -306,6 +306,15 @@ DECLARE_STACK_OF(BIO) | |||
| 306 | 306 | ||
| 307 | typedef struct bio_f_buffer_ctx_struct | 307 | typedef struct bio_f_buffer_ctx_struct |
| 308 | { | 308 | { |
| 309 | /* Buffers are setup like this: | ||
| 310 | * | ||
| 311 | * <---------------------- size -----------------------> | ||
| 312 | * +---------------------------------------------------+ | ||
| 313 | * | consumed | remaining | free space | | ||
| 314 | * +---------------------------------------------------+ | ||
| 315 | * <-- off --><------- len -------> | ||
| 316 | */ | ||
| 317 | |||
| 309 | /* BIO *bio; */ /* this is now in the BIO struct */ | 318 | /* BIO *bio; */ /* this is now in the BIO struct */ |
| 310 | int ibuf_size; /* how big is the input buffer */ | 319 | int ibuf_size; /* how big is the input buffer */ |
| 311 | int obuf_size; /* how big is the output buffer */ | 320 | int obuf_size; /* how big is the output buffer */ |
diff --git a/src/lib/libssl/src/crypto/bn/asm/ppc.pl b/src/lib/libssl/src/crypto/bn/asm/ppc.pl index 37c65d3511..f4093177e6 100644 --- a/src/lib/libssl/src/crypto/bn/asm/ppc.pl +++ b/src/lib/libssl/src/crypto/bn/asm/ppc.pl | |||
| @@ -949,7 +949,7 @@ $data=<<EOF; | |||
| 949 | addze r11,r0 | 949 | addze r11,r0 |
| 950 | #mul_add_c(a[3],b[2],c3,c1,c2); | 950 | #mul_add_c(a[3],b[2],c3,c1,c2); |
| 951 | $LD r6,`3*$BNSZ`(r4) | 951 | $LD r6,`3*$BNSZ`(r4) |
| 952 | $LD r7,`2*$BNSZ`(r4) | 952 | $LD r7,`2*$BNSZ`(r5) |
| 953 | $UMULL r8,r6,r7 | 953 | $UMULL r8,r6,r7 |
| 954 | $UMULH r9,r6,r7 | 954 | $UMULH r9,r6,r7 |
| 955 | addc r12,r8,r12 | 955 | addc r12,r8,r12 |
diff --git a/src/lib/libssl/src/crypto/bn/bn_blind.c b/src/lib/libssl/src/crypto/bn/bn_blind.c index e060592fdc..9ed8bc2b40 100644 --- a/src/lib/libssl/src/crypto/bn/bn_blind.c +++ b/src/lib/libssl/src/crypto/bn/bn_blind.c | |||
| @@ -126,7 +126,7 @@ struct bn_blinding_st | |||
| 126 | * used only by crypto/rsa/rsa_eay.c, rsa_lib.c */ | 126 | * used only by crypto/rsa/rsa_eay.c, rsa_lib.c */ |
| 127 | #endif | 127 | #endif |
| 128 | CRYPTO_THREADID tid; | 128 | CRYPTO_THREADID tid; |
| 129 | unsigned int counter; | 129 | int counter; |
| 130 | unsigned long flags; | 130 | unsigned long flags; |
| 131 | BN_MONT_CTX *m_ctx; | 131 | BN_MONT_CTX *m_ctx; |
| 132 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | 132 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, |
| @@ -160,7 +160,10 @@ BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod) | |||
| 160 | if (BN_get_flags(mod, BN_FLG_CONSTTIME) != 0) | 160 | if (BN_get_flags(mod, BN_FLG_CONSTTIME) != 0) |
| 161 | BN_set_flags(ret->mod, BN_FLG_CONSTTIME); | 161 | BN_set_flags(ret->mod, BN_FLG_CONSTTIME); |
| 162 | 162 | ||
| 163 | ret->counter = BN_BLINDING_COUNTER; | 163 | /* Set the counter to the special value -1 |
| 164 | * to indicate that this is never-used fresh blinding | ||
| 165 | * that does not need updating before first use. */ | ||
| 166 | ret->counter = -1; | ||
| 164 | CRYPTO_THREADID_current(&ret->tid); | 167 | CRYPTO_THREADID_current(&ret->tid); |
| 165 | return(ret); | 168 | return(ret); |
| 166 | err: | 169 | err: |
| @@ -190,7 +193,10 @@ int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx) | |||
| 190 | goto err; | 193 | goto err; |
| 191 | } | 194 | } |
| 192 | 195 | ||
| 193 | if (--(b->counter) == 0 && b->e != NULL && | 196 | if (b->counter == -1) |
| 197 | b->counter = 0; | ||
| 198 | |||
| 199 | if (++b->counter == BN_BLINDING_COUNTER && b->e != NULL && | ||
| 194 | !(b->flags & BN_BLINDING_NO_RECREATE)) | 200 | !(b->flags & BN_BLINDING_NO_RECREATE)) |
| 195 | { | 201 | { |
| 196 | /* re-create blinding parameters */ | 202 | /* re-create blinding parameters */ |
| @@ -205,8 +211,8 @@ int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx) | |||
| 205 | 211 | ||
| 206 | ret=1; | 212 | ret=1; |
| 207 | err: | 213 | err: |
| 208 | if (b->counter == 0) | 214 | if (b->counter == BN_BLINDING_COUNTER) |
| 209 | b->counter = BN_BLINDING_COUNTER; | 215 | b->counter = 0; |
| 210 | return(ret); | 216 | return(ret); |
| 211 | } | 217 | } |
| 212 | 218 | ||
| @@ -227,6 +233,12 @@ int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx) | |||
| 227 | return(0); | 233 | return(0); |
| 228 | } | 234 | } |
| 229 | 235 | ||
| 236 | if (b->counter == -1) | ||
| 237 | /* Fresh blinding, doesn't need updating. */ | ||
| 238 | b->counter = 0; | ||
| 239 | else if (!BN_BLINDING_update(b,ctx)) | ||
| 240 | return(0); | ||
| 241 | |||
| 230 | if (r != NULL) | 242 | if (r != NULL) |
| 231 | { | 243 | { |
| 232 | if (!BN_copy(r, b->Ai)) ret=0; | 244 | if (!BN_copy(r, b->Ai)) ret=0; |
| @@ -247,22 +259,19 @@ int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *ct | |||
| 247 | int ret; | 259 | int ret; |
| 248 | 260 | ||
| 249 | bn_check_top(n); | 261 | bn_check_top(n); |
| 250 | if ((b->A == NULL) || (b->Ai == NULL)) | ||
| 251 | { | ||
| 252 | BNerr(BN_F_BN_BLINDING_INVERT_EX,BN_R_NOT_INITIALIZED); | ||
| 253 | return(0); | ||
| 254 | } | ||
| 255 | 262 | ||
| 256 | if (r != NULL) | 263 | if (r != NULL) |
| 257 | ret = BN_mod_mul(n, n, r, b->mod, ctx); | 264 | ret = BN_mod_mul(n, n, r, b->mod, ctx); |
| 258 | else | 265 | else |
| 259 | ret = BN_mod_mul(n, n, b->Ai, b->mod, ctx); | ||
| 260 | |||
| 261 | if (ret >= 0) | ||
| 262 | { | 266 | { |
| 263 | if (!BN_BLINDING_update(b,ctx)) | 267 | if (b->Ai == NULL) |
| 268 | { | ||
| 269 | BNerr(BN_F_BN_BLINDING_INVERT_EX,BN_R_NOT_INITIALIZED); | ||
| 264 | return(0); | 270 | return(0); |
| 271 | } | ||
| 272 | ret = BN_mod_mul(n, n, b->Ai, b->mod, ctx); | ||
| 265 | } | 273 | } |
| 274 | |||
| 266 | bn_check_top(n); | 275 | bn_check_top(n); |
| 267 | return(ret); | 276 | return(ret); |
| 268 | } | 277 | } |
diff --git a/src/lib/libssl/src/crypto/opensslv.h b/src/lib/libssl/src/crypto/opensslv.h index 310a3387be..d6d61a0c7d 100644 --- a/src/lib/libssl/src/crypto/opensslv.h +++ b/src/lib/libssl/src/crypto/opensslv.h | |||
| @@ -25,11 +25,11 @@ | |||
| 25 | * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for | 25 | * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for |
| 26 | * major minor fix final patch/beta) | 26 | * major minor fix final patch/beta) |
| 27 | */ | 27 | */ |
| 28 | #define OPENSSL_VERSION_NUMBER 0x1000005fL | 28 | #define OPENSSL_VERSION_NUMBER 0x1000006fL |
| 29 | #ifdef OPENSSL_FIPS | 29 | #ifdef OPENSSL_FIPS |
| 30 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.0e-fips 6 Sep 2011" | 30 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.0f-fips 4 Jan 2012" |
| 31 | #else | 31 | #else |
| 32 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.0e 6 Sep 2011" | 32 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.0f 4 Jan 2012" |
| 33 | #endif | 33 | #endif |
| 34 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT | 34 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT |
| 35 | 35 | ||
diff --git a/src/lib/libssl/src/crypto/rand/rand_unix.c b/src/lib/libssl/src/crypto/rand/rand_unix.c index e9ead3a529..e3a65571c8 100644 --- a/src/lib/libssl/src/crypto/rand/rand_unix.c +++ b/src/lib/libssl/src/crypto/rand/rand_unix.c | |||
| @@ -133,47 +133,87 @@ | |||
| 133 | # define FD_SETSIZE (8*sizeof(fd_set)) | 133 | # define FD_SETSIZE (8*sizeof(fd_set)) |
| 134 | #endif | 134 | #endif |
| 135 | 135 | ||
| 136 | #ifdef __VOS__ | 136 | #if defined(OPENSSL_SYS_VOS) |
| 137 | |||
| 138 | /* The following algorithm repeatedly samples the real-time clock | ||
| 139 | (RTC) to generate a sequence of unpredictable data. The algorithm | ||
| 140 | relies upon the uneven execution speed of the code (due to factors | ||
| 141 | such as cache misses, interrupts, bus activity, and scheduling) and | ||
| 142 | upon the rather large relative difference between the speed of the | ||
| 143 | clock and the rate at which it can be read. | ||
| 144 | |||
| 145 | If this code is ported to an environment where execution speed is | ||
| 146 | more constant or where the RTC ticks at a much slower rate, or the | ||
| 147 | clock can be read with fewer instructions, it is likely that the | ||
| 148 | results would be far more predictable. | ||
| 149 | |||
| 150 | As a precaution, we generate 4 times the minimum required amount of | ||
| 151 | seed data. */ | ||
| 152 | |||
| 137 | int RAND_poll(void) | 153 | int RAND_poll(void) |
| 138 | { | 154 | { |
| 139 | unsigned char buf[ENTROPY_NEEDED]; | 155 | short int code; |
| 156 | gid_t curr_gid; | ||
| 140 | pid_t curr_pid; | 157 | pid_t curr_pid; |
| 141 | uid_t curr_uid; | 158 | uid_t curr_uid; |
| 142 | static int first=1; | 159 | int i, k; |
| 143 | int i; | ||
| 144 | long rnd = 0; | ||
| 145 | struct timespec ts; | 160 | struct timespec ts; |
| 146 | unsigned seed; | 161 | unsigned char v; |
| 147 | |||
| 148 | /* The VOS random() function starts from a static seed so its | ||
| 149 | initial value is predictable. If random() returns the | ||
| 150 | initial value, reseed it with dynamic data. The VOS | ||
| 151 | real-time clock has a granularity of 1 nsec so it should be | ||
| 152 | reasonably difficult to predict its exact value. Do not | ||
| 153 | gratuitously reseed the PRNG because other code in this | ||
| 154 | process or thread may be using it. */ | ||
| 155 | |||
| 156 | if (first) { | ||
| 157 | first = 0; | ||
| 158 | rnd = random (); | ||
| 159 | if (rnd == 1804289383) { | ||
| 160 | clock_gettime (CLOCK_REALTIME, &ts); | ||
| 161 | curr_pid = getpid(); | ||
| 162 | curr_uid = getuid(); | ||
| 163 | seed = ts.tv_sec ^ ts.tv_nsec ^ curr_pid ^ curr_uid; | ||
| 164 | srandom (seed); | ||
| 165 | } | ||
| 166 | } | ||
| 167 | 162 | ||
| 168 | for (i = 0; i < sizeof(buf); i++) { | 163 | #ifdef OPENSSL_SYS_VOS_HPPA |
| 169 | if (i % 4 == 0) | 164 | long duration; |
| 170 | rnd = random(); | 165 | extern void s$sleep (long *_duration, short int *_code); |
| 171 | buf[i] = rnd; | 166 | #else |
| 172 | rnd >>= 8; | 167 | #ifdef OPENSSL_SYS_VOS_IA32 |
| 173 | } | 168 | long long duration; |
| 174 | RAND_add(buf, sizeof(buf), ENTROPY_NEEDED); | 169 | extern void s$sleep2 (long long *_duration, short int *_code); |
| 175 | memset(buf, 0, sizeof(buf)); | 170 | #else |
| 171 | #error "Unsupported Platform." | ||
| 172 | #endif /* OPENSSL_SYS_VOS_IA32 */ | ||
| 173 | #endif /* OPENSSL_SYS_VOS_HPPA */ | ||
| 174 | |||
| 175 | /* Seed with the gid, pid, and uid, to ensure *some* | ||
| 176 | variation between different processes. */ | ||
| 177 | |||
| 178 | curr_gid = getgid(); | ||
| 179 | RAND_add (&curr_gid, sizeof curr_gid, 1); | ||
| 180 | curr_gid = 0; | ||
| 181 | |||
| 182 | curr_pid = getpid(); | ||
| 183 | RAND_add (&curr_pid, sizeof curr_pid, 1); | ||
| 184 | curr_pid = 0; | ||
| 185 | |||
| 186 | curr_uid = getuid(); | ||
| 187 | RAND_add (&curr_uid, sizeof curr_uid, 1); | ||
| 188 | curr_uid = 0; | ||
| 176 | 189 | ||
| 190 | for (i=0; i<(ENTROPY_NEEDED*4); i++) | ||
| 191 | { | ||
| 192 | /* burn some cpu; hope for interrupts, cache | ||
| 193 | collisions, bus interference, etc. */ | ||
| 194 | for (k=0; k<99; k++) | ||
| 195 | ts.tv_nsec = random (); | ||
| 196 | |||
| 197 | #ifdef OPENSSL_SYS_VOS_HPPA | ||
| 198 | /* sleep for 1/1024 of a second (976 us). */ | ||
| 199 | duration = 1; | ||
| 200 | s$sleep (&duration, &code); | ||
| 201 | #else | ||
| 202 | #ifdef OPENSSL_SYS_VOS_IA32 | ||
| 203 | /* sleep for 1/65536 of a second (15 us). */ | ||
| 204 | duration = 1; | ||
| 205 | s$sleep2 (&duration, &code); | ||
| 206 | #endif /* OPENSSL_SYS_VOS_IA32 */ | ||
| 207 | #endif /* OPENSSL_SYS_VOS_HPPA */ | ||
| 208 | |||
| 209 | /* get wall clock time. */ | ||
| 210 | clock_gettime (CLOCK_REALTIME, &ts); | ||
| 211 | |||
| 212 | /* take 8 bits */ | ||
| 213 | v = (unsigned char) (ts.tv_nsec % 256); | ||
| 214 | RAND_add (&v, sizeof v, 1); | ||
| 215 | v = 0; | ||
| 216 | } | ||
| 177 | return 1; | 217 | return 1; |
| 178 | } | 218 | } |
| 179 | #elif defined __OpenBSD__ | 219 | #elif defined __OpenBSD__ |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_eay.c b/src/lib/libssl/src/crypto/rsa/rsa_eay.c index 7c941885f0..2e1ddd48d3 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_eay.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_eay.c | |||
| @@ -314,51 +314,56 @@ static BN_BLINDING *rsa_get_blinding(RSA *rsa, int *local, BN_CTX *ctx) | |||
| 314 | return ret; | 314 | return ret; |
| 315 | } | 315 | } |
| 316 | 316 | ||
| 317 | static int rsa_blinding_convert(BN_BLINDING *b, int local, BIGNUM *f, | 317 | static int rsa_blinding_convert(BN_BLINDING *b, BIGNUM *f, BIGNUM *unblind, |
| 318 | BIGNUM *r, BN_CTX *ctx) | 318 | BN_CTX *ctx) |
| 319 | { | 319 | { |
| 320 | if (local) | 320 | if (unblind == NULL) |
| 321 | /* Local blinding: store the unblinding factor | ||
| 322 | * in BN_BLINDING. */ | ||
| 321 | return BN_BLINDING_convert_ex(f, NULL, b, ctx); | 323 | return BN_BLINDING_convert_ex(f, NULL, b, ctx); |
| 322 | else | 324 | else |
| 323 | { | 325 | { |
| 324 | int ret; | 326 | /* Shared blinding: store the unblinding factor |
| 325 | CRYPTO_r_lock(CRYPTO_LOCK_RSA_BLINDING); | 327 | * outside BN_BLINDING. */ |
| 326 | ret = BN_BLINDING_convert_ex(f, r, b, ctx); | ||
| 327 | CRYPTO_r_unlock(CRYPTO_LOCK_RSA_BLINDING); | ||
| 328 | return ret; | ||
| 329 | } | ||
| 330 | } | ||
| 331 | |||
| 332 | static int rsa_blinding_invert(BN_BLINDING *b, int local, BIGNUM *f, | ||
| 333 | BIGNUM *r, BN_CTX *ctx) | ||
| 334 | { | ||
| 335 | if (local) | ||
| 336 | return BN_BLINDING_invert_ex(f, NULL, b, ctx); | ||
| 337 | else | ||
| 338 | { | ||
| 339 | int ret; | 328 | int ret; |
| 340 | CRYPTO_w_lock(CRYPTO_LOCK_RSA_BLINDING); | 329 | CRYPTO_w_lock(CRYPTO_LOCK_RSA_BLINDING); |
| 341 | ret = BN_BLINDING_invert_ex(f, r, b, ctx); | 330 | ret = BN_BLINDING_convert_ex(f, unblind, b, ctx); |
| 342 | CRYPTO_w_unlock(CRYPTO_LOCK_RSA_BLINDING); | 331 | CRYPTO_w_unlock(CRYPTO_LOCK_RSA_BLINDING); |
| 343 | return ret; | 332 | return ret; |
| 344 | } | 333 | } |
| 345 | } | 334 | } |
| 335 | |||
| 336 | static int rsa_blinding_invert(BN_BLINDING *b, BIGNUM *f, BIGNUM *unblind, | ||
| 337 | BN_CTX *ctx) | ||
| 338 | { | ||
| 339 | /* For local blinding, unblind is set to NULL, and BN_BLINDING_invert_ex | ||
| 340 | * will use the unblinding factor stored in BN_BLINDING. | ||
| 341 | * If BN_BLINDING is shared between threads, unblind must be non-null: | ||
| 342 | * BN_BLINDING_invert_ex will then use the local unblinding factor, | ||
| 343 | * and will only read the modulus from BN_BLINDING. | ||
| 344 | * In both cases it's safe to access the blinding without a lock. | ||
| 345 | */ | ||
| 346 | return BN_BLINDING_invert_ex(f, unblind, b, ctx); | ||
| 347 | } | ||
| 346 | 348 | ||
| 347 | /* signing */ | 349 | /* signing */ |
| 348 | static int RSA_eay_private_encrypt(int flen, const unsigned char *from, | 350 | static int RSA_eay_private_encrypt(int flen, const unsigned char *from, |
| 349 | unsigned char *to, RSA *rsa, int padding) | 351 | unsigned char *to, RSA *rsa, int padding) |
| 350 | { | 352 | { |
| 351 | BIGNUM *f, *ret, *br, *res; | 353 | BIGNUM *f, *ret, *res; |
| 352 | int i,j,k,num=0,r= -1; | 354 | int i,j,k,num=0,r= -1; |
| 353 | unsigned char *buf=NULL; | 355 | unsigned char *buf=NULL; |
| 354 | BN_CTX *ctx=NULL; | 356 | BN_CTX *ctx=NULL; |
| 355 | int local_blinding = 0; | 357 | int local_blinding = 0; |
| 358 | /* Used only if the blinding structure is shared. A non-NULL unblind | ||
| 359 | * instructs rsa_blinding_convert() and rsa_blinding_invert() to store | ||
| 360 | * the unblinding factor outside the blinding structure. */ | ||
| 361 | BIGNUM *unblind = NULL; | ||
| 356 | BN_BLINDING *blinding = NULL; | 362 | BN_BLINDING *blinding = NULL; |
| 357 | 363 | ||
| 358 | if ((ctx=BN_CTX_new()) == NULL) goto err; | 364 | if ((ctx=BN_CTX_new()) == NULL) goto err; |
| 359 | BN_CTX_start(ctx); | 365 | BN_CTX_start(ctx); |
| 360 | f = BN_CTX_get(ctx); | 366 | f = BN_CTX_get(ctx); |
| 361 | br = BN_CTX_get(ctx); | ||
| 362 | ret = BN_CTX_get(ctx); | 367 | ret = BN_CTX_get(ctx); |
| 363 | num = BN_num_bytes(rsa->n); | 368 | num = BN_num_bytes(rsa->n); |
| 364 | buf = OPENSSL_malloc(num); | 369 | buf = OPENSSL_malloc(num); |
| @@ -406,8 +411,15 @@ static int RSA_eay_private_encrypt(int flen, const unsigned char *from, | |||
| 406 | } | 411 | } |
| 407 | 412 | ||
| 408 | if (blinding != NULL) | 413 | if (blinding != NULL) |
| 409 | if (!rsa_blinding_convert(blinding, local_blinding, f, br, ctx)) | 414 | { |
| 415 | if (!local_blinding && ((unblind = BN_CTX_get(ctx)) == NULL)) | ||
| 416 | { | ||
| 417 | RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,ERR_R_MALLOC_FAILURE); | ||
| 418 | goto err; | ||
| 419 | } | ||
| 420 | if (!rsa_blinding_convert(blinding, f, unblind, ctx)) | ||
| 410 | goto err; | 421 | goto err; |
| 422 | } | ||
| 411 | 423 | ||
| 412 | if ( (rsa->flags & RSA_FLAG_EXT_PKEY) || | 424 | if ( (rsa->flags & RSA_FLAG_EXT_PKEY) || |
| 413 | ((rsa->p != NULL) && | 425 | ((rsa->p != NULL) && |
| @@ -441,7 +453,7 @@ static int RSA_eay_private_encrypt(int flen, const unsigned char *from, | |||
| 441 | } | 453 | } |
| 442 | 454 | ||
| 443 | if (blinding) | 455 | if (blinding) |
| 444 | if (!rsa_blinding_invert(blinding, local_blinding, ret, br, ctx)) | 456 | if (!rsa_blinding_invert(blinding, ret, unblind, ctx)) |
| 445 | goto err; | 457 | goto err; |
| 446 | 458 | ||
| 447 | if (padding == RSA_X931_PADDING) | 459 | if (padding == RSA_X931_PADDING) |
| @@ -480,18 +492,21 @@ err: | |||
| 480 | static int RSA_eay_private_decrypt(int flen, const unsigned char *from, | 492 | static int RSA_eay_private_decrypt(int flen, const unsigned char *from, |
| 481 | unsigned char *to, RSA *rsa, int padding) | 493 | unsigned char *to, RSA *rsa, int padding) |
| 482 | { | 494 | { |
| 483 | BIGNUM *f, *ret, *br; | 495 | BIGNUM *f, *ret; |
| 484 | int j,num=0,r= -1; | 496 | int j,num=0,r= -1; |
| 485 | unsigned char *p; | 497 | unsigned char *p; |
| 486 | unsigned char *buf=NULL; | 498 | unsigned char *buf=NULL; |
| 487 | BN_CTX *ctx=NULL; | 499 | BN_CTX *ctx=NULL; |
| 488 | int local_blinding = 0; | 500 | int local_blinding = 0; |
| 501 | /* Used only if the blinding structure is shared. A non-NULL unblind | ||
| 502 | * instructs rsa_blinding_convert() and rsa_blinding_invert() to store | ||
| 503 | * the unblinding factor outside the blinding structure. */ | ||
| 504 | BIGNUM *unblind = NULL; | ||
| 489 | BN_BLINDING *blinding = NULL; | 505 | BN_BLINDING *blinding = NULL; |
| 490 | 506 | ||
| 491 | if((ctx = BN_CTX_new()) == NULL) goto err; | 507 | if((ctx = BN_CTX_new()) == NULL) goto err; |
| 492 | BN_CTX_start(ctx); | 508 | BN_CTX_start(ctx); |
| 493 | f = BN_CTX_get(ctx); | 509 | f = BN_CTX_get(ctx); |
| 494 | br = BN_CTX_get(ctx); | ||
| 495 | ret = BN_CTX_get(ctx); | 510 | ret = BN_CTX_get(ctx); |
| 496 | num = BN_num_bytes(rsa->n); | 511 | num = BN_num_bytes(rsa->n); |
| 497 | buf = OPENSSL_malloc(num); | 512 | buf = OPENSSL_malloc(num); |
| @@ -529,8 +544,15 @@ static int RSA_eay_private_decrypt(int flen, const unsigned char *from, | |||
| 529 | } | 544 | } |
| 530 | 545 | ||
| 531 | if (blinding != NULL) | 546 | if (blinding != NULL) |
| 532 | if (!rsa_blinding_convert(blinding, local_blinding, f, br, ctx)) | 547 | { |
| 548 | if (!local_blinding && ((unblind = BN_CTX_get(ctx)) == NULL)) | ||
| 549 | { | ||
| 550 | RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,ERR_R_MALLOC_FAILURE); | ||
| 533 | goto err; | 551 | goto err; |
| 552 | } | ||
| 553 | if (!rsa_blinding_convert(blinding, f, unblind, ctx)) | ||
| 554 | goto err; | ||
| 555 | } | ||
| 534 | 556 | ||
| 535 | /* do the decrypt */ | 557 | /* do the decrypt */ |
| 536 | if ( (rsa->flags & RSA_FLAG_EXT_PKEY) || | 558 | if ( (rsa->flags & RSA_FLAG_EXT_PKEY) || |
| @@ -564,7 +586,7 @@ static int RSA_eay_private_decrypt(int flen, const unsigned char *from, | |||
| 564 | } | 586 | } |
| 565 | 587 | ||
| 566 | if (blinding) | 588 | if (blinding) |
| 567 | if (!rsa_blinding_invert(blinding, local_blinding, ret, br, ctx)) | 589 | if (!rsa_blinding_invert(blinding, ret, unblind, ctx)) |
| 568 | goto err; | 590 | goto err; |
| 569 | 591 | ||
| 570 | p=buf; | 592 | p=buf; |
diff --git a/src/lib/libssl/src/crypto/x509/x509_vfy.c b/src/lib/libssl/src/crypto/x509/x509_vfy.c index 5a0b0249b4..701ec565e9 100644 --- a/src/lib/libssl/src/crypto/x509/x509_vfy.c +++ b/src/lib/libssl/src/crypto/x509/x509_vfy.c | |||
| @@ -1732,7 +1732,7 @@ int X509_cmp_time(const ASN1_TIME *ctm, time_t *cmp_time) | |||
| 1732 | atm.length=sizeof(buff2); | 1732 | atm.length=sizeof(buff2); |
| 1733 | atm.data=(unsigned char *)buff2; | 1733 | atm.data=(unsigned char *)buff2; |
| 1734 | 1734 | ||
| 1735 | if (X509_time_adj(&atm,-offset*60, cmp_time) == NULL) | 1735 | if (X509_time_adj(&atm, offset*60, cmp_time) == NULL) |
| 1736 | return 0; | 1736 | return 0; |
| 1737 | 1737 | ||
| 1738 | if (ctm->type == V_ASN1_UTCTIME) | 1738 | if (ctm->type == V_ASN1_UTCTIME) |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_clear.pod b/src/lib/libssl/src/doc/ssl/SSL_clear.pod index 8e077e31c9..d4df1bfac3 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_clear.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_clear.pod | |||
| @@ -39,10 +39,16 @@ for a description of the method's properties. | |||
| 39 | SSL_clear() resets the SSL object to allow for another connection. The | 39 | SSL_clear() resets the SSL object to allow for another connection. The |
| 40 | reset operation however keeps several settings of the last sessions | 40 | reset operation however keeps several settings of the last sessions |
| 41 | (some of these settings were made automatically during the last | 41 | (some of these settings were made automatically during the last |
| 42 | handshake). It only makes sense when opening a new session (or reusing | 42 | handshake). It only makes sense for a new connection with the exact |
| 43 | an old one) with the same peer that shares these settings. | 43 | same peer that shares these settings, and may fail if that peer |
| 44 | SSL_clear() is not a short form for the sequence | 44 | changes its settings between connections. Use the sequence |
| 45 | L<SSL_free(3)|SSL_free(3)>; L<SSL_new(3)|SSL_new(3)>; . | 45 | L<SSL_get_session(3)|SSL_get_session(3)>; |
| 46 | L<SSL_new(3)|SSL_new(3)>; | ||
| 47 | L<SSL_set_session(3)|SSL_set_session(3)>; | ||
| 48 | L<SSL_free(3)|SSL_free(3)> | ||
| 49 | instead to avoid such failures | ||
| 50 | (or simply L<SSL_free(3)|SSL_free(3)>; L<SSL_new(3)|SSL_new(3)> | ||
| 51 | if session reuse is not desired). | ||
| 46 | 52 | ||
| 47 | =head1 RETURN VALUES | 53 | =head1 RETURN VALUES |
| 48 | 54 | ||
diff --git a/src/lib/libssl/src/e_os2.h b/src/lib/libssl/src/e_os2.h index 4c785c62cf..d30724d304 100644 --- a/src/lib/libssl/src/e_os2.h +++ b/src/lib/libssl/src/e_os2.h | |||
| @@ -193,8 +193,14 @@ extern "C" { | |||
| 193 | #endif | 193 | #endif |
| 194 | 194 | ||
| 195 | /* --------------------------------- VOS ----------------------------------- */ | 195 | /* --------------------------------- VOS ----------------------------------- */ |
| 196 | #ifdef OPENSSL_SYSNAME_VOS | 196 | #if defined(__VOS__) || defined(OPENSSL_SYSNAME_VOS) |
| 197 | # define OPENSSL_SYS_VOS | 197 | # define OPENSSL_SYS_VOS |
| 198 | #ifdef __HPPA__ | ||
| 199 | # define OPENSSL_SYS_VOS_HPPA | ||
| 200 | #endif | ||
| 201 | #ifdef __IA32__ | ||
| 202 | # define OPENSSL_SYS_VOS_IA32 | ||
| 203 | #endif | ||
| 198 | #endif | 204 | #endif |
| 199 | 205 | ||
| 200 | /* ------------------------------- VxWorks --------------------------------- */ | 206 | /* ------------------------------- VxWorks --------------------------------- */ |
diff --git a/src/lib/libssl/src/openssl.spec b/src/lib/libssl/src/openssl.spec index e4db875539..703cea2a5f 100644 --- a/src/lib/libssl/src/openssl.spec +++ b/src/lib/libssl/src/openssl.spec | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | %define libmaj 1 | 2 | %define libmaj 1 |
| 3 | %define libmin 0 | 3 | %define libmin 0 |
| 4 | %define librel 0 | 4 | %define librel 0 |
| 5 | %define librev e | 5 | %define librev f |
| 6 | Release: 1 | 6 | Release: 1 |
| 7 | 7 | ||
| 8 | %define openssldir /var/ssl | 8 | %define openssldir /var/ssl |
diff --git a/src/lib/libssl/src/ssl/s3_clnt.c b/src/lib/libssl/src/ssl/s3_clnt.c index 50bd415b56..53223bd38d 100644 --- a/src/lib/libssl/src/ssl/s3_clnt.c +++ b/src/lib/libssl/src/ssl/s3_clnt.c | |||
| @@ -953,7 +953,7 @@ int ssl3_get_server_hello(SSL *s) | |||
| 953 | /* wrong packet length */ | 953 | /* wrong packet length */ |
| 954 | al=SSL_AD_DECODE_ERROR; | 954 | al=SSL_AD_DECODE_ERROR; |
| 955 | SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_BAD_PACKET_LENGTH); | 955 | SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_BAD_PACKET_LENGTH); |
| 956 | goto err; | 956 | goto f_err; |
| 957 | } | 957 | } |
| 958 | 958 | ||
| 959 | return(1); | 959 | return(1); |
| @@ -1837,7 +1837,7 @@ int ssl3_get_new_session_ticket(SSL *s) | |||
| 1837 | if (n < 6) | 1837 | if (n < 6) |
| 1838 | { | 1838 | { |
| 1839 | /* need at least ticket_lifetime_hint + ticket length */ | 1839 | /* need at least ticket_lifetime_hint + ticket length */ |
| 1840 | al = SSL3_AL_FATAL,SSL_AD_DECODE_ERROR; | 1840 | al = SSL_AD_DECODE_ERROR; |
| 1841 | SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET,SSL_R_LENGTH_MISMATCH); | 1841 | SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET,SSL_R_LENGTH_MISMATCH); |
| 1842 | goto f_err; | 1842 | goto f_err; |
| 1843 | } | 1843 | } |
| @@ -1848,7 +1848,7 @@ int ssl3_get_new_session_ticket(SSL *s) | |||
| 1848 | /* ticket_lifetime_hint + ticket_length + ticket */ | 1848 | /* ticket_lifetime_hint + ticket_length + ticket */ |
| 1849 | if (ticklen + 6 != n) | 1849 | if (ticklen + 6 != n) |
| 1850 | { | 1850 | { |
| 1851 | al = SSL3_AL_FATAL,SSL_AD_DECODE_ERROR; | 1851 | al = SSL_AD_DECODE_ERROR; |
| 1852 | SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET,SSL_R_LENGTH_MISMATCH); | 1852 | SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET,SSL_R_LENGTH_MISMATCH); |
| 1853 | goto f_err; | 1853 | goto f_err; |
| 1854 | } | 1854 | } |
diff --git a/src/lib/libssl/src/ssl/s3_enc.c b/src/lib/libssl/src/ssl/s3_enc.c index 58386e1ba0..b14597076d 100644 --- a/src/lib/libssl/src/ssl/s3_enc.c +++ b/src/lib/libssl/src/ssl/s3_enc.c | |||
| @@ -511,6 +511,9 @@ int ssl3_enc(SSL *s, int send) | |||
| 511 | 511 | ||
| 512 | /* we need to add 'i-1' padding bytes */ | 512 | /* we need to add 'i-1' padding bytes */ |
| 513 | l+=i; | 513 | l+=i; |
| 514 | /* the last of these zero bytes will be overwritten | ||
| 515 | * with the padding length. */ | ||
| 516 | memset(&rec->input[rec->length], 0, i); | ||
| 514 | rec->length+=i; | 517 | rec->length+=i; |
| 515 | rec->input[l-1]=(i-1); | 518 | rec->input[l-1]=(i-1); |
| 516 | } | 519 | } |
diff --git a/src/lib/libssl/src/ssl/s3_lib.c b/src/lib/libssl/src/ssl/s3_lib.c index 62c791cb72..1130244aeb 100644 --- a/src/lib/libssl/src/ssl/s3_lib.c +++ b/src/lib/libssl/src/ssl/s3_lib.c | |||
| @@ -2177,6 +2177,7 @@ void ssl3_clear(SSL *s) | |||
| 2177 | { | 2177 | { |
| 2178 | unsigned char *rp,*wp; | 2178 | unsigned char *rp,*wp; |
| 2179 | size_t rlen, wlen; | 2179 | size_t rlen, wlen; |
| 2180 | int init_extra; | ||
| 2180 | 2181 | ||
| 2181 | #ifdef TLSEXT_TYPE_opaque_prf_input | 2182 | #ifdef TLSEXT_TYPE_opaque_prf_input |
| 2182 | if (s->s3->client_opaque_prf_input != NULL) | 2183 | if (s->s3->client_opaque_prf_input != NULL) |
| @@ -2215,6 +2216,7 @@ void ssl3_clear(SSL *s) | |||
| 2215 | wp = s->s3->wbuf.buf; | 2216 | wp = s->s3->wbuf.buf; |
| 2216 | rlen = s->s3->rbuf.len; | 2217 | rlen = s->s3->rbuf.len; |
| 2217 | wlen = s->s3->wbuf.len; | 2218 | wlen = s->s3->wbuf.len; |
| 2219 | init_extra = s->s3->init_extra; | ||
| 2218 | if (s->s3->handshake_buffer) { | 2220 | if (s->s3->handshake_buffer) { |
| 2219 | BIO_free(s->s3->handshake_buffer); | 2221 | BIO_free(s->s3->handshake_buffer); |
| 2220 | s->s3->handshake_buffer = NULL; | 2222 | s->s3->handshake_buffer = NULL; |
| @@ -2227,6 +2229,7 @@ void ssl3_clear(SSL *s) | |||
| 2227 | s->s3->wbuf.buf = wp; | 2229 | s->s3->wbuf.buf = wp; |
| 2228 | s->s3->rbuf.len = rlen; | 2230 | s->s3->rbuf.len = rlen; |
| 2229 | s->s3->wbuf.len = wlen; | 2231 | s->s3->wbuf.len = wlen; |
| 2232 | s->s3->init_extra = init_extra; | ||
| 2230 | 2233 | ||
| 2231 | ssl_free_wbio_buffer(s); | 2234 | ssl_free_wbio_buffer(s); |
| 2232 | 2235 | ||
diff --git a/src/lib/libssl/src/ssl/s3_srvr.c b/src/lib/libssl/src/ssl/s3_srvr.c index c3b5ff33ff..d734c359fb 100644 --- a/src/lib/libssl/src/ssl/s3_srvr.c +++ b/src/lib/libssl/src/ssl/s3_srvr.c | |||
| @@ -258,6 +258,7 @@ int ssl3_accept(SSL *s) | |||
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | s->init_num=0; | 260 | s->init_num=0; |
| 261 | s->s3->flags &= ~SSL3_FLAGS_SGC_RESTART_DONE; | ||
| 261 | 262 | ||
| 262 | if (s->state != SSL_ST_RENEGOTIATE) | 263 | if (s->state != SSL_ST_RENEGOTIATE) |
| 263 | { | 264 | { |
| @@ -755,6 +756,14 @@ int ssl3_check_client_hello(SSL *s) | |||
| 755 | int ok; | 756 | int ok; |
| 756 | long n; | 757 | long n; |
| 757 | 758 | ||
| 759 | /* We only allow the client to restart the handshake once per | ||
| 760 | * negotiation. */ | ||
| 761 | if (s->s3->flags & SSL3_FLAGS_SGC_RESTART_DONE) | ||
| 762 | { | ||
| 763 | SSLerr(SSL_F_SSL3_CHECK_CLIENT_HELLO, SSL_R_MULTIPLE_SGC_RESTARTS); | ||
| 764 | return -1; | ||
| 765 | } | ||
| 766 | |||
| 758 | /* this function is called when we really expect a Certificate message, | 767 | /* this function is called when we really expect a Certificate message, |
| 759 | * so permit appropriate message length */ | 768 | * so permit appropriate message length */ |
| 760 | n=s->method->ssl_get_message(s, | 769 | n=s->method->ssl_get_message(s, |
| @@ -783,6 +792,7 @@ int ssl3_check_client_hello(SSL *s) | |||
| 783 | s->s3->tmp.ecdh = NULL; | 792 | s->s3->tmp.ecdh = NULL; |
| 784 | } | 793 | } |
| 785 | #endif | 794 | #endif |
| 795 | s->s3->flags |= SSL3_FLAGS_SGC_RESTART_DONE; | ||
| 786 | return 2; | 796 | return 2; |
| 787 | } | 797 | } |
| 788 | return 1; | 798 | return 1; |
| @@ -2130,6 +2140,7 @@ int ssl3_get_client_key_exchange(SSL *s) | |||
| 2130 | if (i <= 0) | 2140 | if (i <= 0) |
| 2131 | { | 2141 | { |
| 2132 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,ERR_R_DH_LIB); | 2142 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,ERR_R_DH_LIB); |
| 2143 | BN_clear_free(pub); | ||
| 2133 | goto err; | 2144 | goto err; |
| 2134 | } | 2145 | } |
| 2135 | 2146 | ||
diff --git a/src/lib/libssl/src/ssl/ssl.h b/src/lib/libssl/src/ssl/ssl.h index e4c3f65010..8f922eea72 100644 --- a/src/lib/libssl/src/ssl/ssl.h +++ b/src/lib/libssl/src/ssl/ssl.h | |||
| @@ -1882,6 +1882,7 @@ void ERR_load_SSL_strings(void); | |||
| 1882 | #define SSL_F_SSL3_CALLBACK_CTRL 233 | 1882 | #define SSL_F_SSL3_CALLBACK_CTRL 233 |
| 1883 | #define SSL_F_SSL3_CHANGE_CIPHER_STATE 129 | 1883 | #define SSL_F_SSL3_CHANGE_CIPHER_STATE 129 |
| 1884 | #define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM 130 | 1884 | #define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM 130 |
| 1885 | #define SSL_F_SSL3_CHECK_CLIENT_HELLO 304 | ||
| 1885 | #define SSL_F_SSL3_CLIENT_HELLO 131 | 1886 | #define SSL_F_SSL3_CLIENT_HELLO 131 |
| 1886 | #define SSL_F_SSL3_CONNECT 132 | 1887 | #define SSL_F_SSL3_CONNECT 132 |
| 1887 | #define SSL_F_SSL3_CTRL 213 | 1888 | #define SSL_F_SSL3_CTRL 213 |
| @@ -2139,6 +2140,7 @@ void ERR_load_SSL_strings(void); | |||
| 2139 | #define SSL_R_MISSING_TMP_RSA_KEY 172 | 2140 | #define SSL_R_MISSING_TMP_RSA_KEY 172 |
| 2140 | #define SSL_R_MISSING_TMP_RSA_PKEY 173 | 2141 | #define SSL_R_MISSING_TMP_RSA_PKEY 173 |
| 2141 | #define SSL_R_MISSING_VERIFY_MESSAGE 174 | 2142 | #define SSL_R_MISSING_VERIFY_MESSAGE 174 |
| 2143 | #define SSL_R_MULTIPLE_SGC_RESTARTS 346 | ||
| 2142 | #define SSL_R_NON_SSLV2_INITIAL_PACKET 175 | 2144 | #define SSL_R_NON_SSLV2_INITIAL_PACKET 175 |
| 2143 | #define SSL_R_NO_CERTIFICATES_RETURNED 176 | 2145 | #define SSL_R_NO_CERTIFICATES_RETURNED 176 |
| 2144 | #define SSL_R_NO_CERTIFICATE_ASSIGNED 177 | 2146 | #define SSL_R_NO_CERTIFICATE_ASSIGNED 177 |
diff --git a/src/lib/libssl/src/ssl/ssl3.h b/src/lib/libssl/src/ssl/ssl3.h index baaa89e717..9c2c41287a 100644 --- a/src/lib/libssl/src/ssl/ssl3.h +++ b/src/lib/libssl/src/ssl/ssl3.h | |||
| @@ -379,6 +379,17 @@ typedef struct ssl3_buffer_st | |||
| 379 | #define SSL3_FLAGS_POP_BUFFER 0x0004 | 379 | #define SSL3_FLAGS_POP_BUFFER 0x0004 |
| 380 | #define TLS1_FLAGS_TLS_PADDING_BUG 0x0008 | 380 | #define TLS1_FLAGS_TLS_PADDING_BUG 0x0008 |
| 381 | #define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010 | 381 | #define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010 |
| 382 | |||
| 383 | /* SSL3_FLAGS_SGC_RESTART_DONE is set when we | ||
| 384 | * restart a handshake because of MS SGC and so prevents us | ||
| 385 | * from restarting the handshake in a loop. It's reset on a | ||
| 386 | * renegotiation, so effectively limits the client to one restart | ||
| 387 | * per negotiation. This limits the possibility of a DDoS | ||
| 388 | * attack where the client handshakes in a loop using SGC to | ||
| 389 | * restart. Servers which permit renegotiation can still be | ||
| 390 | * effected, but we can't prevent that. | ||
| 391 | */ | ||
| 392 | #define SSL3_FLAGS_SGC_RESTART_DONE 0x0040 | ||
| 382 | 393 | ||
| 383 | typedef struct ssl3_state_st | 394 | typedef struct ssl3_state_st |
| 384 | { | 395 | { |
diff --git a/src/lib/libssl/src/ssl/ssl_ciph.c b/src/lib/libssl/src/ssl/ssl_ciph.c index a8ce186b78..54ba7ef5b4 100644 --- a/src/lib/libssl/src/ssl/ssl_ciph.c +++ b/src/lib/libssl/src/ssl/ssl_ciph.c | |||
| @@ -446,6 +446,7 @@ static void load_builtin_compressions(void) | |||
| 446 | sk_SSL_COMP_push(ssl_comp_methods,comp); | 446 | sk_SSL_COMP_push(ssl_comp_methods,comp); |
| 447 | } | 447 | } |
| 448 | } | 448 | } |
| 449 | sk_SSL_COMP_sort(ssl_comp_methods); | ||
| 449 | } | 450 | } |
| 450 | MemCheck_on(); | 451 | MemCheck_on(); |
| 451 | } | 452 | } |
diff --git a/src/lib/libssl/src/ssl/ssl_err.c b/src/lib/libssl/src/ssl/ssl_err.c index 0eed464749..e9be77109f 100644 --- a/src/lib/libssl/src/ssl/ssl_err.c +++ b/src/lib/libssl/src/ssl/ssl_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* ssl/ssl_err.c */ | 1 | /* ssl/ssl_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2009 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -137,6 +137,7 @@ static ERR_STRING_DATA SSL_str_functs[]= | |||
| 137 | {ERR_FUNC(SSL_F_SSL3_CALLBACK_CTRL), "SSL3_CALLBACK_CTRL"}, | 137 | {ERR_FUNC(SSL_F_SSL3_CALLBACK_CTRL), "SSL3_CALLBACK_CTRL"}, |
| 138 | {ERR_FUNC(SSL_F_SSL3_CHANGE_CIPHER_STATE), "SSL3_CHANGE_CIPHER_STATE"}, | 138 | {ERR_FUNC(SSL_F_SSL3_CHANGE_CIPHER_STATE), "SSL3_CHANGE_CIPHER_STATE"}, |
| 139 | {ERR_FUNC(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM), "SSL3_CHECK_CERT_AND_ALGORITHM"}, | 139 | {ERR_FUNC(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM), "SSL3_CHECK_CERT_AND_ALGORITHM"}, |
| 140 | {ERR_FUNC(SSL_F_SSL3_CHECK_CLIENT_HELLO), "SSL3_CHECK_CLIENT_HELLO"}, | ||
| 140 | {ERR_FUNC(SSL_F_SSL3_CLIENT_HELLO), "SSL3_CLIENT_HELLO"}, | 141 | {ERR_FUNC(SSL_F_SSL3_CLIENT_HELLO), "SSL3_CLIENT_HELLO"}, |
| 141 | {ERR_FUNC(SSL_F_SSL3_CONNECT), "SSL3_CONNECT"}, | 142 | {ERR_FUNC(SSL_F_SSL3_CONNECT), "SSL3_CONNECT"}, |
| 142 | {ERR_FUNC(SSL_F_SSL3_CTRL), "SSL3_CTRL"}, | 143 | {ERR_FUNC(SSL_F_SSL3_CTRL), "SSL3_CTRL"}, |
| @@ -397,6 +398,7 @@ static ERR_STRING_DATA SSL_str_reasons[]= | |||
| 397 | {ERR_REASON(SSL_R_MISSING_TMP_RSA_KEY) ,"missing tmp rsa key"}, | 398 | {ERR_REASON(SSL_R_MISSING_TMP_RSA_KEY) ,"missing tmp rsa key"}, |
| 398 | {ERR_REASON(SSL_R_MISSING_TMP_RSA_PKEY) ,"missing tmp rsa pkey"}, | 399 | {ERR_REASON(SSL_R_MISSING_TMP_RSA_PKEY) ,"missing tmp rsa pkey"}, |
| 399 | {ERR_REASON(SSL_R_MISSING_VERIFY_MESSAGE),"missing verify message"}, | 400 | {ERR_REASON(SSL_R_MISSING_VERIFY_MESSAGE),"missing verify message"}, |
| 401 | {ERR_REASON(SSL_R_MULTIPLE_SGC_RESTARTS) ,"multiple sgc restarts"}, | ||
| 400 | {ERR_REASON(SSL_R_NON_SSLV2_INITIAL_PACKET),"non sslv2 initial packet"}, | 402 | {ERR_REASON(SSL_R_NON_SSLV2_INITIAL_PACKET),"non sslv2 initial packet"}, |
| 401 | {ERR_REASON(SSL_R_NO_CERTIFICATES_RETURNED),"no certificates returned"}, | 403 | {ERR_REASON(SSL_R_NO_CERTIFICATES_RETURNED),"no certificates returned"}, |
| 402 | {ERR_REASON(SSL_R_NO_CERTIFICATE_ASSIGNED),"no certificate assigned"}, | 404 | {ERR_REASON(SSL_R_NO_CERTIFICATE_ASSIGNED),"no certificate assigned"}, |
diff --git a/src/lib/libssl/src/ssl/ssl_lib.c b/src/lib/libssl/src/ssl/ssl_lib.c index 46732791fd..8e89911f48 100644 --- a/src/lib/libssl/src/ssl/ssl_lib.c +++ b/src/lib/libssl/src/ssl/ssl_lib.c | |||
| @@ -1054,6 +1054,9 @@ long SSL_ctrl(SSL *s,int cmd,long larg,void *parg) | |||
| 1054 | s->max_cert_list=larg; | 1054 | s->max_cert_list=larg; |
| 1055 | return(l); | 1055 | return(l); |
| 1056 | case SSL_CTRL_SET_MTU: | 1056 | case SSL_CTRL_SET_MTU: |
| 1057 | if (larg < (long)dtls1_min_mtu()) | ||
| 1058 | return 0; | ||
| 1059 | |||
| 1057 | if (SSL_version(s) == DTLS1_VERSION || | 1060 | if (SSL_version(s) == DTLS1_VERSION || |
| 1058 | SSL_version(s) == DTLS1_BAD_VER) | 1061 | SSL_version(s) == DTLS1_BAD_VER) |
| 1059 | { | 1062 | { |
diff --git a/src/lib/libssl/src/ssl/ssl_locl.h b/src/lib/libssl/src/ssl/ssl_locl.h index 4c78393f3f..cea622a2a6 100644 --- a/src/lib/libssl/src/ssl/ssl_locl.h +++ b/src/lib/libssl/src/ssl/ssl_locl.h | |||
| @@ -950,6 +950,7 @@ void dtls1_stop_timer(SSL *s); | |||
| 950 | int dtls1_is_timer_expired(SSL *s); | 950 | int dtls1_is_timer_expired(SSL *s); |
| 951 | void dtls1_double_timeout(SSL *s); | 951 | void dtls1_double_timeout(SSL *s); |
| 952 | int dtls1_send_newsession_ticket(SSL *s); | 952 | int dtls1_send_newsession_ticket(SSL *s); |
| 953 | unsigned int dtls1_min_mtu(void); | ||
| 953 | 954 | ||
| 954 | /* some client-only functions */ | 955 | /* some client-only functions */ |
| 955 | int ssl3_client_hello(SSL *s); | 956 | int ssl3_client_hello(SSL *s); |
diff --git a/src/lib/libssl/src/ssl/t1_lib.c b/src/lib/libssl/src/ssl/t1_lib.c index 85371c87b8..26cbae449e 100644 --- a/src/lib/libssl/src/ssl/t1_lib.c +++ b/src/lib/libssl/src/ssl/t1_lib.c | |||
| @@ -971,6 +971,12 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in | |||
| 971 | sdata = data; | 971 | sdata = data; |
| 972 | if (dsize > 0) | 972 | if (dsize > 0) |
| 973 | { | 973 | { |
| 974 | if (s->tlsext_ocsp_exts) | ||
| 975 | { | ||
| 976 | sk_X509_EXTENSION_pop_free(s->tlsext_ocsp_exts, | ||
| 977 | X509_EXTENSION_free); | ||
| 978 | } | ||
| 979 | |||
| 974 | s->tlsext_ocsp_exts = | 980 | s->tlsext_ocsp_exts = |
| 975 | d2i_X509_EXTENSIONS(NULL, | 981 | d2i_X509_EXTENSIONS(NULL, |
| 976 | &sdata, dsize); | 982 | &sdata, dsize); |
diff --git a/src/lib/libssl/src/test/testssl b/src/lib/libssl/src/test/testssl index f9d7c5d65f..b55364ae88 100644 --- a/src/lib/libssl/src/test/testssl +++ b/src/lib/libssl/src/test/testssl | |||
| @@ -100,8 +100,8 @@ echo test sslv2/sslv3 via BIO pair | |||
| 100 | $ssltest $extra || exit 1 | 100 | $ssltest $extra || exit 1 |
| 101 | 101 | ||
| 102 | if [ $dsa_cert = NO ]; then | 102 | if [ $dsa_cert = NO ]; then |
| 103 | echo test sslv2/sslv3 w/o DHE via BIO pair | 103 | echo 'test sslv2/sslv3 w/o (EC)DHE via BIO pair' |
| 104 | $ssltest -bio_pair -no_dhe $extra || exit 1 | 104 | $ssltest -bio_pair -no_dhe -no_ecdhe $extra || exit 1 |
| 105 | fi | 105 | fi |
| 106 | 106 | ||
| 107 | echo test sslv2/sslv3 with 1024bit DHE via BIO pair | 107 | echo test sslv2/sslv3 with 1024bit DHE via BIO pair |
| @@ -131,8 +131,8 @@ fi | |||
| 131 | if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then | 131 | if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then |
| 132 | echo skipping RSA tests | 132 | echo skipping RSA tests |
| 133 | else | 133 | else |
| 134 | echo test tls1 with 1024bit RSA, no DHE, multiple handshakes | 134 | echo 'test tls1 with 1024bit RSA, no (EC)DHE, multiple handshakes' |
| 135 | ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -no_dhe -num 10 -f -time $extra || exit 1 | 135 | ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -no_dhe -no_ecdhe -num 10 -f -time $extra || exit 1 |
| 136 | 136 | ||
| 137 | if ../util/shlib_wrap.sh ../apps/openssl no-dh; then | 137 | if ../util/shlib_wrap.sh ../apps/openssl no-dh; then |
| 138 | echo skipping RSA+DHE tests | 138 | echo skipping RSA+DHE tests |
diff --git a/src/lib/libssl/src/util/mkerr.pl b/src/lib/libssl/src/util/mkerr.pl index 2c99467d34..aec401c773 100644 --- a/src/lib/libssl/src/util/mkerr.pl +++ b/src/lib/libssl/src/util/mkerr.pl | |||
| @@ -769,7 +769,7 @@ EOF | |||
| 769 | undef %err_reason_strings; | 769 | undef %err_reason_strings; |
| 770 | } | 770 | } |
| 771 | 771 | ||
| 772 | if($debug && defined(%notrans)) { | 772 | if($debug && %notrans) { |
| 773 | print STDERR "The following function codes were not translated:\n"; | 773 | print STDERR "The following function codes were not translated:\n"; |
| 774 | foreach(sort keys %notrans) | 774 | foreach(sort keys %notrans) |
| 775 | { | 775 | { |
