From owner-freebsd-bugs@FreeBSD.ORG Wed Dec 3 17:45:14 2014 Return-Path: Delivered-To: freebsd-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1B59D155 for ; Wed, 3 Dec 2014 17:45:14 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE4BE1D5 for ; Wed, 3 Dec 2014 17:45:13 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.9/8.14.9) with ESMTP id sB3HjDGd008382 for ; Wed, 3 Dec 2014 17:45:13 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 195630] New: Calling ecb_crypt()/cbc_crypt() actually does not encrypt or decrypt the passed data buffer Date: Wed, 03 Dec 2014 17:45:13 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: misc X-Bugzilla-Version: 10.1-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: ebfe@inbox.ru X-Bugzilla-Status: New X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Dec 2014 17:45:14 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195630 Bug ID: 195630 Summary: Calling ecb_crypt()/cbc_crypt() actually does not encrypt or decrypt the passed data buffer Product: Base System Version: 10.1-STABLE Hardware: amd64 OS: Any Status: New Severity: Affects Only Me Priority: --- Component: misc Assignee: freebsd-bugs@FreeBSD.org Reporter: ebfe@inbox.ru Created attachment 150148 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=150148&action=edit minimal poc code in C Calling ecb_crypt()/cbc_crypt() actually does not encrypt or decrypt the passed data buffer but returns a [DESERR_NOHWDEVICE] " == Encryption succeeded, but done in software". See attached poc.c Details: Component: des_crypt, /usr/src/lib/libc/rpc/des_crypt.c OS: FreeBSD 10.1 STABLE man ecb_crypt(3) says "The ecb_crypt() and cbc_crypt() functions implement the NBS DES ... The ecb_crypt() function encrypts in ECB (Electronic Code Book) mode, which encrypts blocks of data independently. The cbc_crypt() function encrypts in CBC (Cipher Block Chaining) mode, which chains together successive blocks." but actually - "nothing happens" and "it doesn't work!(tm)" (the return code suggests a successfull encryption stept but the data remains unmodified) How to reproduce: ------------ #define LEN 8 char key1[LEN] = "testkey1"; char secret1[LEN] = "secret 1"; des_setparity(key1); ecb_crypt(key1, secret1, LEN, DES_ENCRYPT); printf("ecb_crypt result: key: %.*s, encrypted buf: %.*s\n", LEN, key1, LEN, secret1); ----------- see the poc.c for a minimal example. PS: And no, I am not using ecb/cbc_crypt in my software ;) - some time ago I tried to implement some kind of a "master password" extension for claws-mail (e-mail client). I was surprised by the fact, that the passwords for email-accouts are stored in plain text (encoded in base64) and not obfuscated with DES-foo-magic (DES-encryption with hard-coded password, mentioned multiple times in claws mailing list) - it turned out, that claws-mail's code for password obfuscation calls ecb_crypt on FreeBSD. -- You are receiving this mail because: You are the assignee for the bug.