[From nobody Sun Mar 22 09:13:08 2026
Received: (at submit) by bugs.debian.org; 6 Jul 2010 16:50:32 +0000
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
 (2008-06-10) on busoni.debian.org
X-Spam-Level: 
X-Spam-Bayes: score:0.0000 Tokens: new, 60; hammy, 148; neutral, 84; spammy,
 3. spammytokens:0.993-1--H*r:sk:mailpri, 0.987-1--H*RU:sk:mailpri,
 0.987-1--HX-Spam-Relays-External:sk:mailpri
 hammytokens:0.000-+--H*M:reportbug, 0.000-+--H*MI:reportbug,
 0.000-+--H*x:reportbug, 0.000-+--H*UA:reportbug, 0.000-+--H*x:3.48
X-Spam-Status: No, score=-9.9 required=4.0 tests=BAYES_00, FOURLA, HAS_PACKAGE,
 IMPRONONCABLE_2,MONOTONE_WORDS_2_15,XMAILER_REPORTBUG autolearn=ham
 version=3.2.5-bugs.debian.org_2005_01_02
Return-path: &lt;gac@4js.com&gt;
Received: from mail2007.strasbourg.4js.com ([84.14.60.197]
 helo=mailpri.strasbourg.4js.com)
 by busoni.debian.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.69) (envelope-from &lt;gac@4js.com&gt;) id 1OWBLr-00063T-Ec
 for submit@bugs.debian.org; Tue, 06 Jul 2010 16:50:31 +0000
Received: from tachikoma.strasbourg.4js.com (tachikoma.strasbourg.4js.com
 [10.0.0.10])
 by mailpri.strasbourg.4js.com (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id
 o66GbOna029403; Tue, 6 Jul 2010 18:37:24 +0200
Received: by tachikoma.strasbourg.4js.com (Postfix, from userid 1028)
 id A666C288013; Tue,  6 Jul 2010 18:37:24 +0200 (CEST)
Content-Type: text/plain; charset=&quot;us-ascii&quot;
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Gabriel CORRE &lt;gac@4js.com&gt;
To: Debian Bug Tracking System &lt;submit@bugs.debian.org&gt;
Subject: openssl randomly get into endless loop when using pipe output and
 limited read in sub process
Message-ID: &lt;20100706163724.24890.98305.reportbug@tachikoma.strasbourg.4js.com&gt;
X-Mailer: reportbug 3.48
Date: Tue, 06 Jul 2010 18:37:24 +0200
X-Virus-Scanned: clamav-milter 0.95.3 at mailpri
X-Virus-Status: Clean
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3
 (mailpri.strasbourg.4js.com [10.10.0.1]);
 Tue, 06 Jul 2010 18:37:24 +0200 (CEST)
X-Greylist: delayed 778 seconds by postgrey-1.31 at busoni;
 Tue, 06 Jul 2010 16:50:31 UTC
Delivered-To: submit@bugs.debian.org

Package: openssl
Version: 0.9.8g-15+lenny7
Severity: normal

This issue will not append not all the time.
I have got success and failure with the same keyfile, salt and input data.
When the issue appends, openssl seems enter in endless loop.

I use the -debug option to see :
1) without the issue

BEGIN
BIO[080BE738]:ctrl(106) - FILE pointer
BIO[080BE738]:ctrl return 1
BIO[080CC110]:ctrl(106) - FILE pointer
BIO[080CC110]:ctrl return 1
BIO[080CC110]:write(0,8) - FILE pointer
BIO[080CC110]:write return 8
BIO[080CC110]:write(0,8) - FILE pointer
BIO[080CC110]:write return 8
BIO[080CC2C0]:ctrl(6) - cipher
BIO[080CC110]:ctrl(6) - FILE pointer
BIO[080CC110]:ctrl return 0
BIO[080CC2C0]:ctrl return 0
BIO[080BE738]:read(0,32768) - FILE pointer
BIO[080BE738]:read return 512
BIO[080CC2C0]:write(0,512) - cipher
BIO[080CC110]:write(0,512) - FILE pointer
BIO[080CC110]:write return 512
BIO[080CC2C0]:write return 512
BIO[080BE738]:read(0,32768) - FILE pointer
BIO[080BE738]:read return 0
BIO[080CC2C0]:ctrl(11) - cipher
BIO[080CC110]:write(0,16) - FILE pointer
BIO[080CC110]:write return 16
BIO[080CC110]:ctrl(11) - FILE pointer
BIO[080CC110]:ctrl return 1
BIO[080CC2C0]:ctrl return 1
BIO[080BE738]:Free - FILE pointer
BIO[080CC110]:Free - FILE pointer
BIO[080CC2C0]:Free - cipher
END

2) with the issue

BEGIN
BIO[080BE738]:ctrl(106) - FILE pointer
BIO[080BE738]:ctrl return 1
BIO[080CC110]:ctrl(106) - FILE pointer
BIO[080CC110]:ctrl return 1
BIO[080CC110]:write(0,8) - FILE pointer
BIO[080CC110]:write return 8
BIO[080CC110]:write(0,8) - FILE pointer
BIO[080CC110]:write return 8
BIO[080CC2C0]:ctrl(6) - cipher
BIO[080CC110]:ctrl(6) - FILE pointer
BIO[080CC110]:ctrl return 0
BIO[080CC2C0]:ctrl return 0
BIO[080BE738]:read(0,32768) - FILE pointer
BIO[080BE738]:read return 512
BIO[080CC2C0]:write(0,512) - cipher
BIO[080CC110]:write(0,512) - FILE pointer
BIO[080CC110]:write return 0
BIO[080CC2C0]:write return 512
BIO[080BE738]:read(0,32768) - FILE pointer
BIO[080BE738]:read return 0
BIO[080CC2C0]:ctrl(11) - cipher
BIO[080CC110]:write(0,512) - FILE pointer
BIO[080CC110]:write return 0
BIO[080CC110]:write(0,512) - FILE pointer
BIO[080CC110]:write return 0
BIO[080CC110]:write(0,512) - FILE pointer
BIO[080CC110]:write return 0
BIO[080CC110]:write(0,512) - FILE pointer
BIO[080CC110]:write return 0
BIO[080CC110]:write(0,512) - FILE pointer
BIO[080CC110]:write return 0
BIO[080CC110]:write(0,512) - FILE pointer
BIO[080CC110]:write return 0
BIO[080CC110]:write(0,512) - FILE pointer
BIO[080CC110]:write return 0
BIO[080CC110]:write(0,512) - FILE pointer
BIO[080CC110]:write return 0
BIO[080CC110]:write(0,512) - FILE pointer
BIO[080CC110]:write return 0
BIO[080CC110]:write(0,512) - FILE pointer
BIO[080CC110]:write return 0
BIO[080CC110]:write(0,512) - FILE pointer
BIO[080CC110]:write return 0
BIO[080CC110]:write(0,512) - FILE pointer
BIO[080CC110]:write return 0
BIO[080CC110]:write(0,512) - FILE pointer
BIO[080CC110]:write return 0
BIO[080CC110]:write(0,512) - FILE pointer
BIO[080CC110]:write return 0
BIO[080CC110]:write(0,512) - FILE pointer
BIO[080CC110]:write return 0
BIO[080CC110]:write(0,512) - FILE pointer
[truncated]

My script to reproduce the issue :

#!/bin/sh

KEYFILE=/tmp/test.fakeprivatekey
TMPSALT=/tmp/test.salt
TMP=/tmp/test.head
RANDOMDATA=/tmp/test.random.data

if [ ! -f &quot;$KEYFILE&quot; ]; then
        dd if=/dev/urandom bs=1 count=512 of=&quot;$KEYFILE&quot;
        echo &quot;KEYFILE $KEYFILE created&quot;
fi
if [ ! -f &quot;$TMPSALT&quot; ]; then
        echo -n '06c69ac405593b94' &gt; &quot;$TMPSALT&quot;
        echo &quot;TMPSALT $TMPSALT created&quot;
fi
if [ ! -f &quot;$RANDOMDATA&quot; ]; then
        dd if=/dev/urandom obs=32768 count=1 2&gt;/dev/null &gt; &quot;$RANDOMDATA&quot;
        echo &quot;RANDOMDATA $RANDOMDATA created&quot;
fi

echo &quot;BEGIN check&quot;

# issue append a lot by this way :
openssl aes-256-cbc -debug -bufsize 32768 -pass file:$KEYFILE -salt -S &quot;`cat $TMPSALT`&quot; &lt; $RANDOMDATA \
| hexdump -n 16 &gt; &quot;$TMP&quot;

# issue not found by this way :
#openssl aes-256-cbc -debug -bufsize 32768 -pass file:$KEYFILE -salt -S &quot;`cat $TMPSALT`&quot; &lt; $RANDOMDATA &gt; $TMP2
#cat $TMP2 | hexdump -n 16 &gt; &quot;$TMP&quot;

echo &quot;END check&quot;



-- System Information:
Debian Release: 5.0.4
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages openssl depends on:
ii  libc6                  2.7-18lenny4      GNU C Library: Shared libraries
ii  libssl0.9.8            0.9.8g-15+lenny6  SSL shared libraries
ii  zlib1g                 1:1.2.3.3.dfsg-12 compression library - runtime

openssl recommends no packages.

Versions of packages openssl suggests:
ii  ca-certificates               20080809   Common CA certificates

-- no debconf information


]