summaryrefslogtreecommitdiff
path: root/Cryptlib/OpenSSL/crypto/rc4
diff options
context:
space:
mode:
authorGary Ching-Pang Lin <glin@suse.com>2015-07-13 11:58:44 +0800
committerPeter Jones <pjones@redhat.com>2015-07-28 11:46:38 -0400
commit4ac84f8673eb7f3e5b98226aabe21f3e3111c7db (patch)
tree2fb3d9dd667c772fae5f87fa61e1501cf12da0ce /Cryptlib/OpenSSL/crypto/rc4
parentdb142ce288a63db2e8f7858ba7564158cc7a64e5 (diff)
downloadefi-boot-shim-4ac84f8673eb7f3e5b98226aabe21f3e3111c7db.tar.gz
efi-boot-shim-4ac84f8673eb7f3e5b98226aabe21f3e3111c7db.zip
Update openssl to 1.0.2d
Also update Cryptlib to edk2 r17731 Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
Diffstat (limited to 'Cryptlib/OpenSSL/crypto/rc4')
-rw-r--r--Cryptlib/OpenSSL/crypto/rc4/rc4_enc.c18
-rw-r--r--Cryptlib/OpenSSL/crypto/rc4/rc4_locl.h6
-rw-r--r--Cryptlib/OpenSSL/crypto/rc4/rc4_skey.c50
-rw-r--r--Cryptlib/OpenSSL/crypto/rc4/rc4_utl.c (renamed from Cryptlib/OpenSSL/crypto/rc4/rc4_fblk.c)35
4 files changed, 23 insertions, 86 deletions
diff --git a/Cryptlib/OpenSSL/crypto/rc4/rc4_enc.c b/Cryptlib/OpenSSL/crypto/rc4/rc4_enc.c
index 72cc8f65..0f0a2487 100644
--- a/Cryptlib/OpenSSL/crypto/rc4/rc4_enc.c
+++ b/Cryptlib/OpenSSL/crypto/rc4/rc4_enc.c
@@ -68,18 +68,18 @@
* Date: Wed, 14 Sep 1994 06:35:31 GMT
*/
-void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
+void RC4(RC4_KEY *key, size_t len, const unsigned char *indata,
unsigned char *outdata)
{
register RC4_INT *d;
register RC4_INT x, y, tx, ty;
- int i;
+ size_t i;
x = key->x;
y = key->y;
d = key->data;
-#if defined(RC4_CHUNK)
+#if defined(RC4_CHUNK) && !defined(PEDANTIC)
/*-
* The original reason for implementing this(*) was the fact that
* pre-21164a Alpha CPUs don't have byte load/store instructions
@@ -121,8 +121,8 @@ void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
(RC4_CHUNK)d[(tx+ty)&0xff]\
)
- if ((((unsigned long)indata & (sizeof(RC4_CHUNK) - 1)) |
- ((unsigned long)outdata & (sizeof(RC4_CHUNK) - 1))) == 0) {
+ if ((((size_t)indata & (sizeof(RC4_CHUNK) - 1)) |
+ ((size_t)outdata & (sizeof(RC4_CHUNK) - 1))) == 0) {
RC4_CHUNK ichunk, otp;
const union {
long one;
@@ -161,7 +161,7 @@ void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
*/
if (!is_endian.little) { /* BIG-ENDIAN CASE */
# define BESHFT(c) (((sizeof(RC4_CHUNK)-(c)-1)*8)&(sizeof(RC4_CHUNK)*8-1))
- for (; len & ~(sizeof(RC4_CHUNK) - 1); len -= sizeof(RC4_CHUNK)) {
+ for (; len & (0 - sizeof(RC4_CHUNK)); len -= sizeof(RC4_CHUNK)) {
ichunk = *(RC4_CHUNK *) indata;
otp = RC4_STEP << BESHFT(0);
otp |= RC4_STEP << BESHFT(1);
@@ -215,7 +215,7 @@ void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
return;
} else { /* LITTLE-ENDIAN CASE */
# define LESHFT(c) (((c)*8)&(sizeof(RC4_CHUNK)*8-1))
- for (; len & ~(sizeof(RC4_CHUNK) - 1); len -= sizeof(RC4_CHUNK)) {
+ for (; len & (0 - sizeof(RC4_CHUNK)); len -= sizeof(RC4_CHUNK)) {
ichunk = *(RC4_CHUNK *) indata;
otp = RC4_STEP;
otp |= RC4_STEP << 8;
@@ -284,7 +284,7 @@ void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
# define RC4_LOOP(a,b,i) LOOP(a[i],b[i])
#endif
- i = (int)(len >> 3L);
+ i = len >> 3;
if (i) {
for (;;) {
RC4_LOOP(indata, outdata, 0);
@@ -303,7 +303,7 @@ void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
break;
}
}
- i = (int)len & 0x07;
+ i = len & 0x07;
if (i) {
for (;;) {
RC4_LOOP(indata, outdata, 0);
diff --git a/Cryptlib/OpenSSL/crypto/rc4/rc4_locl.h b/Cryptlib/OpenSSL/crypto/rc4/rc4_locl.h
index c712e163..faf8742f 100644
--- a/Cryptlib/OpenSSL/crypto/rc4/rc4_locl.h
+++ b/Cryptlib/OpenSSL/crypto/rc4/rc4_locl.h
@@ -1,5 +1,5 @@
#ifndef HEADER_RC4_LOCL_H
-#define HEADER_RC4_LOCL_H
-#include <openssl/opensslconf.h>
-#include <cryptlib.h>
+# define HEADER_RC4_LOCL_H
+# include <openssl/opensslconf.h>
+# include <cryptlib.h>
#endif
diff --git a/Cryptlib/OpenSSL/crypto/rc4/rc4_skey.c b/Cryptlib/OpenSSL/crypto/rc4/rc4_skey.c
index 62121d90..06890d16 100644
--- a/Cryptlib/OpenSSL/crypto/rc4/rc4_skey.c
+++ b/Cryptlib/OpenSSL/crypto/rc4/rc4_skey.c
@@ -59,10 +59,6 @@
#include <openssl/rc4.h>
#include "rc4_locl.h"
#include <openssl/opensslv.h>
-#include <openssl/crypto.h>
-#ifdef OPENSSL_FIPS
-# include <openssl/fips.h>
-#endif
const char RC4_version[] = "RC4" OPENSSL_VERSION_PTEXT;
@@ -90,11 +86,7 @@ const char *RC4_options(void)
* Date: Wed, 14 Sep 1994 06:35:31 GMT
*/
-#ifdef OPENSSL_FIPS
void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
-#else
-void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
-#endif
{
register RC4_INT tmp;
register int id1, id2;
@@ -113,48 +105,6 @@ void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
d[(n)]=d[id2]; \
d[id2]=tmp; }
-#if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM)
-# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__INTEL__) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64)
- if (sizeof(RC4_INT) > 1) {
- /*
- * Unlike all other x86 [and x86_64] implementations,
- * Intel P4 core [including EM64T] was found to perform
- * poorly with wider RC4_INT. Performance improvement
- * for IA-32 hand-coded assembler turned out to be 2.8x
- * if re-coded for RC4_CHAR! It's however inappropriate
- * to just switch to RC4_CHAR for x86[_64], as non-P4
- * implementations suffer from significant performance
- * losses then, e.g. PIII exhibits >2x deterioration,
- * and so does Opteron. In order to assure optimal
- * all-round performance, we detect P4 at run-time by
- * checking upon reserved bit 20 in CPU capability
- * vector and set up compressed key schedule, which is
- * recognized by correspondingly updated assembler
- * module... Bit 20 is set up by OPENSSL_ia32_cpuid.
- *
- * <appro@fy.chalmers.se>
- */
-# ifdef OPENSSL_FIPS
- unsigned long *ia32cap_ptr = OPENSSL_ia32cap_loc();
- if (ia32cap_ptr && (*ia32cap_ptr & (1 << 20))) {
-# else
- if (OPENSSL_ia32cap_P & (1 << 20)) {
-# endif
- unsigned char *cp = (unsigned char *)d;
-
- for (i = 0; i < 256; i++)
- cp[i] = i;
- for (i = 0; i < 256; i++)
- SK_LOOP(cp, i);
- /* mark schedule as compressed! */
- d[256 / sizeof(RC4_INT)] = -1;
- return;
- }
- }
-# endif
-#endif
for (i = 0; i < 256; i++)
d[i] = i;
for (i = 0; i < 256; i += 4) {
diff --git a/Cryptlib/OpenSSL/crypto/rc4/rc4_fblk.c b/Cryptlib/OpenSSL/crypto/rc4/rc4_utl.c
index f2366851..7c6a15f1 100644
--- a/Cryptlib/OpenSSL/crypto/rc4/rc4_fblk.c
+++ b/Cryptlib/OpenSSL/crypto/rc4/rc4_utl.c
@@ -1,10 +1,6 @@
-/* crypto/rc4/rc4_fblk.c */
-/*
- * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
- * project.
- */
+/* crypto/rc4/rc4_utl.c -*- mode:C; c-file-style: "eay" -*- */
/* ====================================================================
- * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -21,12 +17,12 @@
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
- * licensing@OpenSSL.org.
+ * openssl-core@openssl.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
@@ -35,7 +31,7 @@
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -50,26 +46,17 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
+ *
*/
-#include <openssl/rc4.h>
-#include "rc4_locl.h"
#include <openssl/opensslv.h>
#include <openssl/crypto.h>
-#ifdef OPENSSL_FIPS
-# include <openssl/fips.h>
-#endif
-
-/*
- * FIPS mode blocking for RC4 has to be done separately since RC4_set_key may
- * be implemented in an assembly language file.
- */
+#include <openssl/rc4.h>
-#ifdef OPENSSL_FIPS
void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
{
- if (FIPS_mode())
- FIPS_BAD_ABORT(RC4)
- private_RC4_set_key(key, len, data);
-}
+#ifdef OPENSSL_FIPS
+ fips_cipher_abort(RC4);
#endif
+ private_RC4_set_key(key, len, data);
+}