Changeset View
Changeset View
Standalone View
Standalone View
head/sys/opencrypto/xform_skipjack.c
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <opencrypto/skipjack.h> | #include <opencrypto/skipjack.h> | ||||
#include <opencrypto/xform_enc.h> | #include <opencrypto/xform_enc.h> | ||||
static int skipjack_setkey(u_int8_t **, u_int8_t *, int); | static int skipjack_setkey(u_int8_t **, const u_int8_t *, int); | ||||
static void skipjack_encrypt(caddr_t, u_int8_t *); | static void skipjack_encrypt(caddr_t, u_int8_t *); | ||||
static void skipjack_decrypt(caddr_t, u_int8_t *); | static void skipjack_decrypt(caddr_t, u_int8_t *); | ||||
static void skipjack_zerokey(u_int8_t **); | static void skipjack_zerokey(u_int8_t **); | ||||
/* Encryption instances */ | /* Encryption instances */ | ||||
struct enc_xform enc_xform_skipjack = { | struct enc_xform enc_xform_skipjack = { | ||||
CRYPTO_SKIPJACK_CBC, "Skipjack", | CRYPTO_SKIPJACK_CBC, "Skipjack", | ||||
SKIPJACK_BLOCK_LEN, SKIPJACK_BLOCK_LEN, SKIPJACK_MIN_KEY, | SKIPJACK_BLOCK_LEN, SKIPJACK_BLOCK_LEN, SKIPJACK_MIN_KEY, | ||||
Show All 15 Lines | |||||
static void | static void | ||||
skipjack_decrypt(caddr_t key, u_int8_t *blk) | skipjack_decrypt(caddr_t key, u_int8_t *blk) | ||||
{ | { | ||||
skipjack_backwards(blk, blk, (u_int8_t **) key); | skipjack_backwards(blk, blk, (u_int8_t **) key); | ||||
} | } | ||||
static int | static int | ||||
skipjack_setkey(u_int8_t **sched, u_int8_t *key, int len) | skipjack_setkey(u_int8_t **sched, const u_int8_t *key, int len) | ||||
{ | { | ||||
int err; | int err; | ||||
/* NB: allocate all the memory that's needed at once */ | /* NB: allocate all the memory that's needed at once */ | ||||
*sched = KMALLOC(10 * (sizeof(u_int8_t *) + 0x100), | *sched = KMALLOC(10 * (sizeof(u_int8_t *) + 0x100), | ||||
M_CRYPTO_DATA, M_NOWAIT|M_ZERO); | M_CRYPTO_DATA, M_NOWAIT|M_ZERO); | ||||
if (*sched != NULL) { | if (*sched != NULL) { | ||||
u_int8_t** key_tables = (u_int8_t**) *sched; | u_int8_t** key_tables = (u_int8_t**) *sched; | ||||
Show All 21 Lines |