version 1.15, 2022/10/28 00:41:17 |
version 1.16, 2022/10/28 00:41:52 |
|
|
|
|
static int |
static int |
ssh_ed25519_serialize_public(const struct sshkey *key, struct sshbuf *b, |
ssh_ed25519_serialize_public(const struct sshkey *key, struct sshbuf *b, |
const char *typename, enum sshkey_serialize_rep opts) |
enum sshkey_serialize_rep opts) |
{ |
{ |
int r; |
int r; |
|
|
if (key->ed25519_pk == NULL) |
if (key->ed25519_pk == NULL) |
return SSH_ERR_INVALID_ARGUMENT; |
return SSH_ERR_INVALID_ARGUMENT; |
if ((r = sshbuf_put_cstring(b, typename)) != 0 || |
if ((r = sshbuf_put_string(b, key->ed25519_pk, ED25519_PK_SZ)) != 0) |
(r = sshbuf_put_string(b, key->ed25519_pk, ED25519_PK_SZ)) != 0) |
|
return r; |
return r; |
|
|
return 0; |
return 0; |
|
|
return 0; |
return 0; |
} |
} |
|
|
|
static int |
|
ssh_ed25519_deserialize_public(const char *ktype, struct sshbuf *b, |
|
struct sshkey *key) |
|
{ |
|
u_char *pk = NULL; |
|
size_t len = 0; |
|
int r; |
|
|
|
if ((r = sshbuf_get_string(b, &pk, &len)) != 0) |
|
return r; |
|
if (len != ED25519_PK_SZ) { |
|
freezero(pk, len); |
|
return SSH_ERR_INVALID_FORMAT; |
|
} |
|
key->ed25519_pk = pk; |
|
return 0; |
|
} |
|
|
int |
int |
ssh_ed25519_sign(const struct sshkey *key, u_char **sigp, size_t *lenp, |
ssh_ed25519_sign(const struct sshkey *key, u_char **sigp, size_t *lenp, |
const u_char *data, size_t datalen, u_int compat) |
const u_char *data, size_t datalen, u_int compat) |
|
|
/* .cleanup = */ ssh_ed25519_cleanup, |
/* .cleanup = */ ssh_ed25519_cleanup, |
/* .equal = */ ssh_ed25519_equal, |
/* .equal = */ ssh_ed25519_equal, |
/* .ssh_serialize_public = */ ssh_ed25519_serialize_public, |
/* .ssh_serialize_public = */ ssh_ed25519_serialize_public, |
|
/* .ssh_deserialize_public = */ ssh_ed25519_deserialize_public, |
/* .generate = */ ssh_ed25519_generate, |
/* .generate = */ ssh_ed25519_generate, |
/* .copy_public = */ ssh_ed25519_copy_public, |
/* .copy_public = */ ssh_ed25519_copy_public, |
}; |
}; |