summaryrefslogtreecommitdiff
path: root/src/lib/libssl/src/crypto/evp/e_ecb_d.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/src/crypto/evp/e_ecb_d.c')
-rw-r--r--src/lib/libssl/src/crypto/evp/e_ecb_d.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/lib/libssl/src/crypto/evp/e_ecb_d.c b/src/lib/libssl/src/crypto/evp/e_ecb_d.c
index 7a409d6459..5fb4e64b1c 100644
--- a/src/lib/libssl/src/crypto/evp/e_ecb_d.c
+++ b/src/lib/libssl/src/crypto/evp/e_ecb_d.c
@@ -56,21 +56,16 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_DES
59#include <stdio.h> 60#include <stdio.h>
60#include "cryptlib.h" 61#include "cryptlib.h"
61#include "evp.h" 62#include <openssl/evp.h>
62#include "objects.h" 63#include <openssl/objects.h>
63 64
64#ifndef NOPROTO
65static void des_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, 65static void des_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key,
66 unsigned char *iv,int enc); 66 unsigned char *iv,int enc);
67static void des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 67static void des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
68 unsigned char *in, unsigned int inl); 68 unsigned char *in, unsigned int inl);
69#else
70static void des_ecb_init_key();
71static void des_ecb_cipher();
72#endif
73
74static EVP_CIPHER d_ecb_cipher= 69static EVP_CIPHER d_ecb_cipher=
75 { 70 {
76 NID_des_ecb, 71 NID_des_ecb,
@@ -84,35 +79,40 @@ static EVP_CIPHER d_ecb_cipher=
84 NULL, 79 NULL,
85 }; 80 };
86 81
87EVP_CIPHER *EVP_des_ecb() 82EVP_CIPHER *EVP_des_ecb(void)
88 { 83 {
89 return(&d_ecb_cipher); 84 return(&d_ecb_cipher);
90 } 85 }
91 86
92static void des_ecb_init_key(ctx,key,iv,enc) 87static void des_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key,
93EVP_CIPHER_CTX *ctx; 88 unsigned char *iv, int enc)
94unsigned char *key;
95unsigned char *iv;
96int enc;
97 { 89 {
98 if (key != NULL) 90 des_cblock *deskey = (des_cblock *)key;
99 des_set_key((des_cblock *)key,ctx->c.des_ks); 91
92 if (deskey != NULL)
93 des_set_key(deskey,ctx->c.des_ks);
100 } 94 }
101 95
102static void des_ecb_cipher(ctx,out,in,inl) 96static void des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
103EVP_CIPHER_CTX *ctx; 97 unsigned char *in, unsigned int inl)
104unsigned char *out;
105unsigned char *in;
106unsigned int inl;
107 { 98 {
108 unsigned int i; 99 unsigned int i;
100 des_cblock *output /* = (des_cblock *)out */;
101 des_cblock *input /* = (des_cblock *)in */;
109 102
110 if (inl < 8) return; 103 if (inl < 8) return;
111 inl-=8; 104 inl-=8;
112 for (i=0; i<=inl; i+=8) 105 for (i=0; i<=inl; i+=8)
113 { 106 {
114 des_ecb_encrypt( 107 /* Either this ... */
115 (des_cblock *)&(in[i]),(des_cblock *)&(out[i]), 108 output = (des_cblock *)(out + i);
116 ctx->c.des_ks,ctx->encrypt); 109 input = (des_cblock *)(in + i);
110
111 des_ecb_encrypt(input,output,ctx->c.des_ks,ctx->encrypt);
112
113 /* ... or this. */
114 /* output++; */
115 /* input++; */
117 } 116 }
118 } 117 }
118#endif