summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rc2
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/rc2')
-rw-r--r--src/lib/libcrypto/rc2/rc2.h7
-rw-r--r--src/lib/libcrypto/rc2/rc2_ecb.c2
-rw-r--r--src/lib/libcrypto/rc2/rc2_skey.c21
-rw-r--r--src/lib/libcrypto/rc2/rc2speed.c3
-rw-r--r--src/lib/libcrypto/rc2/rc2test.c3
5 files changed, 16 insertions, 20 deletions
diff --git a/src/lib/libcrypto/rc2/rc2.h b/src/lib/libcrypto/rc2/rc2.h
index 71788158d8..34c8362317 100644
--- a/src/lib/libcrypto/rc2/rc2.h
+++ b/src/lib/libcrypto/rc2/rc2.h
@@ -59,6 +59,7 @@
59#ifndef HEADER_RC2_H 59#ifndef HEADER_RC2_H
60#define HEADER_RC2_H 60#define HEADER_RC2_H
61 61
62#include <openssl/opensslconf.h> /* OPENSSL_NO_RC2, RC2_INT */
62#ifdef OPENSSL_NO_RC2 63#ifdef OPENSSL_NO_RC2
63#error RC2 is disabled. 64#error RC2 is disabled.
64#endif 65#endif
@@ -66,7 +67,6 @@
66#define RC2_ENCRYPT 1 67#define RC2_ENCRYPT 1
67#define RC2_DECRYPT 0 68#define RC2_DECRYPT 0
68 69
69#include <openssl/opensslconf.h> /* RC2_INT */
70#define RC2_BLOCK 8 70#define RC2_BLOCK 8
71#define RC2_KEY_LENGTH 16 71#define RC2_KEY_LENGTH 16
72 72
@@ -79,10 +79,7 @@ typedef struct rc2_key_st
79 RC2_INT data[64]; 79 RC2_INT data[64];
80 } RC2_KEY; 80 } RC2_KEY;
81 81
82#ifdef OPENSSL_FIPS 82
83void private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,
84 int bits);
85#endif
86void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits); 83void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits);
87void RC2_ecb_encrypt(const unsigned char *in,unsigned char *out,RC2_KEY *key, 84void RC2_ecb_encrypt(const unsigned char *in,unsigned char *out,RC2_KEY *key,
88 int enc); 85 int enc);
diff --git a/src/lib/libcrypto/rc2/rc2_ecb.c b/src/lib/libcrypto/rc2/rc2_ecb.c
index d3e8c2718a..fff86c7af8 100644
--- a/src/lib/libcrypto/rc2/rc2_ecb.c
+++ b/src/lib/libcrypto/rc2/rc2_ecb.c
@@ -60,7 +60,7 @@
60#include "rc2_locl.h" 60#include "rc2_locl.h"
61#include <openssl/opensslv.h> 61#include <openssl/opensslv.h>
62 62
63const char *RC2_version="RC2" OPENSSL_VERSION_PTEXT; 63const char RC2_version[]="RC2" OPENSSL_VERSION_PTEXT;
64 64
65/* RC2 as implemented frm a posting from 65/* RC2 as implemented frm a posting from
66 * Newsgroups: sci.crypt 66 * Newsgroups: sci.crypt
diff --git a/src/lib/libcrypto/rc2/rc2_skey.c b/src/lib/libcrypto/rc2/rc2_skey.c
index 9652865188..4953642056 100644
--- a/src/lib/libcrypto/rc2/rc2_skey.c
+++ b/src/lib/libcrypto/rc2/rc2_skey.c
@@ -57,8 +57,6 @@
57 */ 57 */
58 58
59#include <openssl/rc2.h> 59#include <openssl/rc2.h>
60#include <openssl/crypto.h>
61#include <openssl/fips.h>
62#include "rc2_locl.h" 60#include "rc2_locl.h"
63 61
64static unsigned char key_table[256]={ 62static unsigned char key_table[256]={
@@ -86,25 +84,17 @@ static unsigned char key_table[256]={
86 0xfe,0x7f,0xc1,0xad, 84 0xfe,0x7f,0xc1,0xad,
87 }; 85 };
88 86
87#if defined(_MSC_VER) && defined(_ARM_)
88#pragma optimize("g",off)
89#endif
90
89/* It has come to my attention that there are 2 versions of the RC2 91/* It has come to my attention that there are 2 versions of the RC2
90 * key schedule. One which is normal, and anther which has a hook to 92 * key schedule. One which is normal, and anther which has a hook to
91 * use a reduced key length. 93 * use a reduced key length.
92 * BSAFE uses the 'retarded' version. What I previously shipped is 94 * BSAFE uses the 'retarded' version. What I previously shipped is
93 * the same as specifying 1024 for the 'bits' parameter. Bsafe uses 95 * the same as specifying 1024 for the 'bits' parameter. Bsafe uses
94 * a version where the bits parameter is the same as len*8 */ 96 * a version where the bits parameter is the same as len*8 */
95
96#ifdef OPENSSL_FIPS
97void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits)
98 {
99 if (FIPS_mode())
100 FIPS_BAD_ABORT(RC2)
101 private_RC2_set_key(key, len, data, bits);
102 }
103void private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,
104 int bits)
105#else
106void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) 97void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits)
107#endif
108 { 98 {
109 int i,j; 99 int i,j;
110 unsigned char *k; 100 unsigned char *k;
@@ -150,3 +140,6 @@ void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits)
150 *(ki--)=((k[i]<<8)|k[i-1])&0xffff; 140 *(ki--)=((k[i]<<8)|k[i-1])&0xffff;
151 } 141 }
152 142
143#if defined(_MSC_VER)
144#pragma optimize("",on)
145#endif
diff --git a/src/lib/libcrypto/rc2/rc2speed.c b/src/lib/libcrypto/rc2/rc2speed.c
index 4d0e1242ea..85cf6f65bf 100644
--- a/src/lib/libcrypto/rc2/rc2speed.c
+++ b/src/lib/libcrypto/rc2/rc2speed.c
@@ -69,7 +69,10 @@
69#include OPENSSL_UNISTD_IO 69#include OPENSSL_UNISTD_IO
70OPENSSL_DECLARE_EXIT 70OPENSSL_DECLARE_EXIT
71 71
72#ifndef OPENSSL_SYS_NETWARE
72#include <signal.h> 73#include <signal.h>
74#endif
75
73#ifndef _IRIX 76#ifndef _IRIX
74#include <time.h> 77#include <time.h>
75#endif 78#endif
diff --git a/src/lib/libcrypto/rc2/rc2test.c b/src/lib/libcrypto/rc2/rc2test.c
index b67bafb49f..0e117436bb 100644
--- a/src/lib/libcrypto/rc2/rc2test.c
+++ b/src/lib/libcrypto/rc2/rc2test.c
@@ -205,6 +205,9 @@ int main(int argc, char *argv[])
205 printf("ok\n"); 205 printf("ok\n");
206#endif 206#endif
207 207
208#ifdef OPENSSL_SYS_NETWARE
209 if (err) printf("ERROR: %d\n", err);
210#endif
208 EXIT(err); 211 EXIT(err);
209 return(err); 212 return(err);
210 } 213 }