Consistently use C99 fixed-width types in the in-kernel crypto code.
Reviewed by: markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27061
This commit is contained in:
parent
ce3fdfa110
commit
8b08f8964e
@ -18,7 +18,7 @@ chacha20_xform_setkey(void *ctx, const uint8_t *key, int len)
|
||||
}
|
||||
|
||||
static void
|
||||
chacha20_xform_reinit(void *ctx, const u_int8_t *iv)
|
||||
chacha20_xform_reinit(void *ctx, const uint8_t *iv)
|
||||
{
|
||||
|
||||
chacha_ivsetup(ctx, iv + 8, iv);
|
||||
|
@ -56,7 +56,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* must be 32bit quantity */
|
||||
#define DES_LONG u_int32_t
|
||||
#define DES_LONG uint32_t
|
||||
|
||||
typedef unsigned char des_cblock[8];
|
||||
typedef struct des_ks_struct
|
||||
|
@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$");
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
typedef u_int8_t BYTE;
|
||||
typedef uint8_t BYTE;
|
||||
|
||||
int rijndael_makeKey(keyInstance *key, BYTE direction, int keyLen,
|
||||
const char *keyMaterial) {
|
||||
@ -84,7 +84,7 @@ int rijndael_cipherInit(cipherInstance *cipher, BYTE mode, char *IV) {
|
||||
int rijndael_blockEncrypt(cipherInstance *cipher, keyInstance *key,
|
||||
const BYTE *input, int inputLen, BYTE *outBuffer) {
|
||||
int i, k, numBlocks;
|
||||
u_int8_t block[16], iv[4][4];
|
||||
uint8_t block[16], iv[4][4];
|
||||
|
||||
if (cipher == NULL ||
|
||||
key == NULL ||
|
||||
@ -110,15 +110,15 @@ int rijndael_blockEncrypt(cipherInstance *cipher, keyInstance *key,
|
||||
#if 1 /*STRICT_ALIGN*/
|
||||
memcpy(block, cipher->IV, 16);
|
||||
memcpy(iv, input, 16);
|
||||
((u_int32_t*)block)[0] ^= ((u_int32_t*)iv)[0];
|
||||
((u_int32_t*)block)[1] ^= ((u_int32_t*)iv)[1];
|
||||
((u_int32_t*)block)[2] ^= ((u_int32_t*)iv)[2];
|
||||
((u_int32_t*)block)[3] ^= ((u_int32_t*)iv)[3];
|
||||
((uint32_t*)block)[0] ^= ((uint32_t*)iv)[0];
|
||||
((uint32_t*)block)[1] ^= ((uint32_t*)iv)[1];
|
||||
((uint32_t*)block)[2] ^= ((uint32_t*)iv)[2];
|
||||
((uint32_t*)block)[3] ^= ((uint32_t*)iv)[3];
|
||||
#else
|
||||
((u_int32_t*)block)[0] = ((u_int32_t*)cipher->IV)[0] ^ ((u_int32_t*)input)[0];
|
||||
((u_int32_t*)block)[1] = ((u_int32_t*)cipher->IV)[1] ^ ((u_int32_t*)input)[1];
|
||||
((u_int32_t*)block)[2] = ((u_int32_t*)cipher->IV)[2] ^ ((u_int32_t*)input)[2];
|
||||
((u_int32_t*)block)[3] = ((u_int32_t*)cipher->IV)[3] ^ ((u_int32_t*)input)[3];
|
||||
((uint32_t*)block)[0] = ((uint32_t*)cipher->IV)[0] ^ ((uint32_t*)input)[0];
|
||||
((uint32_t*)block)[1] = ((uint32_t*)cipher->IV)[1] ^ ((uint32_t*)input)[1];
|
||||
((uint32_t*)block)[2] = ((uint32_t*)cipher->IV)[2] ^ ((uint32_t*)input)[2];
|
||||
((uint32_t*)block)[3] = ((uint32_t*)cipher->IV)[3] ^ ((uint32_t*)input)[3];
|
||||
#endif
|
||||
rijndaelEncrypt(key->rk, key->Nr, block, outBuffer);
|
||||
input += 16;
|
||||
@ -126,15 +126,15 @@ int rijndael_blockEncrypt(cipherInstance *cipher, keyInstance *key,
|
||||
#if 1 /*STRICT_ALIGN*/
|
||||
memcpy(block, outBuffer, 16);
|
||||
memcpy(iv, input, 16);
|
||||
((u_int32_t*)block)[0] ^= ((u_int32_t*)iv)[0];
|
||||
((u_int32_t*)block)[1] ^= ((u_int32_t*)iv)[1];
|
||||
((u_int32_t*)block)[2] ^= ((u_int32_t*)iv)[2];
|
||||
((u_int32_t*)block)[3] ^= ((u_int32_t*)iv)[3];
|
||||
((uint32_t*)block)[0] ^= ((uint32_t*)iv)[0];
|
||||
((uint32_t*)block)[1] ^= ((uint32_t*)iv)[1];
|
||||
((uint32_t*)block)[2] ^= ((uint32_t*)iv)[2];
|
||||
((uint32_t*)block)[3] ^= ((uint32_t*)iv)[3];
|
||||
#else
|
||||
((u_int32_t*)block)[0] = ((u_int32_t*)outBuffer)[0] ^ ((u_int32_t*)input)[0];
|
||||
((u_int32_t*)block)[1] = ((u_int32_t*)outBuffer)[1] ^ ((u_int32_t*)input)[1];
|
||||
((u_int32_t*)block)[2] = ((u_int32_t*)outBuffer)[2] ^ ((u_int32_t*)input)[2];
|
||||
((u_int32_t*)block)[3] = ((u_int32_t*)outBuffer)[3] ^ ((u_int32_t*)input)[3];
|
||||
((uint32_t*)block)[0] = ((uint32_t*)outBuffer)[0] ^ ((uint32_t*)input)[0];
|
||||
((uint32_t*)block)[1] = ((uint32_t*)outBuffer)[1] ^ ((uint32_t*)input)[1];
|
||||
((uint32_t*)block)[2] = ((uint32_t*)outBuffer)[2] ^ ((uint32_t*)input)[2];
|
||||
((uint32_t*)block)[3] = ((uint32_t*)outBuffer)[3] ^ ((uint32_t*)input)[3];
|
||||
#endif
|
||||
outBuffer += 16;
|
||||
rijndaelEncrypt(key->rk, key->Nr, block, outBuffer);
|
||||
@ -146,17 +146,17 @@ int rijndael_blockEncrypt(cipherInstance *cipher, keyInstance *key,
|
||||
#if 1 /*STRICT_ALIGN*/
|
||||
memcpy(iv, cipher->IV, 16);
|
||||
#else /* !STRICT_ALIGN */
|
||||
*((u_int32_t*)iv[0]) = *((u_int32_t*)(cipher->IV ));
|
||||
*((u_int32_t*)iv[1]) = *((u_int32_t*)(cipher->IV+ 4));
|
||||
*((u_int32_t*)iv[2]) = *((u_int32_t*)(cipher->IV+ 8));
|
||||
*((u_int32_t*)iv[3]) = *((u_int32_t*)(cipher->IV+12));
|
||||
*((uint32_t*)iv[0]) = *((uint32_t*)(cipher->IV ));
|
||||
*((uint32_t*)iv[1]) = *((uint32_t*)(cipher->IV+ 4));
|
||||
*((uint32_t*)iv[2]) = *((uint32_t*)(cipher->IV+ 8));
|
||||
*((uint32_t*)iv[3]) = *((uint32_t*)(cipher->IV+12));
|
||||
#endif /* ?STRICT_ALIGN */
|
||||
for (i = numBlocks; i > 0; i--) {
|
||||
for (k = 0; k < 128; k++) {
|
||||
*((u_int32_t*) block ) = *((u_int32_t*)iv[0]);
|
||||
*((u_int32_t*)(block+ 4)) = *((u_int32_t*)iv[1]);
|
||||
*((u_int32_t*)(block+ 8)) = *((u_int32_t*)iv[2]);
|
||||
*((u_int32_t*)(block+12)) = *((u_int32_t*)iv[3]);
|
||||
*((uint32_t*) block ) = *((uint32_t*)iv[0]);
|
||||
*((uint32_t*)(block+ 4)) = *((uint32_t*)iv[1]);
|
||||
*((uint32_t*)(block+ 8)) = *((uint32_t*)iv[2]);
|
||||
*((uint32_t*)(block+12)) = *((uint32_t*)iv[3]);
|
||||
rijndaelEncrypt(key->ek, key->Nr, block,
|
||||
block);
|
||||
outBuffer[k/8] ^= (block[0] & 0x80) >> (k & 7);
|
||||
@ -200,7 +200,7 @@ int rijndael_blockEncrypt(cipherInstance *cipher, keyInstance *key,
|
||||
int rijndael_padEncrypt(cipherInstance *cipher, keyInstance *key,
|
||||
const BYTE *input, int inputOctets, BYTE *outBuffer) {
|
||||
int i, numBlocks, padLen;
|
||||
u_int8_t block[16], *iv, *cp;
|
||||
uint8_t block[16], *iv, *cp;
|
||||
|
||||
if (cipher == NULL ||
|
||||
key == NULL ||
|
||||
@ -232,10 +232,10 @@ int rijndael_padEncrypt(cipherInstance *cipher, keyInstance *key,
|
||||
case MODE_CBC:
|
||||
iv = cipher->IV;
|
||||
for (i = numBlocks; i > 0; i--) {
|
||||
((u_int32_t*)block)[0] = ((const u_int32_t*)input)[0] ^ ((u_int32_t*)iv)[0];
|
||||
((u_int32_t*)block)[1] = ((const u_int32_t*)input)[1] ^ ((u_int32_t*)iv)[1];
|
||||
((u_int32_t*)block)[2] = ((const u_int32_t*)input)[2] ^ ((u_int32_t*)iv)[2];
|
||||
((u_int32_t*)block)[3] = ((const u_int32_t*)input)[3] ^ ((u_int32_t*)iv)[3];
|
||||
((uint32_t*)block)[0] = ((const uint32_t*)input)[0] ^ ((uint32_t*)iv)[0];
|
||||
((uint32_t*)block)[1] = ((const uint32_t*)input)[1] ^ ((uint32_t*)iv)[1];
|
||||
((uint32_t*)block)[2] = ((const uint32_t*)input)[2] ^ ((uint32_t*)iv)[2];
|
||||
((uint32_t*)block)[3] = ((const uint32_t*)input)[3] ^ ((uint32_t*)iv)[3];
|
||||
rijndaelEncrypt(key->rk, key->Nr, block, outBuffer);
|
||||
iv = outBuffer;
|
||||
input += 16;
|
||||
@ -264,7 +264,7 @@ int rijndael_padEncrypt(cipherInstance *cipher, keyInstance *key,
|
||||
int rijndael_blockDecrypt(cipherInstance *cipher, keyInstance *key,
|
||||
const BYTE *input, int inputLen, BYTE *outBuffer) {
|
||||
int i, k, numBlocks;
|
||||
u_int8_t block[16], iv[4][4];
|
||||
uint8_t block[16], iv[4][4];
|
||||
|
||||
if (cipher == NULL ||
|
||||
key == NULL ||
|
||||
@ -290,25 +290,25 @@ int rijndael_blockDecrypt(cipherInstance *cipher, keyInstance *key,
|
||||
#if 1 /*STRICT_ALIGN */
|
||||
memcpy(iv, cipher->IV, 16);
|
||||
#else
|
||||
*((u_int32_t*)iv[0]) = *((u_int32_t*)(cipher->IV ));
|
||||
*((u_int32_t*)iv[1]) = *((u_int32_t*)(cipher->IV+ 4));
|
||||
*((u_int32_t*)iv[2]) = *((u_int32_t*)(cipher->IV+ 8));
|
||||
*((u_int32_t*)iv[3]) = *((u_int32_t*)(cipher->IV+12));
|
||||
*((uint32_t*)iv[0]) = *((uint32_t*)(cipher->IV ));
|
||||
*((uint32_t*)iv[1]) = *((uint32_t*)(cipher->IV+ 4));
|
||||
*((uint32_t*)iv[2]) = *((uint32_t*)(cipher->IV+ 8));
|
||||
*((uint32_t*)iv[3]) = *((uint32_t*)(cipher->IV+12));
|
||||
#endif
|
||||
for (i = numBlocks; i > 0; i--) {
|
||||
rijndaelDecrypt(key->rk, key->Nr, input, block);
|
||||
((u_int32_t*)block)[0] ^= *((u_int32_t*)iv[0]);
|
||||
((u_int32_t*)block)[1] ^= *((u_int32_t*)iv[1]);
|
||||
((u_int32_t*)block)[2] ^= *((u_int32_t*)iv[2]);
|
||||
((u_int32_t*)block)[3] ^= *((u_int32_t*)iv[3]);
|
||||
((uint32_t*)block)[0] ^= *((uint32_t*)iv[0]);
|
||||
((uint32_t*)block)[1] ^= *((uint32_t*)iv[1]);
|
||||
((uint32_t*)block)[2] ^= *((uint32_t*)iv[2]);
|
||||
((uint32_t*)block)[3] ^= *((uint32_t*)iv[3]);
|
||||
#if 1 /*STRICT_ALIGN*/
|
||||
memcpy(iv, input, 16);
|
||||
memcpy(outBuffer, block, 16);
|
||||
#else
|
||||
*((u_int32_t*)iv[0]) = ((u_int32_t*)input)[0]; ((u_int32_t*)outBuffer)[0] = ((u_int32_t*)block)[0];
|
||||
*((u_int32_t*)iv[1]) = ((u_int32_t*)input)[1]; ((u_int32_t*)outBuffer)[1] = ((u_int32_t*)block)[1];
|
||||
*((u_int32_t*)iv[2]) = ((u_int32_t*)input)[2]; ((u_int32_t*)outBuffer)[2] = ((u_int32_t*)block)[2];
|
||||
*((u_int32_t*)iv[3]) = ((u_int32_t*)input)[3]; ((u_int32_t*)outBuffer)[3] = ((u_int32_t*)block)[3];
|
||||
*((uint32_t*)iv[0]) = ((uint32_t*)input)[0]; ((uint32_t*)outBuffer)[0] = ((uint32_t*)block)[0];
|
||||
*((uint32_t*)iv[1]) = ((uint32_t*)input)[1]; ((uint32_t*)outBuffer)[1] = ((uint32_t*)block)[1];
|
||||
*((uint32_t*)iv[2]) = ((uint32_t*)input)[2]; ((uint32_t*)outBuffer)[2] = ((uint32_t*)block)[2];
|
||||
*((uint32_t*)iv[3]) = ((uint32_t*)input)[3]; ((uint32_t*)outBuffer)[3] = ((uint32_t*)block)[3];
|
||||
#endif
|
||||
input += 16;
|
||||
outBuffer += 16;
|
||||
@ -319,17 +319,17 @@ int rijndael_blockDecrypt(cipherInstance *cipher, keyInstance *key,
|
||||
#if 1 /*STRICT_ALIGN */
|
||||
memcpy(iv, cipher->IV, 16);
|
||||
#else
|
||||
*((u_int32_t*)iv[0]) = *((u_int32_t*)(cipher->IV));
|
||||
*((u_int32_t*)iv[1]) = *((u_int32_t*)(cipher->IV+ 4));
|
||||
*((u_int32_t*)iv[2]) = *((u_int32_t*)(cipher->IV+ 8));
|
||||
*((u_int32_t*)iv[3]) = *((u_int32_t*)(cipher->IV+12));
|
||||
*((uint32_t*)iv[0]) = *((uint32_t*)(cipher->IV));
|
||||
*((uint32_t*)iv[1]) = *((uint32_t*)(cipher->IV+ 4));
|
||||
*((uint32_t*)iv[2]) = *((uint32_t*)(cipher->IV+ 8));
|
||||
*((uint32_t*)iv[3]) = *((uint32_t*)(cipher->IV+12));
|
||||
#endif
|
||||
for (i = numBlocks; i > 0; i--) {
|
||||
for (k = 0; k < 128; k++) {
|
||||
*((u_int32_t*) block ) = *((u_int32_t*)iv[0]);
|
||||
*((u_int32_t*)(block+ 4)) = *((u_int32_t*)iv[1]);
|
||||
*((u_int32_t*)(block+ 8)) = *((u_int32_t*)iv[2]);
|
||||
*((u_int32_t*)(block+12)) = *((u_int32_t*)iv[3]);
|
||||
*((uint32_t*) block ) = *((uint32_t*)iv[0]);
|
||||
*((uint32_t*)(block+ 4)) = *((uint32_t*)iv[1]);
|
||||
*((uint32_t*)(block+ 8)) = *((uint32_t*)iv[2]);
|
||||
*((uint32_t*)(block+12)) = *((uint32_t*)iv[3]);
|
||||
rijndaelEncrypt(key->ek, key->Nr, block,
|
||||
block);
|
||||
iv[0][0] = (iv[0][0] << 1) | (iv[0][1] >> 7);
|
||||
@ -364,8 +364,8 @@ int rijndael_blockDecrypt(cipherInstance *cipher, keyInstance *key,
|
||||
int rijndael_padDecrypt(cipherInstance *cipher, keyInstance *key,
|
||||
const BYTE *input, int inputOctets, BYTE *outBuffer) {
|
||||
int i, numBlocks, padLen, rval;
|
||||
u_int8_t block[16];
|
||||
u_int32_t iv[4];
|
||||
uint8_t block[16];
|
||||
uint32_t iv[4];
|
||||
|
||||
if (cipher == NULL ||
|
||||
key == NULL ||
|
||||
@ -410,10 +410,10 @@ int rijndael_padDecrypt(cipherInstance *cipher, keyInstance *key,
|
||||
/* all blocks but last */
|
||||
for (i = numBlocks - 1; i > 0; i--) {
|
||||
rijndaelDecrypt(key->rk, key->Nr, input, block);
|
||||
((u_int32_t*)block)[0] ^= iv[0];
|
||||
((u_int32_t*)block)[1] ^= iv[1];
|
||||
((u_int32_t*)block)[2] ^= iv[2];
|
||||
((u_int32_t*)block)[3] ^= iv[3];
|
||||
((uint32_t*)block)[0] ^= iv[0];
|
||||
((uint32_t*)block)[1] ^= iv[1];
|
||||
((uint32_t*)block)[2] ^= iv[2];
|
||||
((uint32_t*)block)[3] ^= iv[3];
|
||||
memcpy(iv, input, 16);
|
||||
memcpy(outBuffer, block, 16);
|
||||
input += 16;
|
||||
@ -421,10 +421,10 @@ int rijndael_padDecrypt(cipherInstance *cipher, keyInstance *key,
|
||||
}
|
||||
/* last block */
|
||||
rijndaelDecrypt(key->rk, key->Nr, input, block);
|
||||
((u_int32_t*)block)[0] ^= iv[0];
|
||||
((u_int32_t*)block)[1] ^= iv[1];
|
||||
((u_int32_t*)block)[2] ^= iv[2];
|
||||
((u_int32_t*)block)[3] ^= iv[3];
|
||||
((uint32_t*)block)[0] ^= iv[0];
|
||||
((uint32_t*)block)[1] ^= iv[1];
|
||||
((uint32_t*)block)[2] ^= iv[2];
|
||||
((uint32_t*)block)[3] ^= iv[3];
|
||||
padLen = block[15];
|
||||
if (padLen <= 0 || padLen > 16) {
|
||||
rval = BAD_DATA;
|
||||
|
@ -45,11 +45,11 @@ void rijndael_set_key(rijndael_ctx *, const u_char *, int);
|
||||
void rijndael_decrypt(const rijndael_ctx *, const u_char *, u_char *);
|
||||
void rijndael_encrypt(const rijndael_ctx *, const u_char *, u_char *);
|
||||
|
||||
int rijndaelKeySetupEnc(u_int32_t [/*4*(Nr+1)*/], const u_int8_t [], int);
|
||||
int rijndaelKeySetupDec(u_int32_t [/*4*(Nr+1)*/], const u_int8_t [], int);
|
||||
void rijndaelEncrypt(const u_int32_t [/*4*(Nr+1)*/], int,
|
||||
const u_int8_t[16], u_int8_t [16]);
|
||||
void rijndaelDecrypt(const u_int32_t [/*4*(Nr+1)*/], int,
|
||||
const u_int8_t [16], u_int8_t [16]);
|
||||
int rijndaelKeySetupEnc(uint32_t [/*4*(Nr+1)*/], const uint8_t [], int);
|
||||
int rijndaelKeySetupDec(uint32_t [/*4*(Nr+1)*/], const uint8_t [], int);
|
||||
void rijndaelEncrypt(const uint32_t [/*4*(Nr+1)*/], int,
|
||||
const uint8_t[16], uint8_t [16]);
|
||||
void rijndaelDecrypt(const uint32_t [/*4*(Nr+1)*/], int,
|
||||
const uint8_t [16], uint8_t [16]);
|
||||
|
||||
#endif /* __RIJNDAEL_H */
|
||||
|
@ -2,6 +2,6 @@
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/* the file should not be used from outside */
|
||||
typedef u_int8_t u8;
|
||||
typedef u_int16_t u16;
|
||||
typedef u_int32_t u32;
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
|
@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$");
|
||||
#ifndef unsupported
|
||||
|
||||
/* constant table */
|
||||
static u_int32_t _K[] = { 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6 };
|
||||
static uint32_t _K[] = { 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6 };
|
||||
#define K(t) _K[(t) / 20]
|
||||
|
||||
#define F0(b, c, d) (((b) & (c)) | ((~(b)) & (d)))
|
||||
@ -94,9 +94,9 @@ static void
|
||||
sha1_step(ctxt)
|
||||
struct sha1_ctxt *ctxt;
|
||||
{
|
||||
u_int32_t a, b, c, d, e;
|
||||
uint32_t a, b, c, d, e;
|
||||
size_t t, s;
|
||||
u_int32_t tmp;
|
||||
uint32_t tmp;
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
struct sha1_ctxt tctxt;
|
||||
@ -225,7 +225,7 @@ sha1_pad(ctxt)
|
||||
void
|
||||
sha1_loop(ctxt, input, len)
|
||||
struct sha1_ctxt *ctxt;
|
||||
const u_int8_t *input;
|
||||
const uint8_t *input;
|
||||
size_t len;
|
||||
{
|
||||
size_t gaplen;
|
||||
@ -253,9 +253,9 @@ sha1_loop(ctxt, input, len)
|
||||
void
|
||||
sha1_result(struct sha1_ctxt *ctxt, char digest0[static SHA1_RESULTLEN])
|
||||
{
|
||||
u_int8_t *digest;
|
||||
uint8_t *digest;
|
||||
|
||||
digest = (u_int8_t *)digest0;
|
||||
digest = (uint8_t *)digest0;
|
||||
sha1_pad(ctxt);
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
bcopy(&ctxt->h.b8[0], digest, SHA1_RESULTLEN);
|
||||
|
@ -42,18 +42,18 @@
|
||||
|
||||
struct sha1_ctxt {
|
||||
union {
|
||||
u_int8_t b8[20];
|
||||
u_int32_t b32[5];
|
||||
uint8_t b8[20];
|
||||
uint32_t b32[5];
|
||||
} h;
|
||||
union {
|
||||
u_int8_t b8[8];
|
||||
u_int64_t b64[1];
|
||||
uint8_t b8[8];
|
||||
uint64_t b64[1];
|
||||
} c;
|
||||
union {
|
||||
u_int8_t b8[64];
|
||||
u_int32_t b32[16];
|
||||
uint8_t b8[64];
|
||||
uint32_t b32[16];
|
||||
} m;
|
||||
u_int8_t count;
|
||||
uint8_t count;
|
||||
};
|
||||
typedef struct sha1_ctxt SHA1_CTX;
|
||||
|
||||
@ -62,7 +62,7 @@ typedef struct sha1_ctxt SHA1_CTX;
|
||||
#ifdef _KERNEL
|
||||
extern void sha1_init(struct sha1_ctxt *);
|
||||
extern void sha1_pad(struct sha1_ctxt *);
|
||||
extern void sha1_loop(struct sha1_ctxt *, const u_int8_t *, size_t);
|
||||
extern void sha1_loop(struct sha1_ctxt *, const uint8_t *, size_t);
|
||||
extern void sha1_result(struct sha1_ctxt *, char[__min_size(SHA1_RESULTLEN)]);
|
||||
|
||||
/* compatibilty with other SHA1 source codes */
|
||||
|
@ -22,9 +22,9 @@
|
||||
#ifndef _OPENSOLARIS_SYS_TYPES_H_ /* Avoid redefining this typedef */
|
||||
typedef unsigned int uint_t; /* native unsigned integer */
|
||||
#endif
|
||||
typedef u_int8_t u08b_t; /* 8-bit unsigned integer */
|
||||
typedef u_int32_t uint_32t; /* 32-bit unsigned integer */
|
||||
typedef u_int64_t u64b_t; /* 64-bit unsigned integer */
|
||||
typedef uint8_t u08b_t; /* 8-bit unsigned integer */
|
||||
typedef uint32_t uint_32t; /* 32-bit unsigned integer */
|
||||
typedef uint64_t u64b_t; /* 64-bit unsigned integer */
|
||||
|
||||
#ifndef RotL_64
|
||||
#define RotL_64(x,N) (((x) << (N)) | ((x) >> (64-(N))))
|
||||
|
@ -117,9 +117,9 @@ static struct mtx crypto_drivers_mtx; /* lock on driver table */
|
||||
struct cryptocap {
|
||||
device_t cc_dev;
|
||||
uint32_t cc_hid;
|
||||
u_int32_t cc_sessions; /* (d) # of sessions */
|
||||
u_int32_t cc_koperations; /* (d) # os asym operations */
|
||||
u_int8_t cc_kalg[CRK_ALGORITHM_MAX + 1];
|
||||
uint32_t cc_sessions; /* (d) # of sessions */
|
||||
uint32_t cc_koperations; /* (d) # os asym operations */
|
||||
uint8_t cc_kalg[CRK_ALGORITHM_MAX + 1];
|
||||
|
||||
int cc_flags; /* (d) flags */
|
||||
#define CRYPTOCAP_F_CLEANUP 0x80000000 /* needs resource cleanup */
|
||||
@ -173,8 +173,8 @@ struct crypto_ret_worker {
|
||||
TAILQ_HEAD(,cryptop) crp_ret_q; /* callback queue for symetric jobs */
|
||||
TAILQ_HEAD(,cryptkop) crp_ret_kq; /* callback queue for asym jobs */
|
||||
|
||||
u_int32_t reorder_ops; /* total ordered sym jobs received */
|
||||
u_int32_t reorder_cur_seq; /* current sym job dispatched */
|
||||
uint32_t reorder_ops; /* total ordered sym jobs received */
|
||||
uint32_t reorder_cur_seq; /* current sym job dispatched */
|
||||
|
||||
struct proc *cryptoretproc;
|
||||
};
|
||||
@ -611,7 +611,7 @@ crypto_cipher(const struct crypto_session_params *csp)
|
||||
}
|
||||
|
||||
static struct cryptocap *
|
||||
crypto_checkdriver(u_int32_t hid)
|
||||
crypto_checkdriver(uint32_t hid)
|
||||
{
|
||||
|
||||
return (hid >= crypto_drivers_size ? NULL : crypto_drivers[hid]);
|
||||
@ -1119,7 +1119,7 @@ crypto_getcaps(int hid)
|
||||
* is called once for each algorithm supported a driver.
|
||||
*/
|
||||
int
|
||||
crypto_kregister(u_int32_t driverid, int kalg, u_int32_t flags)
|
||||
crypto_kregister(uint32_t driverid, int kalg, uint32_t flags)
|
||||
{
|
||||
struct cryptocap *cap;
|
||||
int err;
|
||||
@ -1159,7 +1159,7 @@ crypto_kregister(u_int32_t driverid, int kalg, u_int32_t flags)
|
||||
* requests.
|
||||
*/
|
||||
int
|
||||
crypto_unregister_all(u_int32_t driverid)
|
||||
crypto_unregister_all(uint32_t driverid)
|
||||
{
|
||||
struct cryptocap *cap;
|
||||
|
||||
@ -1190,7 +1190,7 @@ crypto_unregister_all(u_int32_t driverid)
|
||||
* the driver is now ready for cryptop's and/or cryptokop's.
|
||||
*/
|
||||
int
|
||||
crypto_unblock(u_int32_t driverid, int what)
|
||||
crypto_unblock(uint32_t driverid, int what)
|
||||
{
|
||||
struct cryptocap *cap;
|
||||
int err;
|
||||
|
@ -49,13 +49,13 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
SDT_PROVIDER_DECLARE(opencrypto);
|
||||
SDT_PROBE_DEFINE2(opencrypto, deflate, deflate_global, entry,
|
||||
"int", "u_int32_t");
|
||||
"int", "uint32_t");
|
||||
SDT_PROBE_DEFINE6(opencrypto, deflate, deflate_global, bad,
|
||||
"int", "int", "int", "int", "int", "int");
|
||||
SDT_PROBE_DEFINE6(opencrypto, deflate, deflate_global, iter,
|
||||
"int", "int", "int", "int", "int", "int");
|
||||
SDT_PROBE_DEFINE2(opencrypto, deflate, deflate_global, return,
|
||||
"int", "u_int32_t");
|
||||
"int", "uint32_t");
|
||||
|
||||
int window_inflate = -1 * MAX_WBITS;
|
||||
int window_deflate = -12;
|
||||
@ -81,18 +81,18 @@ crypto_zfree(void *nil, void *ptr)
|
||||
* algorithm
|
||||
*/
|
||||
|
||||
u_int32_t
|
||||
uint32_t
|
||||
deflate_global(data, size, decomp, out)
|
||||
u_int8_t *data;
|
||||
u_int32_t size;
|
||||
uint8_t *data;
|
||||
uint32_t size;
|
||||
int decomp;
|
||||
u_int8_t **out;
|
||||
uint8_t **out;
|
||||
{
|
||||
/* decomp indicates whether we compress (0) or decompress (1) */
|
||||
|
||||
z_stream zbuf;
|
||||
u_int8_t *output;
|
||||
u_int32_t count, result;
|
||||
uint8_t *output;
|
||||
uint32_t count, result;
|
||||
int error, i;
|
||||
struct deflate_buf *bufh, *bufp;
|
||||
|
||||
|
@ -72,53 +72,53 @@ SDT_PROBE_DEFINE1(opencrypto, dev, ioctl, error, "int"/*line number*/);
|
||||
#include <compat/freebsd32/freebsd32.h>
|
||||
|
||||
struct session_op32 {
|
||||
u_int32_t cipher;
|
||||
u_int32_t mac;
|
||||
u_int32_t keylen;
|
||||
u_int32_t key;
|
||||
uint32_t cipher;
|
||||
uint32_t mac;
|
||||
uint32_t keylen;
|
||||
uint32_t key;
|
||||
int mackeylen;
|
||||
u_int32_t mackey;
|
||||
u_int32_t ses;
|
||||
uint32_t mackey;
|
||||
uint32_t ses;
|
||||
};
|
||||
|
||||
struct session2_op32 {
|
||||
u_int32_t cipher;
|
||||
u_int32_t mac;
|
||||
u_int32_t keylen;
|
||||
u_int32_t key;
|
||||
uint32_t cipher;
|
||||
uint32_t mac;
|
||||
uint32_t keylen;
|
||||
uint32_t key;
|
||||
int mackeylen;
|
||||
u_int32_t mackey;
|
||||
u_int32_t ses;
|
||||
uint32_t mackey;
|
||||
uint32_t ses;
|
||||
int crid;
|
||||
int pad[4];
|
||||
};
|
||||
|
||||
struct crypt_op32 {
|
||||
u_int32_t ses;
|
||||
u_int16_t op;
|
||||
u_int16_t flags;
|
||||
uint32_t ses;
|
||||
uint16_t op;
|
||||
uint16_t flags;
|
||||
u_int len;
|
||||
u_int32_t src, dst;
|
||||
u_int32_t mac;
|
||||
u_int32_t iv;
|
||||
uint32_t src, dst;
|
||||
uint32_t mac;
|
||||
uint32_t iv;
|
||||
};
|
||||
|
||||
struct crypt_aead32 {
|
||||
u_int32_t ses;
|
||||
u_int16_t op;
|
||||
u_int16_t flags;
|
||||
uint32_t ses;
|
||||
uint16_t op;
|
||||
uint16_t flags;
|
||||
u_int len;
|
||||
u_int aadlen;
|
||||
u_int ivlen;
|
||||
u_int32_t src;
|
||||
u_int32_t dst;
|
||||
u_int32_t aad;
|
||||
u_int32_t tag;
|
||||
u_int32_t iv;
|
||||
uint32_t src;
|
||||
uint32_t dst;
|
||||
uint32_t aad;
|
||||
uint32_t tag;
|
||||
uint32_t iv;
|
||||
};
|
||||
|
||||
struct crparam32 {
|
||||
u_int32_t crp_p;
|
||||
uint32_t crp_p;
|
||||
u_int crp_nbits;
|
||||
};
|
||||
|
||||
@ -309,7 +309,7 @@ struct csession {
|
||||
TAILQ_ENTRY(csession) next;
|
||||
crypto_session_t cses;
|
||||
volatile u_int refs;
|
||||
u_int32_t ses;
|
||||
uint32_t ses;
|
||||
struct mtx lock; /* for op submission */
|
||||
|
||||
struct enc_xform *txform;
|
||||
@ -437,7 +437,7 @@ cryptof_ioctl(
|
||||
void *mackey = NULL;
|
||||
struct crypt_kop *kop;
|
||||
crypto_session_t cses;
|
||||
u_int32_t ses;
|
||||
uint32_t ses;
|
||||
int error = 0, crid;
|
||||
union {
|
||||
struct session2_op sopc;
|
||||
@ -806,7 +806,7 @@ cryptof_ioctl(
|
||||
session2_op_to_op(sop, data);
|
||||
break;
|
||||
case CIOCFSESSION:
|
||||
ses = *(u_int32_t *)data;
|
||||
ses = *(uint32_t *)data;
|
||||
if (!csedelete(fcr, ses)) {
|
||||
SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__);
|
||||
return (EINVAL);
|
||||
|
@ -216,15 +216,15 @@
|
||||
|
||||
/* NB: deprecated */
|
||||
struct session_op {
|
||||
u_int32_t cipher; /* ie. CRYPTO_AES_CBC */
|
||||
u_int32_t mac; /* ie. CRYPTO_SHA2_256_HMAC */
|
||||
uint32_t cipher; /* ie. CRYPTO_AES_CBC */
|
||||
uint32_t mac; /* ie. CRYPTO_SHA2_256_HMAC */
|
||||
|
||||
u_int32_t keylen; /* cipher key */
|
||||
uint32_t keylen; /* cipher key */
|
||||
c_caddr_t key;
|
||||
int mackeylen; /* mac key */
|
||||
c_caddr_t mackey;
|
||||
|
||||
u_int32_t ses; /* returns: session # */
|
||||
uint32_t ses; /* returns: session # */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -233,25 +233,25 @@ struct session_op {
|
||||
* "cryptop" (no underscore).
|
||||
*/
|
||||
struct session2_op {
|
||||
u_int32_t cipher; /* ie. CRYPTO_AES_CBC */
|
||||
u_int32_t mac; /* ie. CRYPTO_SHA2_256_HMAC */
|
||||
uint32_t cipher; /* ie. CRYPTO_AES_CBC */
|
||||
uint32_t mac; /* ie. CRYPTO_SHA2_256_HMAC */
|
||||
|
||||
u_int32_t keylen; /* cipher key */
|
||||
uint32_t keylen; /* cipher key */
|
||||
c_caddr_t key;
|
||||
int mackeylen; /* mac key */
|
||||
c_caddr_t mackey;
|
||||
|
||||
u_int32_t ses; /* returns: session # */
|
||||
uint32_t ses; /* returns: session # */
|
||||
int crid; /* driver id + flags (rw) */
|
||||
int pad[4]; /* for future expansion */
|
||||
};
|
||||
|
||||
struct crypt_op {
|
||||
u_int32_t ses;
|
||||
u_int16_t op; /* i.e. COP_ENCRYPT */
|
||||
uint32_t ses;
|
||||
uint16_t op; /* i.e. COP_ENCRYPT */
|
||||
#define COP_ENCRYPT 1
|
||||
#define COP_DECRYPT 2
|
||||
u_int16_t flags;
|
||||
uint16_t flags;
|
||||
#define COP_F_CIPHER_FIRST 0x0001 /* Cipher before MAC. */
|
||||
#define COP_F_BATCH 0x0008 /* Batch op if possible */
|
||||
u_int len;
|
||||
@ -263,9 +263,9 @@ struct crypt_op {
|
||||
|
||||
/* op and flags the same as crypt_op */
|
||||
struct crypt_aead {
|
||||
u_int32_t ses;
|
||||
u_int16_t op; /* i.e. COP_ENCRYPT */
|
||||
u_int16_t flags;
|
||||
uint32_t ses;
|
||||
uint16_t op; /* i.e. COP_ENCRYPT */
|
||||
uint16_t flags;
|
||||
u_int len;
|
||||
u_int aadlen;
|
||||
u_int ivlen;
|
||||
@ -320,16 +320,16 @@ struct crypt_kop {
|
||||
* done against open of /dev/crypto, to get a cloned descriptor.
|
||||
* Please use F_SETFD against the cloned descriptor.
|
||||
*/
|
||||
#define CRIOGET _IOWR('c', 100, u_int32_t)
|
||||
#define CRIOGET _IOWR('c', 100, uint32_t)
|
||||
#define CRIOASYMFEAT CIOCASYMFEAT
|
||||
#define CRIOFINDDEV CIOCFINDDEV
|
||||
|
||||
/* the following are done against the cloned descriptor */
|
||||
#define CIOCGSESSION _IOWR('c', 101, struct session_op)
|
||||
#define CIOCFSESSION _IOW('c', 102, u_int32_t)
|
||||
#define CIOCFSESSION _IOW('c', 102, uint32_t)
|
||||
#define CIOCCRYPT _IOWR('c', 103, struct crypt_op)
|
||||
#define CIOCKEY _IOWR('c', 104, struct crypt_kop)
|
||||
#define CIOCASYMFEAT _IOR('c', 105, u_int32_t)
|
||||
#define CIOCASYMFEAT _IOR('c', 105, uint32_t)
|
||||
#define CIOCGSESSION2 _IOWR('c', 106, struct session2_op)
|
||||
#define CIOCKEY2 _IOWR('c', 107, struct crypt_kop)
|
||||
#define CIOCFINDDEV _IOWR('c', 108, struct crypt_find_op)
|
||||
@ -656,13 +656,13 @@ extern int32_t crypto_get_driverid(device_t dev, size_t session_size,
|
||||
extern int crypto_find_driver(const char *);
|
||||
extern device_t crypto_find_device_byhid(int hid);
|
||||
extern int crypto_getcaps(int hid);
|
||||
extern int crypto_kregister(u_int32_t, int, u_int32_t);
|
||||
extern int crypto_unregister_all(u_int32_t driverid);
|
||||
extern int crypto_kregister(uint32_t, int, uint32_t);
|
||||
extern int crypto_unregister_all(uint32_t driverid);
|
||||
extern int crypto_dispatch(struct cryptop *crp);
|
||||
extern int crypto_kdispatch(struct cryptkop *);
|
||||
#define CRYPTO_SYMQ 0x1
|
||||
#define CRYPTO_ASYMQ 0x2
|
||||
extern int crypto_unblock(u_int32_t, int);
|
||||
extern int crypto_unblock(uint32_t, int);
|
||||
extern void crypto_done(struct cryptop *crp);
|
||||
extern void crypto_kdone(struct cryptkop *);
|
||||
extern int crypto_getfeat(int *);
|
||||
|
@ -893,10 +893,10 @@ swcr_eta(struct swcr_session *ses, struct cryptop *crp)
|
||||
static int
|
||||
swcr_compdec(struct swcr_session *ses, struct cryptop *crp)
|
||||
{
|
||||
u_int8_t *data, *out;
|
||||
uint8_t *data, *out;
|
||||
struct comp_algo *cxf;
|
||||
int adj;
|
||||
u_int32_t result;
|
||||
uint32_t result;
|
||||
|
||||
cxf = ses->swcr_compdec.sw_cxf;
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
#define MINCOMP 2 /* won't be used, but must be defined */
|
||||
#define ZBUF 10
|
||||
|
||||
u_int32_t deflate_global(u_int8_t *, u_int32_t, int, u_int8_t **);
|
||||
uint32_t deflate_global(uint8_t *, uint32_t, int, uint8_t **);
|
||||
|
||||
/*
|
||||
* We are going to use a combined allocation to hold the metadata
|
||||
|
@ -106,9 +106,9 @@ RMD160Init(RMD160_CTX *ctx)
|
||||
}
|
||||
|
||||
void
|
||||
RMD160Update(RMD160_CTX *ctx, const u_char *input, u_int32_t len)
|
||||
RMD160Update(RMD160_CTX *ctx, const u_char *input, uint32_t len)
|
||||
{
|
||||
u_int32_t have, off, need;
|
||||
uint32_t have, off, need;
|
||||
|
||||
have = (ctx->count/8) % 64;
|
||||
need = 64 - have;
|
||||
@ -137,7 +137,7 @@ RMD160Final(u_char digest[20], RMD160_CTX *ctx)
|
||||
{
|
||||
int i;
|
||||
u_char size[8];
|
||||
u_int32_t padlen;
|
||||
uint32_t padlen;
|
||||
|
||||
PUT_64BIT_LE(size, ctx->count);
|
||||
|
||||
@ -159,9 +159,9 @@ RMD160Final(u_char digest[20], RMD160_CTX *ctx)
|
||||
}
|
||||
|
||||
void
|
||||
RMD160Transform(u_int32_t state[5], const u_char block[64])
|
||||
RMD160Transform(uint32_t state[5], const u_char block[64])
|
||||
{
|
||||
u_int32_t a, b, c, d, e, aa, bb, cc, dd, ee, t, x[16];
|
||||
uint32_t a, b, c, d, e, aa, bb, cc, dd, ee, t, x[16];
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
memcpy(x, block, 64);
|
||||
@ -169,7 +169,7 @@ RMD160Transform(u_int32_t state[5], const u_char block[64])
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
x[i] = bswap32(*(const u_int32_t*)(block+i*4));
|
||||
x[i] = bswap32(*(const uint32_t*)(block+i*4));
|
||||
#endif
|
||||
|
||||
a = state[0];
|
||||
|
@ -28,14 +28,14 @@
|
||||
|
||||
/* RMD160 context. */
|
||||
typedef struct RMD160Context {
|
||||
u_int32_t state[5]; /* state */
|
||||
u_int64_t count; /* number of bits, modulo 2^64 */
|
||||
uint32_t state[5]; /* state */
|
||||
uint64_t count; /* number of bits, modulo 2^64 */
|
||||
u_char buffer[64]; /* input buffer */
|
||||
} RMD160_CTX;
|
||||
|
||||
void RMD160Init(RMD160_CTX *);
|
||||
void RMD160Transform(u_int32_t [5], const u_char [64]);
|
||||
void RMD160Update(RMD160_CTX *, const u_char *, u_int32_t);
|
||||
void RMD160Transform(uint32_t [5], const u_char [64]);
|
||||
void RMD160Update(RMD160_CTX *, const u_char *, uint32_t);
|
||||
void RMD160Final(u_char [20], RMD160_CTX *);
|
||||
|
||||
#endif /* _RMD160_H */
|
||||
|
@ -52,15 +52,15 @@
|
||||
struct auth_hash {
|
||||
int type;
|
||||
char *name;
|
||||
u_int16_t keysize;
|
||||
u_int16_t hashsize;
|
||||
u_int16_t ctxsize;
|
||||
u_int16_t blocksize;
|
||||
uint16_t keysize;
|
||||
uint16_t hashsize;
|
||||
uint16_t ctxsize;
|
||||
uint16_t blocksize;
|
||||
void (*Init) (void *);
|
||||
void (*Setkey) (void *, const uint8_t *, u_int);
|
||||
void (*Reinit) (void *, const uint8_t *, u_int);
|
||||
int (*Update) (void *, const void *, u_int);
|
||||
void (*Final) (u_int8_t *, void *);
|
||||
void (*Final) (uint8_t *, void *);
|
||||
};
|
||||
|
||||
extern struct auth_hash auth_hash_null;
|
||||
|
@ -42,8 +42,8 @@ struct comp_algo {
|
||||
int type;
|
||||
char *name;
|
||||
size_t minlen;
|
||||
u_int32_t (*compress) (u_int8_t *, u_int32_t, u_int8_t **);
|
||||
u_int32_t (*decompress) (u_int8_t *, u_int32_t, u_int8_t **);
|
||||
uint32_t (*compress) (uint8_t *, uint32_t, uint8_t **);
|
||||
uint32_t (*decompress) (uint8_t *, uint32_t, uint8_t **);
|
||||
};
|
||||
|
||||
extern struct comp_algo comp_algo_deflate;
|
||||
|
@ -53,8 +53,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <opencrypto/deflate.h>
|
||||
#include <opencrypto/xform_comp.h>
|
||||
|
||||
static u_int32_t deflate_compress(u_int8_t *, u_int32_t, u_int8_t **);
|
||||
static u_int32_t deflate_decompress(u_int8_t *, u_int32_t, u_int8_t **);
|
||||
static uint32_t deflate_compress(uint8_t *, uint32_t, uint8_t **);
|
||||
static uint32_t deflate_decompress(uint8_t *, uint32_t, uint8_t **);
|
||||
|
||||
/* Compression instance */
|
||||
struct comp_algo comp_algo_deflate = {
|
||||
@ -67,20 +67,20 @@ struct comp_algo comp_algo_deflate = {
|
||||
* And compression
|
||||
*/
|
||||
|
||||
static u_int32_t
|
||||
static uint32_t
|
||||
deflate_compress(data, size, out)
|
||||
u_int8_t *data;
|
||||
u_int32_t size;
|
||||
u_int8_t **out;
|
||||
uint8_t *data;
|
||||
uint32_t size;
|
||||
uint8_t **out;
|
||||
{
|
||||
return deflate_global(data, size, 0, out);
|
||||
}
|
||||
|
||||
static u_int32_t
|
||||
static uint32_t
|
||||
deflate_decompress(data, size, out)
|
||||
u_int8_t *data;
|
||||
u_int32_t size;
|
||||
u_int8_t **out;
|
||||
uint8_t *data;
|
||||
uint32_t size;
|
||||
uint8_t **out;
|
||||
{
|
||||
return deflate_global(data, size, 1, out);
|
||||
}
|
||||
|
@ -50,10 +50,10 @@ struct enc_xform {
|
||||
int type;
|
||||
char *name;
|
||||
size_t ctxsize;
|
||||
u_int16_t blocksize; /* Required input block size -- 1 for stream ciphers. */
|
||||
uint16_t blocksize; /* Required input block size -- 1 for stream ciphers. */
|
||||
uint16_t native_blocksize; /* Used for stream ciphers. */
|
||||
u_int16_t ivsize;
|
||||
u_int16_t minkey, maxkey;
|
||||
uint16_t ivsize;
|
||||
uint16_t minkey, maxkey;
|
||||
|
||||
/*
|
||||
* Encrypt/decrypt a single block. For stream ciphers this
|
||||
@ -62,7 +62,7 @@ struct enc_xform {
|
||||
void (*encrypt) (void *, const uint8_t *, uint8_t *);
|
||||
void (*decrypt) (void *, const uint8_t *, uint8_t *);
|
||||
int (*setkey) (void *, const uint8_t *, int len);
|
||||
void (*reinit) (void *, const u_int8_t *);
|
||||
void (*reinit) (void *, const uint8_t *);
|
||||
|
||||
/*
|
||||
* For stream ciphers, encrypt/decrypt the final partial block
|
||||
@ -84,16 +84,16 @@ extern struct enc_xform enc_xform_chacha20;
|
||||
extern struct enc_xform enc_xform_ccm;
|
||||
|
||||
struct aes_icm_ctx {
|
||||
u_int32_t ac_ek[4*(RIJNDAEL_MAXNR + 1)];
|
||||
uint32_t ac_ek[4*(RIJNDAEL_MAXNR + 1)];
|
||||
/* ac_block is initialized to IV */
|
||||
u_int8_t ac_block[AESICM_BLOCKSIZE];
|
||||
uint8_t ac_block[AESICM_BLOCKSIZE];
|
||||
int ac_nr;
|
||||
};
|
||||
|
||||
struct aes_xts_ctx {
|
||||
rijndael_ctx key1;
|
||||
rijndael_ctx key2;
|
||||
u_int8_t tweak[AES_XTS_BLOCKSIZE];
|
||||
uint8_t tweak[AES_XTS_BLOCKSIZE];
|
||||
};
|
||||
|
||||
#endif /* _CRYPTO_XFORM_ENC_H_ */
|
||||
|
@ -53,13 +53,13 @@ __FBSDID("$FreeBSD$");
|
||||
#include <opencrypto/xform_auth.h>
|
||||
#include <opencrypto/xform_enc.h>
|
||||
|
||||
static int null_setkey(void *, const u_int8_t *, int);
|
||||
static int null_setkey(void *, const uint8_t *, int);
|
||||
static void null_crypt(void *, const uint8_t *, uint8_t *);
|
||||
|
||||
static void null_init(void *);
|
||||
static void null_reinit(void *ctx, const uint8_t *buf, u_int len);
|
||||
static int null_update(void *, const void *, u_int);
|
||||
static void null_final(u_int8_t *, void *);
|
||||
static void null_final(uint8_t *, void *);
|
||||
|
||||
/* Encryption instances */
|
||||
struct enc_xform enc_xform_null = {
|
||||
@ -125,8 +125,8 @@ null_update(void *ctx, const void *buf, u_int len)
|
||||
}
|
||||
|
||||
static void
|
||||
null_final(u_int8_t *buf, void *ctx)
|
||||
null_final(uint8_t *buf, void *ctx)
|
||||
{
|
||||
if (buf != (u_int8_t *) 0)
|
||||
if (buf != (uint8_t *) 0)
|
||||
bzero(buf, 12);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <crypto/rijndael/rijndael.h>
|
||||
#include <opencrypto/xform_enc.h>
|
||||
|
||||
static int rijndael128_setkey(void *, const u_int8_t *, int);
|
||||
static int rijndael128_setkey(void *, const uint8_t *, int);
|
||||
static void rijndael128_encrypt(void *, const uint8_t *, uint8_t *);
|
||||
static void rijndael128_decrypt(void *, const uint8_t *, uint8_t *);
|
||||
|
||||
|
@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
static void SHA1Init_int(void *);
|
||||
static int SHA1Update_int(void *, const void *, u_int);
|
||||
static void SHA1Final_int(u_int8_t *, void *);
|
||||
static void SHA1Final_int(uint8_t *, void *);
|
||||
|
||||
/* Plain hash */
|
||||
struct auth_hash auth_hash_sha1 = {
|
||||
@ -99,7 +99,7 @@ SHA1Update_int(void *ctx, const void *buf, u_int len)
|
||||
}
|
||||
|
||||
static void
|
||||
SHA1Final_int(u_int8_t *blk, void *ctx)
|
||||
SHA1Final_int(uint8_t *blk, void *ctx)
|
||||
{
|
||||
SHA1Final(blk, ctx);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ struct auth_hash auth_hash_sha2_224 = {
|
||||
.blocksize = SHA2_224_BLOCK_LEN,
|
||||
.Init = (void (*)(void *)) SHA224_Init,
|
||||
.Update = SHA224Update_int,
|
||||
.Final = (void (*)(u_int8_t *, void *)) SHA224_Final,
|
||||
.Final = (void (*)(uint8_t *, void *)) SHA224_Final,
|
||||
};
|
||||
|
||||
struct auth_hash auth_hash_sha2_256 = {
|
||||
@ -82,7 +82,7 @@ struct auth_hash auth_hash_sha2_256 = {
|
||||
.blocksize = SHA2_256_BLOCK_LEN,
|
||||
.Init = (void (*)(void *)) SHA256_Init,
|
||||
.Update = SHA256Update_int,
|
||||
.Final = (void (*)(u_int8_t *, void *)) SHA256_Final,
|
||||
.Final = (void (*)(uint8_t *, void *)) SHA256_Final,
|
||||
};
|
||||
|
||||
struct auth_hash auth_hash_sha2_384 = {
|
||||
@ -94,7 +94,7 @@ struct auth_hash auth_hash_sha2_384 = {
|
||||
.blocksize = SHA2_384_BLOCK_LEN,
|
||||
.Init = (void (*)(void *)) SHA384_Init,
|
||||
.Update = SHA384Update_int,
|
||||
.Final = (void (*)(u_int8_t *, void *)) SHA384_Final,
|
||||
.Final = (void (*)(uint8_t *, void *)) SHA384_Final,
|
||||
};
|
||||
|
||||
struct auth_hash auth_hash_sha2_512 = {
|
||||
@ -106,7 +106,7 @@ struct auth_hash auth_hash_sha2_512 = {
|
||||
.blocksize = SHA2_512_BLOCK_LEN,
|
||||
.Init = (void (*)(void *)) SHA512_Init,
|
||||
.Update = SHA512Update_int,
|
||||
.Final = (void (*)(u_int8_t *, void *)) SHA512_Final,
|
||||
.Final = (void (*)(uint8_t *, void *)) SHA512_Final,
|
||||
};
|
||||
|
||||
/* Authentication instances */
|
||||
@ -119,7 +119,7 @@ struct auth_hash auth_hash_hmac_sha2_224 = {
|
||||
.blocksize = SHA2_224_BLOCK_LEN,
|
||||
.Init = (void (*)(void *)) SHA224_Init,
|
||||
.Update = SHA224Update_int,
|
||||
.Final = (void (*)(u_int8_t *, void *)) SHA224_Final,
|
||||
.Final = (void (*)(uint8_t *, void *)) SHA224_Final,
|
||||
};
|
||||
|
||||
struct auth_hash auth_hash_hmac_sha2_256 = {
|
||||
@ -131,7 +131,7 @@ struct auth_hash auth_hash_hmac_sha2_256 = {
|
||||
.blocksize = SHA2_256_BLOCK_LEN,
|
||||
.Init = (void (*)(void *)) SHA256_Init,
|
||||
.Update = SHA256Update_int,
|
||||
.Final = (void (*)(u_int8_t *, void *)) SHA256_Final,
|
||||
.Final = (void (*)(uint8_t *, void *)) SHA256_Final,
|
||||
};
|
||||
|
||||
struct auth_hash auth_hash_hmac_sha2_384 = {
|
||||
@ -143,7 +143,7 @@ struct auth_hash auth_hash_hmac_sha2_384 = {
|
||||
.blocksize = SHA2_384_BLOCK_LEN,
|
||||
.Init = (void (*)(void *)) SHA384_Init,
|
||||
.Update = SHA384Update_int,
|
||||
.Final = (void (*)(u_int8_t *, void *)) SHA384_Final,
|
||||
.Final = (void (*)(uint8_t *, void *)) SHA384_Final,
|
||||
};
|
||||
|
||||
struct auth_hash auth_hash_hmac_sha2_512 = {
|
||||
@ -155,7 +155,7 @@ struct auth_hash auth_hash_hmac_sha2_512 = {
|
||||
.blocksize = SHA2_512_BLOCK_LEN,
|
||||
.Init = (void (*)(void *)) SHA512_Init,
|
||||
.Update = SHA512Update_int,
|
||||
.Final = (void (*)(u_int8_t *, void *)) SHA512_Final,
|
||||
.Final = (void (*)(uint8_t *, void *)) SHA512_Final,
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user