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).
Created attachment 30085 [details] crypto++-5.1-r2.ebuild
Created attachment 30086 [details, diff] crypto++-5.1-amd64.diff
Committed this with the gcc 3.4 fix (#49449). AMD64 developers: Can you test this please?
Looks good here... All tests passed. I'll unmasked ~amd64. Feel free to close this.
closed