* [including the GNU Public Licence.]
*/
+#ifndef NO_DES
#include <stdio.h>
#include "cryptlib.h"
#include <openssl/evp.h>
#include <openssl/objects.h>
-#ifndef NOPROTO
static void des_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key,
unsigned char *iv,int enc);
static void des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
unsigned char *in, unsigned int inl);
-#else
-static void des_ecb_init_key();
-static void des_ecb_cipher();
-#endif
-
static EVP_CIPHER d_ecb_cipher=
{
NID_des_ecb,
static void des_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key,
unsigned char *iv, int enc)
{
- if (key != NULL)
- des_set_key(key,ctx->c.des_ks);
+ des_cblock *deskey = (des_cblock *)key;
+
+ if (deskey != NULL)
+ des_set_key_unchecked(deskey,ctx->c.des_ks);
}
static void des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
unsigned char *in, unsigned int inl)
{
unsigned int i;
+ des_cblock *output /* = (des_cblock *)out */;
+ des_cblock *input /* = (des_cblock *)in */;
if (inl < 8) return;
inl-=8;
for (i=0; i<=inl; i+=8)
{
- des_ecb_encrypt(&(in[i]),&(out[i]),ctx->c.des_ks,ctx->encrypt);
+ /* Either this ... */
+ output = (des_cblock *)(out + i);
+ input = (des_cblock *)(in + i);
+
+ des_ecb_encrypt(input,output,ctx->c.des_ks,ctx->encrypt);
+
+ /* ... or this. */
+ /* output++; */
+ /* input++; */
}
}
+#endif