From owner-freebsd-bugs@freebsd.org Sat Dec 15 02:32:17 2018 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD5BC132CAB8 for ; Sat, 15 Dec 2018 02:32:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 674B877B2A for ; Sat, 15 Dec 2018 02:32:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 25655132CAB7; Sat, 15 Dec 2018 02:32:17 +0000 (UTC) Delivered-To: bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00506132CAB0 for ; Sat, 15 Dec 2018 02:32:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8A98877B1F for ; Sat, 15 Dec 2018 02:32:16 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) 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 mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id C4B5F7848 for ; Sat, 15 Dec 2018 02:32:15 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id wBF2WFiN081783 for ; Sat, 15 Dec 2018 02:32:15 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id wBF2WFaB081781 for bugs@FreeBSD.org; Sat, 15 Dec 2018 02:32:15 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 234028] Openssl cannot decrypt properly Date: Sat, 15 Dec 2018 02:32:15 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 12.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: cem@freebsd.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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.29 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Dec 2018 02:32:18 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D234028 --- Comment #1 from Conrad Meyer --- When I do the same thing on 11.2ish with a 16-byte plaintext file, it uses aes-256-cbc and produces a 48 byte output. I am able to reproduce, sort of =E2=80=94 I don't get bogus output, but a d= ecryption error instead. Because it may be useful, here is the output with '-v -v -v -debug' too: ENCRYPT, 11.x: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D BIO[0x801816070]: ctrl(108) - FILE pointer BIO[0x801816070]: ctrl return 1 enter aes-256-cbc encryption password: Verifying - enter aes-256-cbc encryption password: BIO[0x8018160e0]: ctrl(108) - FILE pointer BIO[0x8018160e0]: ctrl return 1 BIO[0x8018160e0]: write(0,8) - FILE pointer BIO[0x8018160e0]: write return 8 BIO[0x8018160e0]: write(0,8) - FILE pointer BIO[0x8018160e0]: write return 8 BIO[0x801816150]: ctrl(6) - cipher BIO[0x8018160e0]: ctrl(6) - FILE pointer BIO[0x8018160e0]: ctrl return 0 BIO[0x801816150]: ctrl return 0 BIO[0x801816070]: read(0,8192) - FILE pointer BIO[0x801816070]: read return 16 BIO[0x801816150]: write(0,16) - cipher BIO[0x8018160e0]: write(0,16) - FILE pointer BIO[0x8018160e0]: write return 16 BIO[0x801816150]: write return 16 BIO[0x801816070]: read(0,8192) - FILE pointer BIO[0x801816070]: read return 0 BIO[0x801816150]: ctrl(11) - cipher BIO[0x8018160e0]: write(0,16) - FILE pointer BIO[0x8018160e0]: write return 16 BIO[0x8018160e0]: ctrl(11) - FILE pointer BIO[0x8018160e0]: ctrl return 1 BIO[0x801816150]: ctrl return 1 bytes read : 16 bytes written: 48 BIO[0x801816070]: Free - FILE pointer BIO[0x8018160e0]: Free - FILE pointer BIO[0x801816150]: Free - cipher DECRYPT, CURRENT: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D bufsize=3D8192 enter aes-256-cbc decryption password: BIO[0x800aea180]: read(0,8) - FILE pointer BIO[0x800aea180]: read return 8 BIO[0x800aea180]: read(0,8) - FILE pointer BIO[0x800aea180]: read return 8 *** WARNING : deprecated key derivation used. Using -iter or -pbkdf2 would be better. BIO[0x800aea280]: ctrl(6) - cipher BIO[0x800aea200]: ctrl(6) - FILE pointer BIO[0x800aea200]: ctrl return 0 BIO[0x800aea280]: ctrl return 0 BIO[0x800aea180]: read(0,8192) - FILE pointer BIO[0x800aea180]: read return 32 BIO[0x800aea280]: write(0,32) - cipher BIO[0x800aea200]: write(0,16) - FILE pointer BIO[0x800aea200]: write return 16 BIO[0x800aea280]: write return 32 BIO[0x800aea180]: read(0,8192) - FILE pointer BIO[0x800aea180]: read return 0 BIO[0x800aea280]: ctrl(11) - cipher BIO[0x800aea280]: ctrl return 0 bad decrypt 34371153920:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:/usr/home/conrad/src/freebsd/crypto/openssl/crypto/evp/evp_enc.c:53= 7: BIO[0x800aea180]: Free - FILE pointer BIO[0x800aea200]: Free - FILE pointer BIO[0x800aea280]: Free - cipher Additionally, running the same encryption command on CURRENT with the same plaintext produces a different ciphertext. But result is salted, so that i= sn't very surprising. CURRENT openssl is able to decrypt the output from the enc command on CURRENT. The debug output is identical, up to this point: BIO[0x800aea280]: write return 32 BIO[0x800aea180]: read(0,8192) - FILE pointer BIO[0x800aea180]: read return 0 BIO[0x800aea280]: ctrl(11) - cipher -------------------------------------- diverges BIO[0x800aea200]: ctrl(11) - FILE pointer BIO[0x800aea200]: ctrl return 1 BIO[0x800aea280]: ctrl return 1 bytes read : 48 bytes written: 16 --=20 You are receiving this mail because: You are the assignee for the bug.=