[botan-devel] strange behavior declaring BigInt on FreeBSD

tiredashell at gmail.com tiredashell at gmail.com
Thu Aug 4 23:29:42 EDT 2011

I successfully compiled my program on FreeBSD (8.2-RELEASE amd64) but
at runtime, when instantiating an RSA_PrivateKey, Botan would throw
either "Invalid private key" or "Blinder: Arguments too small". This
was puzzling, because the code ran perfectly fine on OSX and Debian
Linux. After several days of debugging, I finally narrowed it down to
how I was declaring the BigInts that I fed into the constructor. My
code looked like this:

Botan::BigInt p_int, q_int, e_int;
p_int = Botan::BigInt::decode(p_bytes);
q_int = Botan::BigInt::decode(q_bytes);
e_int = Botan::BigInt(65537);

For some reason, separating declaration from instantiation was the
problem. When I rewrote it as below, it no longer complained:

Botan::BigInt p_int = Botan::BigInt::decode(p_bytes);
Botan::BigInt q_int = Botan::BigInt::decode(q_bytes);
Botan::BigInt e_int = Botan::BigInt(65537);

I may just be clueless in this regard, but I didn't think there would
be any difference between the two. Just thought I'd share.

More information about the botan-devel mailing list