ecdsa.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef DROPBEAR_ECDSA_H_
  2. #define DROPBEAR_ECDSA_H_
  3. #include "includes.h"
  4. #include "buffer.h"
  5. #include "signkey.h"
  6. #if DROPBEAR_ECDSA
  7. /* prefer 256 or 384 since those are SHOULD for
  8. draft-ietf-curdle-ssh-kex-sha2.txt */
  9. #if DROPBEAR_ECC_256
  10. #define ECDSA_DEFAULT_SIZE 256
  11. #elif DROPBEAR_ECC_384
  12. #define ECDSA_DEFAULT_SIZE 384
  13. #elif DROPBEAR_ECC_521
  14. #define ECDSA_DEFAULT_SIZE 521
  15. #else
  16. #error ECDSA cannot be enabled without enabling at least one size (256, 384, 521)
  17. #endif
  18. ecc_key *gen_ecdsa_priv_key(unsigned int bit_size);
  19. ecc_key *buf_get_ecdsa_pub_key(buffer* buf);
  20. ecc_key *buf_get_ecdsa_priv_key(buffer *buf);
  21. void buf_put_ecdsa_pub_key(buffer *buf, ecc_key *key);
  22. void buf_put_ecdsa_priv_key(buffer *buf, ecc_key *key);
  23. enum signkey_type ecdsa_signkey_type(const ecc_key * key);
  24. void buf_put_ecdsa_sign(buffer *buf, const ecc_key *key, const buffer *data_buf);
  25. int buf_ecdsa_verify(buffer *buf, const ecc_key *key, const buffer *data_buf);
  26. /* Returns 1 on success */
  27. int signkey_is_ecdsa(enum signkey_type type);
  28. #endif
  29. #endif /* DROPBEAR_ECDSA_H_ */