2015-02-24 12:43:01 +00:00
|
|
|
#ifndef DROPBEAR_ECDSA_H_
|
|
|
|
#define DROPBEAR_ECDSA_H_
|
2013-04-13 16:50:03 +00:00
|
|
|
|
|
|
|
#include "includes.h"
|
|
|
|
#include "buffer.h"
|
2013-05-03 15:07:48 +00:00
|
|
|
#include "signkey.h"
|
2013-04-13 16:50:03 +00:00
|
|
|
|
2016-05-04 13:33:40 +00:00
|
|
|
#if DROPBEAR_ECDSA
|
2013-05-09 15:24:58 +00:00
|
|
|
|
2018-02-26 14:19:01 +00:00
|
|
|
/* prefer 256 or 384 since those are SHOULD for
|
|
|
|
draft-ietf-curdle-ssh-kex-sha2.txt */
|
|
|
|
#if DROPBEAR_ECC_256
|
|
|
|
#define ECDSA_DEFAULT_SIZE 256
|
2016-05-04 13:33:40 +00:00
|
|
|
#elif DROPBEAR_ECC_384
|
2013-10-31 14:49:15 +00:00
|
|
|
#define ECDSA_DEFAULT_SIZE 384
|
2018-02-26 14:19:01 +00:00
|
|
|
#elif DROPBEAR_ECC_521
|
|
|
|
#define ECDSA_DEFAULT_SIZE 521
|
2013-04-28 15:17:43 +00:00
|
|
|
#else
|
2018-03-08 14:37:54 +00:00
|
|
|
#error ECDSA cannot be enabled without enabling at least one size (256, 384, 521)
|
2013-04-28 15:17:43 +00:00
|
|
|
#endif
|
|
|
|
|
2013-04-13 16:50:03 +00:00
|
|
|
ecc_key *gen_ecdsa_priv_key(unsigned int bit_size);
|
|
|
|
ecc_key *buf_get_ecdsa_pub_key(buffer* buf);
|
|
|
|
ecc_key *buf_get_ecdsa_priv_key(buffer *buf);
|
|
|
|
void buf_put_ecdsa_pub_key(buffer *buf, ecc_key *key);
|
|
|
|
void buf_put_ecdsa_priv_key(buffer *buf, ecc_key *key);
|
2017-08-19 15:16:13 +00:00
|
|
|
enum signkey_type ecdsa_signkey_type(const ecc_key * key);
|
2013-04-13 16:50:03 +00:00
|
|
|
|
2017-08-19 15:16:13 +00:00
|
|
|
void buf_put_ecdsa_sign(buffer *buf, const ecc_key *key, const buffer *data_buf);
|
|
|
|
int buf_ecdsa_verify(buffer *buf, const ecc_key *key, const buffer *data_buf);
|
2013-11-06 16:18:52 +00:00
|
|
|
/* Returns 1 on success */
|
|
|
|
int signkey_is_ecdsa(enum signkey_type type);
|
2013-04-13 16:50:03 +00:00
|
|
|
|
2013-05-09 15:24:58 +00:00
|
|
|
#endif
|
|
|
|
|
2015-02-24 12:43:01 +00:00
|
|
|
#endif /* DROPBEAR_ECDSA_H_ */
|