Rename Methods class to Libsodium

This commit is contained in:
Pieter-Jan Briers
2022-03-27 18:00:02 +02:00
parent 8643c10779
commit 2161e38118
4 changed files with 22 additions and 10 deletions

View File

@@ -93,3 +93,6 @@ libsodium
--remap --remap
crypto_aead_aes256gcm_state_=crypto_aead_aes256gcm_state crypto_aead_aes256gcm_state_=crypto_aead_aes256gcm_state
crypto_auth_hmacsha512_state=crypto_auth_hmacsha512256_state crypto_auth_hmacsha512_state=crypto_auth_hmacsha512256_state
--methodClassName
Libsodium

View File

@@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
namespace SpaceWizards.Sodium.Interop namespace SpaceWizards.Sodium.Interop
{ {
public static unsafe partial class Methods public static unsafe partial class Libsodium
{ {
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int sodium_init(); public static extern int sodium_init();
@@ -2680,6 +2680,15 @@ namespace SpaceWizards.Sodium.Interop
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_stream_salsa20_keygen([NativeTypeName("unsigned char [32]")] byte* k); public static extern void crypto_stream_salsa20_keygen([NativeTypeName("unsigned char [32]")] byte* k);
[NativeTypeName("#define crypto_stream_salsa20_KEYBYTES 32U")]
public const uint crypto_stream_salsa20_KEYBYTES = 32U;
[NativeTypeName("#define crypto_stream_salsa20_NONCEBYTES 8U")]
public const uint crypto_stream_salsa20_NONCEBYTES = 8U;
[NativeTypeName("#define crypto_stream_salsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX")]
public const ulong crypto_stream_salsa20_MESSAGEBYTES_MAX = ((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL));
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")] [return: NativeTypeName("size_t")]
public static extern nuint crypto_stream_salsa208_keybytes(); public static extern nuint crypto_stream_salsa208_keybytes();

View File

@@ -14,11 +14,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Generated"/> <Folder Include="Generated" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="libsodium" Version="1.0.18.1"/> <PackageReference Include="libsodium" Version="1.0.18.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1,6 +1,6 @@
using System.Security.Cryptography; using System.Security.Cryptography;
using NUnit.Framework; using NUnit.Framework;
using static SpaceWizards.Sodium.Interop.Methods; using static SpaceWizards.Sodium.Interop.Libsodium;
namespace SpaceWizards.Sodium.Tests; namespace SpaceWizards.Sodium.Tests;