mirror of
https://github.com/open-quantum-safe/liboqs.git
synced 2025-10-06 00:03:35 -04:00
(Re)Added SIDHv3/SIKE to Visual Studio. (#213)
This commit is contained in:
parent
872c68a796
commit
46a8976399
@ -57,6 +57,13 @@
|
||||
<ClInclude Include="..\..\src\kex_rlwe_msrln16\kex_rlwe_msrln16.h" />
|
||||
<ClInclude Include="..\..\src\kex_rlwe_msrln16\LatticeCrypto.h" />
|
||||
<ClInclude Include="..\..\src\kex_rlwe_msrln16\LatticeCrypto_priv.h" />
|
||||
<ClInclude Include="..\..\src\kex_sidh_msr\kex_sidh_msr.h" />
|
||||
<ClInclude Include="..\..\src\kex_sidh_msr\P503\P503_api.h" />
|
||||
<ClInclude Include="..\..\src\kex_sidh_msr\P503\P503_internal.h" />
|
||||
<ClInclude Include="..\..\src\kex_sidh_msr\P751\P751_api.h" />
|
||||
<ClInclude Include="..\..\src\kex_sidh_msr\P751\P751_internal.h" />
|
||||
<ClInclude Include="..\..\src\kex_sidh_msr\sha3\fips202.h" />
|
||||
<ClInclude Include="..\..\src\kex_sidh_msr\windows_undef.h" />
|
||||
<ClInclude Include="..\..\src\sig\sig.h" />
|
||||
<ClInclude Include="..\..\src\sig_picnic\sig_picnic.h" />
|
||||
</ItemGroup>
|
||||
@ -84,6 +91,10 @@
|
||||
<ClCompile Include="..\..\src\kex_rlwe_msrln16\kex_rlwe_msrln16.c" />
|
||||
<ClCompile Include="..\..\src\kex_rlwe_msrln16\LatticeCrypto_kex.c" />
|
||||
<ClCompile Include="..\..\src\kex_rlwe_msrln16\ntt_constants.c" />
|
||||
<ClCompile Include="..\..\src\kex_sidh_msr\kex_sidh_msr.c" />
|
||||
<ClCompile Include="..\..\src\kex_sidh_msr\P503\P503.c" />
|
||||
<ClCompile Include="..\..\src\kex_sidh_msr\P751\P751.c" />
|
||||
<ClCompile Include="..\..\src\kex_sidh_msr\sha3\fips202.c" />
|
||||
<ClCompile Include="..\..\src\sig\sig.c" />
|
||||
<ClCompile Include="..\..\src\sig_picnic\sig_picnic.c" />
|
||||
</ItemGroup>
|
||||
@ -225,6 +236,7 @@ copy "$(SolutionDir)..\src\kex_rlwe_msrln16\kex_rlwe_msrln16.h" "$(SolutionDir)i
|
||||
copy "$(SolutionDir)..\src\kex_lwe_frodo\kex_lwe_frodo.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_code_mcbits\kex_code_mcbits.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_ntru\kex_ntru.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_sidh_msr\kex_sidh_msr.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\sig\sig.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\sig_picnic\sig_picnic.h" "$(SolutionDir)include\oqs\"
|
||||
</Command>
|
||||
@ -261,6 +273,7 @@ copy "$(SolutionDir)..\src\kex_rlwe_msrln16\kex_rlwe_msrln16.h" "$(SolutionDir)i
|
||||
copy "$(SolutionDir)..\src\kex_lwe_frodo\kex_lwe_frodo.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_code_mcbits\kex_code_mcbits.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_ntru\kex_ntru.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_sidh_msr\kex_sidh_msr.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\sig\sig.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\sig_picnic\sig_picnic.h" "$(SolutionDir)include\oqs\"
|
||||
</Command>
|
||||
@ -297,6 +310,7 @@ copy "$(SolutionDir)..\src\kex_rlwe_msrln16\kex_rlwe_msrln16.h" "$(SolutionDir)i
|
||||
copy "$(SolutionDir)..\src\kex_lwe_frodo\kex_lwe_frodo.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_code_mcbits\kex_code_mcbits.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_ntru\kex_ntru.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_sidh_msr\kex_sidh_msr.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\sig\sig.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\sig_picnic\sig_picnic.h" "$(SolutionDir)include\oqs\"
|
||||
</Command>
|
||||
@ -337,6 +351,7 @@ copy "$(SolutionDir)..\src\kex_rlwe_msrln16\kex_rlwe_msrln16.h" "$(SolutionDir)i
|
||||
copy "$(SolutionDir)..\src\kex_lwe_frodo\kex_lwe_frodo.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_code_mcbits\kex_code_mcbits.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_ntru\kex_ntru.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_sidh_msr\kex_sidh_msr.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\sig\sig.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\sig_picnic\sig_picnic.h" "$(SolutionDir)include\oqs\"
|
||||
</Command>
|
||||
@ -379,6 +394,7 @@ copy "$(SolutionDir)..\src\kex_rlwe_msrln16\kex_rlwe_msrln16.h" "$(SolutionDir)i
|
||||
copy "$(SolutionDir)..\src\kex_lwe_frodo\kex_lwe_frodo.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_code_mcbits\kex_code_mcbits.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_ntru\kex_ntru.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_sidh_msr\kex_sidh_msr.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\sig\sig.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\sig_picnic\sig_picnic.h" "$(SolutionDir)include\oqs\"
|
||||
</Command>
|
||||
@ -419,6 +435,7 @@ copy "$(SolutionDir)..\src\kex_rlwe_msrln16\kex_rlwe_msrln16.h" "$(SolutionDir)i
|
||||
copy "$(SolutionDir)..\src\kex_lwe_frodo\kex_lwe_frodo.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_code_mcbits\kex_code_mcbits.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_ntru\kex_ntru.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_sidh_msr\kex_sidh_msr.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\sig\sig.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\sig_picnic\sig_picnic.h" "$(SolutionDir)include\oqs\"
|
||||
</Command>
|
||||
@ -459,6 +476,7 @@ copy "$(SolutionDir)..\src\kex_rlwe_msrln16\kex_rlwe_msrln16.h" "$(SolutionDir)i
|
||||
copy "$(SolutionDir)..\src\kex_lwe_frodo\kex_lwe_frodo.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_code_mcbits\kex_code_mcbits.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_ntru\kex_ntru.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_sidh_msr\kex_sidh_msr.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\sig\sig.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\sig_picnic\sig_picnic.h" "$(SolutionDir)include\oqs\"
|
||||
</Command>
|
||||
@ -503,6 +521,7 @@ copy "$(SolutionDir)..\src\kex_rlwe_msrln16\kex_rlwe_msrln16.h" "$(SolutionDir)i
|
||||
copy "$(SolutionDir)..\src\kex_lwe_frodo\kex_lwe_frodo.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_code_mcbits\kex_code_mcbits.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_ntru\kex_ntru.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\kex_sidh_msr\kex_sidh_msr.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\sig\sig.h" "$(SolutionDir)include\oqs\"
|
||||
copy "$(SolutionDir)..\src\sig_picnic\sig_picnic.h" "$(SolutionDir)include\oqs\"
|
||||
</Command>
|
||||
|
@ -76,6 +76,18 @@
|
||||
<ClCompile Include="..\..\src\sig_picnic\sig_picnic.c">
|
||||
<Filter>Sig_Picnic</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kex_sidh_msr\kex_sidh_msr.c">
|
||||
<Filter>KEX_SIDH_MSR</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kex_sidh_msr\P503\P503.c">
|
||||
<Filter>KEX_SIDH_MSR</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kex_sidh_msr\P751\P751.c">
|
||||
<Filter>KEX_SIDH_MSR</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kex_sidh_msr\sha3\fips202.c">
|
||||
<Filter>KEX_SIDH_MSR</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\kex_lwe_frodo\kex_lwe_frodo.h">
|
||||
@ -150,6 +162,27 @@
|
||||
<ClInclude Include="..\..\src\sig_picnic\sig_picnic.h">
|
||||
<Filter>Sig_Picnic</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kex_sidh_msr\kex_sidh_msr.h">
|
||||
<Filter>KEX_SIDH_MSR</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kex_sidh_msr\sha3\fips202.h">
|
||||
<Filter>KEX_SIDH_MSR</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kex_sidh_msr\P503\P503_api.h">
|
||||
<Filter>KEX_SIDH_MSR</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kex_sidh_msr\P503\P503_internal.h">
|
||||
<Filter>KEX_SIDH_MSR</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kex_sidh_msr\windows_undef.h">
|
||||
<Filter>KEX_SIDH_MSR</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kex_sidh_msr\P751\P751_api.h">
|
||||
<Filter>KEX_SIDH_MSR</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kex_sidh_msr\P751\P751_internal.h">
|
||||
<Filter>KEX_SIDH_MSR</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Common">
|
||||
@ -194,8 +227,11 @@
|
||||
<Filter Include="Sig_Picnic">
|
||||
<UniqueIdentifier>{18dd9adb-41b8-4058-a714-0a0d49db26ad}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="KEX_SIDH_MSR">
|
||||
<UniqueIdentifier>{e8cfee66-d051-4f66-af66-1478288097fb}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="dll.def" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
@ -7,9 +7,7 @@
|
||||
#include <oqs/kex_rlwe_bcns15.h>
|
||||
#include <oqs/kex_rlwe_msrln16.h>
|
||||
#include <oqs/kex_rlwe_newhope.h>
|
||||
#ifdef ENABLE_KEX_SIDH_MSR
|
||||
#include <oqs/kex_sidh_msr.h>
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_CODE_MCBITS
|
||||
#include <oqs/kex_code_mcbits.h>
|
||||
|
@ -9,15 +9,19 @@
|
||||
|
||||
#include <oqs/rand.h>
|
||||
|
||||
#if defined(WINDOWS)
|
||||
#include "../windows_undef.h"
|
||||
#endif
|
||||
|
||||
/*********************** Key encapsulation mechanism API ***********************/
|
||||
|
||||
#define CRYPTO_SECRETKEYBYTES 434 // MSG_BYTES + SECRETKEY_B_BYTES + CRYPTO_PUBLICKEYBYTES bytes
|
||||
#define CRYPTO_PUBLICKEYBYTES 378
|
||||
#define CRYPTO_BYTES 16
|
||||
#define CRYPTO_CIPHERTEXTBYTES 402 // CRYPTO_PUBLICKEYBYTES + MSG_BYTES bytes
|
||||
#define OQS_SIDH_MSR_CRYPTO_SECRETKEYBYTES 434 // MSG_BYTES + SECRETKEY_B_BYTES + CRYPTO_PUBLICKEYBYTES bytes
|
||||
#define OQS_SIDH_MSR_CRYPTO_PUBLICKEYBYTES 378
|
||||
#define OQS_SIDH_MSR_CRYPTO_BYTES 16
|
||||
#define OQS_SIDH_MSR_CRYPTO_CIPHERTEXTBYTES 402 // CRYPTO_PUBLICKEYBYTES + MSG_BYTES bytes
|
||||
|
||||
// Algorithm name
|
||||
#define CRYPTO_ALGNAME "SIKEp503"
|
||||
#define OQS_SIDH_MSR_CRYPTO_ALGNAME "SIKEp503"
|
||||
|
||||
// SIKE's key generation
|
||||
// It produces a private key sk and computes the public key pk.
|
||||
|
@ -9,15 +9,18 @@
|
||||
|
||||
#include <oqs/rand.h>
|
||||
|
||||
/*********************** Key encapsulation mechanism API ***********************/
|
||||
#if defined(WINDOWS)
|
||||
#include "../windows_undef.h"
|
||||
#endif
|
||||
|
||||
#define CRYPTO_SECRETKEYBYTES 644 // MSG_BYTES + SECRETKEY_B_BYTES + CRYPTO_PUBLICKEYBYTES bytes
|
||||
#define CRYPTO_PUBLICKEYBYTES 564
|
||||
#define CRYPTO_BYTES 24
|
||||
#define CRYPTO_CIPHERTEXTBYTES 596 // CRYPTO_PUBLICKEYBYTES + MSG_BYTES bytes
|
||||
/*********************** Key encapsulation mechanism API ***********************/
|
||||
#define OQS_SIDH_MSR_CRYPTO_SECRETKEYBYTES 644 // MSG_BYTES + SECRETKEY_B_BYTES + CRYPTO_PUBLICKEYBYTES bytes
|
||||
#define OQS_SIDH_MSR_CRYPTO_PUBLICKEYBYTES 564
|
||||
#define OQS_SIDH_MSR_CRYPTO_BYTES 24
|
||||
#define OQS_SIDH_MSR_CRYPTO_CIPHERTEXTBYTES 596 // CRYPTO_PUBLICKEYBYTES + MSG_BYTES bytes
|
||||
|
||||
// Algorithm name
|
||||
#define CRYPTO_ALGNAME "SIKEp751"
|
||||
#define OQS_SIDH_MSR_CRYPTO_ALGNAME "SIKEp751"
|
||||
|
||||
// SIKE's key generation
|
||||
// It produces a private key sk and computes the public key pk.
|
||||
|
@ -58,7 +58,7 @@ OQS_KEX *OQS_KEX_sidh_msr_new(OQS_RAND *rand, const char *named_parameters) {
|
||||
}
|
||||
SIDH_CTX *sidh_ctx = malloc(sizeof(SIDH_CTX));
|
||||
if (sidh_ctx == NULL) {
|
||||
goto cleanup;
|
||||
goto err;
|
||||
}
|
||||
if (strcmp(named_parameters, OQS_KEX_SIDH_503_params) == 0) {
|
||||
k->method_name = strdup("SIDH MSR p503");
|
||||
|
@ -19,7 +19,7 @@ int crypto_kem_keypair(unsigned char *pk, unsigned char *sk, OQS_RAND *rand) { /
|
||||
EphemeralKeyGeneration_B(sk + MSG_BYTES, pk, rand);
|
||||
|
||||
// Append public key pk to secret key sk
|
||||
memcpy(&sk[MSG_BYTES + SECRETKEY_B_BYTES], pk, CRYPTO_PUBLICKEYBYTES);
|
||||
memcpy(&sk[MSG_BYTES + SECRETKEY_B_BYTES], pk, OQS_SIDH_MSR_CRYPTO_PUBLICKEYBYTES);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -34,13 +34,13 @@ int crypto_kem_enc(unsigned char *ct, unsigned char *ss, const unsigned char *pk
|
||||
unsigned char ephemeralsk[SECRETKEY_A_BYTES];
|
||||
unsigned char jinvariant[FP2_ENCODED_BYTES];
|
||||
unsigned char h[MSG_BYTES];
|
||||
unsigned char temp[CRYPTO_CIPHERTEXTBYTES + MSG_BYTES];
|
||||
unsigned char temp[OQS_SIDH_MSR_CRYPTO_CIPHERTEXTBYTES + MSG_BYTES];
|
||||
unsigned int i;
|
||||
|
||||
// Generate ephemeralsk <- G(m||pk) mod oA
|
||||
OQS_RAND_n(rand, temp, MSG_BYTES);
|
||||
memcpy(&temp[MSG_BYTES], pk, CRYPTO_PUBLICKEYBYTES);
|
||||
cshake256_simple(ephemeralsk, SECRETKEY_A_BYTES, G, temp, CRYPTO_PUBLICKEYBYTES + MSG_BYTES);
|
||||
memcpy(&temp[MSG_BYTES], pk, OQS_SIDH_MSR_CRYPTO_PUBLICKEYBYTES);
|
||||
cshake256_simple(ephemeralsk, SECRETKEY_A_BYTES, G, temp, OQS_SIDH_MSR_CRYPTO_PUBLICKEYBYTES + MSG_BYTES);
|
||||
ephemeralsk[SECRETKEY_A_BYTES - 1] &= MASK_ALICE;
|
||||
|
||||
// Encrypt
|
||||
@ -48,11 +48,11 @@ int crypto_kem_enc(unsigned char *ct, unsigned char *ss, const unsigned char *pk
|
||||
EphemeralSecretAgreement_A(ephemeralsk, pk, jinvariant);
|
||||
cshake256_simple(h, MSG_BYTES, P, jinvariant, FP2_ENCODED_BYTES);
|
||||
for (i = 0; i < MSG_BYTES; i++)
|
||||
ct[i + CRYPTO_PUBLICKEYBYTES] = temp[i] ^ h[i];
|
||||
ct[i + OQS_SIDH_MSR_CRYPTO_PUBLICKEYBYTES] = temp[i] ^ h[i];
|
||||
|
||||
// Generate shared secret ss <- H(m||ct)
|
||||
memcpy(&temp[MSG_BYTES], ct, CRYPTO_CIPHERTEXTBYTES);
|
||||
cshake256_simple(ss, CRYPTO_BYTES, H, temp, CRYPTO_CIPHERTEXTBYTES + MSG_BYTES);
|
||||
memcpy(&temp[MSG_BYTES], ct, OQS_SIDH_MSR_CRYPTO_CIPHERTEXTBYTES);
|
||||
cshake256_simple(ss, OQS_SIDH_MSR_CRYPTO_BYTES, H, temp, OQS_SIDH_MSR_CRYPTO_CIPHERTEXTBYTES + MSG_BYTES);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -67,28 +67,28 @@ int crypto_kem_dec(unsigned char *ss, const unsigned char *ct, const unsigned ch
|
||||
unsigned char ephemeralsk_[SECRETKEY_A_BYTES];
|
||||
unsigned char jinvariant_[FP2_ENCODED_BYTES];
|
||||
unsigned char h_[MSG_BYTES];
|
||||
unsigned char c0_[CRYPTO_PUBLICKEYBYTES];
|
||||
unsigned char temp[CRYPTO_CIPHERTEXTBYTES + MSG_BYTES];
|
||||
unsigned char c0_[OQS_SIDH_MSR_CRYPTO_PUBLICKEYBYTES];
|
||||
unsigned char temp[OQS_SIDH_MSR_CRYPTO_CIPHERTEXTBYTES + MSG_BYTES];
|
||||
unsigned int i;
|
||||
|
||||
// Decrypt
|
||||
EphemeralSecretAgreement_B(sk + MSG_BYTES, ct, jinvariant_);
|
||||
cshake256_simple(h_, MSG_BYTES, P, jinvariant_, FP2_ENCODED_BYTES);
|
||||
for (i = 0; i < MSG_BYTES; i++)
|
||||
temp[i] = ct[i + CRYPTO_PUBLICKEYBYTES] ^ h_[i];
|
||||
temp[i] = ct[i + OQS_SIDH_MSR_CRYPTO_PUBLICKEYBYTES] ^ h_[i];
|
||||
|
||||
// Generate ephemeralsk_ <- G(m||pk) mod oA
|
||||
memcpy(&temp[MSG_BYTES], &sk[MSG_BYTES + SECRETKEY_B_BYTES], CRYPTO_PUBLICKEYBYTES);
|
||||
cshake256_simple(ephemeralsk_, SECRETKEY_A_BYTES, G, temp, CRYPTO_PUBLICKEYBYTES + MSG_BYTES);
|
||||
memcpy(&temp[MSG_BYTES], &sk[MSG_BYTES + SECRETKEY_B_BYTES], OQS_SIDH_MSR_CRYPTO_PUBLICKEYBYTES);
|
||||
cshake256_simple(ephemeralsk_, SECRETKEY_A_BYTES, G, temp, OQS_SIDH_MSR_CRYPTO_PUBLICKEYBYTES + MSG_BYTES);
|
||||
ephemeralsk_[SECRETKEY_A_BYTES - 1] &= MASK_ALICE;
|
||||
|
||||
// Generate shared secret ss <- H(m||ct) or output ss <- H(s||ct)
|
||||
EphemeralKeyGeneration_A(ephemeralsk_, c0_, rand);
|
||||
if (memcmp(c0_, ct, CRYPTO_PUBLICKEYBYTES) != 0) {
|
||||
if (memcmp(c0_, ct, OQS_SIDH_MSR_CRYPTO_PUBLICKEYBYTES) != 0) {
|
||||
memcpy(temp, sk, MSG_BYTES);
|
||||
}
|
||||
memcpy(&temp[MSG_BYTES], ct, CRYPTO_CIPHERTEXTBYTES);
|
||||
cshake256_simple(ss, CRYPTO_BYTES, H, temp, CRYPTO_CIPHERTEXTBYTES + MSG_BYTES);
|
||||
memcpy(&temp[MSG_BYTES], ct, OQS_SIDH_MSR_CRYPTO_CIPHERTEXTBYTES);
|
||||
cshake256_simple(ss, OQS_SIDH_MSR_CRYPTO_BYTES, H, temp, OQS_SIDH_MSR_CRYPTO_CIPHERTEXTBYTES + MSG_BYTES);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
15
src/kex_sidh_msr/windows_undef.h
Normal file
15
src/kex_sidh_msr/windows_undef.h
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* undefines SIDH symbols included in both P503 and P751
|
||||
* to avoid Visual Studio errors
|
||||
*/
|
||||
|
||||
#if defined(WINDOWS)
|
||||
#undef OQS_SIDH_MSR_CRYPTO_SECRETKEYBYTES
|
||||
#undef OQS_SIDH_MSR_CRYPTO_PUBLICKEYBYTES
|
||||
#undef OQS_SIDH_MSR_CRYPTO_BYTES
|
||||
#undef OQS_SIDH_MSR_CRYPTO_CIPHERTEXTBYTES
|
||||
#undef OQS_SIDH_MSR_CRYPTO_ALGNAME
|
||||
#undef SIDH_SECRETKEYBYTES
|
||||
#undef SIDH_PUBLICKEYBYTES
|
||||
#undef SIDH_BYTES
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user