What about an ECC API facelift? #724
Labels
No labels
bug
duplicate
enhancement
feature
help wanted
improve API
invalid
needs documentation
not-planned
rtfm
stale
support
wishlist
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libtom/libtomcrypt#724
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The new RSA API has moved from long ad hoc argument lists to parameter(s) structs. What about using a similar approach for ECC as well?
Things are a bit more complicated with ECC so one
..._optsstruct may not be enough. Here is the basic idea based on structs: ltc_ecc_sign_opts_v3, ltc_ecc_verify_opts_v3, ltc_ecc_recovery_opts_v3, and ltc_ecc_crypt_opts_v3New public ECC functions:
Deprecated (but still available) public ECC functions:
@sjaeckel what do you think?
The current API is as follows:
github.com/libtom/libtomcrypt@68aae28a9d/src/headers/tomcrypt_pk.h (L450-L474)github.com/libtom/libtomcrypt@68aae28a9d/src/headers/tomcrypt_pk.h (L545-L550)and already basically looks like what you proposed!?
Can you please specify what the different types of opts struct should contain? As candidates I see only
prng_state *prng, int wprng, int hashinto altc_ecc_crypt_optsforecc_encrypt_key().But then we should maybe think one step further and make the common parts the same for all PK algs? And more, there's FMU only
prng_state *prng, int wprngwhich could be shared, which is minimized toprng_state *prngonce #515 would be merged.Something like this:
As a first point: this wouldn't require a v3. v2 hasn't been officially released yet, we can still do what we want with the current develop branch.
... and then I'm not sure ... the current opts struct is a dump for all of these possibilities that's true, which is not exactly nice, but OTOH I don't like having 4 different structs just for the sake of "cleanliness" ... I'm still missing the functional advantage resp. improvement ...
also
ltc_ecc_crypt_opts_v3should be renamed toltc_ecc_encrypt_opts_v3.plus two questions regarding the nonce mode:
I understand what you want, but this just doesn't feel right. Especially that
ltc_ecc_verify_opts_v3andltc_ecc_recovery_opts_v3have only one element are an indicator for me, that this isn't thought out (yet).OK, no problem.
But one thing I would like to mention here: in the current ltc_ecc_sig_opts, I really do not like the
int *recidmember. In my opinion, it is an ugly hack that does not fit well here and is quite hard to understand and use.Fair enough, that's really not straight-forward.
I guess that'd be better!?
The idea of enable_recovery_id is definitely better.
The only remaining purist issue is that we are kind of abusing the "options struct" to return part of the result/output, but I can live with that.
Yeah, right again. We can still improve this, therefore I'm leaving this issue open.