Hi Niels,
Thanks so much for your replay. I stayed with the c interface, and I think I correctly ported most of the code, following your guides.
The only remaining issue is converting between big endian byte arrays and gmp types, but I have asked about this on the gmp forum.
Would you be able to do a quick review of the port once I am done?
Thanks again, Aaron
On Thu, May 26, 2016 at 3:16 AM, Niels Möller nisse@lysator.liu.se wrote:
Aaron Boxer boxerab@gmail.com writes:
Hello!
I am porting some openssl code to nettle. It involves working with SHA1 keys. What would people recommend as a guide to doing this port?
[...]
https://github.com/GrokImageCompression/asdcplib/blob/master/src/KM_prng.cpp
For SHA1 and AES, start by checking the Nettle manual and the sha1 example program:
https://www.lysator.liu.se/~nisse/nettle/nettle.html#Example https://www.lysator.liu.se/~nisse/nettle/nettle.html#Conventions https://www.lysator.liu.se/~nisse/nettle/nettle.html#AES https://www.lysator.liu.se/~nisse/nettle/nettle.html#SHA1
Then your Gen_FIPS_186_Value function also uses some basic bignum arithmetic. You'd need to rewrite this to use GNU GMP, and I guess you'd want to use the C++ interface, gmpxx.h, which I'm not very familiar with. See
https://gmplib.org/manual/C_002b_002b-Interface-Integers.html#C_002b_002b-In...
Not sure how to do base256 conversion (the BN_bin2bn and BN_bn2bin in openssl) in the C++ interface, you may need to use the functions mpz_import and mpz_export on the underlying C type mpz_t.
Regards, /Niels
-- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance.