| OLD | NEW | 
|---|
| 1 /* crypto/des/ecb_enc.c */ | 1 /* crypto/des/ecb_enc.c */ | 
| 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 
| 3  * All rights reserved. | 3  * All rights reserved. | 
| 4  * | 4  * | 
| 5  * This package is an SSL implementation written | 5  * This package is an SSL implementation written | 
| 6  * by Eric Young (eay@cryptsoft.com). | 6  * by Eric Young (eay@cryptsoft.com). | 
| 7  * The implementation was written so as to conform with Netscapes SSL. | 7  * The implementation was written so as to conform with Netscapes SSL. | 
| 8  * | 8  * | 
| 9  * This library is free for commercial and non-commercial use as long as | 9  * This library is free for commercial and non-commercial use as long as | 
| 10  * the following conditions are aheared to.  The following conditions | 10  * the following conditions are aheared to.  The following conditions | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 50  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 
| 51  * SUCH DAMAGE. | 51  * SUCH DAMAGE. | 
| 52  * | 52  * | 
| 53  * The licence and distribution terms for any publically available version or | 53  * The licence and distribution terms for any publically available version or | 
| 54  * derivative of this code cannot be changed.  i.e. this code cannot simply be | 54  * derivative of this code cannot be changed.  i.e. this code cannot simply be | 
| 55  * copied and put under another distribution licence | 55  * copied and put under another distribution licence | 
| 56  * [including the GNU Public Licence.] | 56  * [including the GNU Public Licence.] | 
| 57  */ | 57  */ | 
| 58 | 58 | 
| 59 #include "des_locl.h" | 59 #include "des_locl.h" | 
| 60 #include "spr.h" | 60 #include "des_ver.h" | 
|  | 61 #include <openssl/opensslv.h> | 
|  | 62 #include <openssl/bio.h> | 
|  | 63 | 
|  | 64 OPENSSL_GLOBAL const char libdes_version[]="libdes" OPENSSL_VERSION_PTEXT; | 
|  | 65 OPENSSL_GLOBAL const char DES_version[]="DES" OPENSSL_VERSION_PTEXT; | 
|  | 66 | 
|  | 67 const char *DES_options(void) | 
|  | 68 »       { | 
|  | 69 »       static int init=1; | 
|  | 70 »       static char buf[32]; | 
|  | 71 | 
|  | 72 »       if (init) | 
|  | 73 »       »       { | 
|  | 74 »       »       const char *ptr,*unroll,*risc,*size; | 
|  | 75 | 
|  | 76 #ifdef DES_PTR | 
|  | 77 »       »       ptr="ptr"; | 
|  | 78 #else | 
|  | 79 »       »       ptr="idx"; | 
|  | 80 #endif | 
|  | 81 #if defined(DES_RISC1) || defined(DES_RISC2) | 
|  | 82 #ifdef DES_RISC1 | 
|  | 83 »       »       risc="risc1"; | 
|  | 84 #endif | 
|  | 85 #ifdef DES_RISC2 | 
|  | 86 »       »       risc="risc2"; | 
|  | 87 #endif | 
|  | 88 #else | 
|  | 89 »       »       risc="cisc"; | 
|  | 90 #endif | 
|  | 91 #ifdef DES_UNROLL | 
|  | 92 »       »       unroll="16"; | 
|  | 93 #else | 
|  | 94 »       »       unroll="2"; | 
|  | 95 #endif | 
|  | 96 »       »       if (sizeof(DES_LONG) != sizeof(long)) | 
|  | 97 »       »       »       size="int"; | 
|  | 98 »       »       else | 
|  | 99 »       »       »       size="long"; | 
|  | 100 »       »       BIO_snprintf(buf,sizeof buf,"des(%s,%s,%s,%s)",ptr,risc,unroll, | 
|  | 101 »       »       »            size); | 
|  | 102 »       »       init=0; | 
|  | 103 »       »       } | 
|  | 104 »       return(buf); | 
|  | 105 »       } | 
|  | 106 »       » | 
| 61 | 107 | 
| 62 void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, | 108 void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, | 
| 63                      DES_key_schedule *ks, int enc) | 109                      DES_key_schedule *ks, int enc) | 
| 64         { | 110         { | 
| 65         register DES_LONG l; | 111         register DES_LONG l; | 
| 66         DES_LONG ll[2]; | 112         DES_LONG ll[2]; | 
| 67         const unsigned char *in = &(*input)[0]; | 113         const unsigned char *in = &(*input)[0]; | 
| 68         unsigned char *out = &(*output)[0]; | 114         unsigned char *out = &(*output)[0]; | 
| 69 | 115 | 
| 70         c2l(in,l); ll[0]=l; | 116         c2l(in,l); ll[0]=l; | 
| 71         c2l(in,l); ll[1]=l; | 117         c2l(in,l); ll[1]=l; | 
| 72         DES_encrypt1(ll,ks,enc); | 118         DES_encrypt1(ll,ks,enc); | 
| 73         l=ll[0]; l2c(l,out); | 119         l=ll[0]; l2c(l,out); | 
| 74         l=ll[1]; l2c(l,out); | 120         l=ll[1]; l2c(l,out); | 
| 75         l=ll[0]=ll[1]=0; | 121         l=ll[0]=ll[1]=0; | 
| 76         } | 122         } | 
| OLD | NEW | 
|---|