crypto/modes: make modes.h selfsufficient and rename block_f to block128_t.
authorAndy Polyakov <appro@openssl.org>
Tue, 23 Dec 2008 11:18:45 +0000 (11:18 +0000)
committerAndy Polyakov <appro@openssl.org>
Tue, 23 Dec 2008 11:18:45 +0000 (11:18 +0000)
crypto/modes/cbc128.c
crypto/modes/cfb128.c
crypto/modes/ctr128.c
crypto/modes/modes.h
crypto/modes/ofb128.c

index af844b6ac48a6ef8d4c76221a75dbe04447a93dc..8f8bd563b96cf1b6c40bdb0515d6c92df448fd0d 100644 (file)
@@ -48,7 +48,7 @@
  *
  */
 
-#include <stddef.h>
+#include "modes.h"
 #include <string.h>
 
 #ifndef MODES_DEBUG
@@ -58,8 +58,6 @@
 #endif
 #include <assert.h>
 
-#include "modes.h"
-
 #define STRICT_ALIGNMENT 1
 #if defined(__i386) || defined(__i386__) || \
     defined(__x86_64) || defined(__x86_64__) || \
@@ -71,7 +69,7 @@
 
 void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,
                        size_t len, const void *key,
-                       unsigned char ivec[16], block_f block)
+                       unsigned char ivec[16], block128_f block)
 {
        size_t n;
        const unsigned char *iv = ivec;
@@ -120,7 +118,7 @@ void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,
 
 void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
                        size_t len, const void *key,
-                       unsigned char ivec[16], block_f block)
+                       unsigned char ivec[16], block128_f block)
 {
        size_t n;
        union { size_t align; unsigned char c[16]; } tmp;
index 0512c3f986c1c634d03cbe96d9633117b0a4149a..9ba498471877199983de9add3001896b4ebb34f5 100644 (file)
@@ -48,7 +48,7 @@
  *
  */
 
-#include <stddef.h>
+#include "modes.h"
 #include <string.h>
 
 #ifndef MODES_DEBUG
@@ -58,8 +58,6 @@
 #endif
 #include <assert.h>
 
-#include "modes.h"
-
 #define STRICT_ALIGNMENT
 #if defined(__i386) || defined(__i386__) || \
     defined(__x86_64) || defined(__x86_64__) || \
@@ -75,7 +73,7 @@
 void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
                        size_t len, const void *key,
                        unsigned char ivec[16], int *num,
-                       int enc, block_f block)
+                       int enc, block128_f block)
 {
     unsigned int n;
     size_t l = 0;
@@ -184,7 +182,7 @@ void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
 static void cfbr_encrypt_block(const unsigned char *in,unsigned char *out,
                            int nbits,const void *key,
                            unsigned char ivec[16],int enc,
-                           block_f block)
+                           block128_f block)
 {
     int n,rem,num;
     unsigned char ovec[16*2 + 1];  /* +1 because we dererefence (but don't use) one byte off the end */
@@ -218,7 +216,7 @@ static void cfbr_encrypt_block(const unsigned char *in,unsigned char *out,
 void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out,
                        size_t bits, const void *key,
                        unsigned char ivec[16], int *num,
-                       int enc, block_f block)
+                       int enc, block128_f block)
 {
     size_t n;
     unsigned char c[1],d[1];
@@ -238,7 +236,7 @@ void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out,
 void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out,
                        size_t length, const void *key,
                        unsigned char ivec[16], int *num,
-                       int enc, block_f block)
+                       int enc, block128_f block)
 {
     size_t n;
 
index db79c76d392f20242084cf8cc5bdfc1802e7f3b8..bd84f41528b288829ad70c872725074d3be76946 100644 (file)
@@ -48,7 +48,7 @@
  *
  */
 
-#include <stddef.h>
+#include "modes.h"
 #include <string.h>
 
 #ifndef MODES_DEBUG
@@ -58,8 +58,6 @@
 #endif
 #include <assert.h>
 
-#include "modes.h"
-
 typedef unsigned int u32;
 typedef unsigned char u8;
 
@@ -128,7 +126,7 @@ static void ctr128_inc_aligned(unsigned char *counter) {
 void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out,
                        size_t len, const void *key,
                        unsigned char ivec[16], unsigned char ecount_buf[16],
-                       unsigned int *num, block_f block)
+                       unsigned int *num, block128_f block)
 {
        unsigned int n;
        size_t l=0;
index 87e0ec61156792acd4941fa873f1d0fa804a1ce7..6315a60fc4d42edf95f673747546c6a5946e6cb0 100644 (file)
@@ -1,34 +1,42 @@
-typedef void (*block_f)(const unsigned char in[16],
+/* ====================================================================
+ * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
+ *
+ * Rights for redistribution and usage in source and binary
+ * forms are granted according to the OpenSSL license.
+ */
+
+#include <stddef.h>
+
+typedef void (*block128_f)(const unsigned char in[16],
                        unsigned char out[16],
                        const void *key);
 
 void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,
                        size_t len, const void *key,
-                       unsigned char ivec[16], block_f block);
+                       unsigned char ivec[16], block128_f block);
 void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
                        size_t len, const void *key,
-                       unsigned char ivec[16], block_f block);
+                       unsigned char ivec[16], block128_f block);
 
 void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out,
                        size_t len, const void *key,
                        unsigned char ivec[16], unsigned char ecount_buf[16],
-                       unsigned int *num, block_f block);
+                       unsigned int *num, block128_f block);
 
 void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out,
                        size_t len, const void *key,
                        unsigned char ivec[16], int *num,
-                       block_f block);
+                       block128_f block);
 
 void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
                        size_t len, const void *key,
                        unsigned char ivec[16], int *num,
-                       int enc, block_f block);
+                       int enc, block128_f block);
 void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out,
                        size_t length, const void *key,
                        unsigned char ivec[16], int *num,
-                       int enc, block_f block);
+                       int enc, block128_f block);
 void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out,
                        size_t bits, const void *key,
                        unsigned char ivec[16], int *num,
-                       int enc, block_f block);
-
+                       int enc, block128_f block);
index ae264c832c5fefba52f611d2fe265917a383dc24..09b34300346975b364f4d2339335c527680947c1 100644 (file)
@@ -48,7 +48,7 @@
  *
  */
 
-#include <stddef.h>
+#include "modes.h"
 #include <string.h>
 
 #ifndef MODES_DEBUG
@@ -58,8 +58,6 @@
 #endif
 #include <assert.h>
 
-#include "modes.h"
-
 #define STRICT_ALIGNMENT
 #if defined(__i386) || defined(__i386__) || \
     defined(__x86_64) || defined(__x86_64__) || \
@@ -75,7 +73,7 @@
 void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out,
                        size_t len, const void *key,
                        unsigned char ivec[16], int *num,
-                       block_f block)
+                       block128_f block)
 {
        unsigned int n;
        size_t l=0;