First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 49034
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Ryan Phillips (RETIRED) <rphillips@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Thomas Weidner <3.14159@gmx.net>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
crypto++-5.1-r2.ebuild crypto++-5.1-r2.ebuild text/plain Thomas Weidner 2004-04-26 07:29 0000 1.27 KB Details
crypto++-5.1-amd64.diff crypto++-5.1-amd64.diff patch Thomas Weidner 2004-04-26 07:30 0000 3.00 KB Details | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 49034 depends on: Show dependency tree
Bug 49034 blocks: 45855
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2004-04-26 07:29 0000
Hi,

i managed to get cypto++-5.1 working on amd64. a patch and new ebuild, which applies the patch, will be attached. the patch adds some defines to make cypto++ recognize it as 64bit platform (so define types for 32 and 64bit words correctly). and fixes a very interesting bug on amd64. (further reading only if interested).
The file sergent.cpp:439 contains a expression like k[i-1]. k is a pointer to a 32bit unsigned integer and i an unsigned 32bit integer. on 32bit platforms it works like this: i is zero. so i-1 is 0xFFFFFFFF due to an integer underflow. so we have k[0xFFFFFFFF], which is the same as k+0xFFFFFFFF. which is the same as (word32*)((byte*)k+4*0xFFFFFFFF). the multiplication overflows and results in 0xFFFFFFFC. when this value is added to the 32bit pointer k the pointer also overflows resulting in the same as (word32*)((byte*)k-4) which is k[-1],which is what the author of the code wanted. on amd64 pointers are 8bit wide, so adding 0xFFFFFFFC to k does not overflow and produces an invalid pointer. now there are  two solutions. make i a 64bit integer to make k overflow again or use signed integer arithmetic (so i-1 does not underflow). i've choosen the second one for my patch. (i hope this was correct and not too confusing).

------- Comment #1 From Thomas Weidner 2004-04-26 07:29:45 0000 -------
Created an attachment (id=30085) [details]
crypto++-5.1-r2.ebuild

------- Comment #2 From Thomas Weidner 2004-04-26 07:30:13 0000 -------
Created an attachment (id=30086) [details]
crypto++-5.1-amd64.diff

------- Comment #3 From Ryan Phillips (RETIRED) 2004-04-30 10:44:52 0000 -------
Committed this with the gcc 3.4 fix (#49449).

AMD64 developers: Can you test this please?

------- Comment #4 From Jason Huebel (RETIRED) 2004-06-04 10:31:37 0000 -------
Looks good here... All tests passed. I'll unmasked ~amd64. Feel free to close
this.

------- Comment #5 From Ryan Phillips (RETIRED) 2004-06-05 00:43:24 0000 -------
closed

First Last Prev Next    No search results available      Search page      Enter new bug