bf_ecb.c (55714) | bf_ecb.c (59191) |
---|---|
1/* crypto/bf/bf_ecb.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 47 unchanged lines hidden (view full) --- 56 * [including the GNU Public Licence.] 57 */ 58 59#include <openssl/blowfish.h> 60#include "bf_locl.h" 61#include <openssl/opensslv.h> 62 63/* Blowfish as implemented from 'Blowfish: Springer-Verlag paper' | 1/* crypto/bf/bf_ecb.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 47 unchanged lines hidden (view full) --- 56 * [including the GNU Public Licence.] 57 */ 58 59#include <openssl/blowfish.h> 60#include "bf_locl.h" 61#include <openssl/opensslv.h> 62 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) 66 */ 67 | 65 * CAMBRIDGE SECURITY WORKSHOP, CAMBRIDGE, U.K., DECEMBER 9-11, 1993) 66 */ 67 |
68const char *BF_version="BlowFish" OPENSSL_VERSION_PTEXT; | 68const char *BF_version="Blowfish" OPENSSL_VERSION_PTEXT; |
69 70const char *BF_options(void) 71 { 72#ifdef BF_PTR 73 return("blowfish(ptr)"); 74#elif defined(BF_PTR2) 75 return("blowfish(ptr2)"); 76#else 77 return("blowfish(idx)"); 78#endif 79 } 80 | 69 70const char *BF_options(void) 71 { 72#ifdef BF_PTR 73 return("blowfish(ptr)"); 74#elif defined(BF_PTR2) 75 return("blowfish(ptr2)"); 76#else 77 return("blowfish(idx)"); 78#endif 79 } 80 |
81void BF_ecb_encrypt(unsigned char *in, unsigned char *out, BF_KEY *ks, 82 int encrypt) | 81void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, 82 const BF_KEY *key, int encrypt) |
83 { 84 BF_LONG l,d[2]; 85 86 n2l(in,l); d[0]=l; 87 n2l(in,l); d[1]=l; 88 if (encrypt) | 83 { 84 BF_LONG l,d[2]; 85 86 n2l(in,l); d[0]=l; 87 n2l(in,l); d[1]=l; 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); 93 l=d[1]; l2n(l,out); 94 l=d[0]=d[1]=0; 95 } 96 | 92 l=d[0]; l2n(l,out); 93 l=d[1]; l2n(l,out); 94 l=d[0]=d[1]=0; 95 } 96 |