X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fevp%2Fe_xcbc_d.c;h=3a6628a75c9aee129a690dca9ec111ba56997011;hb=10cea23bd46cb43fab1de5c59828ae67f80975c3;hp=b0bae80970afee9316d137fa61774ae1de96bff8;hpb=4e31df2cd73dbb659fd8a6eca6270fac661c072d;p=oweals%2Fopenssl.git diff --git a/crypto/evp/e_xcbc_d.c b/crypto/evp/e_xcbc_d.c index b0bae80970..3a6628a75c 100644 --- a/crypto/evp/e_xcbc_d.c +++ b/crypto/evp/e_xcbc_d.c @@ -56,21 +56,16 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DES #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void desx_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void desx_cbc_init_key(); -static void desx_cbc_cipher(); -#endif - static EVP_CIPHER d_xcbc_cipher= { NID_desx_cbc, @@ -84,37 +79,34 @@ static EVP_CIPHER d_xcbc_cipher= EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_desx_cbc() +EVP_CIPHER *EVP_desx_cbc(void) { return(&d_xcbc_cipher); } -static void desx_cbc_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void desx_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { + des_cblock *deskey = (des_cblock *)key; + if (iv != NULL) memcpy(&(ctx->oiv[0]),iv,8); memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); - if (key != NULL) + if (deskey != NULL) { - des_set_key(key,ctx->c.desx_cbc.ks); + des_set_key(deskey,ctx->c.desx_cbc.ks); memcpy(&(ctx->c.desx_cbc.inw[0]),&(key[8]),8); memcpy(&(ctx->c.desx_cbc.outw[0]),&(key[16]),8); } } -static void desx_cbc_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { des_xcbc_encrypt(in,out,inl,ctx->c.desx_cbc.ks, - &(ctx->iv[0]), - &(ctx->c.desx_cbc.inw[0]), - &(ctx->c.desx_cbc.outw[0]), + (des_cblock *)&(ctx->iv[0]), + &ctx->c.desx_cbc.inw, + &ctx->c.desx_cbc.outw, ctx->encrypt); } +#endif