Skip to content

What about an ECC API facelift? #724

@karel-m

Description

@karel-m

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 ..._opts struct 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_v3

New public ECC functions:

int ecc_sign_hash_v3(const unsigned char *in,  unsigned long inlen,
                           unsigned char *out, unsigned long *outlen,
                     const ltc_ecc_sign_opts_v3 *opts,
                           int *recid_out,
                     const ecc_key *key);

int ecc_verify_hash_v3(const unsigned char *sig,  unsigned long siglen,
                       const unsigned char *hash, unsigned long hashlen,
                       const ltc_ecc_verify_opts_v3 *opts,
                             int *stat,
                       const ecc_key *key);

int ecc_recover_key_v3(const unsigned char *sig,  unsigned long siglen,
                       const unsigned char *hash, unsigned long hashlen,
                       const ltc_ecc_recovery_opts_v3 *opts,
                             ecc_key *key);

int ecc_encrypt_key_v3(const unsigned char *in,  unsigned long inlen,
                             unsigned char *out, unsigned long *outlen,
                       const ltc_ecc_crypt_opts_v3 *opts,
                       const ecc_key *key);

int ecc_decrypt_key_v3(const unsigned char *in,  unsigned long inlen,
                             unsigned char *out, unsigned long *outlen,
                       const ltc_ecc_crypt_opts_v3 *opts,
                       const ecc_key *key);

Deprecated (but still available) public ECC functions:

ecc_sign_hash
ecc_sign_hash_v2
ecc_verify_hash
ecc_verify_hash_v2
ecc_sign_hash_rfc7518
ecc_verify_hash_rfc7518
ecc_encrypt_key
ecc_decrypt_key
ecc_recover_key

@sjaeckel what do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions