From 88d18d7d4980147f12cc10b1223554fdb5fcd069 Mon Sep 17 00:00:00 2001 From: Christian Paquin Date: Thu, 22 Dec 2016 11:27:29 -0500 Subject: [PATCH] Enable McBits on Windows (#78) --- README.md | 6 +++++- VisualStudio/oqs/oqs.vcxproj | 24 +++++++++++++++-------- VisualStudio/oqs/oqs.vcxproj.filters | 15 ++++++++++++++ src/kex_code_mcbits/external/operations.c | 3 ++- 4 files changed, 38 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 7d69848d8..b5f7e12f5 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,11 @@ To run benchmarks, run ### Windows -Windows binaries can be generated using the Visual Studio solution in the VisualStudio folder. +Windows binaries can be generated using the Visual Studio solution in the VisualStudio folder. McBits is disabled by default; follow these steps to enable it: +- Obtain the ([libsodium library](https://libsodium.org)); compile the static library from the Visual Studio projects. +- Add ENABLE_CODE_MCBITS and SODIUM_STATIC to the preprocessor definitions of the oqs and test_kex projects. +- Add the sodium "src/include" location to the "Additional Include Directories" in the oqs project C properties. +- Add the libsodium library to the "Additional Depencies" in the test_kex project Linker properties. Documentation ------------- diff --git a/VisualStudio/oqs/oqs.vcxproj b/VisualStudio/oqs/oqs.vcxproj index 257423270..3169034e3 100644 --- a/VisualStudio/oqs/oqs.vcxproj +++ b/VisualStudio/oqs/oqs.vcxproj @@ -27,6 +27,8 @@ + + @@ -52,6 +54,8 @@ + + @@ -139,7 +143,7 @@ Disabled AES_DISABLE_NI;OQS_RAND_DEFAULT_URANDOM_CHACHA20;OQS_KEX_DEFAULT_BCNS15;CONSTANT_TIME;WINDOWS;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) false - $(SolutionDir)include; + $(SolutionDir)include MultiThreadedDebug @@ -159,7 +163,8 @@ copy "$(SolutionDir)..\src\kex_rlwe_bcns15\kex_rlwe_bcns15.h" "$(SolutionDir)inc copy "$(SolutionDir)..\src\kex_rlwe_newhope\kex_rlwe_newhope.h" "$(SolutionDir)include\oqs\" copy "$(SolutionDir)..\src\kex_rlwe_msrln16\kex_rlwe_msrln16.h" "$(SolutionDir)include\oqs\" copy "$(SolutionDir)..\src\kex_lwe_frodo\kex_lwe_frodo.h" "$(SolutionDir)include\oqs\" -copy "$(SolutionDir)..\src\kex_sidh_cln16\kex_sidh_cln16.h" "$(SolutionDir)include\oqs\" +copy "$(SolutionDir)..\src\kex_sidh_cln16\kex_sidh_cln16.h" "$(SolutionDir)include\oqs\" +copy "$(SolutionDir)..\src\kex_code_mcbits\kex_code_mcbits.h" "$(SolutionDir)include\oqs\" @@ -170,7 +175,7 @@ copy "$(SolutionDir)..\src\kex_sidh_cln16\kex_sidh_cln16.h" "$(SolutionDir)inclu Disabled OQS_RAND_DEFAULT_URANDOM_CHACHA20;OQS_KEX_DEFAULT_BCNS15;CONSTANT_TIME;WINDOWS;_DEBUG;_LIB;%(PreprocessorDefinitions) false - $(SolutionDir)include; + $(SolutionDir)include MultiThreadedDebug @@ -190,7 +195,8 @@ copy "$(SolutionDir)..\src\kex_rlwe_bcns15\kex_rlwe_bcns15.h" "$(SolutionDir)inc copy "$(SolutionDir)..\src\kex_rlwe_newhope\kex_rlwe_newhope.h" "$(SolutionDir)include\oqs\" copy "$(SolutionDir)..\src\kex_rlwe_msrln16\kex_rlwe_msrln16.h" "$(SolutionDir)include\oqs\" copy "$(SolutionDir)..\src\kex_lwe_frodo\kex_lwe_frodo.h" "$(SolutionDir)include\oqs\" -copy "$(SolutionDir)..\src\kex_sidh_cln16\kex_sidh_cln16.h" "$(SolutionDir)include\oqs\" +copy "$(SolutionDir)..\src\kex_sidh_cln16\kex_sidh_cln16.h" "$(SolutionDir)include\oqs\" +copy "$(SolutionDir)..\src\kex_code_mcbits\kex_code_mcbits.h" "$(SolutionDir)include\oqs\" @@ -203,7 +209,7 @@ copy "$(SolutionDir)..\src\kex_sidh_cln16\kex_sidh_cln16.h" "$(SolutionDir)inclu true AES_DISABLE_NI;OQS_RAND_DEFAULT_URANDOM_CHACHA20;OQS_KEX_DEFAULT_BCNS15;CONSTANT_TIME;WINDOWS;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) false - $(SolutionDir)include; + $(SolutionDir)include MultiThreaded @@ -225,7 +231,8 @@ copy "$(SolutionDir)..\src\kex_rlwe_bcns15\kex_rlwe_bcns15.h" "$(SolutionDir)inc copy "$(SolutionDir)..\src\kex_rlwe_newhope\kex_rlwe_newhope.h" "$(SolutionDir)include\oqs\" copy "$(SolutionDir)..\src\kex_rlwe_msrln16\kex_rlwe_msrln16.h" "$(SolutionDir)include\oqs\" copy "$(SolutionDir)..\src\kex_lwe_frodo\kex_lwe_frodo.h" "$(SolutionDir)include\oqs\" -copy "$(SolutionDir)..\src\kex_sidh_cln16\kex_sidh_cln16.h" "$(SolutionDir)include\oqs\" +copy "$(SolutionDir)..\src\kex_sidh_cln16\kex_sidh_cln16.h" "$(SolutionDir)include\oqs\" +copy "$(SolutionDir)..\src\kex_code_mcbits\kex_code_mcbits.h" "$(SolutionDir)include\oqs\" @@ -238,7 +245,7 @@ copy "$(SolutionDir)..\src\kex_sidh_cln16\kex_sidh_cln16.h" "$(SolutionDir)inclu true OQS_RAND_DEFAULT_URANDOM_CHACHA20;OQS_KEX_DEFAULT_BCNS15;CONSTANT_TIME;WINDOWS;NDEBUG;_LIB;%(PreprocessorDefinitions) false - $(SolutionDir)include; + $(SolutionDir)include MultiThreaded @@ -260,7 +267,8 @@ copy "$(SolutionDir)..\src\kex_rlwe_bcns15\kex_rlwe_bcns15.h" "$(SolutionDir)inc copy "$(SolutionDir)..\src\kex_rlwe_newhope\kex_rlwe_newhope.h" "$(SolutionDir)include\oqs\" copy "$(SolutionDir)..\src\kex_rlwe_msrln16\kex_rlwe_msrln16.h" "$(SolutionDir)include\oqs\" copy "$(SolutionDir)..\src\kex_lwe_frodo\kex_lwe_frodo.h" "$(SolutionDir)include\oqs\" -copy "$(SolutionDir)..\src\kex_sidh_cln16\kex_sidh_cln16.h" "$(SolutionDir)include\oqs\" +copy "$(SolutionDir)..\src\kex_sidh_cln16\kex_sidh_cln16.h" "$(SolutionDir)include\oqs\" +copy "$(SolutionDir)..\src\kex_code_mcbits\kex_code_mcbits.h" "$(SolutionDir)include\oqs\" diff --git a/VisualStudio/oqs/oqs.vcxproj.filters b/VisualStudio/oqs/oqs.vcxproj.filters index 53e1acaba..3a7c7e2ce 100644 --- a/VisualStudio/oqs/oqs.vcxproj.filters +++ b/VisualStudio/oqs/oqs.vcxproj.filters @@ -85,6 +85,12 @@ KEX + + KEX_McBits + + + KEX_McBits + @@ -153,6 +159,12 @@ KEX + + KEX_McBits + + + KEX_McBits + @@ -188,5 +200,8 @@ {a9a0db92-1388-4ea2-b0d5-d61a51581993} + + {9c91a128-d5a0-4eec-998e-a7bc85b3691e} + \ No newline at end of file diff --git a/src/kex_code_mcbits/external/operations.c b/src/kex_code_mcbits/external/operations.c index 235f5913e..870957322 100755 --- a/src/kex_code_mcbits/external/operations.c +++ b/src/kex_code_mcbits/external/operations.c @@ -1,3 +1,4 @@ +#ifdef ENABLE_CODE_MCBITS // don't want this file in Visual Studio if libsodium is not present #include #include #include @@ -8,7 +9,6 @@ #include #include #include - #include "params.h" #include "util.c" #include "transpose.c" @@ -109,3 +109,4 @@ int oqs_kex_mcbits_gen_keypair return 0; } +#endif \ No newline at end of file