Add support for Camellia encryption algorithm.

PR:		kern/113790
Submitted by:	Yoshisato YANAGISAWA <yanagisawa@csg.is.titech.ac.jp>
Approved by:	re (bmah)
This commit is contained in:
Pawel Jakub Dawidek 2007-09-01 06:33:02 +00:00
parent 6bc581fcf0
commit 864cba9669
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=172031
10 changed files with 53 additions and 18 deletions

View File

@ -146,7 +146,8 @@ will make use of it automatically.
.It
Supports many cryptographic algorithms (currently
.Nm AES ,
.Nm Blowfish
.Nm Blowfish ,
.Nm Camellia
and
.Nm 3DES ) .
.It
@ -227,7 +228,8 @@ If the option is not given, there will be no authentication, only encryption.
Encryption algorithm to use.
Currently supported algorithms are:
.Nm AES ,
.Nm Blowfish
.Nm Blowfish ,
.Nm Camellia
and
.Nm 3DES .
The default is
@ -260,7 +262,9 @@ If not given, the default key length for the given algorithm is used, which is:
128 for
.Nm AES ,
128 for
.Nm Blowfish
.Nm Blowfish ,
128 for
.Nm Camellia
and 192 for
.Nm 3DES .
.It Fl s Ar sectorsize
@ -652,5 +656,9 @@ The
.Nm
utility appeared in
.Fx 6.0 .
Support for
.Nm Camellia
block cipher is implemented by Yoshisato Yanagisawa in
.Fx 7.0 .
.Sh AUTHORS
.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org

View File

@ -286,6 +286,8 @@ g_eli_str2ealgo(const char *name)
return (CRYPTO_AES_CBC);
else if (strcasecmp("blowfish", name) == 0)
return (CRYPTO_BLF_CBC);
else if (strcasecmp("camellia", name) == 0)
return (CRYPTO_CAMELLIA_CBC);
else if (strcasecmp("3des", name) == 0)
return (CRYPTO_3DES_CBC);
return (CRYPTO_ALGORITHM_MIN - 1);
@ -321,6 +323,8 @@ g_eli_algo2str(u_int algo)
return ("AES-CBC");
case CRYPTO_BLF_CBC:
return ("Blowfish-CBC");
case CRYPTO_CAMELLIA_CBC:
return ("CAMELLIA-CBC");
case CRYPTO_3DES_CBC:
return ("3DES-CBC");
case CRYPTO_MD5_HMAC:
@ -390,7 +394,8 @@ g_eli_keylen(u_int algo, u_int keylen)
keylen = 0;
}
return (keylen);
case CRYPTO_AES_CBC:
case CRYPTO_AES_CBC: /* FALLTHROUGH */
case CRYPTO_CAMELLIA_CBC:
switch (keylen) {
case 0:
return (128);

View File

@ -158,6 +158,21 @@ g_eli_crypto_cipher(u_int algo, int enc, u_char *data, size_t datasize,
case CRYPTO_BLF_CBC:
type = EVP_bf_cbc();
break;
case CRYPTO_CAMELLIA_CBC:
switch (keysize) {
case 128:
type = EVP_camellia_128_cbc();
break;
case 192:
type = EVP_camellia_192_cbc();
break;
case 256:
type = EVP_camellia_256_cbc();
break;
default:
return (EINVAL);
}
break;
case CRYPTO_3DES_CBC:
type = EVP_des_ede3_cbc();
break;

View File

@ -6,14 +6,15 @@ no=45
sectors=100
keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
echo "1..540"
echo "1..660"
i=1
for cipher in aes:0 aes:128 aes:192 aes:256 \
3des:0 3des:192 \
blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \
blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \
blowfish:416 blowfish:448; do
blowfish:416 blowfish:448 \
camellia:0 camellia:128 camellia:192 camellia:256; do
ealgo=${cipher%%:*}
keylen=${cipher##*:}
for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do

View File

@ -6,14 +6,15 @@ no=45
sectors=100
keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
echo "1..180"
echo "1..220"
i=1
for cipher in aes:0 aes:128 aes:192 aes:256 \
3des:0 3des:192 \
blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \
blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \
blowfish:416 blowfish:448; do
blowfish:416 blowfish:448 \
camellia:0 camellia:128 camellia:192 camellia:256; do
ealgo=${cipher%%:*}
keylen=${cipher##*:}
for secsize in 512 1024 2048 4096 8192; do

View File

@ -7,14 +7,15 @@ sectors=100
keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
sector=`mktemp /tmp/$base.XXXXXX` || exit 1
echo "1..2160"
echo "1..2640"
i=1
for cipher in aes:0 aes:128 aes:192 aes:256 \
3des:0 3des:192 \
blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \
blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \
blowfish:416 blowfish:448; do
blowfish:416 blowfish:448 \
camellia:0 camellia:128 camellia:192 camellia:256; do
ealgo=${cipher%%:*}
keylen=${cipher##*:}
for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do

View File

@ -7,14 +7,15 @@ sectors=100
keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
sector=`mktemp /tmp/$base.XXXXXX` || exit 1
echo "1..1080"
echo "1..1320"
i=1
for cipher in aes:0 aes:128 aes:192 aes:256 \
3des:0 3des:192 \
blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \
blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \
blowfish:416 blowfish:448; do
blowfish:416 blowfish:448 \
camellia:0 camellia:128 camellia:192 camellia:256; do
ealgo=${cipher%%:*}
keylen=${cipher##*:}
for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do

View File

@ -7,14 +7,15 @@ sectors=100
keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
sector=`mktemp /tmp/$base.XXXXXX` || exit 1
echo "1..1080"
echo "1..1320"
i=1
for cipher in aes:0 aes:128 aes:192 aes:256 \
3des:0 3des:192 \
blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \
blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \
blowfish:416 blowfish:448; do
blowfish:416 blowfish:448 \
camellia:0 camellia:128 camellia:192 camellia:256; do
ealgo=${cipher%%:*}
keylen=${cipher##*:}
for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do

View File

@ -5,14 +5,15 @@ base=`basename $0`
no=45
sectors=100
echo "1..540"
echo "1..660"
i=1
for cipher in aes:0 aes:128 aes:192 aes:256 \
3des:0 3des:192 \
blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \
blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \
blowfish:416 blowfish:448; do
blowfish:416 blowfish:448 \
camellia:0 camellia:128 camellia:192 camellia:256; do
ealgo=${cipher%%:*}
keylen=${cipher##*:}
for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do

View File

@ -5,14 +5,15 @@ base=`basename $0`
no=45
sectors=100
echo "1..180"
echo "1..220"
i=1
for cipher in aes:0 aes:128 aes:192 aes:256 \
3des:0 3des:192 \
blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \
blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \
blowfish:416 blowfish:448; do
blowfish:416 blowfish:448 \
camellia:0 camellia:128 camellia:192 camellia:256; do
ealgo=${cipher%%:*}
keylen=${cipher##*:}
for secsize in 512 1024 2048 4096 8192; do