From nobody@FreeBSD.org  Tue Jan 11 16:06:17 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id AE6B516A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 11 Jan 2005 16:06:17 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 981C643D2F
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 11 Jan 2005 16:06:17 +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 j0BG6HYG045497
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 11 Jan 2005 16:06:17 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j0BG6Hme045496;
	Tue, 11 Jan 2005 16:06:17 GMT
	(envelope-from nobody)
Message-Id: <200501111606.j0BG6Hme045496@www.freebsd.org>
Date: Tue, 11 Jan 2005 16:06:17 GMT
From: Kenichi Morioka <morioka@openloop.co.jp>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Invalid hash-value is output by  the `digest' command with sha256 mode.
X-Send-Pr-Version: www-2.3

>Number:         76106
>Category:       misc
>Synopsis:       Invalid hash-value is output by  the `digest' command with sha256 mode.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 11 16:10:30 GMT 2005
>Closed-Date:    Sun Feb 06 20:14:38 GMT 2005
>Last-Modified:  Sun Feb 06 20:14:38 GMT 2005
>Originator:     Kenichi Morioka
>Release:        4-10 RELEASE
>Organization:
Openloop Inc.
>Environment:
FreeBSD gw1 4.10-RELEASE FreeBSD 4.10-RELEASE #0: Tue Oct 12 08:45:15 JST 2004     root@gw1:/usr/src/sys/compile/GATEWAY-001
i386
>Description:
            When inputting a file including 54-byte data, the digest command output invalid hash value.
(where, the input data size is 55-byte as including return code(0x0a).)

In a word, when inputting the 55-byte message data to sha256, output value is invalid.
Such a result is only when using 55-byte input data.
>How-To-Repeat:
      When a file including 54-byte(size of that final data becomes 55-byte) is input to `digest' in sha256-mode.
>Fix:
      I think that it is good to correct `the 64-byte message block generator' in sha256 (SHA256_Update() or SHA256_Final() in sha2.c).
(I think that this cause of this problem is not the implementation of sha256 transform alogorithm but the process of input message block.)

--
Because that the message of 55-bytes is the values that become just 64 bytes when `the message terminator code(0x80)' and `size-field(8-byte)' are added.
Perhaps, I think this block of a lot of one be made at this time.

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Sun Feb 6 20:14:07 GMT 2005 
State-Changed-Why:  
Superceeded by ports/76289. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=76106 
>Unformatted:
