From f3dea9a5958b576345bae710c0acd2e52ecde0c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bodo=20M=C3=B6ller?= Date: Fri, 9 Jun 2006 15:44:59 +0000 Subject: Camellia cipher, contributed by NTT Submitted by: Masashi Fujita Reviewed by: Bodo Moeller --- CHANGES | 13 + Makefile.org | 2 +- apps/Makefile | 41 +-- apps/dsa.c | 7 + apps/gendsa.c | 12 + apps/genrsa.c | 12 + apps/openssl.c | 10 +- apps/pkcs12.c | 11 +- apps/progs.h | 18 ++ apps/progs.pl | 4 + apps/rsa.c | 7 + apps/smime.c | 12 + apps/speed.c | 113 ++++++- config | 2 +- crypto/asn1/Makefile | 19 +- crypto/engine/Makefile | 4 +- crypto/evp/Makefile | 33 ++- crypto/evp/c_allc.c | 27 ++ crypto/evp/evp.h | 25 ++ crypto/evp/evp_err.c | 2 + crypto/evp/evp_test.c | 7 + crypto/evp/evptests.txt | 129 ++++++++ crypto/objects/obj_dat.h | 100 ++++++- crypto/objects/obj_mac.h | 88 ++++++ crypto/objects/obj_mac.num | 18 ++ crypto/objects/objects.txt | 38 +++ crypto/pem/Makefile | 33 ++- doc/apps/ciphers.pod | 22 ++ doc/apps/smime.pod | 11 +- ssl/s3_lib.c | 168 +++++++++++ ssl/ssl.h | 1 + ssl/ssl_algs.c | 5 + ssl/ssl_ciph.c | 29 ++ ssl/ssl_locl.h | 10 +- ssl/tls1.h | 31 ++ test/Makefile | 14 +- util/libeay.num | 726 ++++++++++++++++++++++++--------------------- util/mk1mf.pl | 9 +- util/mkdef.pl | 7 +- util/mkfiles.pl | 1 + 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 */ @@ -219,6 +222,10 @@ bad: #ifndef OPENSSL_NO_AES 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"); diff --git a/apps/gendsa.c b/apps/gendsa.c index 828e27f1c0..936a42b810 100644 --- a/apps/gendsa.c +++ b/apps/gendsa.c @@ -147,6 +147,14 @@ int MAIN(int argc, char **argv) enc=EVP_aes_192_cbc(); 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) { @@ -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 @@ -167,6 +167,14 @@ int MAIN(int argc, char **argv) enc=EVP_aes_192_cbc(); 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) { @@ -190,6 +198,10 @@ bad: #ifndef OPENSSL_NO_AES 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"); 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 @@ -163,6 +163,11 @@ int MAIN(int argc, char **argv) else if (!strcmp(*args,"-aes128")) enc=EVP_aes_128_cbc(); 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")) @@ -291,6 +296,10 @@ int MAIN(int argc, char **argv) #ifndef OPENSSL_NO_AES 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"); diff --git a/apps/progs.h b/apps/progs.h index 3458b11c16..a1a421ac40 100644 --- a/apps/progs.h +++ b/apps/progs.h @@ -176,6 +176,24 @@ FUNCTION functions[] = { #endif #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 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 @@ -223,6 +226,10 @@ bad: #ifndef OPENSSL_NO_AES 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"); diff --git a/apps/smime.c b/apps/smime.c index c5453eafe2..69ce28039a 100644 --- a/apps/smime.c +++ b/apps/smime.c @@ -167,6 +167,14 @@ int MAIN(int argc, char **argv) cipher = EVP_aes_192_cbc(); 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; @@ -429,6 +437,10 @@ int MAIN(int argc, char **argv) #ifndef OPENSSL_NO_AES 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"); 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 #endif +#ifndef OPENSSL_NO_CAMELLIA +#include +#endif #ifndef OPENSSL_NO_MD2 #include #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; @@ -1571,6 +1627,51 @@ int MAIN(int argc, char **argv) } } +#endif +#ifndef OPENSSL_NO_CAMELLIA + if (doit[D_CBC_128_CML]) + { + for (j=0; j