Hi..... I'm currently working on my own implementation of the IDEA block cypher and had a pretty hard time of understanding (Ok,Ok I know there's a bunch of publicly available implementations, but I wanted to do it myself)
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. Is there any compensation within the crypto code which I've missed (e.g. in the quite complicated E_IDEA macro) or do we deal with a modified IDEA implementation here ? Since I'm afraid that Eric Young may not be reachable via his e-mail at cryptsoft I ask here. Cheers Sebastian Kloska -- ********************************** Dr. Sebastian Kloska Head of Bioinformatics Scienion AG Volmerstr. 7a 12489 Berlin phone: +49-(30)-6392-1708 fax: +49-(30)-6392-1701 http://www.scienion.de ********************************** ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]