On Thu, Jan 24, 2002 at 03:11:34PM +0100, Sebastian Kloska wrote:
[...]
> Anyway. After consulting a bunch of crypto books
> I've stumbled about the idea_mul macro in
> idea_lcl.h (openssl-0.9.6c) which is supposed
> to do the modified multiplication mod 2^16+1
> which looks like.
>
> ----------------------------------------------
>
> #define idea_mul(r,a,b,ul) \
> ul=(unsigned long)a*b; \
> if (ul != 0) \
> { \
> r=(ul&0xffff)-(ul>>16); \
> r-=((r)>>16); \
> } \
> else \
> r=(-(int)a-b+1);
>
> ---------------------------------------------
>
> All other reference implementations of the
> multiplication I could find look like:
>
> ---------------------------------------------
> mul( a, b) {
> int32_t p;
>
> if (a)
> {
> if (b)
> {
> p = a * b;
> b = p & 0xFFFF;
> a = p >> 16;
> return b - a + (b < a);
> }
> else
> return (1 - a);
> }
> return (1 - b);
> }
> --------------------------------------------
>
> And they definitely produce different results.
Can you elaborate? What input values do produce different results?
--
Bodo M�ller <[EMAIL PROTECTED]>
PGP http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/moeller/0x36d2c658.html
* TU Darmstadt, Theoretische Informatik, Alexanderstr. 10, D-64283 Darmstadt
* Tel. +49-6151-16-6628, Fax +49-6151-16-6036
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]