| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#include |
|
2
|
|
|
|
|
|
|
#include "ed25519.h" |
|
3
|
|
|
|
|
|
|
#include "sha512.h" |
|
4
|
|
|
|
|
|
|
#include "ge.h" |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
|
|
|
void ed25519_create_keypair(unsigned char *public_key, unsigned char *private_key, const unsigned char *seed) { |
|
8
|
|
|
|
|
|
|
ge_p3 A; |
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
|
|
|
sha512(seed, 32, private_key); |
|
11
|
1
|
|
|
|
|
|
private_key[0] &= 248; |
|
12
|
1
|
|
|
|
|
|
private_key[31] &= 63; |
|
13
|
1
|
|
|
|
|
|
private_key[31] |= 64; |
|
14
|
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
|
ge_scalarmult_base(&A, private_key); |
|
16
|
1
|
|
|
|
|
|
ge_p3_tobytes(public_key, &A); |
|
17
|
|
|
|
|
|
|
|
|
18
|
1
|
|
|
|
|
|
memmove(private_key, seed, 32); |
|
19
|
1
|
|
|
|
|
|
memmove(private_key + 32, public_key, 32); |
|
20
|
1
|
|
|
|
|
|
} |