Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 213088 - app-crypt/mcrypt-2.6.7 doesn't work properly with openpgp format
Summary: app-crypt/mcrypt-2.6.7 doesn't work properly with openpgp format
Status: RESOLVED DUPLICATE of bug 426914
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Lowest normal with 1 vote (vote)
Assignee: Robin Johnson
URL: http://sourceforge.net/tracker/index....
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-11 23:31 UTC by Fabio Rossi
Modified: 2012-12-22 21:02 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
x1.nc (Passphrase: passphrase) (x1.nc,80.68 KB, application/octet-stream)
2008-04-17 06:54 UTC, Alon Bar-Lev (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fabio Rossi 2008-03-11 23:31:04 UTC
First I tried to crypt the file...

$ mcrypt -V linux_logo.gif
Enter the passphrase (maximum of 512 characters)
Please use a combination of upper and lower case letters and numbers.
Enter passphrase: linux
Enter passphrase: linux

Algorithm: rijndael-128
Keysize: 32
Mode: ncfb
Keyword mode: s2k-isalted-sha1
File format: openpgp
Input File: linux_logo.gif
Output File: linux_logo.gif.nc

File linux_logo.gif was encrypted.

... but during decrypting ...

$ mcrypt -d -V linux_logo.gif.nc
Enter passphrase: linux
decryption: wrong key.
Algorithm: rijndael-128
Keysize: 32
Mode: ncfb
Keyword mode: s2k-isalted-sha1
File format: openpgp
Input File: linux_logo.gif.nc
Output File: linux_logo.gif

File linux_logo.gif.nc was NOT decrypted successfully.


I'm sure that the  password inserted is right (you can also try with an empty password). It works if I change to the mcrypt format (with --no-openpgp).

$ mcrypt --no-openpgp -V linux_logo.gif
Enter the passphrase (maximum of 512 characters)
Please use a combination of upper and lower case letters and numbers.
Enter passphrase: linux
Enter passphrase: linux

Algorithm: rijndael-128
Keysize: 32
Mode: cbc
Keyword mode: mcrypt-sha1
File format: mcrypt
Input File: linux_logo.gif
Output File: linux_logo.gif.nc

File linux_logo.gif was encrypted.

and then ...

$ mcrypt --no-openpgp -d -V linux_logo.gif.nc
Enter passphrase: linux
Algorithm: rijndael-128
Keysize: 32
Mode: cbc
Keyword mode: mcrypt-sha1
File format: mcrypt
Input File: linux_logo.gif.nc
Output File: linux_logo.gif

File linux_logo.gif.nc was decrypted.
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-03-12 19:45:02 UTC
Works fine for me. Please post your emerge --info.

root@grubbs-int:/tmp # cp test.txt.orig test.txt; 
root@grubbs-int:/tmp # mcrypt -V test.txt 
Enter the passphrase (maximum of 512 characters)
Please use a combination of upper and lower case letters and numbers.
Enter passphrase: 
Enter passphrase: 

Algorithm: rijndael-128
Keysize: 32
Mode: ncfb
Keyword mode: s2k-isalted-sha1
File format: openpgp
Input File: test.txt
Output File: test.txt.nc

File test.txt was encrypted.
root@grubbs-int:/tmp # rm test.txt
root@grubbs-int:/tmp # mcrypt -d  -V test.txt.nc
Enter passphrase: 
Algorithm: rijndael-128
Keysize: 32
Mode: ncfb
Keyword mode: s2k-isalted-sha1
File format: openpgp
Input File: test.txt.nc
Output File: test.txt

File test.txt.nc was decrypted.
root@grubbs-int:/tmp # md5sum test.txt test.txt.orig
e1656e417993e7977d222cb4564c29b6  test.txt
e1656e417993e7977d222cb4564c29b6  test.txt.orig
Comment 2 Fabio Rossi 2008-03-12 23:05:46 UTC
On my system mcrypt works with text files but not with bin files.

emerge --info:

Portage 2.1.4.4 (default-linux/x86/2006.1, gcc-4.1.2, glibc-2.6.1-r0, 2.6.23-gentoo-r9 i686)
=================================================================
System uname: 2.6.23-gentoo-r9 i686 AMD Athlon(tm) Processor
Timestamp of tree: Sun, 09 Mar 2008 13:16:01 +0000
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.4 [disabled]
app-shells/bash:     3.2_p17-r1
dev-java/java-config: 1.3.7, 2.1.4
dev-lang/python:     2.4.4-r9
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=athlon-tbird -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -march=athlon-tbird -pipe"
DISTDIR="/mnt/lfs/distfiles/"
EMERGE_DEFAULT_OPTS="--with-bdeps=y"
FEATURES="distlocks metadata-transfer parallel-fetch sandbox sfperms splitdebug strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ ftp://ftp.solnet.ch/mirror/Gentoo http://gentoo.mneisen.org/ http://gentoo.mirror.solnet.ch"
LANG="it_IT.UTF-8"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage-overlays/voip /usr/local/portage-overlays/sunrise /usr/local/portage-overlays/gechi /usr/local/portage-overlays/science /usr/local/portage-overlays/__mine__"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X aac acl alsa amr apache2 arts asf audiofile bash-completion berkdb blas bluetooth boehm-gc bonobo bzip2 cairo caps cddb cdparanoia chroot cli cmucl cracklib crypt css cups curl dbus directfb dri dv dvb dvd dvdr dvdread encode examples exif expat fame ffmpeg fftw firefox flac foomaticdb fortran fpx gcj gd gdbm gif gimpprint ginac glut gmp gnutls gphoto2 gpm graphviz gs gsl gtk gtk2 gtkhtml guile iconv idn imagemagick imlib isdnlog java jbig jpeg jpeg2k kde kdeenablefinal lame lcms libwww live lm_sensors logitech-mouse lzo mad mhash midi mikmod mjpeg mmx mmxext mng motif mozdevelop mp3 mpeg mudflap mysql ncurses network nls nntp nptl nptlonly obex ogg opengl openmp oss pam pcre pdf perl php plotutils png ppds pppd python qt3 qt4 quicktime readline real realmedia recode reflection samba sdl session skey speex spell spl sql ssl stats subversion svg tcl tcltk tcpd tetex theora threads tiff tk truetype unicode usb vim vim-syntax vim-with-x vorbis wifi win32codecs wma wmf wxwindows x264 x86 xanim xine xml xorg xv xvid yv12 zlib" ALSA_CARDS="emu10k1" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="mouse keyboard" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="radeon vesa fbdev vga v4l"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 3 Alon Bar-Lev (RETIRED) gentoo-dev 2008-04-17 06:54:33 UTC
Created attachment 150017 [details]
x1.nc (Passphrase: passphrase)

Can confirm an issue with mcrypt, not going to investigate this further.
Attached is x1.nc

cp libsegfault.tar.bz2 x1
mcrypt x1
mcrypt -d x1.nc (DOES NOT WORK)
gpg --decrypt x1.nc (WORK)
Comment 4 Michael Surran 2008-10-05 20:24:44 UTC
(In reply to comment #3)
> Created an attachment (id=150017) [edit]
> x1.nc
> 
> Can confirm an issue with mcrypt, not going to investigate this further.
> Attached is x1.nc

I can also confirm this bug. I have software that uses mcrypt on an intranet server that encrypts the data and uploads it to a web server. My ability to decrypt this data on the web server broke when I upgraded to version 2.6.7 of mcrypt on the intranet server (used for encryption). I downgraded to 2.6.4 and everything started working fine again.

- Mike

Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2010-02-01 06:01:57 UTC
Please retest w/ 2.6.8, author claims OpenPGP code fixed.
Comment 6 Fabio Rossi 2010-02-01 20:17:30 UTC
NAK, now I get also a SIGSEGV :-(

Program received signal SIGSEGV, Segmentation fault.
_______________________________________________________________________________
Error while running hook_stop:                                                 
Value can't be converted to integer.                                           
0x00007ffff749334b in memcpy () from /lib/libc.so.6                            
gdb> bt
#0  0x00007ffff749334b in memcpy () from /lib/libc.so.6
#1  0x000000000040a926 in make_ustring ()              
#2  0x000000000040b6c1 in encrypted_encode ()          
#3  0x000000000040c0ba in pgp_encrypt_file ()          
#4  0x0000000000406cb3 in pgp_encrypt_wrap ()          
#5  0x000000000040567b in main ()                      
gdb> quit                                              
Comment 7 Alon Bar-Lev (RETIRED) gentoo-dev 2012-12-22 21:02:43 UTC

*** This bug has been marked as a duplicate of bug 426914 ***