SourceForge has been redesigned. Learn more.
Close

#6 remops OpenBSD IDEA

closed-rejected
None
5
2015-01-17
2001-11-03
Anonymous
No

Delivered-To: remailer-operators@anon.lcs.mit.edu
Date: Fri, 2 Nov 2001 19:00:23 -0700
From: Anonymous <nobody@noisebox.remailer.org>
Comments: This message did not originate from the Sender
address above.
It was remailed automatically by anonymizing
remailer software.
Please report problems or inappropriate use to the
remailer administrator at <
abuse@noisebox.remailer.org>.
To: rabbi@quickie.net, remailer-
operators@anon.lcs.mit.edu,
mail2news@dizum.com
Subject: Mixmaster 2.9beta31: IDEA for Mix on OpenBSD
newsgroups: alt.privacy.anon-server

# This is a shell archive. Save it in a file, remove
anything before
# this line, and then unpack it by entering "sh file".
Note, it may
# create directories; files and directories will be
owned by you and
# have default permissions.
#
# This archive contains:
#
# Mix-2.9beta31/Src/idea/Makefile
# Mix-2.9beta31/Src/idea/README.1st
# Mix-2.9beta31/Src/idea/i_cbc.c
# Mix-2.9beta31/Src/idea/i_cfb64.c
# Mix-2.9beta31/Src/idea/i_skey.c
# Mix-2.9beta31/Src/idea/idea.h
# Mix-2.9beta31/Src/idea/idea_lcl.h
#
echo x - Mix-2.9beta31/Src/idea/Makefile
sed 's/^X//' >Mix-2.9beta31/Src/idea/Makefile << 'END-
of-Mix-2.9beta31/Src/idea/Makefile'
XOPT = -g -Wall
X
XCFLAGS = $(INC) $(DEF) $(OPT)
XCC = gcc
XAR = ar rc
XRANLIB = ranlib
X
XOBJ = i_cfb64.o i_cbc.o i_skey.o
X
Xall: libidea.a
X
Xlibidea.a: $(OBJ)
X $(AR) libidea.a $(OBJ)
X
Xclean:
X -rm -f *.o *.a *.res
END-of-Mix-2.9beta31/Src/idea/Makefile
echo x - Mix-2.9beta31/Src/idea/README.1st
sed 's/^X//' >Mix-2.9beta31/Src/idea/README.1st << 'END-
of-Mix-2.9beta31/Src/idea/README.1st'
XThis directory contains only the files required to
build libidea for
XOpenBSD Mix installs
X
XThe IDEA source and include files are those from the
OpenSSL 0.9.6b
Xdistribution.
X
XThey are needed only on systems that by default do not
include the
Xpatented IDEA algorithm in their OpenSSL installation.
Such systems
Xinclude OpenBSD.
END-of-Mix-2.9beta31/Src/idea/README.1st
echo x - Mix-2.9beta31/Src/idea/i_cbc.c
sed 's/^X//' >Mix-2.9beta31/Src/idea/i_cbc.c << 'END-of-
Mix-2.9beta31/Src/idea/i_cbc.c'
X/* crypto/idea/i_cbc.c */
X/* Copyright (C) 1995-1998 Eric Young
(eay@cryptsoft.com)
X * All rights reserved.
X *
X * This package is an SSL implementation written
X * by Eric Young (eay@cryptsoft.com).
X * The implementation was written so as to conform with
Netscapes SSL.
X *
X * This library is free for commercial and non-
commercial use as long as
X * the following conditions are aheared to. The
following conditions
X * apply to all code found in this distribution, be it
the RC4, RSA,
X * lhash, DES, etc., code; not just the SSL code. The
SSL documentation
X * included with this distribution is covered by the
same copyright terms
X * except that the holder is Tim Hudson
(tjh@cryptsoft.com).
X *
X * Copyright remains Eric Young's, and as such any
Copyright notices in
X * the code are not to be removed.
X * If this package is used in a product, Eric Young
should be given attribution
X * as the author of the parts of the library used.
X * This can be in the form of a textual message at
program startup or
X * in documentation (online or textual) provided with
the package.
X *
X * Redistribution and use in source and binary forms,
with or without
X * modification, are permitted provided that the
following conditions
X * are met:
X * 1. Redistributions of source code must retain the
copyright
X * notice, this list of conditions and the following
disclaimer.
X * 2. Redistributions in binary form must reproduce the
above copyright
X * notice, this list of conditions and the following
disclaimer in the
X * documentation and/or other materials provided
with the distribution.
X * 3. All advertising materials mentioning features or
use of this software
X * must display the following acknowledgement:
X * "This product includes cryptographic software
written by
X * Eric Young (eay@cryptsoft.com)"
X * The word 'cryptographic' can be left out if the
rouines from the library
X * being used are not cryptographic related :-).
X * 4. If you include any Windows specific code (or a
derivative thereof) from
X * the apps directory (application code) you must
include an acknowledgement:
X * "This product includes software written by Tim
Hudson (tjh@cryptsoft.com)"
X *
X * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS''
AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF
X * SUCH DAMAGE.
X *
X * The licence and distribution terms for any
publically available version or
X * derivative of this code cannot be changed. i.e.
this code cannot simply be
X * copied and put under another distribution licence
X * [including the GNU Public Licence.]
X */
X
X#include <openssl/idea.h>
X#include "idea_lcl.h"
X
Xvoid idea_cbc_encrypt(const unsigned char *in, unsigned
char *out, long length,
X IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int
encrypt)
X {
X register unsigned long tin0,tin1;
X register unsigned long tout0,tout1,xor0,xor1;
X register long l=length;
X unsigned long tin[2];
X
X if (encrypt)
X {
X n2l(iv,tout0);
X n2l(iv,tout1);
X iv-=8;
X for (l-=8; l>=0; l-=8)
X {
X n2l(in,tin0);
X n2l(in,tin1);
X tin0^=tout0;
X tin1^=tout1;
X tin[0]=tin0;
X tin[1]=tin1;
X idea_encrypt(tin,ks);
X tout0=tin[0]; l2n(tout0,out);
X tout1=tin[1]; l2n(tout1,out);
X }
X if (l != -8)
X {
X n2ln(in,tin0,tin1,l+8);
X tin0^=tout0;
X tin1^=tout1;
X tin[0]=tin0;
X tin[1]=tin1;
X idea_encrypt(tin,ks);
X tout0=tin[0]; l2n(tout0,out);
X tout1=tin[1]; l2n(tout1,out);
X }
X l2n(tout0,iv);
X l2n(tout1,iv);
X }
X else
X {
X n2l(iv,xor0);
X n2l(iv,xor1);
X iv-=8;
X for (l-=8; l>=0; l-=8)
X {
X n2l(in,tin0); tin[0]=tin0;
X n2l(in,tin1); tin[1]=tin1;
X idea_encrypt(tin,ks);
X tout0=tin[0]^xor0;
X tout1=tin[1]^xor1;
X l2n(tout0,out);
X l2n(tout1,out);
X xor0=tin0;
X xor1=tin1;
X }
X if (l != -8)
X {
X n2l(in,tin0); tin[0]=tin0;
X n2l(in,tin1); tin[1]=tin1;
X idea_encrypt(tin,ks);
X tout0=tin[0]^xor0;
X tout1=tin[1]^xor1;
X l2nn(tout0,tout1,out,l+8);
X xor0=tin0;
X xor1=tin1;
X }
X l2n(xor0,iv);
X l2n(xor1,iv);
X }
X tin0=tin1=tout0=tout1=xor0=xor1=0;
X tin[0]=tin[1]=0;
X }
X
Xvoid idea_encrypt(unsigned long *d, IDEA_KEY_SCHEDULE *
key)
X {
X register IDEA_INT *p;
X register unsigned long x1,x2,x3,x4,t0,t1,ul;
X
X x2=d[0];
X x1=(x2>>16);
X x4=d[1];
X x3=(x4>>16);
X
X p= &(key->data[0][0]);
X
X E_IDEA(0);
X E_IDEA(1);
X E_IDEA(2);
X E_IDEA(3);
X E_IDEA(4);
X E_IDEA(5);
X E_IDEA(6);
X E_IDEA(7);
X
X x1&=0xffff;
X idea_mul(x1,x1,*p,ul); p++;
X
X t0= x3+ *(p++);
X t1= x2+ *(p++);
X
X x4&=0xffff;
X idea_mul(x4,x4,*p,ul);
X
X d[0]=(t0&0xffff)|((x1&0xffff)<<16);
X d[1]=(x4&0xffff)|((t1&0xffff)<<16);
X }
END-of-Mix-2.9beta31/Src/idea/i_cbc.c
echo x - Mix-2.9beta31/Src/idea/i_cfb64.c
sed 's/^X//' >Mix-2.9beta31/Src/idea/i_cfb64.c << 'END-
of-Mix-2.9beta31/Src/idea/i_cfb64.c'
X/* crypto/idea/i_cfb64.c */
X/* Copyright (C) 1995-1998 Eric Young
(eay@cryptsoft.com)
X * All rights reserved.
X *
X * This package is an SSL implementation written
X * by Eric Young (eay@cryptsoft.com).
X * The implementation was written so as to conform with
Netscapes SSL.
X *
X * This library is free for commercial and non-
commercial use as long as
X * the following conditions are aheared to. The
following conditions
X * apply to all code found in this distribution, be it
the RC4, RSA,
X * lhash, DES, etc., code; not just the SSL code. The
SSL documentation
X * included with this distribution is covered by the
same copyright terms
X * except that the holder is Tim Hudson
(tjh@cryptsoft.com).
X *
X * Copyright remains Eric Young's, and as such any
Copyright notices in
X * the code are not to be removed.
X * If this package is used in a product, Eric Young
should be given attribution
X * as the author of the parts of the library used.
X * This can be in the form of a textual message at
program startup or
X * in documentation (online or textual) provided with
the package.
X *
X * Redistribution and use in source and binary forms,
with or without
X * modification, are permitted provided that the
following conditions
X * are met:
X * 1. Redistributions of source code must retain the
copyright
X * notice, this list of conditions and the following
disclaimer.
X * 2. Redistributions in binary form must reproduce the
above copyright
X * notice, this list of conditions and the following
disclaimer in the
X * documentation and/or other materials provided
with the distribution.
X * 3. All advertising materials mentioning features or
use of this software
X * must display the following acknowledgement:
X * "This product includes cryptographic software
written by
X * Eric Young (eay@cryptsoft.com)"
X * The word 'cryptographic' can be left out if the
rouines from the library
X * being used are not cryptographic related :-).
X * 4. If you include any Windows specific code (or a
derivative thereof) from
X * the apps directory (application code) you must
include an acknowledgement:
X * "This product includes software written by Tim
Hudson (tjh@cryptsoft.com)"
X *
X * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS''
AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF
X * SUCH DAMAGE.
X *
X * The licence and distribution terms for any
publically available version or
X * derivative of this code cannot be changed. i.e.
this code cannot simply be
X * copied and put under another distribution licence
X * [including the GNU Public Licence.]
X */
X
X#include <openssl/idea.h>
X#include "idea_lcl.h"
X
X/* The input and output encrypted as though 64bit cfb
mode is being
X * used. The extra state information to record how
much of the
X * 64bit block we have used is contained in *num;
X */
X
Xvoid idea_cfb64_encrypt(const unsigned char *in,
unsigned char *out,
X long length, IDEA_KEY_SCHEDULE *
schedule,
X unsigned char *ivec, int *num, int
encrypt)
X {
X register unsigned long v0,v1,t;
X register int n= *num;
X register long l=length;
X unsigned long ti[2];
X unsigned char *iv,c,cc;
X
X iv=(unsigned char *)ivec;
X if (encrypt)
X {
X while (l--)
X {
X if (n == 0)
X {
X n2l(iv,v0); ti[0]=v0;
X n2l(iv,v1); ti[1]=v1;
X idea_encrypt((unsigned long *
)ti,schedule);
X iv=(unsigned char *)ivec;
X t=ti[0]; l2n(t,iv);
X t=ti[1]; l2n(t,iv);
X iv=(unsigned char *)ivec;
X }
X c= *(in++)^iv[n];
X *(out++)=c;
X iv[n]=c;
X n=(n+1)&0x07;
X }
X }
X else
X {
X while (l--)
X {
X if (n == 0)
X {
X n2l(iv,v0); ti[0]=v0;
X n2l(iv,v1); ti[1]=v1;
X idea_encrypt((unsigned long *
)ti,schedule);
X iv=(unsigned char *)ivec;
X t=ti[0]; l2n(t,iv);
X t=ti[1]; l2n(t,iv);
X iv=(unsigned char *)ivec;
X }
X cc= *(in++);
X c=iv[n];
X iv[n]=cc;
X *(out++)=c^cc;
X n=(n+1)&0x07;
X }
X }
X v0=v1=ti[0]=ti[1]=t=c=cc=0;
X *num=n;
X }
X
END-of-Mix-2.9beta31/Src/idea/i_cfb64.c
echo x - Mix-2.9beta31/Src/idea/i_skey.c
sed 's/^X//' >Mix-2.9beta31/Src/idea/i_skey.c << 'END-
of-Mix-2.9beta31/Src/idea/i_skey.c'
X/* crypto/idea/i_skey.c */
X/* Copyright (C) 1995-1998 Eric Young
(eay@cryptsoft.com)
X * All rights reserved.
X *
X * This package is an SSL implementation written
X * by Eric Young (eay@cryptsoft.com).
X * The implementation was written so as to conform with
Netscapes SSL.
X *
X * This library is free for commercial and non-
commercial use as long as
X * the following conditions are aheared to. The
following conditions
X * apply to all code found in this distribution, be it
the RC4, RSA,
X * lhash, DES, etc., code; not just the SSL code. The
SSL documentation
X * included with this distribution is covered by the
same copyright terms
X * except that the holder is Tim Hudson
(tjh@cryptsoft.com).
X *
X * Copyright remains Eric Young's, and as such any
Copyright notices in
X * the code are not to be removed.
X * If this package is used in a product, Eric Young
should be given attribution
X * as the author of the parts of the library used.
X * This can be in the form of a textual message at
program startup or
X * in documentation (online or textual) provided with
the package.
X *
X * Redistribution and use in source and binary forms,
with or without
X * modification, are permitted provided that the
following conditions
X * are met:
X * 1. Redistributions of source code must retain the
copyright
X * notice, this list of conditions and the following
disclaimer.
X * 2. Redistributions in binary form must reproduce the
above copyright
X * notice, this list of conditions and the following
disclaimer in the
X * documentation and/or other materials provided
with the distribution.
X * 3. All advertising materials mentioning features or
use of this software
X * must display the following acknowledgement:
X * "This product includes cryptographic software
written by
X * Eric Young (eay@cryptsoft.com)"
X * The word 'cryptographic' can be left out if the
rouines from the library
X * being used are not cryptographic related :-).
X * 4. If you include any Windows specific code (or a
derivative thereof) from
X * the apps directory (application code) you must
include an acknowledgement:
X * "This product includes software written by Tim
Hudson (tjh@cryptsoft.com)"
X *
X * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS''
AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF
X * SUCH DAMAGE.
X *
X * The licence and distribution terms for any
publically available version or
X * derivative of this code cannot be changed. i.e.
this code cannot simply be
X * copied and put under another distribution licence
X * [including the GNU Public Licence.]
X */
X
X#include <openssl/idea.h>
X#include "idea_lcl.h"
X
Xstatic IDEA_INT inverse(unsigned int xin);
Xvoid idea_set_encrypt_key(const unsigned char *key,
IDEA_KEY_SCHEDULE *ks)
X {
X int i;
X register IDEA_INT *kt,*kf,r0,r1,r2;
X
X kt= &(ks->data[0][0]);
X n2s(key,kt[0]); n2s(key,kt[1]); n2s(key,kt[2]);
n2s(key,kt[3]);
X n2s(key,kt[4]); n2s(key,kt[5]); n2s(key,kt[6]);
n2s(key,kt[7]);
X
X kf=kt;
X kt+=8;
X for (i=0; i<6; i++)
X {
X r2= kf[1];
X r1= kf[2];
X *(kt++)= ((r2<<9) | (r1>>7))&0xffff;
X r0= kf[3];
X *(kt++)= ((r1<<9) | (r0>>7))&0xffff;
X r1= kf[4];
X *(kt++)= ((r0<<9) | (r1>>7))&0xffff;
X r0= kf[5];
X *(kt++)= ((r1<<9) | (r0>>7))&0xffff;
X r1= kf[6];
X *(kt++)= ((r0<<9) | (r1>>7))&0xffff;
X r0= kf[7];
X *(kt++)= ((r1<<9) | (r0>>7))&0xffff;
X r1= kf[0];
X if (i >= 5) break;
X *(kt++)= ((r0<<9) | (r1>>7))&0xffff;
X *(kt++)= ((r1<<9) | (r2>>7))&0xffff;
X kf+=8;
X }
X }
X
Xvoid idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek,
IDEA_KEY_SCHEDULE *dk)
X {
X int r;
X register IDEA_INT *fp,*tp,t;
X
X tp= &(dk->data[0][0]);
X fp= &(ek->data[8][0]);
X for (r=0; r<9; r++)
X {
X *(tp++)=inverse(fp[0]);
X *(tp++)=((int)(0x10000L-fp[2])&0xffff);
X *(tp++)=((int)(0x10000L-fp[1])&0xffff);
X *(tp++)=inverse(fp[3]);
X if (r == 8) break;
X fp-=6;
X *(tp++)=fp[4];
X *(tp++)=fp[5];
X }
X
X tp= &(dk->data[0][0]);
X t=tp[1];
X tp[1]=tp[2];
X tp[2]=t;
X
X t=tp[49];
X tp[49]=tp[50];
X tp[50]=t;
X }
X
X/* taken directly from the 'paper' I'll have a look at
it later */
Xstatic IDEA_INT inverse(unsigned int xin)
X {
X long n1,n2,q,r,b1,b2,t;
X
X if (xin == 0)
X b2=0;
X else
X {
X n1=0x10001;
X n2=xin;
X b2=1;
X b1=0;
X
X do {
X r=(n1%n2);
X q=(n1-r)/n2;
X if (r == 0)
X { if (b2 < 0) b2=0x10001+b2; }
X else
X {
X n1=n2;
X n2=r;
X t=b2;
X b2=b1-q*b2;
X b1=t;
X }
X } while (r != 0);
X }
X return((IDEA_INT)b2);
X }
END-of-Mix-2.9beta31/Src/idea/i_skey.c
echo x - Mix-2.9beta31/Src/idea/idea.h
sed 's/^X//' >Mix-2.9beta31/Src/idea/idea.h << 'END-of-
Mix-2.9beta31/Src/idea/idea.h'
X/* crypto/idea/idea.h */
X/* Copyright (C) 1995-1997 Eric Young
(eay@cryptsoft.com)
X * All rights reserved.
X *
X * This package is an SSL implementation written
X * by Eric Young (eay@cryptsoft.com).
X * The implementation was written so as to conform with
Netscapes SSL.
X *
X * This library is free for commercial and non-
commercial use as long as
X * the following conditions are aheared to. The
following conditions
X * apply to all code found in this distribution, be it
the RC4, RSA,
X * lhash, DES, etc., code; not just the SSL code. The
SSL documentation
X * included with this distribution is covered by the
same copyright terms
X * except that the holder is Tim Hudson
(tjh@cryptsoft.com).
X *
X * Copyright remains Eric Young's, and as such any
Copyright notices in
X * the code are not to be removed.
X * If this package is used in a product, Eric Young
should be given attribution
X * as the author of the parts of the library used.
X * This can be in the form of a textual message at
program startup or
X * in documentation (online or textual) provided with
the package.
X *
X * Redistribution and use in source and binary forms,
with or without
X * modification, are permitted provided that the
following conditions
X * are met:
X * 1. Redistributions of source code must retain the
copyright
X * notice, this list of conditions and the following
disclaimer.
X * 2. Redistributions in binary form must reproduce the
above copyright
X * notice, this list of conditions and the following
disclaimer in the
X * documentation and/or other materials provided
with the distribution.
X * 3. All advertising materials mentioning features or
use of this software
X * must display the following acknowledgement:
X * "This product includes cryptographic software
written by
X * Eric Young (eay@cryptsoft.com)"
X * The word 'cryptographic' can be left out if the
rouines from the library
X * being used are not cryptographic related :-).
X * 4. If you include any Windows specific code (or a
derivative thereof) from
X * the apps directory (application code) you must
include an acknowledgement:
X * "This product includes software written by Tim
Hudson (tjh@cryptsoft.com)"
X *
X * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS''
AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF
X * SUCH DAMAGE.
X *
X * The licence and distribution terms for any
publically available version or
X * derivative of this code cannot be changed. i.e. ths
code cannot simply be
X * copied and put under another distribution licence
X * [including the GNU Public Licence.]
X */
X
X#ifndef HEADER_IDEA_H
X#define HEADER_IDEA_H
X
X#ifdef NO_IDEA
X#error IDEA is disabled.
X#endif
X
X#define IDEA_ENCRYPT 1
X#define IDEA_DECRYPT 0
X
X#include <openssl/opensslconf.h> /* IDEA_INT */
X#define IDEA_BLOCK 8
X#define IDEA_KEY_LENGTH 16
X
X#ifdef __cplusplus
Xextern "C" {
X#endif
X
Xtypedef struct idea_key_st
X {
X IDEA_INT data[9][6];
X } IDEA_KEY_SCHEDULE;
X
Xconst char *idea_options(void);
Xvoid idea_ecb_encrypt(const unsigned char *in, unsigned
char *out,
X IDEA_KEY_SCHEDULE *ks);
Xvoid idea_set_encrypt_key(const unsigned char *key,
IDEA_KEY_SCHEDULE *ks);
Xvoid idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek,
IDEA_KEY_SCHEDULE *dk);
Xvoid idea_cbc_encrypt(const unsigned char *in, unsigned
char *out,
X long length, IDEA_KEY_SCHEDULE *ks, unsigned char *
iv,int enc);
Xvoid idea_cfb64_encrypt(const unsigned char *in,
unsigned char *out,
X long length, IDEA_KEY_SCHEDULE *ks, unsigned char *
iv,
X int *num,int enc);
Xvoid idea_ofb64_encrypt(const unsigned char *in,
unsigned char *out,
X long length, IDEA_KEY_SCHEDULE *ks, unsigned char *
iv, int *num);
Xvoid idea_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE
*ks);
X#ifdef __cplusplus
X}
X#endif
X
X#endif
END-of-Mix-2.9beta31/Src/idea/idea.h
echo x - Mix-2.9beta31/Src/idea/idea_lcl.h
sed 's/^X//' >Mix-2.9beta31/Src/idea/idea_lcl.h << 'END-
of-Mix-2.9beta31/Src/idea/idea_lcl.h'
X/* crypto/idea/idea_lcl.h */
X/* Copyright (C) 1995-1998 Eric Young
(eay@cryptsoft.com)
X * All rights reserved.
X *
X * This package is an SSL implementation written
X * by Eric Young (eay@cryptsoft.com).
X * The implementation was written so as to conform with
Netscapes SSL.
X *
X * This library is free for commercial and non-
commercial use as long as
X * the following conditions are aheared to. The
following conditions
X * apply to all code found in this distribution, be it
the RC4, RSA,
X * lhash, DES, etc., code; not just the SSL code. The
SSL documentation
X * included with this distribution is covered by the
same copyright terms
X * except that the holder is Tim Hudson
(tjh@cryptsoft.com).
X *
X * Copyright remains Eric Young's, and as such any
Copyright notices in
X * the code are not to be removed.
X * If this package is used in a product, Eric Young
should be given attribution
X * as the author of the parts of the library used.
X * This can be in the form of a textual message at
program startup or
X * in documentation (online or textual) provided with
the package.
X *
X * Redistribution and use in source and binary forms,
with or without
X * modification, are permitted provided that the
following conditions
X * are met:
X * 1. Redistributions of source code must retain the
copyright
X * notice, this list of conditions and the following
disclaimer.
X * 2. Redistributions in binary form must reproduce the
above copyright
X * notice, this list of conditions and the following
disclaimer in the
X * documentation and/or other materials provided
with the distribution.
X * 3. All advertising materials mentioning features or
use of this software
X * must display the following acknowledgement:
X * "This product includes cryptographic software
written by
X * Eric Young (eay@cryptsoft.com)"
X * The word 'cryptographic' can be left out if the
rouines from the library
X * being used are not cryptographic related :-).
X * 4. If you include any Windows specific code (or a
derivative thereof) from
X * the apps directory (application code) you must
include an acknowledgement:
X * "This product includes software written by Tim
Hudson (tjh@cryptsoft.com)"
X *
X * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS''
AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF
X * SUCH DAMAGE.
X *
X * The licence and distribution terms for any
publically available version or
X * derivative of this code cannot be changed. i.e.
this code cannot simply be
X * copied and put under another distribution licence
X * [including the GNU Public Licence.]
X */
X
X/* The new form of this macro (check if the a*b == 0)
was suggested by
X * Colin Plumb <colin@nyx10.cs.du.edu> */
X/* Removal of the inner if from from Wei Dai 24/4/96 */
X#define idea_mul(r,a,b,ul) \ Xul=(unsigned long)a*b; \ Xif (ul != 0) \ X { \ X r=(ul&0xffff)-(ul>>16); \ X r-=((r)>>16); \ X } \ Xelse \ X r=(-(int)a-b+1); /* assuming a or b is 0 and in
range */ \ X
X#ifdef undef
X#define idea_mul(r,a,b,ul,sl) \ Xif (a == 0) r=(0x10001-b)&0xffff; \ Xelse if (b == 0) r=(0x10001-a)&0xffff; \ Xelse { \ X ul=(unsigned long)a*b; \ X sl=(ul&0xffff)-(ul>>16); \ X if (sl <= 0) sl+=0x10001; \ X r=sl; \ X }
X#endif
X
X/* 7/12/95 - Many thanks to Rhys Weatherley <
rweather@us.oracle.com>
X * for pointing out that I was assuming little endian
X * byte order for all quantities what idea
X * actually used bigendian. No where in the spec does
it mention
X * this, it is all in terms of 16 bit numbers and even
the example
X * does not use byte streams for the input example :-(.
X * If you byte swap each pair of input, keys and iv,
the functions
X * would produce the output as the old version :-(.
X */
X
X/* NOTE - c is not incremented as per n2l */
X#define n2ln(c,l1,l2,n) { \ X c+=n; \ X l1=l2=0; \ X switch (n) { \ X case 8: l2 =((unsigned long)(*(--(c))))
; \ X case 7: l2|=((unsigned long)(*(--(c))))<
< 8; \ X case 6: l2|=((unsigned long)(*(--(c))))<
<16; \ X case 5: l2|=((unsigned long)(*(--(c))))<
<24; \ X case 4: l1 =((unsigned long)(*(--(c))))
; \ X case 3: l1|=((unsigned long)(*(--(c))))<
< 8; \ X case 2: l1|=((unsigned long)(*(--(c))))<
<16; \ X case 1: l1|=((unsigned long)(*(--(c))))<
<24; \ X } \ X }
X
X/* NOTE - c is not incremented as per l2n */
X#define l2nn(l1,l2,c,n) { \ X c+=n; \ X switch (n) { \ X case 8: *(--(c))=(unsigned char)(((l2)
)&0xff); \ X case 7: *(--(c))=(unsigned char)(((l2)>>
8)&0xff); \ X case 6: *(--(c))=(unsigned char)(((l2)>>
16)&0xff); \ X case 5: *(--(c))=(unsigned char)(((l2)>>
24)&0xff); \ X case 4: *(--(c))=(unsigned char)(((l1)
)&0xff); \ X case 3: *(--(c))=(unsigned char)(((l1)>>
8)&0xff); \ X case 2: *(--(c))=(unsigned char)(((l1)>>
16)&0xff); \ X case 1: *(--(c))=(unsigned char)(((l1)>>
24)&0xff); \ X } \ X }
X
X#undef n2l
X#define n2l(c,l) (l =((unsigned long)(*((c)++
)))<<24L, \ X l|=((unsigned long)(*((c)++
)))<<16L, \ X l|=((unsigned long)(*((c)++
)))<< 8L, \ X l|=((unsigned long)(*((c)++
))))
X
X#undef l2n
X#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>
>24L)&0xff), \ X *((c)++)=(unsigned char)(((l)>
>16L)&0xff), \ X *((c)++)=(unsigned char)(((l)>
> 8L)&0xff), \ X *((c)++)=(unsigned char)(((l)
)&0xff))
X
X#undef s2n
X#define s2n(l,c) (*((c)++)=(unsigned char)(((l)
)&0xff), \ X *((c)++)=(unsigned char)(((l)>> 8L)&
0xff))
X
X#undef n2s
X#define n2s(c,l) (l =((IDEA_INT)(*((c)++)))<< 8L, \ X l|=((IDEA_INT)(*((c)++))) )
X
X#ifdef undef
X/* NOTE - c is not incremented as per c2l */
X#define c2ln(c,l1,l2,n) { \ X c+=n; \ X l1=l2=0; \ X switch (n) { \ X case 8: l2 =((unsigned long)(*(--(c))))<
<24; \ X case 7: l2|=((unsigned long)(*(--(c))))<
<16; \ X case 6: l2|=((unsigned long)(*(--(c))))<
< 8; \ X case 5: l2|=((unsigned long)(*(--(c))));
\ X case 4: l1 =((unsigned long)(*(--(c))))<
<24; \ X case 3: l1|=((unsigned long)(*(--(c))))<
<16; \ X case 2: l1|=((unsigned long)(*(--(c))))<
< 8; \ X case 1: l1|=((unsigned long)(*(--(c))));
\ X } \ X }
X
X/* NOTE - c is not incremented as per l2c */
X#define l2cn(l1,l2,c,n) { \ X c+=n; \ X switch (n) { \ X case 8: *(--(c))=(unsigned char)(((l2)>>
24)&0xff); \ X case 7: *(--(c))=(unsigned char)(((l2)>>
16)&0xff); \ X case 6: *(--(c))=(unsigned char)(((l2)>>
8)&0xff); \ X case 5: *(--(c))=(unsigned char)(((l2)
)&0xff); \ X case 4: *(--(c))=(unsigned char)(((l1)>>
24)&0xff); \ X case 3: *(--(c))=(unsigned char)(((l1)>>
16)&0xff); \ X case 2: *(--(c))=(unsigned char)(((l1)>>
8)&0xff); \ X case 1: *(--(c))=(unsigned char)(((l1)
)&0xff); \ X } \ X }
X
X#undef c2s
X#define c2s(c,l) (l =((unsigned long)(*((c)++)))
, \ X l|=((unsigned long)(*((c)++)))<< 8L)
X
X#undef s2c
X#define s2c(l,c) (*((c)++)=(unsigned char)(((l)
)&0xff), \ X *((c)++)=(unsigned char)(((l)>> 8L)&
0xff))
X
X#undef c2l
X#define c2l(c,l) (l =((unsigned long)(*((c)++)))
, \ X l|=((unsigned long)(*((c)++)))<< 8L, \ X l|=((unsigned long)(*((c)++)))<<16L, \ X l|=((unsigned long)(*((c)++)))<<24L)
X
X#undef l2c
X#define l2c(l,c) (*((c)++)=(unsigned char)(((l)
)&0xff), \ X *((c)++)=(unsigned char)(((l)>> 8L)&
0xff), \ X *((c)++)=(unsigned char)(((l)>>16L)&
0xff), \ X *((c)++)=(unsigned char)(((l)>>24L)&
0xff))
X#endif
X
X#define E_IDEA(num) \ X x1&=0xffff; \ X idea_mul(x1,x1,*p,ul); p++; \ X x2+= *(p++); \ X x3+= *(p++); \ X x4&=0xffff; \ X idea_mul(x4,x4,*p,ul); p++; \ X t0=(x1^x3)&0xffff; \ X idea_mul(t0,t0,*p,ul); p++; \ X t1=(t0+(x2^x4))&0xffff; \ X idea_mul(t1,t1,*p,ul); p++; \ X t0+=t1; \ X x1^=t1; \ X x4^=t0; \ X ul=x2^t0; /* do the swap to x3 */ \ X x2=x3^t1; \ X x3=ul;
X
END-of-Mix-2.9beta31/Src/idea/idea_lcl.h
exit

Discussion

  • Len Sassaman

    Len Sassaman - 2001-11-07

    Logged In: YES
    user_id=29569

    IDEA is available in the OpenSSL libraries. If OpenBSD
    users wish to have IDEA on their system, they can
    obtain a full version of OpenSSL from
    www.openssl.org.

    We may have to modify the Install script to convey that
    information.

     
  • Len Sassaman

    Len Sassaman - 2001-11-07
    • assigned_to: nobody --> rabbi
    • status: open --> closed-rejected
     

Log in to post a comment.