I'm integrating a custom engine into OpenSSL v1.1.0e and currently implementing the ECDH functions using Windows CNG (the BCrypt functions). I'm a little confused as to what design to follow. As far as I understand, I would need to implement the functions required by DH_meth_set_init
, DH_meth_set_generate_key
, DH_meth_set_compute_key
and DH_meth_set_finish
.
What I'm confused about is using the internal ossl DH
struct. For e.g. in the generate keys function (param is DH* dh
, used by DH_meth_set_generate_key
), I'm using BCryptGenerateKeyPair
and not sure how to convert the keys and store in DH
struct's priv_key
and pub_key
variables.