X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fidea%2Fi_ecb.c;h=fb613db595c438b6df9b501d42393d17a77100e7;hb=777c47acbeecf9602cc465864c9f5f2c609c989d;hp=b3b694b0c6acddd1c624061c7a85ceee54ba5f2b;hpb=b7896b3cb86d80206af14a14d69b0717786f2729;p=oweals%2Fopenssl.git diff --git a/crypto/idea/i_ecb.c b/crypto/idea/i_ecb.c index b3b694b0c6..fb613db595 100644 --- a/crypto/idea/i_ecb.c +++ b/crypto/idea/i_ecb.c @@ -1,5 +1,5 @@ /* crypto/idea/i_ecb.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written @@ -56,12 +56,13 @@ * [including the GNU Public Licence.] */ -#include "idea.h" +#include #include "idea_lcl.h" +#include -char *IDEA_version="IDEA part of SSLeay 0.8.1b 29-Jun-1998"; +const char *IDEA_version="IDEA" OPENSSL_VERSION_PTEXT; -char *idea_options() +const char *idea_options(void) { if (sizeof(short) != sizeof(IDEA_INT)) return("idea(int)"); @@ -69,10 +70,8 @@ char *idea_options() return("idea(short)"); } -void idea_ecb_encrypt(in, out, ks) -unsigned char *in; -unsigned char *out; -IDEA_KEY_SCHEDULE *ks; +void idea_ecb_encrypt(const unsigned char *in, unsigned char *out, + IDEA_KEY_SCHEDULE *ks) { unsigned long l0,l1,d[2]; @@ -84,55 +83,3 @@ IDEA_KEY_SCHEDULE *ks; l0=l1=d[0]=d[1]=0; } -void idea_encrypt(d,key) -unsigned long *d; -IDEA_KEY_SCHEDULE *key; - { - int i; - register IDEA_INT *p; - register unsigned long x1,x2,x3,x4,t0,t1,ul; - - x2=d[0]; - x1=(x2>>16); - x4=d[1]; - x3=(x4>>16); - - p= &(key->data[0][0]); - for (i=0; i<8; i++) - { - x1&=0xffff; - idea_mul(x1,x1,*p,ul); p++; - - x2+= *(p++); - x3+= *(p++); - - x4&=0xffff; - idea_mul(x4,x4,*p,ul); p++; - - t0=(x1^x3)&0xffff; - idea_mul(t0,t0,*p,ul); p++; - - t1=(t0+(x2^x4))&0xffff; - idea_mul(t1,t1,*p,ul); p++; - - t0+=t1; - - x1^=t1; - x4^=t0; - ul=x2^t0; /* do the swap to x3 */ - x2=x3^t1; - x3=ul; - } - - x1&=0xffff; - idea_mul(x1,x1,*p,ul); p++; - - t0= x3+ *(p++); - t1= x2+ *(p++); - - x4&=0xffff; - idea_mul(x4,x4,*p,ul); - - d[0]=(t0&0xffff)|((x1&0xffff)<<16); - d[1]=(x4&0xffff)|((t1&0xffff)<<16); - }