Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 132356 - dev-libs/libmcrypt-2.5.7 cast-256 test fails on alpha
Summary: dev-libs/libmcrypt-2.5.7 cast-256 test fails on alpha
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: Alpha Linux
: High normal (vote)
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-05 08:53 UTC by Thomas Cort (RETIRED)
Modified: 2008-12-15 21:00 UTC (History)
2 users (show)

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


Attachments
cipher_test (cipher_test.patch,434 bytes, patch)
2008-03-16 23:21 UTC, Jose Luis Rivero (yoswink) (RETIRED)
Details | Diff
patch to fix libmcrypt cast-256 (libmcrypt-rotl32-mask.patch,543 bytes, patch)
2008-12-13 19:24 UTC, Matt Turner
Details | Diff
Mask all shift arguments (libmcrypt-rotate-mask.patch,1.03 KB, patch)
2008-12-13 20:40 UTC, Matt Turner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Cort (RETIRED) gentoo-dev 2006-05-05 08:53:30 UTC
When emerge'ing libmcrypt-2.5.7 with FEATURES="test" I get a failure...

Algorithm: cast-256... failed compatibility
Expected: 5db4dd765f1d3835615a14afcb5dc2f5
Got: ad8dd2f8aeef0ca340373d0e9d373cba

The test passes on x86.

# emerge --info
Portage 2.1_pre10-r2 (default-linux/alpha/no-nptl/2.4, gcc-3.4.6, glibc-2.3.6-r3, 2.4.32 alpha)
=================================================================
System uname: 2.4.32 alpha EV56
Gentoo Base System version 1.12.0_pre16
dev-lang/python:     2.3.5, 2.4.3
dev-util/ccache:     [Not Present]
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.16.1-r2
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.4.26-r1
ACCEPT_KEYWORDS="alpha ~alpha"
AUTOCLEAN="yes"
CBUILD="alpha-unknown-linux-gnu"
CFLAGS="-mieee -pipe -O2 -mcpu=ev56"
CHOST="alpha-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/eselect/compiler /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/env.d"
CXXFLAGS="-mieee -pipe -O2 -mcpu=ev56"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig collision-protect distlocks metadata-transfer sandbox sfperms strict test"
GENTOO_MIRRORS="http://gentoo.mirrored.ca/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /usr/portage/local/layman/java-experimental"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="alpha X aac aalib aim alsa apache2 artworkextra async audacious audiofile bash-completion berkdb binfilter bitmap-fonts bittorrent bl bonjour c++ cairo calendar cdinstall cdparanoia cdr cdrom chroot cli config_wizard cracklib crypt cscope csv ctype cups curl curlwrappers cvs cvsgraph dhcp dillo dri editor eds elf encode epiphany escreen esd ethereal extraicons extras ffmpeg fftw figlet firefox flac ftp gdb gdbm gif glep gnome gnutls gpm grammar gsl gstreamer gtalk gtk gtk2 gtkspell gvim gzip html icq id3 imlib ipv6 jabber javascript jpeg justify ladspa lame libg++ libsexy libwww lite lj logrotate lua mad mapeditor md5sum mikmod motif moznoirc moznomail moznoroaming mozsha1 mp3 mpeg mpeg2 mplayer msn msnextras music ncurses net nethack nls offensive ogg oggvorbis opengl openssh openssl oscar oss pam pcre pdflib perl png python quicktime quotes readline recode reflection reiserfs scp screen sdl session sftp skins sndfile sockets sounds sox speech spell spl ssl subversion symlink syslog tcpd threads truetype truetype-fonts type1-fonts userlocales vcd videos vim vim-with-x vorbis wma wma123 xml xml2 xmlreader xmms xorg xv xvid yahoo zip zlib elibc_glibc kernel_linux userland_GNU"
Unset:  ASFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2006-05-13 00:16:50 UTC
I have no idea why this is occuring. It works fine on ppc as well, and the package is pure C.

Maybe a GCC bug, or something odd with your CFLAGS?
Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2006-09-28 13:25:25 UTC
tcort: does this still occur on another gcc/binutils versions?
Comment 3 Thomas Cort (RETIRED) gentoo-dev 2006-09-28 18:19:11 UTC
The test still failed with a slightly newer toolchain. Maybe someone is testing gcc-4.x and can try it?

#  emerge --info
Portage 2.1-r2 (default-linux/alpha/2006.1, gcc-3.4.6, glibc-2.3.6-r4, 2.6.16.19 alpha)
=================================================================
System uname: 2.6.16.19 alpha EV56
Gentoo Base System version 1.12.1
distcc 2.18.3 alpha-unknown-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]
app-admin/eselect-compiler: [Not Present]
dev-java/java-config: [Not Present]
dev-lang/python:     2.4.3-r1
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     [Not Present]
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.13-r3
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r4
ACCEPT_KEYWORDS="alpha"
AUTOCLEAN="yes"
CBUILD="alpha-unknown-linux-gnu"
CFLAGS="-mieee -pipe -O2 -mcpu=ev56"
CHOST="alpha-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-mieee -pipe -O2 -mcpu=ev56"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distcc distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://adelie.polymtl.ca/ http://distfiles.gentoo.org/"
LINGUAS="en fr"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://larry@rsync.larrythecow.net/gentoo-portage"
USE="alpha X aac aim alsa artwork artworkextra audacious audiofile berkdb bitmap-fonts branding browserplugin bzip2 cli crypt cups dlloader dri encode flac gdbm glut gnome gphoto2 gtk gtk2 icq ipv6 isdnlog jabber jpeg ldap libg++ lua mad mikmod moznocompose moznoirc moznomail mp3 mpeg msn ncurses nls nocd nptl nptlonly nsplugin offensive ogg oggvorbis oscar pam pcre perl png ppds pppd python readline reflection session shorten sndfile spell spl ssl svg symlink tcpd truetype truetype-fonts type1-fonts udev unicode userlocales vorbis xface xml xmms xorg xvid yahoo zlib elibc_glibc input_devices_keyboard input_devices_mouse input_devices_evdev kernel_linux linguas_en linguas_fr userland_GNU video_cards_cirrus video_cards_ati video_cards_dummy video_cards_fbdev video_cards_glint video_cards_mga video_cards_nv video_cards_rendition video_cards_s3 video_cards_s3virge video_cards_savage video_cards_siliconmotion video_cards_sisusb video_cards_tdfx video_cards_tga video_cards_v4l video_cards_vga video_cards_voodoo"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2006-09-28 19:23:18 UTC
tcort: gcc-3.4.6 and gcc-4.1.1 / binutils-2.17 test out fine on my x86, amd64 and ppc boxes.

Need to find an alpha with gcc-4 to check this.
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2006-11-14 03:32:28 UTC
tcort: bump
Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2007-04-07 03:41:40 UTC
alpha: bump
Comment 7 Raúl Porcel (RETIRED) gentoo-dev 2007-06-17 12:59:14 UTC
pong

I get the same failure along with FAIL: ciphertest

Portage 2.1.2.7 (default-linux/alpha/2007.0/desktop, gcc-4.1.2, glibc-2.5-r2, 2.6.21.1 alpha)
=================================================================
System uname: 2.6.21.1 alpha EV68AL
Gentoo Base System release 1.12.9
Timestamp of tree: Sun, 17 Jun 2007 10:50:01 +0000
dev-lang/python:     2.4.4-r4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r4
ACCEPT_KEYWORDS="alpha"
AUTOCLEAN="yes"
CBUILD="alpha-unknown-linux-gnu"
CFLAGS="-mieee -pipe -O2 -mcpu=ev67"
CHOST="alpha-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-mieee -pipe -O2 -mcpu=ev67"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://pandemonium.tiscali.de/pub/gentoo/ http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/ http://gentoo.mirror.solnet.ch"
LDFLAGS="-Wl,--no-relax"
MAKEOPTS="-j5"
PKGDIR="/space/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync5.de.gentoo.org/gentoo-portage"
USE="X acl alpha berkdb bitmap-fonts cairo cdr cli cracklib crypt dri dvd dvdr dvdread eds encode esd evo fam fortran gdbm gif gpm gstreamer gtk iconv ipv6 isdnlog jpeg ldap libg++ mad midi mikmod mp3 mpeg mudflap ncurses nptl nptlonly ogg opengl openmp pam pcre pdf perl png pppd python qt3 qt3support qt4 quicktime readline reflection sdl session spell spl ssl svg tcpd tiff truetype truetype-fonts type1-fonts unicode vorbis xml xorg xv zlib" ALSA_CARDS="ali5451 als4000 bt87x ca0106 cmipci emu10k1 ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 maestro3 trident usb-audio via82xx ymfpci" 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" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="glint"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 8 Raúl Porcel (RETIRED) gentoo-dev 2008-01-09 11:56:29 UTC
bumb? :)
Comment 9 SpanKY gentoo-dev 2008-01-09 18:14:26 UTC
bumping this constantly wont solve anything.  an alpha guy will have to investigate the issue and narrow down the failing code.
Comment 10 Jose Luis Rivero (yoswink) (RETIRED) gentoo-dev 2008-03-16 23:08:19 UTC
Seems to not be a problem with CFLAGS or different toolchain combinations. 

If you check libmcrypt source you will find a KNOWN-BUGS file with this content:
--- 8< ---
cast-256 and rc6 do not work properly on Alpha (64 bit) machines
--- 8< ---

Debian (which doesn't run the test-suite) and red-hat don't care about it and haven't got any kind of patches for this, as far as I can see. I think this need a deep debug to know what's happening in alpha.

Upstream bug tracker and cvs seems to not be too much active so asking upstream to fix the bug could not be effective. One of our options is to disable the test in alpha (I will attach a patch) but Robin, I leave this up to you. If you need help or an account with debugging, the alpha arch team will provide as much as we can.

Thanks.
Comment 11 Jose Luis Rivero (yoswink) (RETIRED) gentoo-dev 2008-03-16 23:21:24 UTC
Created attachment 146352 [details, diff]
cipher_test

Disable cypher test on alpha
Comment 12 Matt Turner gentoo-dev 2008-12-13 19:24:21 UTC
Created attachment 175224 [details, diff]
patch to fix libmcrypt cast-256

After some debugging, I figured it out.

The problem was the rotl32 macro in lib/mcrypt_modules.h.

According to the Alpha Architecture Handbook[*], the sll and srl instructions mask all but bits 5:0 of the shift argument.

Consider the case where the number to be shifted is 1 and the shift argument is 32. The expected result is that the original number is the same as the final number, since it rotated the entire width of the field.

On Alpha (and others?), the 64-bit registers prevent it from rotating, since a shift of 32 actually rotates bits into the upper 32-bits, yielding a result of 0.

The fix is to manually mask the shift argument. Patch included.

This did not affect AMD64 because gcc is able to generate 32-bit shift instructions, whereas no equivalent exists on Alpha.

[*] Page 101, http://h18002.www1.hp.com/alphaserver/technology/literature/alphaahb.pdf

I'll file this upstream as well.
Comment 13 Matt Turner gentoo-dev 2008-12-13 20:40:10 UTC
Created attachment 175226 [details, diff]
Mask all shift arguments

For safety sake, we might as well mask all shift arguments. This patch does that and removes the KNOWN-BUGS file, as the only known bug was this alpha bug that is now fixed.
Comment 14 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-12-15 21:00:26 UTC
Added to 2.5.8-r1 now.