This repo aims to reflect Signal's curve25519-java. Any commits there should be replicated here.
- .NET Core 3.1 or greater
- Opening in Visual Studio requires Visual Studio 2019 (v16.4.0) or greater
- Open the curve25519-dotnet.sln in Visual Studio
- Build the solution
- Run the tests using the Test Explorer window
dotnet build
dotnet test
- Make changes
- The code here should largely reflect the code in curve25519-java. The major difference will be how pointers vs arrays are handled as we can't do pointer math in safe C#.
- It's OK to turn C style if functions that return an int to C# style if functions that return a boolean. (see C gen_labelset#is_labelset_empty vs C# gen_labelset.is_labelset_empty)
- Test changes
- Tests here should match tests in the curve25519-java. Tests should pass before creating a PR. When testing C changes it's best practice to run just
InternalFastTests.cs
. Once all tests there pass runInternalSlowTests.cs
. If you want to be really sure unignoregeneralized_xveddsa_slow_test
and make sure that passes as well.
- Tests here should match tests in the curve25519-java. Tests should pass before creating a PR. When testing C changes it's best practice to run just
- Commit changes with your commit message matching the commit message from curve25519-java. For example this. It's also include a link back to the curve25519-java commit in your commit description.
TODO because I haven't figured it out yet.
If your tests fail after you've made your changes it can be helpful to debug the C code to see what the delta is.
- Follow the prerequisite steps from the VSCode documentation
- Launch a Developer Powershell for Visual Studio
- Copy the
.vscode
folder fromdocs/curve25519-java C debugging
to where you cloned curve25519-java - Navigate to where you cloned curve25519-java
- Checkout the commit you're replicating then the repo in VSCode (
code .
) - Create a
main.c
and reference the test file you want to run. Example below.
#include "internal_fast_tests.h"
int main(int argc, char* argv[])
{
all_fast_tests(0);
return 0;
}
- You may need to edit some C files to fix errors. For example you can't use MSG_LEN to define array lengths in internal_fast_tests.c so replace that with the value of MSG_LEN.
- Set any needed breakpoints
- Start the debugger
Note that this will create a bunch of .obj, .ilk, .pdb, and .exe files in the root directory.