From nobody@FreeBSD.org  Sat Jan 15 19:00:47 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 CBCCF16A4CF
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 15 Jan 2005 19:00:47 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B422043D53
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 15 Jan 2005 19:00:47 +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 j0FJ0l3T008325
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 15 Jan 2005 19:00:47 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j0FJ0lmY008316;
	Sat, 15 Jan 2005 19:00:47 GMT
	(envelope-from nobody)
Message-Id: <200501151900.j0FJ0lmY008316@www.freebsd.org>
Date: Sat, 15 Jan 2005 19:00:47 GMT
From: Kenichi Morioka <morioka@openloop.co.jp>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [Corrected version of ports/76117] `security/digest' with sha256 output miss-match hash vale.
X-Send-Pr-Version: www-2.3

>Number:         76288
>Category:       ports
>Synopsis:       [Corrected version of ports/76117] `security/digest' with sha256 output miss-match hash vale.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 15 19:10:30 GMT 2005
>Closed-Date:    Sun Jan 16 01:14:28 GMT 2005
>Last-Modified:  Sun Jan 16 01:14:28 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 consisting of 55-bytes data to security/digest command with sha256, the hash value is miss match.


=== An example (All data value is hexadecimal representation.) ===

  [input data (55 bytes)]

    30313233343536373839414243444546303132333435363738394142434445463031323334353637383941424344454630313233343530a

  [Output data value (by security/digest with sha256)]

    e875cdeea84dd34be39352361383e370b01b8844ee5559f7ce3b1060bff043d0 (Miss match!)

  [Expected data value]

    3f234cc4c9938ee4fff8642ff108808ae303b7ab405c0ea5f9637541000164b5

==============================================================
>How-To-Repeat:
 Every time, the miss-match hash-value appears only by inputting the file consisting of 55-bytes data to `security/digest' command in sha256.
>Fix:
  I think that it is good to correct `the 64-bytes message block generator' in sha256 (SHA256_Update() or SHA256_Final() in sha2.c).

(I think that the cause of this problem is not the implementation of sha256 transform alogorithm but the process of input-message.)

--
Because that the 55-bytes input-message becomes just 64 bytes block after `the message terminator code(0x80)' and `size-field(8-bytes field)' are added.
Perhaps, I think the block of a lot of one be made at this time.
     
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: pav 
State-Changed-When: Sun Jan 16 01:14:15 GMT 2005 
State-Changed-Why:  
Replaced by ports/76289 

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