Don't cast second argument of mem_printf_hook (%b) to size_t.
Also treat the given number as unsigned int. Due to the printf hook registration the second argument of mem_printf_hook (if called via printf etc.) is always of type int*. Casting this to a size_t pointer and then dereferencing that as int does not work on big endian machines if int is smaller than size_t (e.g. on ppc64). In order to make this change work if the argument is of a type larger than int, size_t for instance, the second argument for %b has to be casted to (u_)int.
This commit is contained in:
@@ -127,14 +127,14 @@ METHOD(prf_t, get_bytes, void,
|
||||
{
|
||||
/* a. XVAL = (XKEY + XSEED j) mod 2^b */
|
||||
add_mod(this->b, xkey, xseed, xval);
|
||||
DBG3(DBG_LIB, "XVAL %b", xval, this->b);
|
||||
DBG3(DBG_LIB, "XVAL %b", xval, (u_int)this->b);
|
||||
/* b. wi = G(t, XVAL ) */
|
||||
this->g(this, chunk_create(xval, this->b), &w[i * this->b]);
|
||||
DBG3(DBG_LIB, "w[%d] %b", i, &w[i * this->b], this->b);
|
||||
DBG3(DBG_LIB, "w[%d] %b", i, &w[i * this->b], (u_int)this->b);
|
||||
/* c. XKEY = (1 + XKEY + wi) mod 2b */
|
||||
add_mod(this->b, xkey, &w[i * this->b], sum);
|
||||
add_mod(this->b, sum, one, xkey);
|
||||
DBG3(DBG_LIB, "XKEY %b", xkey, this->b);
|
||||
DBG3(DBG_LIB, "XKEY %b", xkey, (u_int)this->b);
|
||||
}
|
||||
|
||||
/* 3.3 done already, mod q not used */
|
||||
|
||||
Reference in New Issue
Block a user