key_import_dh() which imports private key doesn't set public key (I actually missed that part yesterday, while it is related to already merged part and not this patchset), that will make the key imported as private do not work as peer key in secret generation. Now key_import_dh() also doesn't set newly added dh_params in key, so export of DH parameters from a key imported as private won't work probably. Similarly, key_import_dh_public() doesn't store DH params handle in the key.
Maybe worth making sure that we always have all the handles properly initialized, and then always use pubkey in key_export_dh_public() without falling back to privkey?