From owner-freebsd-bugs@FreeBSD.ORG Sun Aug 7 23:40:16 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C326C16A41F for ; Sun, 7 Aug 2005 23:40:16 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D8E2A43EBE for ; Sun, 7 Aug 2005 23:40:15 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j77NeFJ9000738 for ; Sun, 7 Aug 2005 23:40:15 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j77NeFDA000737; Sun, 7 Aug 2005 23:40:15 GMT (envelope-from gnats) Resent-Date: Sun, 7 Aug 2005 23:40:15 GMT Resent-Message-Id: <200508072340.j77NeFDA000737@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Benjamin Lutz Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9017F16A41F; Sun, 7 Aug 2005 23:36:25 +0000 (GMT) (envelope-from maxlor@maxlor.mine.nu) Received: from maxlor.mine.nu (c-213-160-32-54.customer.ggaweb.ch [213.160.32.54]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2827D43EBD; Sun, 7 Aug 2005 23:36:25 +0000 (GMT) (envelope-from maxlor@maxlor.mine.nu) Received: from localhost (localhost [127.0.0.1]) by maxlor.mine.nu (Postfix) with ESMTP id 1CFFF3C0; Mon, 8 Aug 2005 01:36:22 +0200 (CEST) Received: from maxlor.mine.nu ([127.0.0.1]) by localhost (midgard [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 28348-09; Mon, 8 Aug 2005 01:36:21 +0200 (CEST) Received: by maxlor.mine.nu (Postfix, from userid 1000) id 09C53347; Mon, 8 Aug 2005 01:36:21 +0200 (CEST) Message-Id: <20050807233621.09C53347@maxlor.mine.nu> Date: Mon, 8 Aug 2005 01:36:21 +0200 (CEST) From: Benjamin Lutz To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Pawel Jakub Dawidek Subject: kern/84659: geli accepts only lower case algorithm names X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Benjamin Lutz List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2005 23:40:17 -0000 >Number: 84659 >Category: kern >Synopsis: geli accepts only lower case algorithm names >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Aug 07 23:40:15 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Benjamin Lutz >Release: FreeBSD 6.0-BETA2 amd64 >Organization: >Environment: System: FreeBSD merlin 6.0-BETA2 FreeBSD 6.0-BETA2 #4: Mon Aug 8 01:09:06 CEST 2005 root@merlin:/usr/obj/usr/src/sys/MERLIN64 amd64 >Description: In the geli(8) manpage, it says that either AES, Blowfish or 3DES should used as algorithm. In practice, however, geli accepts only "aes", "blowfish" and "3des", ie lower case versions. I think this is a bug, and either the manpage should be synced with the code, or, better, the code should allow both upper and lower case names, or only upper case names. I have played around with the code a bit, see the diff below. >How-To-Repeat: $ geli init -a Blowfish /dev/md0 Invalid encryption algorithm. $ geli init -a AES /dev/md0 Invalid encryption algorithm. $ >Fix: --- g_eli.h.diff begins here --- --- g_eli.h.orig Fri Aug 5 21:58:14 2005 +++ g_eli.h Mon Aug 8 01:27:48 2005 @@ -36,9 +36,11 @@ #include #ifdef _KERNEL #include +#include #include #include #else +#include #include #include #endif @@ -222,14 +224,22 @@ static __inline u_int g_eli_str2algo(const char *name) { + char lc_name[9]; + unsigned int i; - if (strcmp("null", name) == 0) + strlcpy(lc_name, name, sizeof(lc_name)); + for(i = 0; lc_name[i] != '\0'; i++) + { + lc_name[i] = tolower(lc_name[i]); + } + + if (strcmp("null", lc_name) == 0) return (CRYPTO_NULL_CBC); - if (strcmp("aes", name) == 0) + if (strcmp("aes", lc_name) == 0) return (CRYPTO_AES_CBC); - else if (strcmp("blowfish", name) == 0) + else if (strcmp("blowfish", lc_name) == 0) return (CRYPTO_BLF_CBC); - else if (strcmp("3des", name) == 0) + else if (strcmp("3des", lc_name) == 0) return (CRYPTO_3DES_CBC); return (CRYPTO_ALGORITHM_MIN - 1); } --- g_eli.h.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: