gpg_do_write_prvkey for ed25519

This commit is contained in:
NIIBE Yutaka
2014-03-31 17:31:42 +09:00
parent c7a6370b74
commit f9ed79f644
4 changed files with 65 additions and 12 deletions

View File

@@ -23,6 +23,7 @@
*/
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "bn.h"
@@ -815,6 +816,22 @@ eddsa_public_key_25519 (bn256 *pk, const bn256 *a)
pk->word[7] ^= mod25519_is_neg (R->x) * 0x80000000;
}
uint8_t *
eddsa_compute_public_25519 (const uint8_t *kd)
{
uint8_t *p0;
const bn256 *a = (const bn256 *)kd;
p0 = (uint8_t *)malloc (sizeof (bn256));
if (p0 == NULL)
return NULL;
eddsa_public_key_25519 ((bn256 *)p0, a);
return p0;
}
#if 0
/**
* check if P is on the curve.