diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2002-11-12 18:23:14 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2002-11-12 18:23:14 +0000 |
commit | 5310b67125a2c4c3936791cfd77dbe37cf314856 (patch) | |
tree | 35c124c4a8ee94f13c2115b7119f8227754e3963 /sys/crypto | |
parent | 66b98bce28788e0c2a144d43ce2b8e993d42f880 (diff) |
Add a CRYPTO_NULL xform (it's a do nothing, but nice for measuring the
bandwidth of the kernel API). It's only available from userland and
then only if kern.cryptodevallowsoft=1.
Diffstat (limited to 'sys/crypto')
-rw-r--r-- | sys/crypto/cryptodev.c | 5 | ||||
-rw-r--r-- | sys/crypto/cryptodev.h | 5 | ||||
-rw-r--r-- | sys/crypto/cryptosoft.c | 9 | ||||
-rw-r--r-- | sys/crypto/xform.c | 35 | ||||
-rw-r--r-- | sys/crypto/xform.h | 3 |
5 files changed, 51 insertions, 6 deletions
diff --git a/sys/crypto/cryptodev.c b/sys/crypto/cryptodev.c index 4647cd836f8..91e4e46c77c 100644 --- a/sys/crypto/cryptodev.c +++ b/sys/crypto/cryptodev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $ */ +/* $OpenBSD: cryptodev.c,v 1.54 2002/11/12 18:23:13 jason Exp $ */ /* * Copyright (c) 2001 Theo de Raadt @@ -175,6 +175,9 @@ cryptof_ioctl(struct file *fp, u_long cmd, caddr_t data, struct proc *p) case CRYPTO_ARC4: txform = &enc_xform_arc4; break; + case CRYPTO_NULL: + txform = &enc_xform_null; + break; default: return (EINVAL); } diff --git a/sys/crypto/cryptodev.h b/sys/crypto/cryptodev.h index 1f0706b1650..8160ec2620a 100644 --- a/sys/crypto/cryptodev.h +++ b/sys/crypto/cryptodev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cryptodev.h,v 1.33 2002/07/17 23:52:39 art Exp $ */ +/* $OpenBSD: cryptodev.h,v 1.34 2002/11/12 18:23:13 jason Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) @@ -93,7 +93,8 @@ #define CRYPTO_MD5 13 #define CRYPTO_SHA1 14 #define CRYPTO_DEFLATE_COMP 15 /* Deflate compression algorithm */ -#define CRYPTO_ALGORITHM_MAX 15 /* Keep updated - see below */ +#define CRYPTO_NULL 16 +#define CRYPTO_ALGORITHM_MAX 16 /* Keep updated - see below */ /* Algorithm flags */ #define CRYPTO_ALG_FLAG_SUPPORTED 0x01 /* Algorithm is supported */ diff --git a/sys/crypto/cryptosoft.c b/sys/crypto/cryptosoft.c index 8d764670abd..6b50bf664c5 100644 --- a/sys/crypto/cryptosoft.c +++ b/sys/crypto/cryptosoft.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cryptosoft.c,v 1.35 2002/04/26 08:43:50 deraadt Exp $ */ +/* $OpenBSD: cryptosoft.c,v 1.36 2002/11/12 18:23:13 jason Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) @@ -612,6 +612,9 @@ swcr_newsession(u_int32_t *sid, struct cryptoini *cri) case CRYPTO_RIJNDAEL128_CBC: txf = &enc_xform_rijndael128; goto enccommon; + case CRYPTO_NULL: + txf = &enc_xform_null; + goto enccommon; enccommon: txf->setkey(&((*swd)->sw_kschedule), cri->cri_key, cri->cri_klen / 8); @@ -759,6 +762,7 @@ swcr_freesession(u_int64_t tid) case CRYPTO_CAST_CBC: case CRYPTO_SKIPJACK_CBC: case CRYPTO_RIJNDAEL128_CBC: + case CRYPTO_NULL: txf = swd->sw_exf; if (swd->sw_kschedule) @@ -873,6 +877,7 @@ swcr_process(struct cryptop *crp) case CRYPTO_CAST_CBC: case CRYPTO_SKIPJACK_CBC: case CRYPTO_RIJNDAEL128_CBC: + case CRYPTO_NULL: if ((crp->crp_etype = swcr_encdec(crd, sw, crp->crp_buf, type)) != 0) goto done; @@ -949,4 +954,6 @@ swcr_init(void) NULL, NULL, NULL); crypto_register(swcr_id, CRYPTO_DEFLATE_COMP, 0, 0, NULL, NULL, NULL); + crypto_register(swcr_id, CRYPTO_NULL, 0, 0, + NULL, NULL, NULL); } diff --git a/sys/crypto/xform.c b/sys/crypto/xform.c index 9c7cab74352..f8d1ae58508 100644 --- a/sys/crypto/xform.c +++ b/sys/crypto/xform.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xform.c,v 1.19 2002/08/16 22:47:25 dhartmei Exp $ */ +/* $OpenBSD: xform.c,v 1.20 2002/11/12 18:23:13 jason Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -84,6 +84,10 @@ void blf_zerokey(u_int8_t **); void cast5_zerokey(u_int8_t **); void skipjack_zerokey(u_int8_t **); void rijndael128_zerokey(u_int8_t **); +void null_encrypt(caddr_t, u_int8_t *); +void null_zerokey(u_int8_t **); +void null_setkey(u_int8_t **, u_int8_t *, int); +void null_decrypt(caddr_t, u_int8_t *); int MD5Update_int(void *, u_int8_t *, u_int16_t); int SHA1Update_int(void *, u_int8_t *, u_int16_t); @@ -156,6 +160,15 @@ struct enc_xform enc_xform_arc4 = { NULL, }; +struct enc_xform enc_xform_null = { + CRYPTO_NULL, "NULL", + 8, 24, 24, + null_encrypt, + null_decrypt, + null_setkey, + null_zerokey, +}; + /* Authentication instances */ struct auth_hash auth_hash_hmac_md5_96 = { CRYPTO_MD5_HMAC, "HMAC-MD5", @@ -303,6 +316,26 @@ blf_zerokey(u_int8_t **sched) } void +null_setkey(u_int8_t **sched, u_int8_t *key, int len) +{ +} + +void +null_zerokey(u_int8_t **sched) +{ +} + +void +null_encrypt(caddr_t key, u_int8_t *blk) +{ +} + +void +null_decrypt(caddr_t key, u_int8_t *blk) +{ +} + +void cast5_encrypt(caddr_t key, u_int8_t *blk) { cast_encrypt((cast_key *) key, blk, blk); diff --git a/sys/crypto/xform.h b/sys/crypto/xform.h index ae236e0e386..a44b6102a55 100644 --- a/sys/crypto/xform.h +++ b/sys/crypto/xform.h @@ -1,4 +1,4 @@ -/* $OpenBSD: xform.h,v 1.10 2002/04/22 23:10:09 deraadt Exp $ */ +/* $OpenBSD: xform.h,v 1.11 2002/11/12 18:23:13 jason Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) @@ -73,6 +73,7 @@ extern struct enc_xform enc_xform_cast5; extern struct enc_xform enc_xform_skipjack; extern struct enc_xform enc_xform_rijndael128; extern struct enc_xform enc_xform_arc4; +extern struct enc_xform enc_xform_null; extern struct auth_hash auth_hash_md5; extern struct auth_hash auth_hash_sha1; |