From owner-freebsd-bugs@FreeBSD.ORG Sat Jan 8 04:20:23 2005 Return-Path: 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 DC24A16A4CE for ; Sat, 8 Jan 2005 04:20:22 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 961EC43D39 for ; Sat, 8 Jan 2005 04:20:22 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.1/8.13.1) with ESMTP id j084KMXc052727 for ; Sat, 8 Jan 2005 04:20:22 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.1/8.13.1/Submit) id j084KM8X052726; Sat, 8 Jan 2005 04:20:22 GMT (envelope-from gnats) Resent-Date: Sat, 8 Jan 2005 04:20:22 GMT Resent-Message-Id: <200501080420.j084KM8X052726@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, "Steven Alexander Jr." Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 884F816A4CE for ; Sat, 8 Jan 2005 04:18:58 +0000 (GMT) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4C64743D2F for ; Sat, 8 Jan 2005 04:18:58 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j084IvMQ066593 for ; Sat, 8 Jan 2005 04:18:57 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id j084Iuum065949; Sat, 8 Jan 2005 04:18:56 GMT (envelope-from nobody) Message-Id: <200501080418.j084Iuum065949@www.freebsd.org> Date: Sat, 8 Jan 2005 04:18:56 GMT From: "Steven Alexander Jr." To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Subject: bin/75934: [PATCH] missing blowfish functionality in passwd/libcrypt X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jan 2005 04:20:23 -0000 >Number: 75934 >Category: bin >Synopsis: [PATCH] missing blowfish functionality in passwd/libcrypt >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Jan 08 04:20:22 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Steven Alexander Jr. >Release: 5.3-RELEASE >Organization: individual >Environment: FreeBSD kernel.wayside.com 5.3-RELEASE FreeBSD 5.3-RELEASE #6: Fri Dec 31 19:48:24 PST 2004 root@kernel.wayside.com:/usr/src/sys/i386/compile/GENERIC i386 >Description: The blowfish crypt(3) mechanism supports the use of a "cost value" for password encryption. The cost value is encoded into the encrypted password that is stored in master.passwd. On OpenBSD, this cost value can be set in login.conf. FreeBSD does not currently support the cost value. The cost value is the base-2 logarithm of the number of rounds of encryption to use so rounds=1< #include #include - #include - #include - #include "blowfish.h" #include "crypt.h" --- 55,60 ---- *************** *** 147,157 **** u_int8_t csalt[BCRYPT_MAXSALT]; u_int32_t cdata[BCRYPT_BLOCKS]; static const char *magic = "$2a$04$"; - - struct passwd pw, *pwd; - char pwbuf[1024]; - - login_cap_t *lc; /* Defaults */ minr = 'a'; --- 144,149 ---- *************** *** 201,238 **** /* Discard num rounds + "$" identifier */ salt += 3; - } - else - { - /* We're crypting a new password. We want to get the - ln_rounds value that is stored in login.conf - and use it to initialize the rounds value. - ln_rounds is the base 2 logarithm of the - desired rounds value. */ - - if(getpwuid_r(getuid(), &pw, pwbuf, sizeof(pwbuf), &pwd) == 0) - { - if( (lc = login_getpwclass(pwd)) != NULL) - { - logr = (int)login_getcapnum(lc, "ln_rounds", logr, logr); - rounds = 1 << logr; - if(rounds < BCRYPT_MINROUNDS) - { - printf("ln_rounds in login.conf is too small\n"); - return error; - } - } - else - { - printf("could not look up capability\n"); - return error; - } - } - else - { - printf("Could not look up current user %d\n", getuid()); - return error; - } } --- 193,198 ---- >How-To-Repeat: Observe all blowfish encrypted passwords begin with $2a$04$. Blowfish can be turned on by setting ":passwd_format=blf:" in login.conf and running "cap_mkdb /etc/login.conf". >Fix: begin 644 libcrypt.patch M9&EF9B`M8R`N+W-E8W5R92]L:6(O;&EB8W)Y<'0O8W)Y<'0M8FQO=V9I7!T+6)L;W=F:7-H+F,* M*BHJ("XO7!T+6YE=R]CPHK(`D)+RH@5V4GF4@=&AE(')O=6YD MPHK(`D):68H("AL8R`](&QO9VEN7V=E='!W8VQAPHK(`D@("`@("`@("`@("!L;V=R(#T@*&EN M="EL;V=I;E]G971C87!N=6TH;&,L(")L;E]R;W5N9',B+"!L;V=R+"!L;V=R M*3L**R`)"2`@("!R;W5N9',@/2`Q(#P\(&QO9W(["BL@"0D@("`@:68HRelease-Note: >Audit-Trail: >Unformatted: