add amd64-{51-30k,64-24k} from SUPERCOP, now use autoconf

This commit is contained in:
cathugger
2017-09-27 02:35:56 +03:00
parent ad9c6592ed
commit 81cebae449
162 changed files with 79451 additions and 277 deletions

View File

@@ -0,0 +1,46 @@
#include <string.h>
#include "crypto_sign.h"
#include "crypto_hash_sha512.h"
#include "randombytes.h"
#include "ge25519.h"
int crypto_sign_seckey_expand(unsigned char *sk,const unsigned char *seed)
{
crypto_hash_sha512(sk,seed,32);
sk[0] &= 248;
sk[31] &= 63;
sk[31] |= 64;
return 0;
}
int crypto_sign_seckey(unsigned char *sk)
{
unsigned char seed[32];
if (randombytes(seed,32) < 0)
return -1;
crypto_sign_seckey_expand(sk,seed);
return 0;
}
int crypto_sign_pubkey(unsigned char *pk,const unsigned char *sk)
{
sc25519 scsk;
ge25519_p3 gepk;
sc25519_from32bytes(&scsk,sk);
ge25519_scalarmult_base(&gepk,&scsk);
ge25519_pack(pk,&gepk);
return 0;
}
int crypto_sign_keypair(unsigned char *pk,unsigned char *sk)
{
crypto_sign_seckey(sk);
crypto_sign_pubkey(pk,sk);
return 0;
}