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