Update filenames in makefiles.
[openssl.git] / crypto / idea / i_cbc.c
index d17e9f29e069d0146d441fccf26705f88b239868..ecb9cb8b8367cd43021b432907195e43474ccc28 100644 (file)
@@ -1,5 +1,5 @@
 /* crypto/idea/i_cbc.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
@@ -47,7 +47,7 @@
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * OUT OF THE USE OF THIS  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * 
  * The licence and distribution terms for any publically available version or
  * [including the GNU Public Licence.]
  */
 
-#include "idea.h"
+#include <openssl/idea.h>
 #include "idea_lcl.h"
 
-void idea_cbc_encrypt(in, out, length, ks, iv, encrypt)
-unsigned char *in;
-unsigned char *out;
-long length;
-IDEA_KEY_SCHEDULE *ks;
-unsigned char *iv;
-int encrypt;
+void idea_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
+            IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int encrypt)
        {
        register unsigned long tin0,tin1;
        register unsigned long tout0,tout1,xor0,xor1;
@@ -138,3 +133,36 @@ int encrypt;
        tin[0]=tin[1]=0;
        }
 
+void idea_encrypt(unsigned long *d, IDEA_KEY_SCHEDULE *key)
+       {
+       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]);
+
+       E_IDEA(0);
+       E_IDEA(1);
+       E_IDEA(2);
+       E_IDEA(3);
+       E_IDEA(4);
+       E_IDEA(5);
+       E_IDEA(6);
+       E_IDEA(7);
+
+       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);
+       }