Aaron Boxer <[email protected]> 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-Interface-Integers

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.
_______________________________________________
nettle-bugs mailing list
[email protected]
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs

Reply via email to