Allow call with null pointer for handle key and template - #367
Conversation
|
Hello! Would be nice if The intended use of the To make this cleaner, maybe we should add a new What do you think? |
|
Thank you for wiligness to support this, since it's something vendor dependent ^^' I was sharing the same idea @hug-dev , but since IDK if there would be any situation when the user would need both I was thinking maybe the following: // current one remains unchanged
pub fn derive_key(...) { ... }
#[cfg(feature = "SOME_MEANINGFUL_NAME")]
pub fn derive_key_vendor(...) { ... } |
Yes I think that is a reasonable approach! Or at least a good way to start until more of those appear and we see a better way to do it. |
17027ff to
cfb2d3d
Compare
cfb2d3d to
44a9601
Compare
Signed-off-by: Alexandru Placinta <placintaalexandru1@gmail.com>
9e8b28a
44a9601 to
9e8b28a
Compare
Some calls to Thales Luna HSMs allows the following call of
C_DeriveKey:One example is when trying to do bip32 derivation using
CKM_BIP32_CHILD_DERIVECK_BIP32_CHILD_DERIVE_PARAMS. The call works as follows:pTemplateandphKeyare null pointersCK_BIP32_CHILD_DERIVE_PARAMS.hPublicKeyandCK_BIP32_CHILD_DERIVE_PARAMS.hPrivateKeyAt the moment this is not expressable by the
cryptokicrate so I was thinking it would be nice to allow it.I tested this against a Thales Luna Network HSM
If there is interest in this, I can work on making the tests pass as well, which is trivial
Downsides
derive_key0as value so the return type should be changed as well to better reflect user's intention