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.h28
-rw-r--r--src/lib/libcrypto/rc2/rc2_cbc.c19
-rw-r--r--src/lib/libcrypto/rc2/rc2_ecb.c12
-rw-r--r--src/lib/libcrypto/rc2/rc2_skey.c8
-rw-r--r--src/lib/libcrypto/rc2/rc2cfb64.c13
-rw-r--r--src/lib/libcrypto/rc2/rc2ofb64.c12
6 files changed, 35 insertions, 57 deletions
diff --git a/src/lib/libcrypto/rc2/rc2.h b/src/lib/libcrypto/rc2/rc2.h
index 9571efb755..7816b454dc 100644
--- a/src/lib/libcrypto/rc2/rc2.h
+++ b/src/lib/libcrypto/rc2/rc2.h
@@ -59,11 +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#ifdef __cplusplus 62#ifdef OPENSSL_NO_RC2
63extern "C" {
64#endif
65
66#ifdef NO_RC2
67#error RC2 is disabled. 63#error RC2 is disabled.
68#endif 64#endif
69 65
@@ -74,23 +70,29 @@ extern "C" {
74#define RC2_BLOCK 8 70#define RC2_BLOCK 8
75#define RC2_KEY_LENGTH 16 71#define RC2_KEY_LENGTH 16
76 72
73#ifdef __cplusplus
74extern "C" {
75#endif
76
77typedef struct rc2_key_st 77typedef struct rc2_key_st
78 { 78 {
79 RC2_INT data[64]; 79 RC2_INT data[64];
80 } RC2_KEY; 80 } RC2_KEY;
81 81
82 82
83void RC2_set_key(RC2_KEY *key, int len, unsigned char *data,int bits); 83void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits);
84void RC2_ecb_encrypt(unsigned char *in,unsigned char *out,RC2_KEY *key, 84void RC2_ecb_encrypt(const unsigned char *in,unsigned char *out,RC2_KEY *key,
85 int enc); 85 int enc);
86void RC2_encrypt(unsigned long *data,RC2_KEY *key); 86void RC2_encrypt(unsigned long *data,RC2_KEY *key);
87void RC2_decrypt(unsigned long *data,RC2_KEY *key); 87void RC2_decrypt(unsigned long *data,RC2_KEY *key);
88void RC2_cbc_encrypt(unsigned char *in, unsigned char *out, long length, 88void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
89 RC2_KEY *ks, unsigned char *iv, int enc); 89 RC2_KEY *ks, unsigned char *iv, int enc);
90void RC2_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, 90void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out,
91 RC2_KEY *schedule, unsigned char *ivec, int *num, int enc); 91 long length, RC2_KEY *schedule, unsigned char *ivec,
92void RC2_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, 92 int *num, int enc);
93 RC2_KEY *schedule, unsigned char *ivec, int *num); 93void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out,
94 long length, RC2_KEY *schedule, unsigned char *ivec,
95 int *num);
94 96
95#ifdef __cplusplus 97#ifdef __cplusplus
96} 98}
diff --git a/src/lib/libcrypto/rc2/rc2_cbc.c b/src/lib/libcrypto/rc2/rc2_cbc.c
index 22e89f0441..74f48d3d87 100644
--- a/src/lib/libcrypto/rc2/rc2_cbc.c
+++ b/src/lib/libcrypto/rc2/rc2_cbc.c
@@ -56,16 +56,11 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#include "rc2.h" 59#include <openssl/rc2.h>
60#include "rc2_locl.h" 60#include "rc2_locl.h"
61 61
62void RC2_cbc_encrypt(in, out, length, ks, iv, encrypt) 62void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
63unsigned char *in; 63 RC2_KEY *ks, unsigned char *iv, int encrypt)
64unsigned char *out;
65long length;
66RC2_KEY *ks;
67unsigned char *iv;
68int encrypt;
69 { 64 {
70 register unsigned long tin0,tin1; 65 register unsigned long tin0,tin1;
71 register unsigned long tout0,tout1,xor0,xor1; 66 register unsigned long tout0,tout1,xor0,xor1;
@@ -138,9 +133,7 @@ int encrypt;
138 tin[0]=tin[1]=0; 133 tin[0]=tin[1]=0;
139 } 134 }
140 135
141void RC2_encrypt(d,key) 136void RC2_encrypt(unsigned long *d, RC2_KEY *key)
142unsigned long *d;
143RC2_KEY *key;
144 { 137 {
145 int i,n; 138 int i,n;
146 register RC2_INT *p0,*p1; 139 register RC2_INT *p0,*p1;
@@ -185,9 +178,7 @@ RC2_KEY *key;
185 d[1]=(unsigned long)(x2&0xffff)|((unsigned long)(x3&0xffff)<<16L); 178 d[1]=(unsigned long)(x2&0xffff)|((unsigned long)(x3&0xffff)<<16L);
186 } 179 }
187 180
188void RC2_decrypt(d,key) 181void RC2_decrypt(unsigned long *d, RC2_KEY *key)
189unsigned long *d;
190RC2_KEY *key;
191 { 182 {
192 int i,n; 183 int i,n;
193 register RC2_INT *p0,*p1; 184 register RC2_INT *p0,*p1;
diff --git a/src/lib/libcrypto/rc2/rc2_ecb.c b/src/lib/libcrypto/rc2/rc2_ecb.c
index 96239cd4e0..d3e8c2718a 100644
--- a/src/lib/libcrypto/rc2/rc2_ecb.c
+++ b/src/lib/libcrypto/rc2/rc2_ecb.c
@@ -56,10 +56,11 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#include "rc2.h" 59#include <openssl/rc2.h>
60#include "rc2_locl.h" 60#include "rc2_locl.h"
61#include <openssl/opensslv.h>
61 62
62char *RC2_version="RC2 part of SSLeay 0.9.0b 29-Jun-1998"; 63const char *RC2_version="RC2" OPENSSL_VERSION_PTEXT;
63 64
64/* RC2 as implemented frm a posting from 65/* RC2 as implemented frm a posting from
65 * Newsgroups: sci.crypt 66 * Newsgroups: sci.crypt
@@ -69,11 +70,8 @@ char *RC2_version="RC2 part of SSLeay 0.9.0b 29-Jun-1998";
69 * Date: 11 Feb 1996 06:45:03 GMT 70 * Date: 11 Feb 1996 06:45:03 GMT
70 */ 71 */
71 72
72void RC2_ecb_encrypt(in, out, ks, encrypt) 73void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, RC2_KEY *ks,
73unsigned char *in; 74 int encrypt)
74unsigned char *out;
75RC2_KEY *ks;
76int encrypt;
77 { 75 {
78 unsigned long l,d[2]; 76 unsigned long l,d[2];
79 77
diff --git a/src/lib/libcrypto/rc2/rc2_skey.c b/src/lib/libcrypto/rc2/rc2_skey.c
index 0f1f253395..cab3080c73 100644
--- a/src/lib/libcrypto/rc2/rc2_skey.c
+++ b/src/lib/libcrypto/rc2/rc2_skey.c
@@ -56,7 +56,7 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#include "rc2.h" 59#include <openssl/rc2.h>
60#include "rc2_locl.h" 60#include "rc2_locl.h"
61 61
62static unsigned char key_table[256]={ 62static unsigned char key_table[256]={
@@ -90,11 +90,7 @@ static unsigned char key_table[256]={
90 * BSAFE uses the 'retarded' version. What I previously shipped is 90 * BSAFE uses the 'retarded' version. What I previously shipped is
91 * the same as specifying 1024 for the 'bits' parameter. Bsafe uses 91 * the same as specifying 1024 for the 'bits' parameter. Bsafe uses
92 * a version where the bits parameter is the same as len*8 */ 92 * a version where the bits parameter is the same as len*8 */
93void RC2_set_key(key,len,data,bits) 93void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits)
94RC2_KEY *key;
95int len;
96unsigned char *data;
97int bits;
98 { 94 {
99 int i,j; 95 int i,j;
100 unsigned char *k; 96 unsigned char *k;
diff --git a/src/lib/libcrypto/rc2/rc2cfb64.c b/src/lib/libcrypto/rc2/rc2cfb64.c
index d409fb77e9..b3a0158a6e 100644
--- a/src/lib/libcrypto/rc2/rc2cfb64.c
+++ b/src/lib/libcrypto/rc2/rc2cfb64.c
@@ -56,7 +56,7 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#include "rc2.h" 59#include <openssl/rc2.h>
60#include "rc2_locl.h" 60#include "rc2_locl.h"
61 61
62/* The input and output encrypted as though 64bit cfb mode is being 62/* The input and output encrypted as though 64bit cfb mode is being
@@ -64,14 +64,9 @@
64 * 64bit block we have used is contained in *num; 64 * 64bit block we have used is contained in *num;
65 */ 65 */
66 66
67void RC2_cfb64_encrypt(in, out, length, schedule, ivec, num, encrypt) 67void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out,
68unsigned char *in; 68 long length, RC2_KEY *schedule, unsigned char *ivec,
69unsigned char *out; 69 int *num, int encrypt)
70long length;
71RC2_KEY *schedule;
72unsigned char *ivec;
73int *num;
74int encrypt;
75 { 70 {
76 register unsigned long v0,v1,t; 71 register unsigned long v0,v1,t;
77 register int n= *num; 72 register int n= *num;
diff --git a/src/lib/libcrypto/rc2/rc2ofb64.c b/src/lib/libcrypto/rc2/rc2ofb64.c
index 4f09167447..9e297867ed 100644
--- a/src/lib/libcrypto/rc2/rc2ofb64.c
+++ b/src/lib/libcrypto/rc2/rc2ofb64.c
@@ -56,20 +56,16 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#include "rc2.h" 59#include <openssl/rc2.h>
60#include "rc2_locl.h" 60#include "rc2_locl.h"
61 61
62/* The input and output encrypted as though 64bit ofb mode is being 62/* The input and output encrypted as though 64bit ofb mode is being
63 * used. The extra state information to record how much of the 63 * used. The extra state information to record how much of the
64 * 64bit block we have used is contained in *num; 64 * 64bit block we have used is contained in *num;
65 */ 65 */
66void RC2_ofb64_encrypt(in, out, length, schedule, ivec, num) 66void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out,
67unsigned char *in; 67 long length, RC2_KEY *schedule, unsigned char *ivec,
68unsigned char *out; 68 int *num)
69long length;
70RC2_KEY *schedule;
71unsigned char *ivec;
72int *num;
73 { 69 {
74 register unsigned long v0,v1,t; 70 register unsigned long v0,v1,t;
75 register int n= *num; 71 register int n= *num;