diff options
Diffstat (limited to 'src/lib/libcrypto/bf')
| -rw-r--r-- | src/lib/libcrypto/bf/bf_cbc.c | 32 | ||||
| -rw-r--r-- | src/lib/libcrypto/bf/bf_cfb64.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/bf/bf_ecb.c | 12 | ||||
| -rw-r--r-- | src/lib/libcrypto/bf/bf_enc.c | 44 | ||||
| -rw-r--r-- | src/lib/libcrypto/bf/bf_locl.h | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/bf/bf_ofb64.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/bf/bf_opts.c | 2 | ||||
| -rw-r--r-- | src/lib/libcrypto/bf/bf_pi.h | 2 | ||||
| -rw-r--r-- | src/lib/libcrypto/bf/bf_skey.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/bf/bfspeed.c | 2 | ||||
| -rw-r--r-- | src/lib/libcrypto/bf/bftest.c | 12 | ||||
| -rw-r--r-- | src/lib/libcrypto/bf/blowfish.h | 24 |
12 files changed, 76 insertions, 72 deletions
diff --git a/src/lib/libcrypto/bf/bf_cbc.c b/src/lib/libcrypto/bf/bf_cbc.c index 95d1cdcdf9..f949629dc6 100644 --- a/src/lib/libcrypto/bf/bf_cbc.c +++ b/src/lib/libcrypto/bf/bf_cbc.c | |||
| @@ -59,8 +59,8 @@ | |||
| 59 | #include <openssl/blowfish.h> | 59 | #include <openssl/blowfish.h> |
| 60 | #include "bf_locl.h" | 60 | #include "bf_locl.h" |
| 61 | 61 | ||
| 62 | void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length, | 62 | void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, |
| 63 | BF_KEY *ks, unsigned char *iv, int encrypt) | 63 | const BF_KEY *schedule, unsigned char *ivec, int encrypt) |
| 64 | { | 64 | { |
| 65 | register BF_LONG tin0,tin1; | 65 | register BF_LONG tin0,tin1; |
| 66 | register BF_LONG tout0,tout1,xor0,xor1; | 66 | register BF_LONG tout0,tout1,xor0,xor1; |
| @@ -69,9 +69,9 @@ void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length, | |||
| 69 | 69 | ||
| 70 | if (encrypt) | 70 | if (encrypt) |
| 71 | { | 71 | { |
| 72 | n2l(iv,tout0); | 72 | n2l(ivec,tout0); |
| 73 | n2l(iv,tout1); | 73 | n2l(ivec,tout1); |
| 74 | iv-=8; | 74 | ivec-=8; |
| 75 | for (l-=8; l>=0; l-=8) | 75 | for (l-=8; l>=0; l-=8) |
| 76 | { | 76 | { |
| 77 | n2l(in,tin0); | 77 | n2l(in,tin0); |
| @@ -80,7 +80,7 @@ void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length, | |||
| 80 | tin1^=tout1; | 80 | tin1^=tout1; |
| 81 | tin[0]=tin0; | 81 | tin[0]=tin0; |
| 82 | tin[1]=tin1; | 82 | tin[1]=tin1; |
| 83 | BF_encrypt(tin,ks); | 83 | BF_encrypt(tin,schedule); |
| 84 | tout0=tin[0]; | 84 | tout0=tin[0]; |
| 85 | tout1=tin[1]; | 85 | tout1=tin[1]; |
| 86 | l2n(tout0,out); | 86 | l2n(tout0,out); |
| @@ -93,27 +93,27 @@ void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length, | |||
| 93 | tin1^=tout1; | 93 | tin1^=tout1; |
| 94 | tin[0]=tin0; | 94 | tin[0]=tin0; |
| 95 | tin[1]=tin1; | 95 | tin[1]=tin1; |
| 96 | BF_encrypt(tin,ks); | 96 | BF_encrypt(tin,schedule); |
| 97 | tout0=tin[0]; | 97 | tout0=tin[0]; |
| 98 | tout1=tin[1]; | 98 | tout1=tin[1]; |
| 99 | l2n(tout0,out); | 99 | l2n(tout0,out); |
| 100 | l2n(tout1,out); | 100 | l2n(tout1,out); |
| 101 | } | 101 | } |
| 102 | l2n(tout0,iv); | 102 | l2n(tout0,ivec); |
| 103 | l2n(tout1,iv); | 103 | l2n(tout1,ivec); |
| 104 | } | 104 | } |
| 105 | else | 105 | else |
| 106 | { | 106 | { |
| 107 | n2l(iv,xor0); | 107 | n2l(ivec,xor0); |
| 108 | n2l(iv,xor1); | 108 | n2l(ivec,xor1); |
| 109 | iv-=8; | 109 | ivec-=8; |
| 110 | for (l-=8; l>=0; l-=8) | 110 | for (l-=8; l>=0; l-=8) |
| 111 | { | 111 | { |
| 112 | n2l(in,tin0); | 112 | n2l(in,tin0); |
| 113 | n2l(in,tin1); | 113 | n2l(in,tin1); |
| 114 | tin[0]=tin0; | 114 | tin[0]=tin0; |
| 115 | tin[1]=tin1; | 115 | tin[1]=tin1; |
| 116 | BF_decrypt(tin,ks); | 116 | BF_decrypt(tin,schedule); |
| 117 | tout0=tin[0]^xor0; | 117 | tout0=tin[0]^xor0; |
| 118 | tout1=tin[1]^xor1; | 118 | tout1=tin[1]^xor1; |
| 119 | l2n(tout0,out); | 119 | l2n(tout0,out); |
| @@ -127,15 +127,15 @@ void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length, | |||
| 127 | n2l(in,tin1); | 127 | n2l(in,tin1); |
| 128 | tin[0]=tin0; | 128 | tin[0]=tin0; |
| 129 | tin[1]=tin1; | 129 | tin[1]=tin1; |
| 130 | BF_decrypt(tin,ks); | 130 | BF_decrypt(tin,schedule); |
| 131 | tout0=tin[0]^xor0; | 131 | tout0=tin[0]^xor0; |
| 132 | tout1=tin[1]^xor1; | 132 | tout1=tin[1]^xor1; |
| 133 | l2nn(tout0,tout1,out,l+8); | 133 | l2nn(tout0,tout1,out,l+8); |
| 134 | xor0=tin0; | 134 | xor0=tin0; |
| 135 | xor1=tin1; | 135 | xor1=tin1; |
| 136 | } | 136 | } |
| 137 | l2n(xor0,iv); | 137 | l2n(xor0,ivec); |
| 138 | l2n(xor1,iv); | 138 | l2n(xor1,ivec); |
| 139 | } | 139 | } |
| 140 | tin0=tin1=tout0=tout1=xor0=xor1=0; | 140 | tin0=tin1=tout0=tout1=xor0=xor1=0; |
| 141 | tin[0]=tin[1]=0; | 141 | tin[0]=tin[1]=0; |
diff --git a/src/lib/libcrypto/bf/bf_cfb64.c b/src/lib/libcrypto/bf/bf_cfb64.c index 1fb8905f49..6451c8d407 100644 --- a/src/lib/libcrypto/bf/bf_cfb64.c +++ b/src/lib/libcrypto/bf/bf_cfb64.c | |||
| @@ -64,8 +64,8 @@ | |||
| 64 | * 64bit block we have used is contained in *num; | 64 | * 64bit block we have used is contained in *num; |
| 65 | */ | 65 | */ |
| 66 | 66 | ||
| 67 | void BF_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, | 67 | void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, |
| 68 | BF_KEY *schedule, unsigned char *ivec, int *num, int encrypt) | 68 | const BF_KEY *schedule, unsigned char *ivec, int *num, int encrypt) |
| 69 | { | 69 | { |
| 70 | register BF_LONG v0,v1,t; | 70 | register BF_LONG v0,v1,t; |
| 71 | register int n= *num; | 71 | register int n= *num; |
diff --git a/src/lib/libcrypto/bf/bf_ecb.c b/src/lib/libcrypto/bf/bf_ecb.c index 9f8a24cdff..341991636f 100644 --- a/src/lib/libcrypto/bf/bf_ecb.c +++ b/src/lib/libcrypto/bf/bf_ecb.c | |||
| @@ -61,11 +61,11 @@ | |||
| 61 | #include <openssl/opensslv.h> | 61 | #include <openssl/opensslv.h> |
| 62 | 62 | ||
| 63 | /* Blowfish as implemented from 'Blowfish: Springer-Verlag paper' | 63 | /* Blowfish as implemented from 'Blowfish: Springer-Verlag paper' |
| 64 | * (From LECTURE NOTES IN COIMPUTER SCIENCE 809, FAST SOFTWARE ENCRYPTION, | 64 | * (From LECTURE NOTES IN COMPUTER SCIENCE 809, FAST SOFTWARE ENCRYPTION, |
| 65 | * CAMBRIDGE SECURITY WORKSHOP, CAMBRIDGE, U.K., DECEMBER 9-11, 1993) | 65 | * CAMBRIDGE SECURITY WORKSHOP, CAMBRIDGE, U.K., DECEMBER 9-11, 1993) |
| 66 | */ | 66 | */ |
| 67 | 67 | ||
| 68 | const char *BF_version="BlowFish" OPENSSL_VERSION_PTEXT; | 68 | const char *BF_version="Blowfish" OPENSSL_VERSION_PTEXT; |
| 69 | 69 | ||
| 70 | const char *BF_options(void) | 70 | const char *BF_options(void) |
| 71 | { | 71 | { |
| @@ -78,17 +78,17 @@ const char *BF_options(void) | |||
| 78 | #endif | 78 | #endif |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | void BF_ecb_encrypt(unsigned char *in, unsigned char *out, BF_KEY *ks, | 81 | void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, |
| 82 | int encrypt) | 82 | const BF_KEY *key, int encrypt) |
| 83 | { | 83 | { |
| 84 | BF_LONG l,d[2]; | 84 | BF_LONG l,d[2]; |
| 85 | 85 | ||
| 86 | n2l(in,l); d[0]=l; | 86 | n2l(in,l); d[0]=l; |
| 87 | n2l(in,l); d[1]=l; | 87 | n2l(in,l); d[1]=l; |
| 88 | if (encrypt) | 88 | if (encrypt) |
| 89 | BF_encrypt(d,ks); | 89 | BF_encrypt(d,key); |
| 90 | else | 90 | else |
| 91 | BF_decrypt(d,ks); | 91 | BF_decrypt(d,key); |
| 92 | l=d[0]; l2n(l,out); | 92 | l=d[0]; l2n(l,out); |
| 93 | l=d[1]; l2n(l,out); | 93 | l=d[1]; l2n(l,out); |
| 94 | l=d[0]=d[1]=0; | 94 | l=d[0]=d[1]=0; |
diff --git a/src/lib/libcrypto/bf/bf_enc.c b/src/lib/libcrypto/bf/bf_enc.c index ee01834561..b380acf959 100644 --- a/src/lib/libcrypto/bf/bf_enc.c +++ b/src/lib/libcrypto/bf/bf_enc.c | |||
| @@ -60,7 +60,7 @@ | |||
| 60 | #include "bf_locl.h" | 60 | #include "bf_locl.h" |
| 61 | 61 | ||
| 62 | /* Blowfish as implemented from 'Blowfish: Springer-Verlag paper' | 62 | /* Blowfish as implemented from 'Blowfish: Springer-Verlag paper' |
| 63 | * (From LECTURE NOTES IN COIMPUTER SCIENCE 809, FAST SOFTWARE ENCRYPTION, | 63 | * (From LECTURE NOTES IN COMPUTER SCIENCE 809, FAST SOFTWARE ENCRYPTION, |
| 64 | * CAMBRIDGE SECURITY WORKSHOP, CAMBRIDGE, U.K., DECEMBER 9-11, 1993) | 64 | * CAMBRIDGE SECURITY WORKSHOP, CAMBRIDGE, U.K., DECEMBER 9-11, 1993) |
| 65 | */ | 65 | */ |
| 66 | 66 | ||
| @@ -69,10 +69,11 @@ | |||
| 69 | to modify the code. | 69 | to modify the code. |
| 70 | #endif | 70 | #endif |
| 71 | 71 | ||
| 72 | void BF_encrypt(BF_LONG *data, BF_KEY *key) | 72 | void BF_encrypt(BF_LONG *data, const BF_KEY *key) |
| 73 | { | 73 | { |
| 74 | #ifndef BF_PTR2 | 74 | #ifndef BF_PTR2 |
| 75 | register BF_LONG l,r,*p,*s; | 75 | register BF_LONG l,r; |
| 76 | const register BF_LONG *p,*s; | ||
| 76 | 77 | ||
| 77 | p=key->P; | 78 | p=key->P; |
| 78 | s= &(key->S[0]); | 79 | s= &(key->S[0]); |
| @@ -145,10 +146,11 @@ void BF_encrypt(BF_LONG *data, BF_KEY *key) | |||
| 145 | 146 | ||
| 146 | #ifndef BF_DEFAULT_OPTIONS | 147 | #ifndef BF_DEFAULT_OPTIONS |
| 147 | 148 | ||
| 148 | void BF_decrypt(BF_LONG *data, BF_KEY *key) | 149 | void BF_decrypt(BF_LONG *data, const BF_KEY *key) |
| 149 | { | 150 | { |
| 150 | #ifndef BF_PTR2 | 151 | #ifndef BF_PTR2 |
| 151 | register BF_LONG l,r,*p,*s; | 152 | register BF_LONG l,r; |
| 153 | const register BF_LONG *p,*s; | ||
| 152 | 154 | ||
| 153 | p=key->P; | 155 | p=key->P; |
| 154 | s= &(key->S[0]); | 156 | s= &(key->S[0]); |
| @@ -219,8 +221,8 @@ void BF_decrypt(BF_LONG *data, BF_KEY *key) | |||
| 219 | #endif | 221 | #endif |
| 220 | } | 222 | } |
| 221 | 223 | ||
| 222 | void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length, | 224 | void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, |
| 223 | BF_KEY *ks, unsigned char *iv, int encrypt) | 225 | const BF_KEY *schedule, unsigned char *ivec, int encrypt) |
| 224 | { | 226 | { |
| 225 | register BF_LONG tin0,tin1; | 227 | register BF_LONG tin0,tin1; |
| 226 | register BF_LONG tout0,tout1,xor0,xor1; | 228 | register BF_LONG tout0,tout1,xor0,xor1; |
| @@ -229,9 +231,9 @@ void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length, | |||
| 229 | 231 | ||
| 230 | if (encrypt) | 232 | if (encrypt) |
| 231 | { | 233 | { |
| 232 | n2l(iv,tout0); | 234 | n2l(ivec,tout0); |
| 233 | n2l(iv,tout1); | 235 | n2l(ivec,tout1); |
| 234 | iv-=8; | 236 | ivec-=8; |
| 235 | for (l-=8; l>=0; l-=8) | 237 | for (l-=8; l>=0; l-=8) |
| 236 | { | 238 | { |
| 237 | n2l(in,tin0); | 239 | n2l(in,tin0); |
| @@ -240,7 +242,7 @@ void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length, | |||
| 240 | tin1^=tout1; | 242 | tin1^=tout1; |
| 241 | tin[0]=tin0; | 243 | tin[0]=tin0; |
| 242 | tin[1]=tin1; | 244 | tin[1]=tin1; |
| 243 | BF_encrypt(tin,ks); | 245 | BF_encrypt(tin,schedule); |
| 244 | tout0=tin[0]; | 246 | tout0=tin[0]; |
| 245 | tout1=tin[1]; | 247 | tout1=tin[1]; |
| 246 | l2n(tout0,out); | 248 | l2n(tout0,out); |
| @@ -253,27 +255,27 @@ void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length, | |||
| 253 | tin1^=tout1; | 255 | tin1^=tout1; |
| 254 | tin[0]=tin0; | 256 | tin[0]=tin0; |
| 255 | tin[1]=tin1; | 257 | tin[1]=tin1; |
| 256 | BF_encrypt(tin,ks); | 258 | BF_encrypt(tin,schedule); |
| 257 | tout0=tin[0]; | 259 | tout0=tin[0]; |
| 258 | tout1=tin[1]; | 260 | tout1=tin[1]; |
| 259 | l2n(tout0,out); | 261 | l2n(tout0,out); |
| 260 | l2n(tout1,out); | 262 | l2n(tout1,out); |
| 261 | } | 263 | } |
| 262 | l2n(tout0,iv); | 264 | l2n(tout0,ivec); |
| 263 | l2n(tout1,iv); | 265 | l2n(tout1,ivec); |
| 264 | } | 266 | } |
| 265 | else | 267 | else |
| 266 | { | 268 | { |
| 267 | n2l(iv,xor0); | 269 | n2l(ivec,xor0); |
| 268 | n2l(iv,xor1); | 270 | n2l(ivec,xor1); |
| 269 | iv-=8; | 271 | ivec-=8; |
| 270 | for (l-=8; l>=0; l-=8) | 272 | for (l-=8; l>=0; l-=8) |
| 271 | { | 273 | { |
| 272 | n2l(in,tin0); | 274 | n2l(in,tin0); |
| 273 | n2l(in,tin1); | 275 | n2l(in,tin1); |
| 274 | tin[0]=tin0; | 276 | tin[0]=tin0; |
| 275 | tin[1]=tin1; | 277 | tin[1]=tin1; |
| 276 | BF_decrypt(tin,ks); | 278 | BF_decrypt(tin,schedule); |
| 277 | tout0=tin[0]^xor0; | 279 | tout0=tin[0]^xor0; |
| 278 | tout1=tin[1]^xor1; | 280 | tout1=tin[1]^xor1; |
| 279 | l2n(tout0,out); | 281 | l2n(tout0,out); |
| @@ -287,15 +289,15 @@ void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length, | |||
| 287 | n2l(in,tin1); | 289 | n2l(in,tin1); |
| 288 | tin[0]=tin0; | 290 | tin[0]=tin0; |
| 289 | tin[1]=tin1; | 291 | tin[1]=tin1; |
| 290 | BF_decrypt(tin,ks); | 292 | BF_decrypt(tin,schedule); |
| 291 | tout0=tin[0]^xor0; | 293 | tout0=tin[0]^xor0; |
| 292 | tout1=tin[1]^xor1; | 294 | tout1=tin[1]^xor1; |
| 293 | l2nn(tout0,tout1,out,l+8); | 295 | l2nn(tout0,tout1,out,l+8); |
| 294 | xor0=tin0; | 296 | xor0=tin0; |
| 295 | xor1=tin1; | 297 | xor1=tin1; |
| 296 | } | 298 | } |
| 297 | l2n(xor0,iv); | 299 | l2n(xor0,ivec); |
| 298 | l2n(xor1,iv); | 300 | l2n(xor1,ivec); |
| 299 | } | 301 | } |
| 300 | tin0=tin1=tout0=tout1=xor0=xor1=0; | 302 | tin0=tin1=tout0=tout1=xor0=xor1=0; |
| 301 | tin[0]=tin[1]=0; | 303 | tin[0]=tin[1]=0; |
diff --git a/src/lib/libcrypto/bf/bf_locl.h b/src/lib/libcrypto/bf/bf_locl.h index 05756b5d3b..cc7c3ec992 100644 --- a/src/lib/libcrypto/bf/bf_locl.h +++ b/src/lib/libcrypto/bf/bf_locl.h | |||
| @@ -148,7 +148,7 @@ | |||
| 148 | *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ | 148 | *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ |
| 149 | *((c)++)=(unsigned char)(((l) )&0xff)) | 149 | *((c)++)=(unsigned char)(((l) )&0xff)) |
| 150 | 150 | ||
| 151 | /* This is actually a big endian algorithm, the most significate byte | 151 | /* This is actually a big endian algorithm, the most significant byte |
| 152 | * is used to lookup array 0 */ | 152 | * is used to lookup array 0 */ |
| 153 | 153 | ||
| 154 | #if defined(BF_PTR2) | 154 | #if defined(BF_PTR2) |
| @@ -183,8 +183,8 @@ | |||
| 183 | 183 | ||
| 184 | /* | 184 | /* |
| 185 | * This is normally very good on RISC platforms where normally you | 185 | * This is normally very good on RISC platforms where normally you |
| 186 | * have to explicitely "multiplicate" array index by sizeof(BF_LONG) | 186 | * have to explicitly "multiply" array index by sizeof(BF_LONG) |
| 187 | * in order to caclulate the effective address. This implementation | 187 | * in order to calculate the effective address. This implementation |
| 188 | * excuses CPU from this extra work. Power[PC] uses should have most | 188 | * excuses CPU from this extra work. Power[PC] uses should have most |
| 189 | * fun as (R>>BF_i)&BF_M gets folded into a single instruction, namely | 189 | * fun as (R>>BF_i)&BF_M gets folded into a single instruction, namely |
| 190 | * rlwinm. So let'em double-check if their compiler does it. | 190 | * rlwinm. So let'em double-check if their compiler does it. |
diff --git a/src/lib/libcrypto/bf/bf_ofb64.c b/src/lib/libcrypto/bf/bf_ofb64.c index 8ceb8d9bda..f2a9ff6e41 100644 --- a/src/lib/libcrypto/bf/bf_ofb64.c +++ b/src/lib/libcrypto/bf/bf_ofb64.c | |||
| @@ -63,8 +63,8 @@ | |||
| 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 | */ |
| 66 | void BF_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, | 66 | void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, |
| 67 | BF_KEY *schedule, unsigned char *ivec, int *num) | 67 | const BF_KEY *schedule, unsigned char *ivec, int *num) |
| 68 | { | 68 | { |
| 69 | register BF_LONG v0,v1,t; | 69 | register BF_LONG v0,v1,t; |
| 70 | register int n= *num; | 70 | register int n= *num; |
diff --git a/src/lib/libcrypto/bf/bf_opts.c b/src/lib/libcrypto/bf/bf_opts.c index 5f330cc53c..bbe32b28c9 100644 --- a/src/lib/libcrypto/bf/bf_opts.c +++ b/src/lib/libcrypto/bf/bf_opts.c | |||
| @@ -242,7 +242,7 @@ int main(int argc, char **argv) | |||
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | #ifndef TIMES | 244 | #ifndef TIMES |
| 245 | fprintf(stderr,"To get the most acurate results, try to run this\n"); | 245 | fprintf(stderr,"To get the most accurate results, try to run this\n"); |
| 246 | fprintf(stderr,"program when this computer is idle.\n"); | 246 | fprintf(stderr,"program when this computer is idle.\n"); |
| 247 | #endif | 247 | #endif |
| 248 | 248 | ||
diff --git a/src/lib/libcrypto/bf/bf_pi.h b/src/lib/libcrypto/bf/bf_pi.h index 417b935538..9949513c68 100644 --- a/src/lib/libcrypto/bf/bf_pi.h +++ b/src/lib/libcrypto/bf/bf_pi.h | |||
| @@ -56,7 +56,7 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | static BF_KEY bf_init= { | 59 | static const BF_KEY bf_init= { |
| 60 | { | 60 | { |
| 61 | 0x243f6a88L, 0x85a308d3L, 0x13198a2eL, 0x03707344L, | 61 | 0x243f6a88L, 0x85a308d3L, 0x13198a2eL, 0x03707344L, |
| 62 | 0xa4093822L, 0x299f31d0L, 0x082efa98L, 0xec4e6c89L, | 62 | 0xa4093822L, 0x299f31d0L, 0x082efa98L, 0xec4e6c89L, |
diff --git a/src/lib/libcrypto/bf/bf_skey.c b/src/lib/libcrypto/bf/bf_skey.c index eefa8e6f51..4d6a232fe0 100644 --- a/src/lib/libcrypto/bf/bf_skey.c +++ b/src/lib/libcrypto/bf/bf_skey.c | |||
| @@ -62,11 +62,11 @@ | |||
| 62 | #include "bf_locl.h" | 62 | #include "bf_locl.h" |
| 63 | #include "bf_pi.h" | 63 | #include "bf_pi.h" |
| 64 | 64 | ||
| 65 | void BF_set_key(BF_KEY *key, int len, unsigned char *data) | 65 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data) |
| 66 | { | 66 | { |
| 67 | int i; | 67 | int i; |
| 68 | BF_LONG *p,ri,in[2]; | 68 | BF_LONG *p,ri,in[2]; |
| 69 | unsigned char *d,*end; | 69 | const unsigned char *d,*end; |
| 70 | 70 | ||
| 71 | 71 | ||
| 72 | memcpy((char *)key,(char *)&bf_init,sizeof(BF_KEY)); | 72 | memcpy((char *)key,(char *)&bf_init,sizeof(BF_KEY)); |
diff --git a/src/lib/libcrypto/bf/bfspeed.c b/src/lib/libcrypto/bf/bfspeed.c index 9b893e92cc..ecc9dff4e4 100644 --- a/src/lib/libcrypto/bf/bfspeed.c +++ b/src/lib/libcrypto/bf/bfspeed.c | |||
| @@ -183,7 +183,7 @@ int main(int argc, char **argv) | |||
| 183 | #endif | 183 | #endif |
| 184 | 184 | ||
| 185 | #ifndef TIMES | 185 | #ifndef TIMES |
| 186 | printf("To get the most acurate results, try to run this\n"); | 186 | printf("To get the most accurate results, try to run this\n"); |
| 187 | printf("program when this computer is idle.\n"); | 187 | printf("program when this computer is idle.\n"); |
| 188 | #endif | 188 | #endif |
| 189 | 189 | ||
diff --git a/src/lib/libcrypto/bf/bftest.c b/src/lib/libcrypto/bf/bftest.c index 6ecd2609a9..5695250195 100644 --- a/src/lib/libcrypto/bf/bftest.c +++ b/src/lib/libcrypto/bf/bftest.c | |||
| @@ -76,18 +76,18 @@ int main(int argc, char *argv[]) | |||
| 76 | #include <openssl/ebcdic.h> | 76 | #include <openssl/ebcdic.h> |
| 77 | #endif | 77 | #endif |
| 78 | 78 | ||
| 79 | char *bf_key[2]={ | 79 | static char *bf_key[2]={ |
| 80 | "abcdefghijklmnopqrstuvwxyz", | 80 | "abcdefghijklmnopqrstuvwxyz", |
| 81 | "Who is John Galt?" | 81 | "Who is John Galt?" |
| 82 | }; | 82 | }; |
| 83 | 83 | ||
| 84 | /* big endian */ | 84 | /* big endian */ |
| 85 | BF_LONG bf_plain[2][2]={ | 85 | static BF_LONG bf_plain[2][2]={ |
| 86 | {0x424c4f57L,0x46495348L}, | 86 | {0x424c4f57L,0x46495348L}, |
| 87 | {0xfedcba98L,0x76543210L} | 87 | {0xfedcba98L,0x76543210L} |
| 88 | }; | 88 | }; |
| 89 | 89 | ||
| 90 | BF_LONG bf_cipher[2][2]={ | 90 | static BF_LONG bf_cipher[2][2]={ |
| 91 | {0x324ed0feL,0xf413a203L}, | 91 | {0x324ed0feL,0xf413a203L}, |
| 92 | {0xcc91732bL,0x8022f684L} | 92 | {0xcc91732bL,0x8022f684L} |
| 93 | }; | 93 | }; |
| @@ -228,16 +228,16 @@ static unsigned char ofb64_ok[]={ | |||
| 228 | 0x63,0xC2,0xCF,0x80,0xDA}; | 228 | 0x63,0xC2,0xCF,0x80,0xDA}; |
| 229 | 229 | ||
| 230 | #define KEY_TEST_NUM 25 | 230 | #define KEY_TEST_NUM 25 |
| 231 | unsigned char key_test[KEY_TEST_NUM]={ | 231 | static unsigned char key_test[KEY_TEST_NUM]={ |
| 232 | 0xf0,0xe1,0xd2,0xc3,0xb4,0xa5,0x96,0x87, | 232 | 0xf0,0xe1,0xd2,0xc3,0xb4,0xa5,0x96,0x87, |
| 233 | 0x78,0x69,0x5a,0x4b,0x3c,0x2d,0x1e,0x0f, | 233 | 0x78,0x69,0x5a,0x4b,0x3c,0x2d,0x1e,0x0f, |
| 234 | 0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77, | 234 | 0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77, |
| 235 | 0x88}; | 235 | 0x88}; |
| 236 | 236 | ||
| 237 | unsigned char key_data[8]= | 237 | static unsigned char key_data[8]= |
| 238 | {0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10}; | 238 | {0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10}; |
| 239 | 239 | ||
| 240 | unsigned char key_out[KEY_TEST_NUM][8]={ | 240 | static unsigned char key_out[KEY_TEST_NUM][8]={ |
| 241 | {0xF9,0xAD,0x59,0x7C,0x49,0xDB,0x00,0x5E}, | 241 | {0xF9,0xAD,0x59,0x7C,0x49,0xDB,0x00,0x5E}, |
| 242 | {0xE9,0x1D,0x21,0xC1,0xD9,0x61,0xA6,0xD6}, | 242 | {0xE9,0x1D,0x21,0xC1,0xD9,0x61,0xA6,0xD6}, |
| 243 | {0xE9,0xC2,0xB7,0x0A,0x1B,0xC6,0x5C,0xF3}, | 243 | {0xE9,0xC2,0xB7,0x0A,0x1B,0xC6,0x5C,0xF3}, |
diff --git a/src/lib/libcrypto/bf/blowfish.h b/src/lib/libcrypto/bf/blowfish.h index 02f73b2f30..78acfd63b4 100644 --- a/src/lib/libcrypto/bf/blowfish.h +++ b/src/lib/libcrypto/bf/blowfish.h | |||
| @@ -103,17 +103,19 @@ typedef struct bf_key_st | |||
| 103 | } BF_KEY; | 103 | } BF_KEY; |
| 104 | 104 | ||
| 105 | 105 | ||
| 106 | void BF_set_key(BF_KEY *key, int len, unsigned char *data); | 106 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data); |
| 107 | void BF_ecb_encrypt(unsigned char *in,unsigned char *out,BF_KEY *key, | 107 | |
| 108 | int enc); | 108 | void BF_encrypt(BF_LONG *data,const BF_KEY *key); |
| 109 | void BF_encrypt(BF_LONG *data,BF_KEY *key); | 109 | void BF_decrypt(BF_LONG *data,const BF_KEY *key); |
| 110 | void BF_decrypt(BF_LONG *data,BF_KEY *key); | 110 | |
| 111 | void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length, | 111 | void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, |
| 112 | BF_KEY *ks, unsigned char *iv, int enc); | 112 | const BF_KEY *key, int enc); |
| 113 | void BF_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, | 113 | void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, |
| 114 | BF_KEY *schedule, unsigned char *ivec, int *num, int enc); | 114 | const BF_KEY *schedule, unsigned char *ivec, int enc); |
| 115 | void BF_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, | 115 | void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, |
| 116 | BF_KEY *schedule, unsigned char *ivec, int *num); | 116 | const BF_KEY *schedule, unsigned char *ivec, int *num, int enc); |
| 117 | void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, | ||
| 118 | const BF_KEY *schedule, unsigned char *ivec, int *num); | ||
| 117 | const char *BF_options(void); | 119 | const char *BF_options(void); |
| 118 | 120 | ||
| 119 | #ifdef __cplusplus | 121 | #ifdef __cplusplus |
