From yanagisawa@mana.csg.is.titech.ac.jp  Sun Jun 17 08:32:00 2007
Return-Path: <yanagisawa@mana.csg.is.titech.ac.jp>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 43FD316A46B
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 17 Jun 2007 08:32:00 +0000 (UTC)
	(envelope-from yanagisawa@mana.csg.is.titech.ac.jp)
Received: from mana.csg.is.titech.ac.jp (mana.csg.is.titech.ac.jp [131.112.40.170])
	by mx1.freebsd.org (Postfix) with ESMTP id 0615813C468
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 17 Jun 2007 08:31:59 +0000 (UTC)
	(envelope-from yanagisawa@mana.csg.is.titech.ac.jp)
Received: from mana.csg.is.titech.ac.jp (localhost [127.0.0.1])
	by mana.csg.is.titech.ac.jp (8.13.8/8.13.8) with ESMTP id l5H8Vw3R017712;
	Sun, 17 Jun 2007 17:31:58 +0900 (JST)
	(envelope-from yanagisawa@mana.csg.is.titech.ac.jp)
Received: (from yanagisawa@localhost)
	by mana.csg.is.titech.ac.jp (8.13.8/8.13.8/Submit) id l5H8Vwt1017711;
	Sun, 17 Jun 2007 17:31:58 +0900 (JST)
	(envelope-from yanagisawa)
Message-Id: <200706170831.l5H8Vwt1017711@mana.csg.is.titech.ac.jp>
Date: Sun, 17 Jun 2007 17:31:58 +0900 (JST)
From: Yoshisato YANAGISAWA <yanagisawa@csg.is.titech.ac.jp>
Reply-To: Yoshisato YANAGISAWA <yanagisawa@csg.is.titech.ac.jp>
To: FreeBSD-gnats-submit@freebsd.org
Cc: Pawel Jakub Dawidek <pjd@freebsd.org>
Subject: [patch] enable the Camellia block cipher on GEOM ELI (geli).
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         113790
>Category:       kern
>Synopsis:       [patch] enable the Camellia block cipher on GEOM ELI (geli).
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pjd
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun 17 08:40:02 GMT 2007
>Closed-Date:    Sat Sep 01 06:34:25 GMT 2007
>Last-Modified:  Sat Sep  1 06:40:01 GMT 2007
>Originator:     Yoshisato YANAGISAWA
>Release:        7.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD gemma.pv.csg.is.titech.ac.jp 7.0-CURRENT FreeBSD 7.0-CURRENT #2: Sat Jun 16 13:59:33 JST 2007     yanagisawa@gemma.pv.csg.is.titech.ac.jp:/usr/obj/usr/src/sys/GENERIC  i386


	
>Description:

I made a small patch to enable the Camellia block cipher on GEOM ELI (geli).
FreeBSD project integrates support for the cipher recently.
http://www.emediawire.com/releases/2007/6/emw531216.htm
If you can, will you import this code into the base tree?

Thank you in advance.
Maintainer is cc'd.

diff -ruN src.bak/sbin/geom/class/eli/geli.8 src/sbin/geom/class/eli/geli.8
--- src.bak/sbin/geom/class/eli/geli.8	2007-03-05 21:39:49.000000000 +0900
+++ src/sbin/geom/class/eli/geli.8	2007-06-16 13:48:37.000000000 +0900
@@ -146,7 +146,8 @@
 .It
 Supports many cryptographic algorithms (currently
 .Nm AES ,
-.Nm Blowfish
+.Nm Blowfish ,
+.Nm Camellia
 and
 .Nm 3DES ) .
 .It
@@ -227,7 +228,8 @@
 Encryption algorithm to use.
 Currently supported algorithms are:
 .Nm AES ,
-.Nm Blowfish
+.Nm Blowfish ,
+.Nm Camellia
 and
 .Nm 3DES .
 The default is
@@ -260,7 +262,9 @@
 128 for
 .Nm AES ,
 128 for
-.Nm Blowfish
+.Nm Blowfish ,
+128 for
+.Nm Camellia
 and 192 for
 .Nm 3DES .
 .It Fl s Ar sectorsize
diff -ruN src.bak/sys/geom/eli/g_eli.h src/sys/geom/eli/g_eli.h
--- src.bak/sys/geom/eli/g_eli.h	2006-09-16 19:43:17.000000000 +0900
+++ src/sys/geom/eli/g_eli.h	2007-06-16 13:50:23.000000000 +0900
@@ -286,6 +286,8 @@
 		return (CRYPTO_AES_CBC);
 	else if (strcasecmp("blowfish", name) == 0)
 		return (CRYPTO_BLF_CBC);
+	else if (strcasecmp("camellia", name) == 0)
+		return (CRYPTO_CAMELLIA_CBC);
 	else if (strcasecmp("3des", name) == 0)
 		return (CRYPTO_3DES_CBC);
 	return (CRYPTO_ALGORITHM_MIN - 1);
@@ -321,6 +323,8 @@
 		return ("AES-CBC");
 	case CRYPTO_BLF_CBC:
 		return ("Blowfish-CBC");
+	case CRYPTO_CAMELLIA_CBC:
+		return ("CAMELLIA-CBC");
 	case CRYPTO_3DES_CBC:
 		return ("3DES-CBC");
 	case CRYPTO_MD5_HMAC:
@@ -390,7 +394,8 @@
 				keylen = 0;
 		}
 		return (keylen);
-	case CRYPTO_AES_CBC:
+	case CRYPTO_AES_CBC: /* FALLTHROUGH */
+	case CRYPTO_CAMELLIA_CBC:
 		switch (keylen) {
 		case 0:
 			return (128);
diff -ruN src.bak/sys/geom/eli/g_eli_crypto.c src/sys/geom/eli/g_eli_crypto.c
--- src.bak/sys/geom/eli/g_eli_crypto.c	2007-03-21 12:42:50.000000000 +0900
+++ src/sys/geom/eli/g_eli_crypto.c	2007-06-16 13:51:23.000000000 +0900
@@ -158,6 +158,21 @@
 	case CRYPTO_BLF_CBC:
 		type = EVP_bf_cbc();
 		break;
+	case CRYPTO_CAMELLIA_CBC:
+		switch (keysize) {
+		case 128:
+			type = EVP_camellia_128_cbc();
+			break;
+		case 192:
+			type = EVP_camellia_192_cbc();
+			break;
+		case 256:
+			type = EVP_camellia_256_cbc();
+			break;
+		default:
+			return (EINVAL);
+		}
+		break;
 	case CRYPTO_3DES_CBC:
 		type = EVP_des_ede3_cbc();
 		break;

	
>How-To-Repeat:
	
>Fix:

	


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-geom 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Jun 17 09:14:33 UTC 2007 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=113790 

From: Yoshisato YANAGISAWA <yanagisawa@csg.is.titech.ac.jp>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc:  
Subject: Re: kern/113790: [patch] enable the Camellia block cipher on GEOM
 ELI (geli).
Date: Sun, 24 Jun 2007 21:33:21 +0900

 Since the patch I sent with PR is hard to read,  I also put it:
 http://www.csg.is.titech.ac.jp/~yanagisawa/programs/geli_camellia.diff
 

From: Yoshisato YANAGISAWA <yanagisawa@csg.is.titech.ac.jp>
To: Pawel Jakub Dawidek <pjd@FreeBSD.org>
Cc: freebsd-geom@FreeBSD.org, FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: kern/113790: [patch] enable the Camellia block cipher on GEOM
 ELI (geli).
Date: Wed, 27 Jun 2007 18:16:37 +0900

 On Mon, 25 Jun 2007 22:12:06 +0200
 Pawel Jakub Dawidek <pjd@FreeBSD.org> wrote:
 
 > The patch looks good on first look. I wasn't able to test it yet as
 > I'm very busy at the moment. I'll try to test everything and ask re@
 > for approval to commit before 7.0-RELEASE. In the mean time, you
 
 Thank you for reading my patch.
 
 > could add camellia to geli regression tests
 > (src/tools/regression/geom_eli/) and update the patch. Thanks!
 
 Ok, I wrote regression tests and updated the patch:
 http://www.csg.is.titech.ac.jp/~yanagisawa/programs/geli_camellia.diff
 
 Then, I did regression tests with "prove -v geom_eli" and it seems good
 although I saw some warnings.  The test log is:
 http://www.csg.is.titech.ac.jp/~yanagisawa/programs/geli_camellia_test.txt
 
 Thank you in advance.
 
 -- 
 -------------------------------------------------------
 Yoshisato YANAGISAWA <yanagisawa@csg.is.titech.ac.jp>
 Dept. of Mathematical and Computing Sciences,
 Graduate School of Information Science and Engineering,
 Tokyo Institute of Technology.
 /* If you are an *BSD user, let's join http://bsdstats.org/ */
State-Changed-From-To: open->closed 
State-Changed-By: pjd 
State-Changed-When: Sat Sep 1 06:33:25 UTC 2007 
State-Changed-Why:  
Patch committed to HEAD. Thank you! 


Responsible-Changed-From-To: freebsd-geom->pjd 
Responsible-Changed-By: pjd 
Responsible-Changed-When: Sat Sep 1 06:33:25 UTC 2007 
Responsible-Changed-Why:  
GELI is mine. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=113790 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/113790: commit references a PR
Date: Sat,  1 Sep 2007 06:33:11 +0000 (UTC)

 pjd         2007-09-01 06:33:02 UTC
 
   FreeBSD src repository
 
   Modified files:
     sbin/geom/class/eli  geli.8 
     sys/geom/eli         g_eli.h g_eli_crypto.c 
     tools/regression/geom_eli init-a.t init.t integrity-copy.t 
                               integrity-data.t integrity-hmac.t 
                               onetime-a.t onetime.t 
   Log:
   Add support for Camellia encryption algorithm.
   
   PR:             kern/113790
   Submitted by:   Yoshisato YANAGISAWA <yanagisawa@csg.is.titech.ac.jp>
   Approved by:    re (bmah)
   
   Revision  Changes    Path
   1.22      +11 -3     src/sbin/geom/class/eli/geli.8
   1.13      +6 -1      src/sys/geom/eli/g_eli.h
   1.5       +15 -0     src/sys/geom/eli/g_eli_crypto.c
   1.2       +3 -2      src/tools/regression/geom_eli/init-a.t
   1.3       +3 -2      src/tools/regression/geom_eli/init.t
   1.2       +3 -2      src/tools/regression/geom_eli/integrity-copy.t
   1.2       +3 -2      src/tools/regression/geom_eli/integrity-data.t
   1.2       +3 -2      src/tools/regression/geom_eli/integrity-hmac.t
   1.2       +3 -2      src/tools/regression/geom_eli/onetime-a.t
   1.3       +3 -2      src/tools/regression/geom_eli/onetime.t
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
