summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2006-06-09 15:44:59 +0000
committerBodo Möller <bodo@openssl.org>2006-06-09 15:44:59 +0000
commitf3dea9a5958b576345bae710c0acd2e52ecde0c8 (patch)
tree795c13bb1a22819cac949744a3dd5cc428270187
parentfb7b3932786e4277eb3235adc239686806cd9610 (diff)
Camellia cipher, contributed by NTT
Submitted by: Masashi Fujita Reviewed by: Bodo Moeller
-rw-r--r--CHANGES13
-rw-r--r--Makefile.org2
-rw-r--r--apps/Makefile41
-rw-r--r--apps/dsa.c7
-rw-r--r--apps/gendsa.c12
-rw-r--r--apps/genrsa.c12
-rw-r--r--apps/openssl.c10
-rw-r--r--apps/pkcs12.c11
-rw-r--r--apps/progs.h18
-rw-r--r--apps/progs.pl4
-rw-r--r--apps/rsa.c7
-rw-r--r--apps/smime.c12
-rw-r--r--apps/speed.c113
-rwxr-xr-xconfig2
-rw-r--r--crypto/asn1/Makefile19
-rw-r--r--crypto/engine/Makefile4
-rw-r--r--crypto/evp/Makefile33
-rw-r--r--crypto/evp/c_allc.c27
-rw-r--r--crypto/evp/evp.h25
-rw-r--r--crypto/evp/evp_err.c2
-rw-r--r--crypto/evp/evp_test.c7
-rw-r--r--crypto/evp/evptests.txt129
-rw-r--r--crypto/objects/obj_dat.h100
-rw-r--r--crypto/objects/obj_mac.h88
-rw-r--r--crypto/objects/obj_mac.num18
-rw-r--r--crypto/objects/objects.txt38
-rw-r--r--crypto/pem/Makefile33
-rw-r--r--doc/apps/ciphers.pod22
-rw-r--r--doc/apps/smime.pod11
-rw-r--r--ssl/s3_lib.c168
-rw-r--r--ssl/ssl.h1
-rw-r--r--ssl/ssl_algs.c5
-rw-r--r--ssl/ssl_ciph.c29
-rw-r--r--ssl/ssl_locl.h10
-rw-r--r--ssl/tls1.h31
-rw-r--r--test/Makefile14
-rwxr-xr-xutil/libeay.num726
-rwxr-xr-xutil/mk1mf.pl9
-rwxr-xr-xutil/mkdef.pl7
-rwxr-xr-xutil/mkfiles.pl1
40 files changed, 1381 insertions, 440 deletions
diff --git a/CHANGES b/CHANGES
index b55eba36e3..33c91862fb 100644
--- a/CHANGES
+++ b/CHANGES
@@ -284,8 +284,21 @@
*) Add print and set support for Issuing Distribution Point CRL extension.
[Steve Henson]
+ *) Change 'Configure' script to enable Camellia by default.
+ [NTT]
+
Changes between 0.9.8b and 0.9.8c [xx XXX xxxx]
+ *) Add the symmetric cipher Camellia (128-bit, 192-bit, 256-bit key
+ versions), which is now available for royalty-free use
+ (see http://info.isl.ntt.co.jp/crypt/eng/info/chiteki.html).
+ Also, add Camellia TLS ciphersuites from RFC 4132.
+
+ To minimize changes between patchlevels in the OpenSSL 0.9.8
+ series, Camellia remains excluded from compilation unless OpenSSL
+ is configured with 'enable-camellia'.
+ [NTT]
+
*) Disable the padding bug check when compression is in use. The padding
bug check assumes the first packet is of even length, this is not
necessarily true if compresssion is enabled and can result in false
diff --git a/Makefile.org b/Makefile.org
index cf5df2f852..b55b6ba8ac 100644
--- a/Makefile.org
+++ b/Makefile.org
@@ -112,7 +112,7 @@ SHLIBDIRS= crypto ssl
SDIRS= \
objects \
md2 md4 md5 sha mdc2 hmac ripemd whrlpool \
- des aes rc2 rc4 rc5 idea bf cast \
+ des aes rc2 rc4 rc5 idea bf cast camellia \
bn ec rsa dsa ecdsa dh ecdh dso engine \
buffer bio stack lhash rand err \
evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
diff --git a/apps/Makefile b/apps/Makefile
index 7167fc54ad..90d45176f4 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -865,26 +865,27 @@ smime.o: ../include/openssl/x509v3.h apps.h smime.c
speed.o: ../e_os.h ../include/openssl/aes.h ../include/openssl/asn1.h
speed.o: ../include/openssl/bio.h ../include/openssl/blowfish.h
speed.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-speed.o: ../include/openssl/cast.h ../include/openssl/conf.h
-speed.o: ../include/openssl/crypto.h ../include/openssl/des.h
-speed.o: ../include/openssl/des_old.h ../include/openssl/dsa.h
-speed.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-speed.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-speed.o: ../include/openssl/engine.h ../include/openssl/err.h
-speed.o: ../include/openssl/evp.h ../include/openssl/hmac.h
-speed.o: ../include/openssl/idea.h ../include/openssl/lhash.h
-speed.o: ../include/openssl/md2.h ../include/openssl/md4.h
-speed.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
-speed.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-speed.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-speed.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
-speed.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
-speed.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
-speed.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-speed.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-speed.o: ../include/openssl/txt_db.h ../include/openssl/ui.h
-speed.o: ../include/openssl/ui_compat.h ../include/openssl/x509.h
-speed.o: ../include/openssl/x509_vfy.h apps.h speed.c testdsa.h testrsa.h
+speed.o: ../include/openssl/camellia.h ../include/openssl/cast.h
+speed.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+speed.o: ../include/openssl/des.h ../include/openssl/des_old.h
+speed.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+speed.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+speed.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+speed.o: ../include/openssl/err.h ../include/openssl/evp.h
+speed.o: ../include/openssl/hmac.h ../include/openssl/idea.h
+speed.o: ../include/openssl/lhash.h ../include/openssl/md2.h
+speed.o: ../include/openssl/md4.h ../include/openssl/md5.h
+speed.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+speed.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+speed.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+speed.o: ../include/openssl/rand.h ../include/openssl/rc2.h
+speed.o: ../include/openssl/rc4.h ../include/openssl/ripemd.h
+speed.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+speed.o: ../include/openssl/sha.h ../include/openssl/stack.h
+speed.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+speed.o: ../include/openssl/ui.h ../include/openssl/ui_compat.h
+speed.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h speed.c
+speed.o: testdsa.h testrsa.h
spkac.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
spkac.o: ../include/openssl/buffer.h ../include/openssl/conf.h
spkac.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
diff --git a/apps/dsa.c b/apps/dsa.c
index 091f936571..ab258eb83c 100644
--- a/apps/dsa.c
+++ b/apps/dsa.c
@@ -84,6 +84,9 @@
* -aes128 - encrypt output if PEM format
* -aes192 - encrypt output if PEM format
* -aes256 - encrypt output if PEM format
+ * -camellia128 - encrypt output if PEM format
+ * -camellia192 - encrypt output if PEM format
+ * -camellia256 - encrypt output if PEM format
* -text - print a text version
* -modulus - print the DSA public key
*/
@@ -220,6 +223,10 @@ bad:
BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
BIO_printf(bio_err," encrypt PEM output with cbc aes\n");
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ BIO_printf(bio_err," -camellia128, -camellia192, -camellia256\n");
+ BIO_printf(bio_err," encrypt PEM output with cbc camellia\n");
+#endif
BIO_printf(bio_err," -text print the key in text\n");
BIO_printf(bio_err," -noout don't print key out\n");
BIO_printf(bio_err," -modulus print the DSA public value\n");
diff --git a/apps/gendsa.c b/apps/gendsa.c
index 828e27f1c0..936a42b810 100644
--- a/apps/gendsa.c
+++ b/apps/gendsa.c
@@ -148,6 +148,14 @@ int MAIN(int argc, char **argv)
else if (strcmp(*argv,"-aes256") == 0)
enc=EVP_aes_256_cbc();
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ else if (strcmp(*argv,"-camellia128") == 0)
+ enc=EVP_camellia_128_cbc();
+ else if (strcmp(*argv,"-camellia192") == 0)
+ enc=EVP_camellia_192_cbc();
+ else if (strcmp(*argv,"-camellia256") == 0)
+ enc=EVP_camellia_256_cbc();
+#endif
else if (**argv != '-' && dsaparams == NULL)
{
dsaparams = *argv;
@@ -174,6 +182,10 @@ bad:
BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
BIO_printf(bio_err," encrypt PEM output with cbc aes\n");
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ BIO_printf(bio_err," -camellia128, -camellia192, -camellia256\n");
+ BIO_printf(bio_err," encrypt PEM output with cbc camellia\n");
+#endif
#ifndef OPENSSL_NO_ENGINE
BIO_printf(bio_err," -engine e - use engine e, possibly a hardware device.\n");
#endif
diff --git a/apps/genrsa.c b/apps/genrsa.c
index 4f62cfd04f..d716a3cde3 100644
--- a/apps/genrsa.c
+++ b/apps/genrsa.c
@@ -168,6 +168,14 @@ int MAIN(int argc, char **argv)
else if (strcmp(*argv,"-aes256") == 0)
enc=EVP_aes_256_cbc();
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ else if (strcmp(*argv,"-camellia128") == 0)
+ enc=EVP_camellia_128_cbc();
+ else if (strcmp(*argv,"-camellia192") == 0)
+ enc=EVP_camellia_192_cbc();
+ else if (strcmp(*argv,"-camellia256") == 0)
+ enc=EVP_camellia_256_cbc();
+#endif
else if (strcmp(*argv,"-passout") == 0)
{
if (--argc < 1) goto bad;
@@ -191,6 +199,10 @@ bad:
BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
BIO_printf(bio_err," encrypt PEM output with cbc aes\n");
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ BIO_printf(bio_err," -camellia128, -camellia192, -camellia256\n");
+ BIO_printf(bio_err," encrypt PEM output with cbc camellia\n");
+#endif
BIO_printf(bio_err," -out file output the key to 'file\n");
BIO_printf(bio_err," -passout arg output file pass phrase source\n");
BIO_printf(bio_err," -f4 use F4 (0x10001) for the E value\n");
diff --git a/apps/openssl.c b/apps/openssl.c
index a9f3df0955..f996bb3e18 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
/* ====================================================================
- * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -459,7 +459,11 @@ static int do_cmd(LHASH *prog, int argc, char *argv[])
for (fp=functions; fp->name != NULL; fp++)
{
nl=0;
+#ifdef OPENSSL_NO_CAMELLIA
if (((i++) % 5) == 0)
+#else
+ if (((i++) % 4) == 0)
+#endif
{
BIO_printf(bio_err,"\n");
nl=1;
@@ -480,7 +484,11 @@ static int do_cmd(LHASH *prog, int argc, char *argv[])
BIO_printf(bio_err,"\nCipher commands (see the `enc' command for more details)\n");
}
}
+#ifdef OPENSSL_NO_CAMELLIA
BIO_printf(bio_err,"%-15s",fp->name);
+#else
+ BIO_printf(bio_err,"%-18s",fp->name);
+#endif
}
BIO_printf(bio_err,"\n\n");
ret=0;
diff --git a/apps/pkcs12.c b/apps/pkcs12.c
index 2e1c0e2c4a..9fa33f64dc 100644
--- a/apps/pkcs12.c
+++ b/apps/pkcs12.c
@@ -3,7 +3,7 @@
* project.
*/
/* ====================================================================
- * Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -164,6 +164,11 @@ int MAIN(int argc, char **argv)
else if (!strcmp(*args,"-aes192")) enc=EVP_aes_192_cbc();
else if (!strcmp(*args,"-aes256")) enc=EVP_aes_256_cbc();
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ else if (!strcmp(*args,"-camellia128")) enc=EVP_camellia_128_cbc();
+ else if (!strcmp(*args,"-camellia192")) enc=EVP_camellia_192_cbc();
+ else if (!strcmp(*args,"-camellia256")) enc=EVP_camellia_256_cbc();
+#endif
else if (!strcmp (*args, "-noiter")) iter = 1;
else if (!strcmp (*args, "-maciter"))
maciter = PKCS12_DEFAULT_ITER;
@@ -292,6 +297,10 @@ int MAIN(int argc, char **argv)
BIO_printf (bio_err, "-aes128, -aes192, -aes256\n");
BIO_printf (bio_err, " encrypt PEM output with cbc aes\n");
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ BIO_printf (bio_err, "-camellia128, -camellia192, -camellia256\n");
+ BIO_printf (bio_err, " encrypt PEM output with cbc camellia\n");
+#endif
BIO_printf (bio_err, "-nodes don't encrypt private keys\n");
BIO_printf (bio_err, "-noiter don't use encryption iteration\n");
BIO_printf (bio_err, "-maciter use MAC iteration\n");
diff --git a/apps/progs.h b/apps/progs.h
index 3458b11c16..a1a421ac40 100644
--- a/apps/progs.h
+++ b/apps/progs.h
@@ -177,6 +177,24 @@ FUNCTION functions[] = {
#ifndef OPENSSL_NO_AES
{FUNC_TYPE_CIPHER,"aes-256-ecb",enc_main},
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ {FUNC_TYPE_CIPHER,"camellia-128-cbc",enc_main},
+#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ {FUNC_TYPE_CIPHER,"camellia-128-ecb",enc_main},
+#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ {FUNC_TYPE_CIPHER,"camellia-192-cbc",enc_main},
+#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ {FUNC_TYPE_CIPHER,"camellia-192-ecb",enc_main},
+#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ {FUNC_TYPE_CIPHER,"camellia-256-cbc",enc_main},
+#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ {FUNC_TYPE_CIPHER,"camellia-256-ecb",enc_main},
+#endif
{FUNC_TYPE_CIPHER,"base64",enc_main},
#ifndef OPENSSL_NO_DES
{FUNC_TYPE_CIPHER,"des",enc_main},
diff --git a/apps/progs.pl b/apps/progs.pl
index aac86a3d9e..02381087ae 100644
--- a/apps/progs.pl
+++ b/apps/progs.pl
@@ -58,6 +58,9 @@ foreach (
"aes-128-cbc", "aes-128-ecb",
"aes-192-cbc", "aes-192-ecb",
"aes-256-cbc", "aes-256-ecb",
+ "camellia-128-cbc", "camellia-128-ecb",
+ "camellia-192-cbc", "camellia-192-ecb",
+ "camellia-256-cbc", "camellia-256-ecb",
"base64",
"des", "des3", "desx", "idea", "rc4", "rc4-40",
"rc2", "bf", "cast", "rc5",
@@ -76,6 +79,7 @@ foreach (
$t=sprintf("\t{FUNC_TYPE_CIPHER,\"%s\",enc_main},\n",$_);
if ($_ =~ /des/) { $t="#ifndef OPENSSL_NO_DES\n${t}#endif\n"; }
elsif ($_ =~ /aes/) { $t="#ifndef OPENSSL_NO_AES\n${t}#endif\n"; }
+ elsif ($_ =~ /camellia/) { $t="#ifndef OPENSSL_NO_CAMELLIA\n${t}#endif\n"; }
elsif ($_ =~ /idea/) { $t="#ifndef OPENSSL_NO_IDEA\n${t}#endif\n"; }
elsif ($_ =~ /rc4/) { $t="#ifndef OPENSSL_NO_RC4\n${t}#endif\n"; }
elsif ($_ =~ /rc2/) { $t="#ifndef OPENSSL_NO_RC2\n${t}#endif\n"; }
diff --git a/apps/rsa.c b/apps/rsa.c
index 3166c6ad72..f79f375742 100644
--- a/apps/rsa.c
+++ b/apps/rsa.c
@@ -84,6 +84,9 @@
* -aes128 - encrypt output if PEM format
* -aes192 - encrypt output if PEM format
* -aes256 - encrypt output if PEM format
+ * -camellia128 - encrypt output if PEM format
+ * -camellia192 - encrypt output if PEM format
+ * -camellia256 - encrypt output if PEM format
* -text - print a text version
* -modulus - print the RSA key modulus
* -check - verify key consistency
@@ -224,6 +227,10 @@ bad:
BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
BIO_printf(bio_err," encrypt PEM output with cbc aes\n");
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ BIO_printf(bio_err," -camellia128, -camellia192, -camellia256\n");
+ BIO_printf(bio_err," encrypt PEM output with cbc camellia\n");
+#endif
BIO_printf(bio_err," -text print the key in text\n");
BIO_printf(bio_err," -noout don't print key out\n");
BIO_printf(bio_err," -modulus print the RSA key modulus\n");
diff --git a/apps/smime.c b/apps/smime.c
index c5453eafe2..69ce28039a 100644
--- a/apps/smime.c
+++ b/apps/smime.c
@@ -168,6 +168,14 @@ int MAIN(int argc, char **argv)
else if (!strcmp(*args,"-aes256"))
cipher = EVP_aes_256_cbc();
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ else if (!strcmp(*args,"-camellia128"))
+ cipher = EVP_camellia_128_cbc();
+ else if (!strcmp(*args,"-camellia192"))
+ cipher = EVP_camellia_192_cbc();
+ else if (!strcmp(*args,"-camellia256"))
+ cipher = EVP_camellia_256_cbc();
+#endif
else if (!strcmp (*args, "-text"))
flags |= PKCS7_TEXT;
else if (!strcmp (*args, "-nointern"))
@@ -430,6 +438,10 @@ int MAIN(int argc, char **argv)
BIO_printf (bio_err, "-aes128, -aes192, -aes256\n");
BIO_printf (bio_err, " encrypt PEM output with cbc aes\n");
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ BIO_printf (bio_err, "-camellia128, -camellia192, -camellia256\n");
+ BIO_printf (bio_err, " encrypt PEM output with cbc camellia\n");
+#endif
BIO_printf (bio_err, "-nointern don't search certificates in message for signer\n");
BIO_printf (bio_err, "-nosigs don't verify message signature\n");
BIO_printf (bio_err, "-noverify don't verify signers certificate\n");
diff --git a/apps/speed.c b/apps/speed.c
index 9b8365c44f..c53f815d47 100644
--- a/apps/speed.c
+++ b/apps/speed.c
@@ -119,6 +119,9 @@
#ifndef OPENSSL_NO_AES
#include <openssl/aes.h>
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+#include <openssl/camellia.h>
+#endif
#ifndef OPENSSL_NO_MD2
#include <openssl/md2.h>
#endif
@@ -195,7 +198,7 @@ static void print_result(int alg,int run_no,int count,double time_used);
static int do_multi(int multi);
#endif
-#define ALGOR_NUM 21
+#define ALGOR_NUM 24
#define SIZE_NUM 5
#define RSA_NUM 4
#define DSA_NUM 3
@@ -207,7 +210,9 @@ static const char *names[ALGOR_NUM]={
"md2","mdc2","md4","md5","hmac(md5)","sha1","rmd160","rc4",
"des cbc","des ede3","idea cbc",
"rc2 cbc","rc5-32/12 cbc","blowfish cbc","cast cbc",
- "aes-128 cbc","aes-192 cbc","aes-256 cbc","evp","sha256","sha512"};
+ "aes-128 cbc","aes-192 cbc","aes-256 cbc",
+ "camellia-128 cbc","camellia-192 cbc","camellia-256 cbc",
+ "evp","sha256","sha512"};
static double results[ALGOR_NUM][SIZE_NUM];
static int lengths[SIZE_NUM]={16,64,256,1024,8*1024};
static double rsa_results[RSA_NUM][2];
@@ -379,6 +384,17 @@ int MAIN(int argc, char **argv)
0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34,
0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34,0x56};
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ static const unsigned char ckey24[24]=
+ {0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
+ 0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,
+ 0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34};
+ static const unsigned char ckey32[32]=
+ {0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
+ 0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,
+ 0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34,
+ 0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34,0x56};
+#endif
#ifndef OPENSSL_NO_AES
#define MAX_BLOCK_SIZE 128
#else
@@ -398,6 +414,9 @@ int MAIN(int argc, char **argv)
#ifndef OPENSSL_NO_AES
AES_KEY aes_ks1, aes_ks2, aes_ks3;
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ CAMELLIA_KEY camellia_ks1, camellia_ks2, camellia_ks3;
+#endif
#define D_MD2 0
#define D_MDC2 1
#define D_MD4 2
@@ -416,9 +435,12 @@ int MAIN(int argc, char **argv)
#define D_CBC_128_AES 15
#define D_CBC_192_AES 16
#define D_CBC_256_AES 17
-#define D_EVP 18
-#define D_SHA256 19
-#define D_SHA512 20
+#define D_CBC_128_CML 18
+#define D_CBC_192_CML 19
+#define D_CBC_256_CML 20
+#define D_EVP 21
+#define D_SHA256 22
+#define D_SHA512 23
double d=0.0;
long c[ALGOR_NUM][SIZE_NUM];
#define R_DSA_512 0
@@ -761,6 +783,12 @@ int MAIN(int argc, char **argv)
else if (strcmp(*argv,"aes-256-cbc") == 0) doit[D_CBC_256_AES]=1;
else
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ if (strcmp(*argv,"camellia-128-cbc") == 0) doit[D_CBC_128_CML]=1;
+ else if (strcmp(*argv,"camellia-192-cbc") == 0) doit[D_CBC_192_CML]=1;
+ else if (strcmp(*argv,"camellia-256-cbc") == 0) doit[D_CBC_256_CML]=1;
+ else
+#endif
#ifndef OPENSSL_NO_RSA
#if 0 /* was: #ifdef RSAref */
if (strcmp(*argv,"rsaref") == 0)
@@ -831,6 +859,15 @@ int MAIN(int argc, char **argv)
}
else
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ if (strcmp(*argv,"camellia") == 0)
+ {
+ doit[D_CBC_128_CML]=1;
+ doit[D_CBC_192_CML]=1;
+ doit[D_CBC_256_CML]=1;
+ }
+ else
+#endif
#ifndef OPENSSL_NO_RSA
if (strcmp(*argv,"rsa") == 0)
{
@@ -957,6 +994,10 @@ int MAIN(int argc, char **argv)
#ifndef OPENSSL_NO_AES
BIO_printf(bio_err,"aes-128-cbc aes-192-cbc aes-256-cbc ");
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ BIO_printf(bio_err,"\n");
+ BIO_printf(bio_err,"camellia-128-cbc camellia-192-cbc camellia-256-cbc ");
+#endif
#ifndef OPENSSL_NO_RC4
BIO_printf(bio_err,"rc4");
#endif
@@ -994,6 +1035,9 @@ int MAIN(int argc, char **argv)
#ifndef OPENSSL_NO_AES
BIO_printf(bio_err,"aes ");
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ BIO_printf(bio_err,"camellia ");
+#endif
#ifndef OPENSSL_NO_RSA
BIO_printf(bio_err,"rsa ");
#endif
@@ -1002,7 +1046,8 @@ int MAIN(int argc, char **argv)
#endif
#if !defined(OPENSSL_NO_IDEA) || !defined(OPENSSL_NO_RC2) || \
!defined(OPENSSL_NO_DES) || !defined(OPENSSL_NO_RSA) || \
- !defined(OPENSSL_NO_BF) || !defined(OPENSSL_NO_AES)
+ !defined(OPENSSL_NO_BF) || !defined(OPENSSL_NO_AES) || \
+ !defined(OPENSSL_NO_CAMELLIA)
BIO_printf(bio_err,"\n");
#endif
@@ -1091,6 +1136,11 @@ int MAIN(int argc, char **argv)
AES_set_encrypt_key(key24,192,&aes_ks2);
AES_set_encrypt_key(key32,256,&aes_ks3);
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ Camellia_set_key(key16,128,&camellia_ks1);
+ Camellia_set_key(ckey24,192,&camellia_ks2);
+ Camellia_set_key(ckey32,256,&camellia_ks3);
+#endif
#ifndef OPENSSL_NO_IDEA
idea_set_encrypt_key(key16,&idea_ks);
#endif
@@ -1144,6 +1194,9 @@ int MAIN(int argc, char **argv)
c[D_CBC_128_AES][0]=count;
c[D_CBC_192_AES][0]=count;
c[D_CBC_256_AES][0]=count;
+ c[D_CBC_128_CML][0]=count;
+ c[D_CBC_192_CML][0]=count;
+ c[D_CBC_256_CML][0]=count;
c[D_SHA256][0]=count;
c[D_SHA512][0]=count;
@@ -1176,6 +1229,9 @@ int MAIN(int argc, char **argv)
c[D_CBC_128_AES][i]=c[D_CBC_128_AES][i-1]*l0/l1;
c[D_CBC_192_AES][i]=c[D_CBC_192_AES][i-1]*l0/l1;
c[D_CBC_256_AES][i]=c[D_CBC_256_AES][i-1]*l0/l1;
+ c[D_CBC_128_CML][i]=c[D_CBC_128_CML][i-1]*l0/l1;
+ c[D_CBC_192_CML][i]=c[D_CBC_192_CML][i-1]*l0/l1;
+ c[D_CBC_256_CML][i]=c[D_CBC_256_CML][i-1]*l0/l1;
}
#ifndef OPENSSL_NO_RSA
rsa_c[R_RSA_512][0]=count/2000;
@@ -1572,6 +1628,51 @@ int MAIN(int argc, char **argv)
}
#endif
+#ifndef OPENSSL_NO_CAMELLIA
+ if (doit[D_CBC_128_CML])
+ {
+ for (j=0; j<SIZE_NUM; j++)
+ {
+ print_message(names[D_CBC_128_CML],c[D_CBC_128_CML][j],lengths[j]);
+ Time_F(START);
+ for (count=0,run=1; COND(c[D_CBC_128_CML][j]); count++)
+ Camellia_cbc_encrypt(buf,buf,
+ (unsigned long)lengths[j],&camellia_ks1,
+ iv,CAMELLIA_ENCRYPT);
+ d=Time_F(STOP);
+ print_result(D_CBC_128_CML,j,count,d);
+ }
+ }
+ if (doit[D_CBC_192_CML])
+ {
+ for (j=0; j<SIZE_NUM; j++)
+ {
+ print_message(names[D_CBC_192_CML],c[D_CBC_192_CML][j],lengths[j]);
+ Time_F(START);
+ for (count=0,run=1; COND(c[D_CBC_192_CML][j]); count++)
+ Camellia_cbc_encrypt(buf,buf,
+ (unsigned long)lengths[j],&camellia_ks2,
+ iv,CAMELLIA_ENCRYPT);
+ d=Time_F(STOP);
+ print_result(D_CBC_192_CML,j,count,d);
+ }
+ }
+ if (doit[D_CBC_256_CML])
+ {
+ for (j=0; j<SIZE_NUM; j++)
+ {
+ print_message(names[D_CBC_256_CML],c[D_CBC_256_CML][j],lengths[j]);
+ Time_F(START);
+ for (count=0,run=1; COND(c[D_CBC_256_CML][j]); count++)
+ Camellia_cbc_encrypt(buf,buf,
+ (unsigned long)lengths[j],&camellia_ks3,
+ iv,CAMELLIA_ENCRYPT);
+ d=Time_F(STOP);
+ print_result(D_CBC_256_CML,j,count,d);
+ }
+ }
+
+#endif
#ifndef OPENSSL_NO_IDEA
if (doit[D_CBC_IDEA])
{
diff --git a/config b/config
index a0a7767d53..1d5fd91e8c 100755
--- a/config
+++ b/config
@@ -803,7 +803,7 @@ case "$GUESSOS" in
i386-*) options="$options 386" ;;
esac
-for i in bf cast des dh dsa ec hmac idea md2 md5 mdc2 rc2 rc4 rc5 aes ripemd rsa sha
+for i in aes bf camellia cast des dh dsa ec hmac idea md2 md5 mdc2 rc2 rc4 rc5 ripemd rsa sha
do
if [ ! -d crypto/$i ]
then
diff --git a/crypto/asn1/Makefile b/crypto/asn1/Makefile
index 7691d71a76..c8bfc1dab5 100644
--- a/crypto/asn1/Makefile
+++ b/crypto/asn1/Makefile
@@ -318,9 +318,9 @@ ameth_lib.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
ameth_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
ameth_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
ameth_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
-ameth_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-ameth_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-ameth_lib.o: ../../include/openssl/objects.h
+ameth_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
+ameth_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+ameth_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
ameth_lib.o: ../../include/openssl/opensslconf.h
ameth_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
ameth_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
@@ -391,12 +391,13 @@ asn_pack.o: ../../include/openssl/symhacks.h ../cryptlib.h asn_pack.c
d2i_pr.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
d2i_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
d2i_pr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
-d2i_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-d2i_pr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-d2i_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
-d2i_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-d2i_pr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-d2i_pr.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_locl.h d2i_pr.c
+d2i_pr.o: ../../include/openssl/engine.h ../../include/openssl/err.h
+d2i_pr.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+d2i_pr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+d2i_pr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
+d2i_pr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
+d2i_pr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+d2i_pr.o: ../cryptlib.h asn1_locl.h d2i_pr.c
d2i_pu.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
d2i_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
d2i_pu.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
diff --git a/crypto/engine/Makefile b/crypto/engine/Makefile
index f3d18ac19c..a292122e81 100644
--- a/