version 1.7, 2022/10/28 00:35:40 |
version 1.8, 2022/10/28 00:36:31 |
|
|
#include "ssh.h" |
#include "ssh.h" |
#include "digest.h" |
#include "digest.h" |
|
|
|
/* Reuse some ED25519 internals */ |
|
extern struct sshkey_impl_funcs sshkey_ed25519_funcs; |
|
|
static void |
static void |
ssh_ed25519_sk_cleanup(struct sshkey *k) |
ssh_ed25519_sk_cleanup(struct sshkey *k) |
{ |
{ |
free(k->sk_application); |
sshkey_sk_cleanup(k); |
sshbuf_free(k->sk_key_handle); |
sshkey_ed25519_funcs.cleanup(k); |
sshbuf_free(k->sk_reserved); |
|
freezero(k->ed25519_pk, ED25519_PK_SZ); |
|
freezero(k->ed25519_sk, ED25519_SK_SZ); |
|
k->ed25519_pk = NULL; |
|
k->ed25519_sk = NULL; |
|
} |
} |
|
|
|
static int |
|
ssh_ed25519_sk_equal(const struct sshkey *a, const struct sshkey *b) |
|
{ |
|
if (!sshkey_sk_fields_equal(a, b)) |
|
return 0; |
|
if (!sshkey_ed25519_funcs.equal(a, b)) |
|
return 0; |
|
return 1; |
|
} |
|
|
int |
int |
ssh_ed25519_sk_verify(const struct sshkey *key, |
ssh_ed25519_sk_verify(const struct sshkey *key, |
const u_char *signature, size_t signaturelen, |
const u_char *signature, size_t signaturelen, |
|
|
/* .size = */ NULL, |
/* .size = */ NULL, |
/* .alloc = */ NULL, |
/* .alloc = */ NULL, |
/* .cleanup = */ ssh_ed25519_sk_cleanup, |
/* .cleanup = */ ssh_ed25519_sk_cleanup, |
|
/* .equal = */ ssh_ed25519_sk_equal, |
}; |
}; |
|
|
const struct sshkey_impl sshkey_ed25519_sk_impl = { |
const struct sshkey_impl sshkey_ed25519_sk_impl = { |