ecc.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef DROPBEAR_DROPBEAR_ECC_H
  2. #define DROPBEAR_DROPBEAR_ECC_H
  3. #include "includes.h"
  4. #include "buffer.h"
  5. #if DROPBEAR_ECC
  6. struct dropbear_ecc_curve {
  7. int ltc_size; /* to match the byte sizes in ltc_ecc_sets[] */
  8. const ltc_ecc_set_type *dp; /* curve domain parameters */
  9. const struct ltc_hash_descriptor *hash_desc;
  10. const char *name;
  11. };
  12. extern struct dropbear_ecc_curve ecc_curve_nistp256;
  13. extern struct dropbear_ecc_curve ecc_curve_nistp384;
  14. extern struct dropbear_ecc_curve ecc_curve_nistp521;
  15. extern struct dropbear_ecc_curve *dropbear_ecc_curves[];
  16. void dropbear_ecc_fill_dp(void);
  17. struct dropbear_ecc_curve* curve_for_dp(const ltc_ecc_set_type *dp);
  18. /* "pubkey" refers to a point, but LTC uses ecc_key structure for both public
  19. and private keys */
  20. void buf_put_ecc_raw_pubkey_string(buffer *buf, ecc_key *key);
  21. ecc_key * buf_get_ecc_raw_pubkey(buffer *buf, const struct dropbear_ecc_curve *curve);
  22. int buf_get_ecc_privkey_string(buffer *buf, ecc_key *key);
  23. mp_int * dropbear_ecc_shared_secret(ecc_key *pub_key, const ecc_key *priv_key);
  24. #endif
  25. #endif /* DROPBEAR_DROPBEAR_ECC_H */