summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/e_xcbc_d.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/evp/e_xcbc_d.c')
-rw-r--r--src/lib/libcrypto/evp/e_xcbc_d.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/lib/libcrypto/evp/e_xcbc_d.c b/src/lib/libcrypto/evp/e_xcbc_d.c
index 8832da2433..250e88c8c5 100644
--- a/src/lib/libcrypto/evp/e_xcbc_d.c
+++ b/src/lib/libcrypto/evp/e_xcbc_d.c
@@ -63,12 +63,13 @@
63 63
64#include <openssl/evp.h> 64#include <openssl/evp.h>
65#include <openssl/objects.h> 65#include <openssl/objects.h>
66#include "evp_locl.h"
66#include <openssl/des.h> 67#include <openssl/des.h>
67 68
68static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 69static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
69 const unsigned char *iv,int enc); 70 const unsigned char *iv,int enc);
70static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 71static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
71 const unsigned char *in, unsigned int inl); 72 const unsigned char *in, size_t inl);
72 73
73 74
74typedef struct 75typedef struct
@@ -113,13 +114,25 @@ static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
113 } 114 }
114 115
115static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 116static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
116 const unsigned char *in, unsigned int inl) 117 const unsigned char *in, size_t inl)
117 { 118 {
118 DES_xcbc_encrypt(in,out,inl,&data(ctx)->ks, 119 while (inl>=EVP_MAXCHUNK)
120 {
121 DES_xcbc_encrypt(in,out,(long)EVP_MAXCHUNK,&data(ctx)->ks,
119 (DES_cblock *)&(ctx->iv[0]), 122 (DES_cblock *)&(ctx->iv[0]),
120 &data(ctx)->inw, 123 &data(ctx)->inw,
121 &data(ctx)->outw, 124 &data(ctx)->outw,
122 ctx->encrypt); 125 ctx->encrypt);
126 inl-=EVP_MAXCHUNK;
127 in +=EVP_MAXCHUNK;
128 out+=EVP_MAXCHUNK;
129 }
130 if (inl)
131 DES_xcbc_encrypt(in,out,(long)inl,&data(ctx)->ks,
132 (DES_cblock *)&(ctx->iv[0]),
133 &data(ctx)->inw,
134 &data(ctx)->outw,
135 ctx->encrypt);
123 return 1; 136 return 1;
124 } 137 }
125#endif 138#endif