summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2008-12-23 11:18:45 +0000
committerAndy Polyakov <appro@openssl.org>2008-12-23 11:18:45 +0000
commit63fc7f848d4e047c3bd0f4a1c7e843191b2e9f0a (patch)
tree05e99736ef10da0618bced732fe626753da282ed /crypto
parent830457ce4fc9c7699900eff53bb4cfc0d4203ed4 (diff)
crypto/modes: make modes.h selfsufficient and rename block_f to block128_t.
Diffstat (limited to 'crypto')
-rw-r--r--crypto/modes/cbc128.c8
-rw-r--r--crypto/modes/cfb128.c12
-rw-r--r--crypto/modes/ctr128.c6
-rw-r--r--crypto/modes/modes.h26
-rw-r--r--crypto/modes/ofb128.c6
5 files changed, 29 insertions, 29 deletions
diff --git a/crypto/modes/cbc128.c b/crypto/modes/cbc128.c
index af844b6ac4..8f8bd563b9 100644
--- a/crypto/modes/cbc128.c
+++ b/crypto/modes/cbc128.c
@@ -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;
diff --git a/crypto/modes/cfb128.c b/crypto/modes/cfb128.c
index 0512c3f986..9ba4984718 100644
--- a/crypto/modes/cfb128.c
+++ b/crypto/modes/cfb128.c
@@ -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;
diff --git a/crypto/modes/ctr128.c b/crypto/modes/ctr128.c
index db79c76d39..bd84f41528 100644
--- a/crypto/modes/ctr128.c
+++ b/crypto/modes/ctr128.c
@@ -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;
diff --git a/crypto/modes/modes.h b/crypto/modes/modes.h
index 87e0ec6115..6315a60fc4 100644
--- a/crypto/modes/modes.h
+++ b/crypto/modes/modes.h
@@ -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);
diff --git a/crypto/modes/ofb128.c b/crypto/modes/ofb128.c
index ae264c832c..09b3430034 100644
--- a/crypto/modes/ofb128.c
+++ b/crypto/modes/ofb128.c
@@ -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;