ecc.h 1.1 KB

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