crypto_sign/ed25519/ref10/keypair.c
raw| 1 | #include <string.h> |
| 2 | #include "randombytes.h" |
| 3 | #include "crypto_sign.h" |
| 4 | #include "crypto_hash_sha512.h" |
| 5 | #include "crypto_nG_merged25519.h" |
| 6 | |
| 7 | void crypto_sign_keypair(unsigned char *pk,unsigned char *sk) |
| 8 | { |
| 9 | unsigned char az[64]; |
| 10 | |
| 11 | randombytes(sk,32); |
| 12 | crypto_hash_sha512(az,sk,32); |
| 13 | az[0] &= 248; |
| 14 | az[31] &= 63; |
| 15 | az[31] |= 64; |
| 16 | |
| 17 | crypto_nG_merged25519(pk,az); |
| 18 | memmove(sk + 32,pk,32); |
| 19 | } |