Camellia cipher, contributed by NTT
authorBodo Möller <bodo@openssl.org>
Fri, 9 Jun 2006 15:42:21 +0000 (15:42 +0000)
committerBodo Möller <bodo@openssl.org>
Fri, 9 Jun 2006 15:42:21 +0000 (15:42 +0000)
Submitted by: Masashi Fujita
Reviewed by: Bodo Moeller

37 files changed:
CHANGES
Configure
Makefile.org
apps/Makefile
apps/dsa.c
apps/gendsa.c
apps/genrsa.c
apps/openssl.c
apps/pkcs12.c
apps/progs.h
apps/progs.pl
apps/rsa.c
apps/smime.c
apps/speed.c
config
crypto/evp/Makefile
crypto/evp/c_allc.c
crypto/evp/evp.h
crypto/evp/evp_err.c
crypto/evp/evp_test.c
crypto/evp/evptests.txt
crypto/objects/obj_dat.h
crypto/objects/obj_mac.h
crypto/objects/obj_mac.num
crypto/objects/objects.txt
doc/apps/ciphers.pod
doc/apps/smime.pod
ssl/s3_lib.c
ssl/ssl.h
ssl/ssl_algs.c
ssl/ssl_ciph.c
ssl/ssl_locl.h
ssl/tls1.h
util/libeay.num
util/mk1mf.pl
util/mkdef.pl
util/mkfiles.pl

diff --git a/CHANGES b/CHANGES
index c9c1c50..518a462 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,16 @@
 
  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
index d661b3f..dce472a 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -600,6 +600,7 @@ my $perl;
 # All of the following is disabled by default (RC5 was enabled before 0.9.8):
 
 my %disabled = ( # "what"         => "comment"
+                "camellia"       => "default",
                 "gmp"            => "default",
                  "mdc2"           => "default",
                  "rc5"            => "default",
@@ -613,7 +614,7 @@ my %disabled = ( # "what"         => "comment"
 # For symmetry, "disable-..." is a synonym for "no-...".
 
 # This is what $depflags will look like with the above default:
-my $default_depflags = "-DOPENSSL_NO_GMP -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 ";
+my $default_depflags = "-DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_GMP -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 ";
 
 
 my $no_sse2=0;
index eaa9a11..c1334c6 100644 (file)
@@ -111,7 +111,7 @@ SHLIBDIRS= crypto ssl
 SDIRS=  \
        objects \
        md2 md4 md5 sha mdc2 hmac ripemd \
-       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 \
index 79ea8a7..b6bd617 100644 (file)
@@ -815,26 +815,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
index a5ec5d7..d503031 100644 (file)
@@ -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
  */
@@ -211,6 +214,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");
index 828e27f..936a42b 100644 (file)
@@ -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
index 4f62cfd..d716a3c 100644 (file)
@@ -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");
index 02d86d5..47aee5b 100644 (file)
@@ -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
@@ -445,7 +445,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;
@@ -466,7 +470,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;
index 5205002..308f920 100644 (file)
@@ -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
@@ -161,6 +161,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"))
@@ -303,6 +308,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");
index dc665c5..011974b 100644 (file)
@@ -165,6 +165,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
index 36569d2..7b1de74 100644 (file)
@@ -57,6 +57,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",
@@ -75,6 +78,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"; }
index d5cb7b7..cf09a19 100644 (file)
@@ -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
@@ -211,6 +214,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");
index 250fd69..06efef0 100644 (file)
@@ -160,6 +160,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;
@@ -423,6 +431,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");
index 7082c37..7858aee 100644 (file)
 #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
@@ -269,7 +272,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
@@ -281,7 +284,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];
@@ -548,6 +553,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
@@ -567,6 +583,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
@@ -585,9 +604,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
@@ -930,6 +952,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) 
@@ -1000,6 +1028,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)
                        {
@@ -1126,6 +1163,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
@@ -1163,6 +1204,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
@@ -1171,7 +1215,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
 
@@ -1265,6 +1310,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
@@ -1318,6 +1368,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;
 
@@ -1350,6 +1403,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;
@@ -1743,6 +1799,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 35fcf7b..26b4386 100755 (executable)
--- a/config
+++ b/config
@@ -794,7 +794,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
index b4f4487..5a6b06e 100644 (file)
@@ -19,7 +19,7 @@ APPS=
 
 LIB=$(TOP)/libcrypto.a
 LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \
-       e_des.c e_bf.c e_idea.c e_des3.c \
+       e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c\
        e_rc4.c e_aes.c names.c \
        e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \
        m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c \
@@ -31,7 +31,7 @@ LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \
        e_old.c
 
 LIBOBJ=        encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \
-       e_des.o e_bf.o e_idea.o e_des3.o \
+       e_des.o e_bf.o e_idea.o e_des3.o e_camellia.o\
        e_rc4.o e_aes.o names.o \
        e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \
        m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o \
@@ -195,6 +195,15 @@ e_bf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 e_bf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 e_bf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 e_bf.o: ../../include/openssl/symhacks.h ../cryptlib.h e_bf.c evp_locl.h
+e_camellia.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
+e_camellia.o: ../../include/openssl/camellia.h ../../include/openssl/crypto.h
+e_camellia.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+e_camellia.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+e_camellia.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+e_camellia.o: ../../include/openssl/opensslconf.h
+e_camellia.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+e_camellia.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+e_camellia.o: ../../include/openssl/symhacks.h e_camellia.c evp_locl.h
 e_cast.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 e_cast.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
 e_cast.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
index fc96812..9ba4d0c 100644 (file)
@@ -183,6 +183,34 @@ void OpenSSL_add_all_ciphers(void)
        EVP_add_cipher_alias(SN_aes_256_cbc,"AES256");
        EVP_add_cipher_alias(SN_aes_256_cbc,"aes256");
 #endif
+
+#ifndef OPENSSL_NO_CAMELLIA
+       EVP_add_cipher(EVP_camellia_128_ecb());
+       EVP_add_cipher(EVP_camellia_128_cbc());
+       EVP_add_cipher(EVP_camellia_128_cfb());
+       EVP_add_cipher(EVP_camellia_128_cfb1());
+       EVP_add_cipher(EVP_camellia_128_cfb8());
+       EVP_add_cipher(EVP_camellia_128_ofb());
+       EVP_add_cipher_alias(SN_camellia_128_cbc,"CAMELLIA128");
+       EVP_add_cipher_alias(SN_camellia_128_cbc,"camellia128");
+       EVP_add_cipher(EVP_camellia_192_ecb());
+       EVP_add_cipher(EVP_camellia_192_cbc());
+       EVP_add_cipher(EVP_camellia_192_cfb());
+       EVP_add_cipher(EVP_camellia_192_cfb1());
+       EVP_add_cipher(EVP_camellia_192_cfb8());
+       EVP_add_cipher(EVP_camellia_192_ofb());
+       EVP_add_cipher_alias(SN_camellia_192_cbc,"CAMELLIA192");
+       EVP_add_cipher_alias(SN_camellia_192_cbc,"camellia192");
+       EVP_add_cipher(EVP_camellia_256_ecb());
+       EVP_add_cipher(EVP_camellia_256_cbc());
+       EVP_add_cipher(EVP_camellia_256_cfb());
+       EVP_add_cipher(EVP_camellia_256_cfb1());
+       EVP_add_cipher(EVP_camellia_256_cfb8());
+       EVP_add_cipher(EVP_camellia_256_ofb());
+       EVP_add_cipher_alias(SN_camellia_256_cbc,"CAMELLIA256");
+       EVP_add_cipher_alias(SN_camellia_256_cbc,"camellia256");
+#endif
+
        PKCS12_PBE_add();
        PKCS5_PBE_add();
        }
index 116a12f..1b09bd8 100644 (file)
@@ -738,6 +738,29 @@ const EVP_CIPHER *EVP_aes_256_ofb(void);
 const EVP_CIPHER *EVP_aes_256_ctr(void);
 #endif
 #endif
+#ifndef OPENSSL_NO_CAMELLIA
+const EVP_CIPHER *EVP_camellia_128_ecb(void);
+const EVP_CIPHER *EVP_camellia_128_cbc(void);
+const EVP_CIPHER *EVP_camellia_128_cfb1(void);
+const EVP_CIPHER *EVP_camellia_128_cfb8(void);
+const EVP_CIPHER *EVP_camellia_128_cfb128(void);
+# define EVP_camellia_128_cfb EVP_camellia_128_cfb128
+const EVP_CIPHER *EVP_camellia_128_ofb(void);
+const EVP_CIPHER *EVP_camellia_192_ecb(void);
+const EVP_CIPHER *EVP_camellia_192_cbc(void);
+const EVP_CIPHER *EVP_camellia_192_cfb1(void);
+const EVP_CIPHER *EVP_camellia_192_cfb8(void);
+const EVP_CIPHER *EVP_camellia_192_cfb128(void);
+# define EVP_camellia_192_cfb EVP_camellia_192_cfb128
+const EVP_CIPHER *EVP_camellia_192_ofb(void);
+const EVP_CIPHER *EVP_camellia_256_ecb(void);
+const EVP_CIPHER *EVP_camellia_256_cbc(void);
+const EVP_CIPHER *EVP_camellia_256_cfb1(void);
+const EVP_CIPHER *EVP_camellia_256_cfb8(void);
+const EVP_CIPHER *EVP_camellia_256_cfb128(void);
+# define EVP_camellia_256_cfb EVP_camellia_256_cfb128
+const EVP_CIPHER *EVP_camellia_256_ofb(void);
+#endif
 
 void OPENSSL_add_all_algorithms_noconf(void);
 void OPENSSL_add_all_algorithms_conf(void);
@@ -854,6 +877,7 @@ void ERR_load_EVP_strings(void);
 
 /* Function codes. */
 #define EVP_F_AES_INIT_KEY                              133
+#define EVP_F_CAMELLIA_INIT_KEY                                 159
 #define EVP_F_D2I_PKEY                                  100
 #define EVP_F_DSAPKEY2PKCS8                             134
 #define EVP_F_DSA_PKEY2PKCS8                            135
@@ -897,6 +921,7 @@ void ERR_load_EVP_strings(void);
 #define EVP_R_BAD_KEY_LENGTH                            137
 #define EVP_R_BN_DECODE_ERROR                           112
 #define EVP_R_BN_PUBKEY_ERROR                           113
+#define EVP_R_CAMELLIA_KEY_SETUP_FAILED                         157
 #define EVP_R_CIPHER_PARAMETER_ERROR                    122
 #define EVP_R_CTRL_NOT_IMPLEMENTED                      132
 #define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED            133
index e854aad..cb6d9fa 100644 (file)
@@ -71,6 +71,7 @@
 static ERR_STRING_DATA EVP_str_functs[]=
        {
 {ERR_FUNC(EVP_F_AES_INIT_KEY), "AES_INIT_KEY"},
+{ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY),    "CAMELLIA_INIT_KEY"},
 {ERR_FUNC(EVP_F_D2I_PKEY),     "D2I_PKEY"},
 {ERR_FUNC(EVP_F_DSAPKEY2PKCS8),        "DSAPKEY2PKCS8"},
 {ERR_FUNC(EVP_F_DSA_PKEY2PKCS8),       "DSA_PKEY2PKCS8"},
@@ -117,6 +118,7 @@ static ERR_STRING_DATA EVP_str_reasons[]=
 {ERR_REASON(EVP_R_BAD_KEY_LENGTH)        ,"bad key length"},
 {ERR_REASON(EVP_R_BN_DECODE_ERROR)       ,"bn decode error"},
 {ERR_REASON(EVP_R_BN_PUBKEY_ERROR)       ,"bn pubkey error"},
+{ERR_REASON(EVP_R_CAMELLIA_KEY_SETUP_FAILED),"camellia key setup failed"},
 {ERR_REASON(EVP_R_CIPHER_PARAMETER_ERROR),"cipher parameter error"},
 {ERR_REASON(EVP_R_CTRL_NOT_IMPLEMENTED)  ,"ctrl not implemented"},
 {ERR_REASON(EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED),"ctrl operation not implemented"},
index 3bf8e9a..6ecbecc 100644 (file)
@@ -416,6 +416,13 @@ int main(int argc,char **argv)
                fprintf(stdout, "Cipher disabled, skipping %s\n", cipher); 
                continue;
                }
+#endif
+#ifdef OPENSSL_NO_CAMELLIA
+           if (strstr(cipher, "CAMELLIA") == cipher)
+               {
+               fprintf(stdout, "Cipher disabled, skipping %s\n", cipher); 
+               continue;
+               }
 #endif
            fprintf(stderr,"Can't find %s\n",cipher);
            EXIT(3);
index 80bd9c7..193009f 100644 (file)
@@ -181,3 +181,132 @@ RC4:00000000000000000000000000000000::0000000000000000:de188941a3375d3a
 RC4:ef012345ef012345ef012345ef012345::0000000000000000000000000000000000000000:d6a141a7ec3c38dfbd615a1162e1c7ba36b67858
 RC4:0123456789abcdef0123456789abcdef::123456789ABCDEF0123456789ABCDEF0123456789ABCDEF012345678:66a0949f8af7d6891f7f832ba833c00c892ebe30143ce28740011ecf
 RC4:ef012345ef012345ef012345ef012345::00000000000000000000:d6a141a7ec3c38dfbd61
+
+
+# Camellia tests from RFC3713
+# For all ECB encrypts and decrypts, the transformed sequence is
+#   CAMELLIA-bits-ECB:key::plaintext:ciphertext:encdec
+CAMELLIA-128-ECB:0123456789abcdeffedcba9876543210::0123456789abcdeffedcba9876543210:67673138549669730857065648eabe43
+CAMELLIA-192-ECB:0123456789abcdeffedcba98765432100011223344556677::0123456789abcdeffedcba9876543210:b4993401b3e996f84ee5cee7d79b09b9
+CAMELLIA-256-ECB:0123456789abcdeffedcba987654321000112233445566778899aabbccddeeff::0123456789abcdeffedcba9876543210:9acc237dff16d76c20ef7c919e3a7509
+
+# ECB-CAMELLIA128.Encrypt
+CAMELLIA-128-ECB:000102030405060708090A0B0C0D0E0F::00112233445566778899AABBCCDDEEFF:77CF412067AF8270613529149919546F:1
+CAMELLIA-192-ECB:000102030405060708090A0B0C0D0E0F1011121314151617::00112233445566778899AABBCCDDEEFF:B22F3C36B72D31329EEE8ADDC2906C68:1
+CAMELLIA-256-ECB:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F::00112233445566778899AABBCCDDEEFF:2EDF1F3418D53B88841FC8985FB1ECF2:1
+
+# ECB-CAMELLIA128.Encrypt and ECB-CAMELLIA128.Decrypt 
+CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::6BC1BEE22E409F96E93D7E117393172A:432FC5DCD628115B7C388D770B270C96
+CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::AE2D8A571E03AC9C9EB76FAC45AF8E51:0BE1F14023782A22E8384C5ABB7FAB2B
+CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::30C81C46A35CE411E5FBC1191A0A52EF:A0A1ABCD1893AB6FE0FE5B65DF5F8636
+CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::F69F2445DF4F9B17AD2B417BE66C3710:E61925E0D5DFAA9BB29F815B3076E51A
+
+# ECB-CAMELLIA192.Encrypt and ECB-CAMELLIA192.Decrypt 
+CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::6BC1BEE22E409F96E93D7E117393172A:CCCC6C4E138B45848514D48D0D3439D3
+CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::AE2D8A571E03AC9C9EB76FAC45AF8E51:5713C62C14B2EC0F8393B6AFD6F5785A
+CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::30C81C46A35CE411E5FBC1191A0A52EF:B40ED2B60EB54D09D030CF511FEEF366
+CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::F69F2445DF4F9B17AD2B417BE66C3710:909DBD95799096748CB27357E73E1D26
+
+# ECB-CAMELLIA256.Encrypt and ECB-CAMELLIA256.Decrypt 
+CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::6BC1BEE22E409F96E93D7E117393172A:BEFD219B112FA00098919CD101C9CCFA
+CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::AE2D8A571E03AC9C9EB76FAC45AF8E51:C91D3A8F1AEA08A9386CF4B66C0169EA
+CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::30C81C46A35CE411E5FBC1191A0A52EF:A623D711DC5F25A51BB8A80D56397D28
+CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::F69F2445DF4F9B17AD2B417BE66C3710:7960109FB6DC42947FCFE59EA3C5EB6B
+
+# For all CBC encrypts and decrypts, the transformed sequence is
+#   CAMELLIA-bits-CBC:key:IV/ciphertext':plaintext:ciphertext:encdec
+# CBC-CAMELLIA128.Encrypt and CBC-CAMELLIA128.Decrypt 
+CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:1607CF494B36BBF00DAEB0B503C831AB
+CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:1607CF494B36BBF00DAEB0B503C831AB:AE2D8A571E03AC9C9EB76FAC45AF8E51:A2F2CF671629EF7840C5A5DFB5074887
+CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:A2F2CF671629EF7840C5A5DFB5074887:30C81C46A35CE411E5FBC1191A0A52EF:0F06165008CF8B8B5A63586362543E54
+CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:36A84CDAFD5F9A85ADA0F0A993D6D577:F69F2445DF4F9B17AD2B417BE66C3710:74C64268CDB8B8FAF5B34E8AF3732980
+
+# CBC-CAMELLIA192.Encrypt and CBC-CAMELLIA192.Decrypt 
+CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:2A4830AB5AC4A1A2405955FD2195CF93
+CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2A4830AB5AC4A1A2405955FD2195CF93:AE2D8A571E03AC9C9EB76FAC45AF8E51:5D5A869BD14CE54264F892A6DD2EC3D5
+CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:5D5A869BD14CE54264F892A6DD2EC3D5:30C81C46A35CE411E5FBC1191A0A52EF:37D359C3349836D884E310ADDF68C449
+CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:37D359C3349836D884E310ADDF68C449:F69F2445DF4F9B17AD2B417BE66C3710:01FAAA930B4AB9916E9668E1428C6B08
+
+# CBC-CAMELLIA256.Encrypt and CBC-CAMELLIA256.Decrypt 
+CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:E6CFA35FC02B134A4D2C0B6737AC3EDA
+CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E6CFA35FC02B134A4D2C0B6737AC3EDA:AE2D8A571E03AC9C9EB76FAC45AF8E51:36CBEB73BD504B4070B1B7DE2B21EB50
+CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:36CBEB73BD504B4070B1B7DE2B21EB50:30C81C46A35CE411E5FBC1191A0A52EF:E31A6055297D96CA3330CDF1B1860A83
+CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E31A6055297D96CA3330CDF1B1860A83:F69F2445DF4F9B17AD2B417BE66C3710:5D563F6D1CCCF236051C0C5C1C58F28F
+
+# We don't support CFB{1,8}-CAMELLIAxxx.{En,De}crypt
+# For all CFB128 encrypts and decrypts, the transformed sequence is
+#   CAMELLIA-bits-CFB:key:IV/ciphertext':plaintext:ciphertext:encdec
+# CFB128-CAMELLIA128.Encrypt 
+CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:1
+CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:14F7646187817EB586599146B82BD719:AE2D8A571E03AC9C9EB76FAC45AF8E51:A53D28BB82DF741103EA4F921A44880B:1
+CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:A53D28BB82DF741103EA4F921A44880B:30C81C46A35CE411E5FBC1191A0A52EF:9C2157A664626D1DEF9EA420FDE69B96:1
+CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:9C2157A664626D1DEF9EA420FDE69B96:F69F2445DF4F9B17AD2B417BE66C3710:742A25F0542340C7BAEF24CA8482BB09:1
+
+# CFB128-CAMELLIA128.Decrypt 
+CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:0
+CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:14F7646187817EB586599146B82BD719:AE2D8A571E03AC9C9EB76FAC45AF8E51:A53D28BB82DF741103EA4F921A44880B:0
+CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:A53D28BB82DF741103EA4F921A44880B:30C81C46A35CE411E5FBC1191A0A52EF:9C2157A664626D1DEF9EA420FDE69B96:0
+CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:9C2157A664626D1DEF9EA420FDE69B96:F69F2445DF4F9B17AD2B417BE66C3710:742A25F0542340C7BAEF24CA8482BB09:0
+
+# CFB128-CAMELLIA192.Encrypt
+CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA82D9B6860DCD565E:1
+CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:C832BB9780677DAA82D9B6860DCD565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:86F8491627906D780C7A6D46EA331F98:1
+CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:86F8491627906D780C7A6D46EA331F98:30C81C46A35CE411E5FBC1191A0A52EF:69511CCE594CF710CB98BB63D7221F01:1
+CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:69511CCE594CF710CB98BB63D7221F01:F69F2445DF4F9B17AD2B417BE66C3710:D5B5378A3ABED55803F25565D8907B84:1
+
+# CFB128-CAMELLIA192.Decrypt
+CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA82D9B6860DCD565E:0
+CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:C832BB9780677DAA82D9B6860DCD565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:86F8491627906D780C7A6D46EA331F98:0
+CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:86F8491627906D780C7A6D46EA331F98:30C81C46A35CE411E5FBC1191A0A52EF:69511CCE594CF710CB98BB63D7221F01:0
+CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:69511CCE594CF710CB98BB63D7221F01:F69F2445DF4F9B17AD2B417BE66C3710:D5B5378A3ABED55803F25565D8907B84:0
+
+# CFB128-CAMELLIA256.Encrypt 
+CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:1
+CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:CF6107BB0CEA7D7FB1BD31F5E7B06C93:AE2D8A571E03AC9C9EB76FAC45AF8E51:89BEDB4CCDD864EA11BA4CBE849B5E2B:1
+CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:89BEDB4CCDD864EA11BA4CBE849B5E2B:30C81C46A35CE411E5FBC1191A0A52EF:555FC3F34BDD2D54C62D9E3BF338C1C4:1
+CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:555FC3F34BDD2D54C62D9E3BF338C1C4:F69F2445DF4F9B17AD2B417BE66C3710:5953ADCE14DB8C7F39F1BD39F359BFFA:1
+
+# CFB128-CAMELLIA256.Decrypt 
+CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:0
+CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:CF6107BB0CEA7D7FB1BD31F5E7B06C93:AE2D8A571E03AC9C9EB76FAC45AF8E51:89BEDB4CCDD864EA11BA4CBE849B5E2B:0
+CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:89BEDB4CCDD864EA11BA4CBE849B5E2B:30C81C46A35CE411E5FBC1191A0A52EF:555FC3F34BDD2D54C62D9E3BF338C1C4:0
+CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:555FC3F34BDD2D54C62D9E3BF338C1C4:F69F2445DF4F9B17AD2B417BE66C3710:5953ADCE14DB8C7F39F1BD39F359BFFA:0
+
+# For all OFB encrypts and decrypts, the transformed sequence is
+#   CAMELLIA-bits-OFB:key:IV/output':plaintext:ciphertext:encdec
+# OFB-CAMELLIA128.Encrypt 
+CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:1
+CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:25623DB569CA51E01482649977E28D84:1
+CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:C776634A60729DC657D12B9FCA801E98:1
+CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:D776379BE0E50825E681DA1A4C980E8E:1
+
+# OFB-CAMELLIA128.Decrypt 
+CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:0
+CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:25623DB569CA51E01482649977E28D84:0
+CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:C776634A60729DC657D12B9FCA801E98:0
+CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:D776379BE0E50825E681DA1A4C980E8E:0
+
+# OFB-CAMELLIA192.Encrypt 
+CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA82D9B6860DCD565E:1
+CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:8ECEB7D0350D72C7F78562AEBDF99339:1
+CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:BDD62DBBB9700846C53B507F544696F0:1
+CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:E28014E046B802F385C4C2E13EAD4A72:1
+
+# OFB-CAMELLIA192.Decrypt 
+CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA82D9B6860DCD565E:0
+CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:8ECEB7D0350D72C7F78562AEBDF99339:0
+CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:BDD62DBBB9700846C53B507F544696F0:0
+CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:E28014E046B802F385C4C2E13EAD4A72:0
+
+# OFB-CAMELLIA256.Encrypt 
+CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:1
+CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:127AD97E8E3994E4820027D7BA109368:1
+CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:6BFF6265A6A6B7A535BC65A80B17214E:1
+CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0A4A0404E26AA78A27CB271E8BF3CF20:1
+
+# OFB-CAMELLIA256.Decrypt 
+CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:0
+CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:127AD97E8E3994E4820027D7BA109368:0
+CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:6BFF6265A6A6B7A535BC65A80B17214E:0
+CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0A4A0404E26AA78A27CB271E8BF3CF20:0
+
index db4400c..78439a3 100644 (file)
  * [including the GNU Public Licence.]
  */
 
-#define NUM_NID 751
-#define NUM_SN 747
-#define NUM_LN 747
-#define NUM_OBJ 709
+#define NUM_NID 769
+#define NUM_SN 765
+#define NUM_LN 765
+#define NUM_OBJ 721
 
-static unsigned char lvalues[5002]={
+static unsigned char lvalues[5107]={
 0x00,                                        /* [  0] OBJ_undef */
 0x2A,0x86,0x48,0x86,0xF7,0x0D,               /* [  1] OBJ_rsadsi */
 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,          /* [  7] OBJ_pkcs */
@@ -777,6 +777,18 @@ static unsigned char lvalues[5002]={
 0x55,0x1D,0x20,0x00,                         /* [4991] OBJ_any_policy */
 0x55,0x1D,0x21,                              /* [4995] OBJ_policy_mappings */
 0x55,0x1D,0x36,                              /* [4998] OBJ_inhibit_any_policy */
+0x2A,0x83,0x08,0x8C,0x9A,0x4B,0x3D,0x01,0x01,0x01,0x02,/* [5001] OBJ_camellia_128_cbc */
+0x2A,0x83,0x08,0x8C,0x9A,0x4B,0x3D,0x01,0x01,0x01,0x03,/* [5012] OBJ_camellia_192_cbc */
+0x2A,0x83,0x08,0x8C,0x9A,0x4B,0x3D,0x01,0x01,0x01,0x04,/* [5023] OBJ_camellia_256_cbc */
+0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x01,     /* [5034] OBJ_camellia_128_ecb */
+0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x15,     /* [5042] OBJ_camellia_192_ecb */
+0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x29,     /* [5050] OBJ_camellia_256_ecb */
+0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x04,     /* [5058] OBJ_camellia_128_cfb128 */
+0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x18,     /* [5066] OBJ_camellia_192_cfb128 */
+0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x2C,     /* [5074] OBJ_camellia_256_cfb128 */
+0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x03,     /* [5082] OBJ_camellia_128_ofb128 */
+0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x17,     /* [5090] OBJ_camellia_192_ofb128 */
+0x03,0xA2,0x31,0x05,0x03,0x01,0x09,0x2B,     /* [5098] OBJ_camellia_256_ofb128 */
 };
 
 static ASN1_OBJECT nid_objs[NUM_NID]={
@@ -1945,6 +1957,36 @@ static ASN1_OBJECT nid_objs[NUM_NID]={
        NID_inhibit_any_policy,3,&(lvalues[4998]),0},
 {"Oakley-EC2N-3","ipsec3",NID_ipsec3,0,NULL,0},
 {"Oakley-EC2N-4","ipsec4",NID_ipsec4,0,NULL,0},
+{"CAMELLIA-128-CBC","camellia-128-cbc",NID_camellia_128_cbc,11,
+       &(lvalues[5001]),0},
+{"CAMELLIA-192-CBC","camellia-192-cbc",NID_camellia_192_cbc,11,
+       &(lvalues[5012]),0},
+{"CAMELLIA-256-CBC","camellia-256-cbc",NID_camellia_256_cbc,11,
+       &(lvalues[5023]),0},
+{"CAMELLIA-128-ECB","camellia-128-ecb",NID_camellia_128_ecb,8,
+       &(lvalues[5034]),0},
+{"CAMELLIA-192-ECB","camellia-192-ecb",NID_camellia_192_ecb,8,
+       &(lvalues[5042]),0},
+{"CAMELLIA-256-ECB","camellia-256-ecb",NID_camellia_256_ecb,8,
+       &(lvalues[5050]),0},
+{"CAMELLIA-128-CFB","camellia-128-cfb",NID_camellia_128_cfb128,8,
+       &(lvalues[5058]),0},
+{"CAMELLIA-192-CFB","camellia-192-cfb",NID_camellia_192_cfb128,8,
+       &(lvalues[5066]),0},
+{"CAMELLIA-256-CFB","camellia-256-cfb",NID_camellia_256_cfb128,8,
+       &(lvalues[5074]),0},
+{"CAMELLIA-128-CFB1","camellia-128-cfb1",NID_camellia_128_cfb1,0,NULL,0},
+{"CAMELLIA-192-CFB1","camellia-192-cfb1",NID_camellia_192_cfb1,0,NULL,0},
+{"CAMELLIA-256-CFB1","camellia-256-cfb1",NID_camellia_256_cfb1,0,NULL,0},
+{"CAMELLIA-128-CFB8","camellia-128-cfb8",NID_camellia_128_cfb8,0,NULL,0},
+{"CAMELLIA-192-CFB8","camellia-192-cfb8",NID_camellia_192_cfb8,0,NULL,0},
+{"CAMELLIA-256-CFB8","camellia-256-cfb8",NID_camellia_256_cfb8,0,NULL,0},
+{"CAMELLIA-128-OFB","camellia-128-ofb",NID_camellia_128_ofb128,8,
+       &(lvalues[5082]),0},
+{"CAMELLIA-192-OFB","camellia-192-ofb",NID_camellia_192_ofb128,8,
+       &(lvalues[5090]),0},
+{"CAMELLIA-256-OFB","camellia-256-ofb",NID_camellia_256_ofb128,8,
+       &(lvalues[5098]),0},
 };
 
 static ASN1_OBJECT *sn_objs[NUM_SN]={
@@ -1972,6 +2014,24 @@ static ASN1_OBJECT *sn_objs[NUM_SN]={
 &(nid_objs[92]),/* "BF-ECB" */
 &(nid_objs[94]),/* "BF-OFB" */
 &(nid_objs[14]),/* "C" */
+&(nid_objs[751]),/* "CAMELLIA-128-CBC" */
+&(nid_objs[757]),/* "CAMELLIA-128-CFB" */
+&(nid_objs[760]),/* "CAMELLIA-128-CFB1" */
+&(nid_objs[763]),/* "CAMELLIA-128-CFB8" */
+&(nid_objs[754]),/* "CAMELLIA-128-ECB" */
+&(nid_objs[766]),/* "CAMELLIA-128-OFB" */
+&(nid_objs[752]),/* "CAMELLIA-192-CBC" */
+&(nid_objs[758]),/* "CAMELLIA-192-CFB" */
+&(nid_objs[761]),/* "CAMELLIA-192-CFB1" */
+&(nid_objs[764]),/* "CAMELLIA-192-CFB8" */
+&(nid_objs[755]),/* "CAMELLIA-192-ECB" */
+&(nid_objs[767]),/* "CAMELLIA-192-OFB" */
+&(nid_objs[753]),/* "CAMELLIA-256-CBC" */
+&(nid_objs[759]),/* "CAMELLIA-256-CFB" */
+&(nid_objs[762]),/* "CAMELLIA-256-CFB1" */
+&(nid_objs[765]),/* "CAMELLIA-256-CFB8" */
+&(nid_objs[756]),/* "CAMELLIA-256-ECB" */
+&(nid_objs[768]),/* "CAMELLIA-256-OFB" */
 &(nid_objs[108]),/* "CAST5-CBC" */
 &(nid_objs[110]),/* "CAST5-CFB" */
 &(nid_objs[109]),/* "CAST5-ECB" */
@@ -2863,6 +2923,24 @@ static ASN1_OBJECT *ln_objs[NUM_LN]={
 &(nid_objs[701]),/* "c2tnb359v1" */
 &(nid_objs[703]),/* "c2tnb431r1" */
 &(nid_objs[483]),/* "cNAMERecord" */
+&(nid_objs[751]),/* "camellia-128-cbc" */
+&(nid_objs[757]),/* "camellia-128-cfb" */
+&(nid_objs[760]),/* "camellia-128-cfb1" */
+&(nid_objs[763]),/* "camellia-128-cfb8" */
+&(nid_objs[754]),/* "camellia-128-ecb" */
+&(nid_objs[766]),/* "camellia-128-ofb" */
+&(nid_objs[752]),/* "camellia-192-cbc" */
+&(nid_objs[758]),/* "camellia-192-cfb" */
+&(nid_objs[761]),/* "camellia-192-cfb1" */
+&(nid_objs[764]),/* "camellia-192-cfb8" */
+&(nid_objs[755]),/* "camellia-192-ecb" */
+&(nid_objs[767]),/* "camellia-192-ofb" */
+&(nid_objs[753]),/* "camellia-256-cbc" */
+&(nid_objs[759]),/* "camellia-256-cfb" */
+&(nid_objs[762]),/* "camellia-256-cfb1" */
+&(nid_objs[765]),/* "camellia-256-cfb8" */
+&(nid_objs[756]),/* "camellia-256-ecb" */
+&(nid_objs[768]),/* "camellia-256-ofb" */
 &(nid_objs[443]),/* "caseIgnoreIA5StringSyntax" */
 &(nid_objs[108]),/* "cast5-cbc" */
 &(nid_objs[110]),/* "cast5-cfb" */
@@ -3755,6 +3833,15 @@ static ASN1_OBJECT *obj_objs[NUM_OBJ]={
 &(nid_objs[507]),/* OBJ_id_hex_partial_message       1 3 6 1 7 1 1 1 */
 &(nid_objs[508]),/* OBJ_id_hex_multipart_message     1 3 6 1 7 1 1 2 */
 &(nid_objs[57]),/* OBJ_netscape                     2 16 840 1 113730 */
+&(nid_objs[754]),/* OBJ_camellia_128_ecb             0 3 4401 5 3 1 9 1 */
+&(nid_objs[766]),/* OBJ_camellia_128_ofb128          0 3 4401 5 3 1 9 3 */
+&(nid_objs[757]),/* OBJ_camellia_128_cfb128          0 3 4401 5 3 1 9 4 */
+&(nid_objs[755]),/* OBJ_camellia_192_ecb             0 3 4401 5 3 1 9 21 */
+&(nid_objs[767]),/* OBJ_camellia_192_ofb128          0 3 4401 5 3 1 9 23 */
+&(nid_objs[758]),/* OBJ_camellia_192_cfb128          0 3 4401 5 3 1 9 24 */
+&(nid_objs[756]),/* OBJ_camellia_256_ecb             0 3 4401 5 3 1 9 41 */
+&(nid_objs[768]),/* OBJ_camellia_256_ofb128          0 3 4401 5 3 1 9 43 */
+&(nid_objs[759]),/* OBJ_camellia_256_cfb128          0 3 4401 5 3 1 9 44 */
 &(nid_objs[437]),/* OBJ_pilot                        0 9 2342 19200300 100 */
 &(nid_objs[186]),/* OBJ_pkcs1                        1 2 840 113549 1 1 */
 &(nid_objs[27]),/* OBJ_pkcs3                        1 2 840 113549 1 3 */
@@ -4089,6 +4176,9 @@ static ASN1_OBJECT *obj_objs[NUM_OBJ]={
 &(nid_objs[138]),/* OBJ_ms_efs                       1 3 6 1 4 1 311 10 3 4 */
 &(nid_objs[648]),/* OBJ_ms_smartcard_login           1 3 6 1 4 1 311 20 2 2 */
 &(nid_objs[649]),/* OBJ_ms_upn                       1 3 6 1 4 1 311 20 2 3 */
+&(nid_objs[751]),/* OBJ_camellia_128_cbc             1 2 392 200011 61 1 1 1 2 */
+&(nid_objs[752]),/* OBJ_camellia_192_cbc             1 2 392 200011 61 1 1 1 3 */
+&(nid_objs[753]),/* OBJ_camellia_256_cbc             1 2 392 200011 61 1 1 1 4 */
 &(nid_objs[196]),/* OBJ_id_smime_mod_cms             1 2 840 113549 1 9 16 0 1 */
 &(nid_objs[197]),/* OBJ_id_smime_mod_ess             1 2 840 113549 1 9 16 0 2 */
 &(nid_objs[198]),/* OBJ_id_smime_mod_oid             1 2 840 113549 1 9 16 0 3 */
index e4d63e5..df4ad90 100644 (file)
 #define LN_ipsec4              "ipsec4"
 #define NID_ipsec4             750
 
+#define SN_camellia_128_cbc            "CAMELLIA-128-CBC"
+#define LN_camellia_128_cbc            "camellia-128-cbc"
+#define NID_camellia_128_cbc           751
+#define OBJ_camellia_128_cbc           1L,2L,392L,200011L,61L,1L,1L,1L,2L
+
+#define SN_camellia_192_cbc            "CAMELLIA-192-CBC"
+#define LN_camellia_192_cbc            "camellia-192-cbc"
+#define NID_camellia_192_cbc           752
+#define OBJ_camellia_192_cbc           1L,2L,392L,200011L,61L,1L,1L,1L,3L
+
+#define SN_camellia_256_cbc            "CAMELLIA-256-CBC"
+#define LN_camellia_256_cbc            "camellia-256-cbc"
+#define NID_camellia_256_cbc           753
+#define OBJ_camellia_256_cbc           1L,2L,392L,200011L,61L,1L,1L,1L,4L
+
+#define OBJ_ntt_ds             0L,3L,4401L,5L
+
+#define OBJ_camellia           OBJ_ntt_ds,3L,1L,9L
+
+#define SN_camellia_128_ecb            "CAMELLIA-128-ECB"
+#define LN_camellia_128_ecb            "camellia-128-ecb"
+#define NID_camellia_128_ecb           754
+#define OBJ_camellia_128_ecb           OBJ_camellia,1L
+
+#define SN_camellia_128_ofb128         "CAMELLIA-128-OFB"
+#define LN_camellia_128_ofb128         "camellia-128-ofb"
+#define NID_camellia_128_ofb128                766
+#define OBJ_camellia_128_ofb128                OBJ_camellia,3L
+
+#define SN_camellia_128_cfb128         "CAMELLIA-128-CFB"
+#define LN_camellia_128_cfb128         "camellia-128-cfb"
+#define NID_camellia_128_cfb128                757
+#define OBJ_camellia_128_cfb128                OBJ_camellia,4L
+
+#define SN_camellia_192_ecb            "CAMELLIA-192-ECB"
+#define LN_camellia_192_ecb            "camellia-192-ecb"
+#define NID_camellia_192_ecb           755
+#define OBJ_camellia_192_ecb           OBJ_camellia,21L
+
+#define SN_camellia_192_ofb128         "CAMELLIA-192-OFB"
+#define LN_camellia_192_ofb128         "camellia-192-ofb"
+#define NID_camellia_192_ofb128                767
+#define OBJ_camellia_192_ofb128                OBJ_camellia,23L
+
+#define SN_camellia_192_cfb128         "CAMELLIA-192-CFB"
+#define LN_camellia_192_cfb128         "camellia-192-cfb"
+#define NID_camellia_192_cfb128                758
+#define OBJ_camellia_192_cfb128                OBJ_camellia,24L
+
+#define SN_camellia_256_ecb            "CAMELLIA-256-ECB"
+#define LN_camellia_256_ecb            "camellia-256-ecb"
+#define NID_camellia_256_ecb           756
+#define OBJ_camellia_256_ecb           OBJ_camellia,41L
+
+#define SN_camellia_256_ofb128         "CAMELLIA-256-OFB"
+#define LN_camellia_256_ofb128         "camellia-256-ofb"
+#define NID_camellia_256_ofb128                768
+#define OBJ_camellia_256_ofb128                OBJ_camellia,43L
+
+#define SN_camellia_256_cfb128         "CAMELLIA-256-CFB"
+#define LN_camellia_256_cfb128         "camellia-256-cfb"
+#define NID_camellia_256_cfb128                759
+#define OBJ_camellia_256_cfb128                OBJ_camellia,44L
+
+#define SN_camellia_128_cfb1           "CAMELLIA-128-CFB1"
+#define LN_camellia_128_cfb1           "camellia-128-cfb1"
+#define NID_camellia_128_cfb1          760
+
+#define SN_camellia_192_cfb1           "CAMELLIA-192-CFB1"
+#define LN_camellia_192_cfb1           "camellia-192-cfb1"
+#define NID_camellia_192_cfb1          761
+
+#define SN_camellia_256_cfb1           "CAMELLIA-256-CFB1"
+#define LN_camellia_256_cfb1           "camellia-256-cfb1"
+#define NID_camellia_256_cfb1          762
+
+#define SN_camellia_128_cfb8           "CAMELLIA-128-CFB8"
+#define LN_camellia_128_cfb8           "camellia-128-cfb8"
+#define NID_camellia_128_cfb8          763
+
+#define SN_camellia_192_cfb8           "CAMELLIA-192-CFB8"
+#define LN_camellia_192_cfb8           "camellia-192-cfb8"
+#define NID_camellia_192_cfb8          764
+
+#define SN_camellia_256_cfb8           "CAMELLIA-256-CFB8"
+#define LN_camellia_256_cfb8           "camellia-256-cfb8"
+#define NID_camellia_256_cfb8          765
+
index 56a2bf7..fb9fbb9 100644 (file)
@@ -748,3 +748,21 @@ policy_mappings            747
 inhibit_any_policy             748
 ipsec3         749
 ipsec4         750
+camellia_128_cbc               751
+camellia_192_cbc               752
+camellia_256_cbc               753
+camellia_128_ecb               754
+camellia_192_ecb               755
+camellia_256_ecb               756
+camellia_128_cfb128            757
+camellia_192_cfb128            758
+camellia_256_cfb128            759
+camellia_128_cfb1              760
+camellia_192_cfb1              761
+camellia_256_cfb1              762
+camellia_128_cfb8              763
+camellia_192_cfb8              764
+camellia_256_cfb8              765
+camellia_128_ofb128            766
+camellia_192_ofb128            767
+camellia_256_ofb128            768
index 0aec79b..a731280 100644 (file)
@@ -1047,3 +1047,41 @@ rsadsi 1 1 6             : rsaOAEPEncryptionSET
 
                        : Oakley-EC2N-3         : ipsec3
                        : Oakley-EC2N-4         : ipsec4
+
+
+# Definitions for Camellia cipher - CBC MODE
+1 2 392 200011 61 1 1 1 2 : CAMELLIA-128-CBC           : camellia-128-cbc
+1 2 392 200011 61 1 1 1 3 : CAMELLIA-192-CBC           : camellia-192-cbc
+1 2 392 200011 61 1 1 1 4 : CAMELLIA-256-CBC           : camellia-256-cbc
+
+# Definitions for Camellia cipher - ECB, CFB, OFB MODE
+!Alias ntt-ds 0 3 4401 5
+!Alias camellia ntt-ds 3 1 9 
+
+camellia 1             : CAMELLIA-128-ECB              : camellia-128-ecb
+!Cname camellia-128-ofb128
+camellia 3             : CAMELLIA-128-OFB              : camellia-128-ofb
+!Cname camellia-128-cfb128
+camellia 4             : CAMELLIA-128-CFB              : camellia-128-cfb
+
+camellia 21            : CAMELLIA-192-ECB              : camellia-192-ecb
+!Cname camellia-192-ofb128
+camellia 23            : CAMELLIA-192-OFB              : camellia-192-ofb
+!Cname camellia-192-cfb128
+camellia 24            : CAMELLIA-192-CFB              : camellia-192-cfb
+
+camellia 41            : CAMELLIA-256-ECB              : camellia-256-ecb
+!Cname camellia-256-ofb128
+camellia 43            : CAMELLIA-256-OFB              : camellia-256-ofb
+!Cname camellia-256-cfb128
+camellia 44            : CAMELLIA-256-CFB              : camellia-256-cfb
+
+# There are no OIDs for these modes...
+
+                       : CAMELLIA-128-CFB1             : camellia-128-cfb1
+                       : CAMELLIA-192-CFB1             : camellia-192-cfb1
+                       : CAMELLIA-256-CFB1             : camellia-256-cfb1
+                       : CAMELLIA-128-CFB8             : camellia-128-cfb8
+                       : CAMELLIA-192-CFB8             : camellia-192-cfb8
+                       : CAMELLIA-256-CFB8             : camellia-256-cfb8
+
index 81a2c43..77e517a 100644 (file)
@@ -235,6 +235,10 @@ cipher suites using MD5.
 
 cipher suites using SHA1.
 
+=item B<Camellia>
+
+cipher suites using Camellia.
+
 =back
 
 =head1 CIPHER SUITE NAMES
@@ -330,6 +334,24 @@ e.g. DES-CBC3-SHA. In these cases, RSA authentication is used.
  TLS_DH_anon_WITH_AES_128_CBC_SHA        ADH-AES128-SHA
  TLS_DH_anon_WITH_AES_256_CBC_SHA        ADH-AES256-SHA
 
+=head2 Camellia ciphersuites from RFC4132, extending TLS v1.0
+
+ TLS_RSA_WITH_CAMELLIA_128_CBC_SHA      CAMELLIA128-SHA
+ TLS_RSA_WITH_CAMELLIA_256_CBC_SHA      CAMELLIA256-SHA
+
+ TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA   Not implemented.
+ TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA   Not implemented.
+ TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA   Not implemented.
+ TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA   Not implemented.
+
+ TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA  DHE-DSS-CAMELLIA128-SHA
+ TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA  DHE-DSS-CAMELLIA256-SHA
+ TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA  DHE-RSA-CAMELLIA128-SHA
+ TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA  DHE-RSA-CAMELLIA256-SHA
+
+ TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA  ADH-CAMELLIA128-SHA
+ TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA  ADH-CAMELLIA256-SHA
+
 =head2 Additional Export 1024 and other cipher suites
 
 Note: these ciphers can also be used in SSL v3.
index 84b673f..caf2d26 100644 (file)
@@ -20,6 +20,9 @@ B<openssl> B<smime>
 [B<-aes128>]
 [B<-aes192>]
 [B<-aes256>]
+[B<-camellia128>]
+[B<-camellia192>]
+[B<-camellia256>]
 [B<-in file>]
 [B<-certfile file>]
 [B<-signer file>]
@@ -129,10 +132,10 @@ B<-verify>. This directory must be a standard certificate directory: that
 is a hash of each subject name (using B<x509 -hash>) should be linked
 to each certificate.
 
-=item B<-des -des3 -rc2-40 -rc2-64 -rc2-128 -aes128 -aes192 -aes256>
+=item B<-des -des3 -rc2-40 -rc2-64 -rc2-128 -aes128 -aes192 -aes256 -camellia128 -camellia192 -camellia256>
 
 the encryption algorithm to use. DES (56 bits), triple DES (168 bits),
-40, 64 or 128 bit RC2 or 128, 192 or 256 bit AES respectively.  If not
+40, 64 or 128 bit RC2, 128, 192 or 256 bit AES, or 128, 192 or 256 bit Camellia respectively.  If not
 specified 40 bit RC2 is used. Only used with B<-encrypt>.
 
 =item B<-nointern>
@@ -354,6 +357,10 @@ alternatively you can base64 decode the signature and use
 
  openssl smime -verify -inform DER -in signature.der -content content.txt
 
+Create an encrypted message using 128 bit Camellia:
+
+ openssl smime -encrypt -in plain.txt -camellia128 -out mail.msg cert.pem
+
 =head1 BUGS
 
 The MIME parser isn't very clever: it seems to handle most messages that I've thrown
index 401ddd7..ca38c86 100644 (file)
@@ -56,7 +56,7 @@
  * [including the GNU Public Licence.]
  */
 /* ====================================================================
- * Copyright (c) 1998-2002 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
@@ -902,6 +902,89 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={
        SSL_ALL_STRENGTHS,
        },
 
+#ifndef OPENSSL_NO_CAMELLIA
+       /* Camellia ciphersuites from RFC4132 (128-bit portion) */
+
+       /* Cipher 41 */
+       {
+       1,
+       TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA,
+       TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA,
+       SSL_kRSA|SSL_aRSA|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+       SSL_NOT_EXP|SSL_HIGH,
+       0,
+       128,
+       128,
+       SSL_ALL_CIPHERS,
+       SSL_ALL_STRENGTHS
+       },
+       /* Cipher 42 */
+       {
+       0, /* not implemented (non-ephemeral DH) */
+       TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA,
+       TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA,
+       SSL_kDHd|SSL_aDH|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+       SSL_NOT_EXP|SSL_HIGH,
+       0,
+       128,
+       128,
+       SSL_ALL_CIPHERS,
+       SSL_ALL_STRENGTHS
+       },
+       /* Cipher 43 */
+       {
+       0, /* not implemented (non-ephemeral DH) */
+       TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA,
+       TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA,
+       SSL_kDHr|SSL_aDH|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+       SSL_NOT_EXP|SSL_HIGH,
+       0,
+       128,
+       128,
+       SSL_ALL_CIPHERS,
+       SSL_ALL_STRENGTHS
+       },
+       /* Cipher 44 */
+       {
+       1,
+       TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA,
+       TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA,
+       SSL_kEDH|SSL_aDSS|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+       SSL_NOT_EXP|SSL_HIGH,
+       0,
+       128,
+       128,
+       SSL_ALL_CIPHERS,
+       SSL_ALL_STRENGTHS
+       },
+       /* Cipher 45 */
+       {
+       1,
+       TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,
+       TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,
+       SSL_kEDH|SSL_aRSA|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+       SSL_NOT_EXP|SSL_HIGH,
+       0,
+       128,
+       128,
+       SSL_ALL_CIPHERS,
+       SSL_ALL_STRENGTHS
+       },
+       /* Cipher 46 */
+       {
+       1,
+       TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA,
+       TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA,
+       SSL_kEDH|SSL_aNULL|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+       SSL_NOT_EXP|SSL_HIGH,
+       0,
+       128,
+       128,
+       SSL_ALL_CIPHERS,
+       SSL_ALL_STRENGTHS
+       },
+#endif /* OPENSSL_NO_CAMELLIA */
+
 #if TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES
        /* New TLS Export CipherSuites */
        /* Cipher 60 */
@@ -996,6 +1079,90 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={
            SSL_ALL_STRENGTHS
            },
 #endif
+
+#ifndef OPENSSL_NO_CAMELLIA
+       /* Camellia ciphersuites from RFC4132 (256-bit portion) */
+
+       /* Cipher 84 */
+       {
+       1,
+       TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA,
+       TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA,
+       SSL_kRSA|SSL_aRSA|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+       SSL_NOT_EXP|SSL_HIGH,
+       0,
+       256,
+       256,
+       SSL_ALL_CIPHERS,
+       SSL_ALL_STRENGTHS
+       },
+       /* Cipher 85 */
+       {
+       0, /* not implemented (non-ephemeral DH) */
+       TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA,
+       TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA,
+       SSL_kDHd|SSL_aDH|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+       SSL_NOT_EXP|SSL_HIGH,
+       0,
+       256,
+       256,
+       SSL_ALL_CIPHERS,
+       SSL_ALL_STRENGTHS
+       },
+       /* Cipher 86 */
+       {
+       0, /* not implemented (non-ephemeral DH) */
+       TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA,
+       TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA,
+       SSL_kDHr|SSL_aDH|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+       SSL_NOT_EXP|SSL_HIGH,
+       0,
+       256,
+       256,
+       SSL_ALL_CIPHERS,
+       SSL_ALL_STRENGTHS
+       },
+       /* Cipher 87 */
+       {
+       1,
+       TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA,
+       TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA,
+       SSL_kEDH|SSL_aDSS|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+       SSL_NOT_EXP|SSL_HIGH,
+       0,
+       256,
+       256,
+       SSL_ALL_CIPHERS,
+       SSL_ALL_STRENGTHS
+       },
+       /* Cipher 88 */
+       {
+       1,
+       TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,
+       TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,
+       SSL_kEDH|SSL_aRSA|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+       SSL_NOT_EXP|SSL_HIGH,
+       0,
+       256,
+       256,
+       SSL_ALL_CIPHERS,
+       SSL_ALL_STRENGTHS
+       },
+       /* Cipher 89 */
+       {
+       1,
+       TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA,
+       TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA,
+       SSL_kEDH|SSL_aNULL|SSL_CAMELLIA|SSL_SHA|SSL_TLSV1,
+       SSL_NOT_EXP|SSL_HIGH,
+       0,
+       256,
+       256,
+       SSL_ALL_CIPHERS,
+       SSL_ALL_STRENGTHS
+       },
+#endif /* OPENSSL_NO_CAMELLIA */
+
 #ifndef OPENSSL_NO_ECDH
        /* Cipher C001 */
            {
@@ -1348,6 +1515,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={
             },
 #endif /* OPENSSL_NO_ECDH */
 
+
 /* end of list */
        };
 
index c87e5f8..66e9a4d 100644 (file)
--- a/ssl/ssl.h
+++ b/ssl/ssl.h
@@ -282,6 +282,7 @@ extern "C" {
 #define SSL_TXT_RC2            "RC2"
 #define SSL_TXT_IDEA           "IDEA"
 #define SSL_TXT_AES            "AES"
+#define SSL_TXT_CAMELLIA       "CAMELLIA"
 #define SSL_TXT_MD5            "MD5"
 #define SSL_TXT_SHA1           "SHA1"
 #define SSL_TXT_SHA            "SHA"
index ac82d45..3d93c5a 100644 (file)
@@ -82,6 +82,15 @@ int SSL_library_init(void)
        EVP_add_cipher(EVP_aes_192_cbc());
        EVP_add_cipher(EVP_aes_256_cbc());
 #endif
+
+
+/* The Camellia algorithm is registered in the management table of EVP. */
+#ifndef OPENSSL_NO_CAMELLIA
+       EVP_add_cipher(EVP_camellia_128_cbc());
+       EVP_add_cipher(EVP_camellia_256_cbc());
+#endif
+
+
 #ifndef OPENSSL_NO_MD2
        EVP_add_digest(EVP_md2());
 #endif
index 441507f..1f884c5 100644 (file)
 #define SSL_ENC_AES128_IDX     7
 #define SSL_ENC_AES256_IDX     8
 #define SSL_ENC_NUM_IDX                9
+#define SSL_ENC_CAMELLIA128_IDX        9
+#define SSL_ENC_CAMELLIA256_IDX        10
+#undef  SSL_ENC_NUM_IDX
+#define SSL_ENC_NUM_IDX                11
+
 
 static const EVP_CIPHER *ssl_cipher_methods[SSL_ENC_NUM_IDX]={
        NULL,NULL,NULL,NULL,NULL,NULL,
@@ -141,6 +146,7 @@ static const SSL_CIPHER cipher_aliases[]={
        {0,SSL_TXT_eNULL,0,SSL_eNULL,0,0,0,0,SSL_ENC_MASK,0},
        {0,SSL_TXT_eFZA,0,SSL_eFZA,  0,0,0,0,SSL_ENC_MASK,0},
        {0,SSL_TXT_AES, 0,SSL_AES,   0,0,0,0,SSL_ENC_MASK,0},
+       {0,SSL_TXT_CAMELLIA,    0,SSL_CAMELLIA,   0,0,0,0,SSL_ENC_MASK,0},
 
        {0,SSL_TXT_MD5, 0,SSL_MD5,   0,0,0,0,SSL_MAC_MASK,0},
        {0,SSL_TXT_SHA1,0,SSL_SHA1,  0,0,0,0,SSL_MAC_MASK,0},
@@ -185,6 +191,10 @@ void ssl_load_ciphers(void)
          EVP_get_cipherbyname(SN_aes_128_cbc);
        ssl_cipher_methods[SSL_ENC_AES256_IDX]=
          EVP_get_cipherbyname(SN_aes_256_cbc);
+       ssl_cipher_methods[SSL_ENC_CAMELLIA128_IDX]=
+         EVP_get_cipherbyname(SN_camellia_128_cbc);
+       ssl_cipher_methods[SSL_ENC_CAMELLIA256_IDX]=
+         EVP_get_cipherbyname(SN_camellia_256_cbc);
 
        ssl_digest_methods[SSL_MD_MD5_IDX]=
                EVP_get_digestbyname(SN_md5);
@@ -293,6 +303,15 @@ int ssl_cipher_get_evp(const SSL_SESSION *s, const EVP_CIPHER **enc,
                default: i=-1; break;
                        }
                break;
+       case SSL_CAMELLIA:
+               switch(c->alg_bits)
+                       {
+               case 128: i=SSL_ENC_CAMELLIA128_IDX; break;
+               case 256: i=SSL_ENC_CAMELLIA256_IDX; break;
+               default: i=-1; break;
+                       }
+               break;
+
        default:
                i= -1;
                break;
@@ -381,6 +400,7 @@ static unsigned long ssl_cipher_get_disabled(void)
        mask |= (ssl_cipher_methods[SSL_ENC_IDEA_IDX] == NULL) ? SSL_IDEA:0;
        mask |= (ssl_cipher_methods[SSL_ENC_eFZA_IDX] == NULL) ? SSL_eFZA:0;
        mask |= (ssl_cipher_methods[SSL_ENC_AES128_IDX] == NULL) ? SSL_AES:0;
+       mask |= (ssl_cipher_methods[SSL_ENC_CAMELLIA128_IDX] == NULL) ? SSL_CAMELLIA:0;
 
        mask |= (ssl_digest_methods[SSL_MD_MD5_IDX ] == NULL) ? SSL_MD5 :0;
        mask |= (ssl_digest_methods[SSL_MD_SHA1_IDX] == NULL) ? SSL_SHA1:0;
@@ -1067,6 +1087,15 @@ char *SSL_CIPHER_description(SSL_CIPHER *cipher, char *buf, int len)
                default: enc="AES(?""?""?)"; break;
                        }
                break;
+       case SSL_CAMELLIA:
+               switch(cipher->strength_bits)
+                       {
+               case 128: enc="Camellia(128)"; break;
+               case 256: enc="Camellia(256)"; break;
+               default: enc="Camellia(?""?""?)"; break;
+                       }
+               break;
+               
        default:
                enc="unknown";
                break;
index 0bebaf0..786d988 100644 (file)
 #define SSL_FZA                        (SSL_aFZA|SSL_kFZA|SSL_eFZA)
 #define SSL_KRB5                (SSL_kKRB5|SSL_aKRB5)
 
-#define SSL_ENC_MASK           0x043F8000L
+#define SSL_ENC_MASK           0x0C3F8000L
 #define SSL_DES                        0x00008000L
 #define SSL_3DES               0x00010000L
 #define SSL_RC4                        0x00020000L
 #define SSL_eFZA               0x00100000L
 #define SSL_eNULL              0x00200000L
 #define SSL_AES                        0x04000000L
+#define SSL_CAMELLIA           0x08000000L
 
 #define SSL_MAC_MASK           0x00c00000L
 #define SSL_MD5                        0x00400000L
 #define SSL_SSLV3              0x02000000L
 #define SSL_TLSV1              SSL_SSLV3       /* for now */
 
-/* we have used 07ffffff - 5 bits left to go. */
+/* we have used 0fffffff - 4 bits left to go. */
 
 /*
  * Export and cipher strength information. For each cipher we have to decide
index f8a215e..c3155e6 100644 (file)
@@ -125,6 +125,21 @@ extern "C" {
 #define TLS1_CK_DHE_RSA_WITH_AES_256_SHA               0x03000039
 #define TLS1_CK_ADH_WITH_AES_256_SHA                   0x0300003A
 
+/* Camellia ciphersuites from RFC4132 */
+#define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA          0x03000041
+#define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA       0x03000042
+#define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA       0x03000043
+#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA      0x03000044
+#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA      0x03000045
+#define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA          0x03000046
+
+#define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA          0x03000084
+#define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA       0x03000085
+#define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA       0x03000086
+#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA      0x03000087
+#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA      0x03000088
+#define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA          0x03000089
+
 /* ECC ciphersuites from draft-ietf-tls-ecc-12.txt with changes soon to be in draft 13 */
 #define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA                0x0300C001
 #define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA             0x0300C002
@@ -217,6 +232,22 @@ extern "C" {
 #define TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA         "AECDH-AES128-SHA"
 #define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA         "AECDH-AES256-SHA"
 
+/* Camellia ciphersuites form RFC4132 */
+#define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA         "CAMELLIA128-SHA"
+#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA      "DH-DSS-CAMELLIA128-SHA"
+#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA      "DH-RSA-CAMELLIA128-SHA"
+#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA     "DHE-DSS-CAMELLIA128-SHA"
+#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA     "DHE-RSA-CAMELLIA128-SHA"
+#define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA         "ADH-CAMELLIA128-SHA"
+
+#define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA         "CAMELLIA256-SHA"
+#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA      "DH-DSS-CAMELLIA256-SHA"
+#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA      "DH-RSA-CAMELLIA256-SHA"
+#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA     "DHE-DSS-CAMELLIA256-SHA"
+#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA     "DHE-RSA-CAMELLIA256-SHA"
+#define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA         "ADH-CAMELLIA256-SHA"
+
+
 #define TLS_CT_RSA_SIGN                        1
 #define TLS_CT_DSS_SIGN                        2
 #define TLS_CT_RSA_FIXED_DH            3
index f8555a1..aa059f6 100755 (executable)
@@ -3380,3 +3380,32 @@ get_rfc2409_prime_768                   3780     EXIST::FUNCTION:
 X509_VERIFY_PARAM_get_flags             3781   EXIST::FUNCTION:
 EVP_CIPHER_CTX_new                      3782   EXIST::FUNCTION:
 EVP_CIPHER_CTX_free                     3783   EXIST::FUNCTION:
+Camellia_cbc_encrypt                    3784   EXIST::FUNCTION:CAMELLIA
+Camellia_cfb128_encrypt                 3785   EXIST::FUNCTION:CAMELLIA
+Camellia_cfb1_encrypt                   3786   EXIST::FUNCTION:CAMELLIA
+Camellia_cfb8_encrypt                   3787   EXIST::FUNCTION:CAMELLIA
+Camellia_ctr128_encrypt                 3788   EXIST::FUNCTION:CAMELLIA
+Camellia_cfbr_encrypt_block             3789   EXIST::FUNCTION:CAMELLIA
+Camellia_decrypt                        3790   EXIST::FUNCTION:CAMELLIA
+Camellia_ecb_encrypt                    3791   EXIST::FUNCTION:CAMELLIA
+Camellia_encrypt                        3792   EXIST::FUNCTION:CAMELLIA
+Camellia_ofb128_encrypt                 3793   EXIST::FUNCTION:CAMELLIA
+Camellia_set_key                        3794   EXIST::FUNCTION:CAMELLIA
+EVP_camellia_128_cbc                    3795   EXIST::FUNCTION:CAMELLIA
+EVP_camellia_128_cfb128                 3796   EXIST::FUNCTION:CAMELLIA
+EVP_camellia_128_cfb1                   3797   EXIST::FUNCTION:CAMELLIA
+EVP_camellia_128_cfb8                   3798   EXIST::FUNCTION:CAMELLIA
+EVP_camellia_128_ecb                    3799   EXIST::FUNCTION:CAMELLIA
+EVP_camellia_128_ofb                    3800   EXIST::FUNCTION:CAMELLIA
+EVP_camellia_192_cbc                    3801   EXIST::FUNCTION:CAMELLIA
+EVP_camellia_192_cfb128                 3802   EXIST::FUNCTION:CAMELLIA
+EVP_camellia_192_cfb1                   3803   EXIST::FUNCTION:CAMELLIA
+EVP_camellia_192_cfb8                   3804   EXIST::FUNCTION:CAMELLIA
+EVP_camellia_192_ecb                    3805   EXIST::FUNCTION:CAMELLIA
+EVP_camellia_192_ofb                    3806   EXIST::FUNCTION:CAMELLIA
+EVP_camellia_256_cbc                    3807   EXIST::FUNCTION:CAMELLIA
+EVP_camellia_256_cfb128                 3808   EXIST::FUNCTION:CAMELLIA
+EVP_camellia_256_cfb1                   3809   EXIST::FUNCTION:CAMELLIA
+EVP_camellia_256_cfb8                   3810   EXIST::FUNCTION:CAMELLIA
+EVP_camellia_256_ecb                    3811   EXIST::FUNCTION:CAMELLIA
+EVP_camellia_256_ofb                    3812   EXIST::FUNCTION:CAMELLIA
index dc5416a..eb61417 100755 (executable)
@@ -63,7 +63,7 @@ and [options] can be one of
        no-md2 no-md4 no-md5 no-sha no-mdc2     - Skip this digest
        no-ripemd
        no-rc2 no-rc4 no-rc5 no-idea no-des     - Skip this symetric cipher
-       no-bf no-cast no-aes
+       no-bf no-cast no-aes no-camellia
        no-rsa no-dsa no-dh                     - Skip this public key cipher
        no-ssl2 no-ssl3                         - Skip this version of SSL
        just-ssl                                - remove all non-ssl keys/digest
@@ -197,6 +197,7 @@ $cflags= "$xcflags$cflags" if $xcflags ne "";
 
 $cflags.=" -DOPENSSL_NO_IDEA" if $no_idea;
 $cflags.=" -DOPENSSL_NO_AES"  if $no_aes;
+$cflags.=" -DOPENSSL_NO_CAMELLIA"  if $no_camellia;
 $cflags.=" -DOPENSSL_NO_RC2"  if $no_rc2;
 $cflags.=" -DOPENSSL_NO_RC4"  if $no_rc4;
 $cflags.=" -DOPENSSL_NO_RC5"  if $no_rc5;
@@ -728,6 +729,7 @@ sub var_add
        return("") if $no_hw   && $dir =~ /\/hw/;
        return("") if $no_idea && $dir =~ /\/idea/;
        return("") if $no_aes  && $dir =~ /\/aes/;
+       return("") if $no_camellia  && $dir =~ /\/camellia/;
        return("") if $no_rc2  && $dir =~ /\/rc2/;
        return("") if $no_rc4  && $dir =~ /\/rc4/;
        return("") if $no_rc5  && $dir =~ /\/rc5/;
@@ -761,6 +763,7 @@ sub var_add
        @a=grep(!/^e_.*_bf$/,@a) if $no_bf;
        @a=grep(!/^e_.*_c$/,@a) if $no_cast;
        @a=grep(!/^e_rc4$/,@a) if $no_rc4;
+       @a=grep(!/^e_camellia$/,@a) if $no_camellia;
 
        @a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2;
        @a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3;
@@ -972,6 +975,7 @@ sub read_options
                "no-rc5" => \$no_rc5,
                "no-idea" => \$no_idea,
                "no-aes" => \$no_aes,
+               "no-camellia" => \$no_camellia,
                "no-des" => \$no_des,
                "no-bf" => \$no_bf,
                "no-cast" => \$no_cast,
@@ -989,6 +993,7 @@ sub read_options
                "no-dh" => \$no_dh,
                "no-hmac" => \$no_hmac,
                "no-aes" => \$no_aes,
+               "no-camellia" => \$no_camellia,
                "no-asm" => \$no_asm,
                "nasm" => \$nasm,
                "nw-nasm" => \$nw_nasm,
@@ -1008,7 +1013,7 @@ sub read_options
                        [\$no_rc2, \$no_idea, \$no_des, \$no_bf, \$no_cast,
                          \$no_md2, \$no_sha, \$no_mdc2, \$no_dsa, \$no_dh,
                          \$no_ssl2, \$no_err, \$no_ripemd, \$no_rc5,
-                         \$no_aes],
+                         \$no_aes, \$no_camellia],
                "rsaref" => 0,
                "gcc" => \$gcc,
                "debug" => \$debug,
index 2438600..38b92bc 100755 (executable)
@@ -84,7 +84,7 @@ my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" );
 my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF",
                         "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1",
                         "SHA256", "SHA512", "RIPEMD",
-                        "MDC2", "RSA", "DSA", "DH", "EC", "ECDH", "ECDSA", "HMAC", "AES",
+                        "MDC2", "RSA", "DSA", "DH", "EC", "ECDH", "ECDSA", "HMAC", "AES", "CAMELLIA",
                         # Envelope "algorithms"
                         "EVP", "X509", "ASN1_TYPEDEFS",
                         # Helper "algorithms"
@@ -111,7 +111,7 @@ my $no_rc2; my $no_rc4; my $no_rc5; my $no_idea; my $no_des; my $no_bf;
 my $no_cast;
 my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2;
 my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5;
-my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw;
+my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw; my $no_camellia;
 my $no_fp_api; my $no_static_engine; my $no_gmp; my $no_deprecated;
 
 
@@ -175,6 +175,7 @@ foreach (@ARGV, split(/ /, $options))
        elsif (/^no-ecdh$/)     { $no_ecdh=1; }
        elsif (/^no-hmac$/)     { $no_hmac=1; }
        elsif (/^no-aes$/)      { $no_aes=1; }
+       elsif (/^no-camellia$/) { $no_camellia=1; }
        elsif (/^no-evp$/)      { $no_evp=1; }
        elsif (/^no-lhash$/)    { $no_lhash=1; }
        elsif (/^no-stack$/)    { $no_stack=1; }
@@ -240,6 +241,7 @@ $crypto.=" crypto/mdc2/mdc2.h" ; # unless $no_mdc2;
 $crypto.=" crypto/sha/sha.h" ; # unless $no_sha;
 $crypto.=" crypto/ripemd/ripemd.h" ; # unless $no_ripemd;
 $crypto.=" crypto/aes/aes.h" ; # unless $no_aes;
+$crypto.=" crypto/camellia/camellia.h" ; # unless $no_camellia;
 
 $crypto.=" crypto/bn/bn.h";
 $crypto.=" crypto/rsa/rsa.h" ; # unless $no_rsa;
@@ -1089,6 +1091,7 @@ sub is_valid
                        if ($keyword eq "ECDH" && $no_ecdh) { return 0; }
                        if ($keyword eq "HMAC" && $no_hmac) { return 0; }
                        if ($keyword eq "AES" && $no_aes) { return 0; }
+                       if ($keyword eq "CAMELLIA" && $no_camellia) { return 0; }
                        if ($keyword eq "EVP" && $no_evp) { return 0; }
                        if ($keyword eq "LHASH" && $no_lhash) { return 0; }
                        if ($keyword eq "STACK" && $no_stack) { return 0; }
index cb0e282..f55d5b6 100755 (executable)
@@ -24,6 +24,7 @@ my @dirs = (
 "crypto/bf",
 "crypto/cast",
 "crypto/aes",
+"crypto/camellia",
 "crypto/bn",
 "crypto/rsa",
 "crypto/dsa",