Update to sodium 1.0.20.1 to .NET 8

This commit is contained in:
2025-03-18 12:50:30 +13:00
parent 78015046a5
commit 93108d7032
55 changed files with 3600 additions and 282 deletions

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
* text=auto
*.sln text eol=crlf

View File

@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PackageId>SpaceWizards.Sodium.Interop</PackageId>
<Version>1.0.18-beta4</Version>
<PackageId>CSSUDII.Sodium.Interop</PackageId>
<Version>1.0.20.1</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Description>Native API binding for libsodium.</Description>
<NoWarn>CS1591</NoWarn>
@@ -18,7 +18,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="libsodium" Version="1.0.18.2" />
<PackageReference Include="libsodium" Version="1.0.20.1" />
</ItemGroup>
</Project>

View File

@@ -1,7 +1,7 @@
using System;
using System.Runtime.InteropServices;
namespace SpaceWizards.Sodium.Interop
namespace CSSUDII.Sodium.Interop
{
public static unsafe partial class Libsodium
{
@@ -69,7 +69,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_aead_aes256gcm_decrypt_detached_afternm([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const crypto_aead_aes256gcm_state *")] crypto_aead_aes256gcm_state* ctx_);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_aead_aes256gcm_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_aead_aes256gcm_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[NativeTypeName("#define crypto_aead_aes256gcm_KEYBYTES 32U")]
public const uint crypto_aead_aes256gcm_KEYBYTES = 32U;
@@ -119,7 +119,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_aead_chacha20poly1305_ietf_decrypt_detached([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_aead_chacha20poly1305_ietf_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_aead_chacha20poly1305_ietf_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
@@ -154,7 +154,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_aead_chacha20poly1305_decrypt_detached([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_aead_chacha20poly1305_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_aead_chacha20poly1305_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[NativeTypeName("#define crypto_aead_chacha20poly1305_ietf_KEYBYTES 32U")]
public const uint crypto_aead_chacha20poly1305_ietf_KEYBYTES = 32U;
@@ -234,7 +234,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_aead_xchacha20poly1305_ietf_decrypt_detached([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_aead_xchacha20poly1305_ietf_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_aead_xchacha20poly1305_ietf_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[NativeTypeName("#define crypto_aead_xchacha20poly1305_ietf_KEYBYTES 32U")]
public const uint crypto_aead_xchacha20poly1305_ietf_KEYBYTES = 32U;
@@ -285,7 +285,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_auth_verify([NativeTypeName("const unsigned char *")] byte* h, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_auth_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_auth_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[NativeTypeName("#define crypto_auth_BYTES crypto_auth_hmacsha512256_BYTES")]
public const uint crypto_auth_BYTES = 32U;
@@ -294,7 +294,7 @@ namespace SpaceWizards.Sodium.Interop
public const uint crypto_auth_KEYBYTES = 32U;
[NativeTypeName("#define crypto_auth_PRIMITIVE \"hmacsha512256\"")]
public static ReadOnlySpan<byte> crypto_auth_PRIMITIVE => new byte[] { 0x68, 0x6D, 0x61, 0x63, 0x73, 0x68, 0x61, 0x35, 0x31, 0x32, 0x32, 0x35, 0x36, 0x00 };
public static ReadOnlySpan<byte> crypto_auth_PRIMITIVE => "hmacsha512256"u8;
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
@@ -324,7 +324,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_auth_hmacsha256_final(crypto_auth_hmacsha256_state* state, [NativeTypeName("unsigned char *")] byte* @out);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_auth_hmacsha256_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_auth_hmacsha256_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[NativeTypeName("#define crypto_auth_hmacsha256_BYTES 32U")]
public const uint crypto_auth_hmacsha256_BYTES = 32U;
@@ -360,7 +360,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_auth_hmacsha512_final([NativeTypeName("crypto_auth_hmacsha512_state *")] crypto_auth_hmacsha512256_state* state, [NativeTypeName("unsigned char *")] byte* @out);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_auth_hmacsha512_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_auth_hmacsha512_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[NativeTypeName("#define crypto_auth_hmacsha512_BYTES 64U")]
public const uint crypto_auth_hmacsha512_BYTES = 64U;
@@ -396,7 +396,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_auth_hmacsha512256_final(crypto_auth_hmacsha512256_state* state, [NativeTypeName("unsigned char *")] byte* @out);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_auth_hmacsha512256_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_auth_hmacsha512256_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[NativeTypeName("#define crypto_auth_hmacsha512256_BYTES 32U")]
public const uint crypto_auth_hmacsha512256_BYTES = 32U;
@@ -518,7 +518,7 @@ namespace SpaceWizards.Sodium.Interop
public const ulong crypto_box_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U);
[NativeTypeName("#define crypto_box_PRIMITIVE \"curve25519xsalsa20poly1305\"")]
public static ReadOnlySpan<byte> crypto_box_PRIMITIVE => new byte[] { 0x63, 0x75, 0x72, 0x76, 0x65, 0x32, 0x35, 0x35, 0x31, 0x39, 0x78, 0x73, 0x61, 0x6C, 0x73, 0x61, 0x32, 0x30, 0x70, 0x6F, 0x6C, 0x79, 0x31, 0x33, 0x30, 0x35, 0x00 };
public static ReadOnlySpan<byte> crypto_box_PRIMITIVE => "curve25519xsalsa20poly1305"u8;
[NativeTypeName("#define crypto_box_BEFORENMBYTES crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES")]
public const uint crypto_box_BEFORENMBYTES = 32U;
@@ -744,6 +744,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_core_ed25519_from_uniform([NativeTypeName("unsigned char *")] byte* p, [NativeTypeName("const unsigned char *")] byte* r);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[Obsolete]
public static extern int crypto_core_ed25519_from_hash([NativeTypeName("unsigned char *")] byte* p, [NativeTypeName("const unsigned char *")] byte* h);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@@ -950,18 +951,22 @@ namespace SpaceWizards.Sodium.Interop
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
[Obsolete]
public static extern nuint crypto_core_salsa208_outputbytes();
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
[Obsolete]
public static extern nuint crypto_core_salsa208_inputbytes();
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
[Obsolete]
public static extern nuint crypto_core_salsa208_keybytes();
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
[Obsolete]
public static extern nuint crypto_core_salsa208_constbytes();
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
@@ -1055,7 +1060,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_generichash_final([NativeTypeName("crypto_generichash_state *")] crypto_generichash_blake2b_state* state, [NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const size_t")] nuint outlen);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_generichash_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_generichash_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[NativeTypeName("#define crypto_generichash_BYTES_MIN crypto_generichash_blake2b_BYTES_MIN")]
public const uint crypto_generichash_BYTES_MIN = 16U;
@@ -1076,7 +1081,7 @@ namespace SpaceWizards.Sodium.Interop
public const uint crypto_generichash_KEYBYTES = 32U;
[NativeTypeName("#define crypto_generichash_PRIMITIVE \"blake2b\"")]
public static ReadOnlySpan<byte> crypto_generichash_PRIMITIVE => new byte[] { 0x62, 0x6C, 0x61, 0x6B, 0x65, 0x32, 0x62, 0x00 };
public static ReadOnlySpan<byte> crypto_generichash_PRIMITIVE => "blake2b"u8;
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
@@ -1133,7 +1138,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_generichash_blake2b_final(crypto_generichash_blake2b_state* state, [NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const size_t")] nuint outlen);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_generichash_blake2b_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_generichash_blake2b_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[NativeTypeName("#define crypto_generichash_blake2b_BYTES_MIN 16U")]
public const uint crypto_generichash_blake2b_BYTES_MIN = 16U;
@@ -1174,7 +1179,7 @@ namespace SpaceWizards.Sodium.Interop
public const uint crypto_hash_BYTES = 64U;
[NativeTypeName("#define crypto_hash_PRIMITIVE \"sha512\"")]
public static ReadOnlySpan<byte> crypto_hash_PRIMITIVE => new byte[] { 0x73, 0x68, 0x61, 0x35, 0x31, 0x32, 0x00 };
public static ReadOnlySpan<byte> crypto_hash_PRIMITIVE => "sha512"u8;
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
@@ -1243,10 +1248,10 @@ namespace SpaceWizards.Sodium.Interop
public static extern sbyte* crypto_kdf_primitive();
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_kdf_derive_from_key([NativeTypeName("unsigned char *")] byte* subkey, [NativeTypeName("size_t")] nuint subkey_len, [NativeTypeName("uint64_t")] ulong subkey_id, [NativeTypeName("const char [8]")] sbyte* ctx, [NativeTypeName("const unsigned char [32]")] byte* key);
public static extern int crypto_kdf_derive_from_key([NativeTypeName("unsigned char *")] byte* subkey, [NativeTypeName("size_t")] nuint subkey_len, [NativeTypeName("uint64_t")] ulong subkey_id, [NativeTypeName("const char[8]")] sbyte* ctx, [NativeTypeName("const unsigned char[32]")] byte* key);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_kdf_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_kdf_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[NativeTypeName("#define crypto_kdf_BYTES_MIN crypto_kdf_blake2b_BYTES_MIN")]
public const int crypto_kdf_BYTES_MIN = 16;
@@ -1261,19 +1266,7 @@ namespace SpaceWizards.Sodium.Interop
public const int crypto_kdf_KEYBYTES = 32;
[NativeTypeName("#define crypto_kdf_PRIMITIVE \"blake2b\"")]
public static ReadOnlySpan<byte> crypto_kdf_PRIMITIVE => new byte[] { 0x62, 0x6C, 0x61, 0x6B, 0x65, 0x32, 0x62, 0x00 };
[NativeTypeName("#define crypto_kdf_blake2b_BYTES_MIN 16")]
public const int crypto_kdf_blake2b_BYTES_MIN = 16;
[NativeTypeName("#define crypto_kdf_blake2b_BYTES_MAX 64")]
public const int crypto_kdf_blake2b_BYTES_MAX = 64;
[NativeTypeName("#define crypto_kdf_blake2b_CONTEXTBYTES 8")]
public const int crypto_kdf_blake2b_CONTEXTBYTES = 8;
[NativeTypeName("#define crypto_kdf_blake2b_KEYBYTES 32")]
public const int crypto_kdf_blake2b_KEYBYTES = 32;
public static ReadOnlySpan<byte> crypto_kdf_PRIMITIVE => "blake2b"u8;
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
@@ -1292,7 +1285,19 @@ namespace SpaceWizards.Sodium.Interop
public static extern nuint crypto_kdf_blake2b_keybytes();
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_kdf_blake2b_derive_from_key([NativeTypeName("unsigned char *")] byte* subkey, [NativeTypeName("size_t")] nuint subkey_len, [NativeTypeName("uint64_t")] ulong subkey_id, [NativeTypeName("const char [8]")] sbyte* ctx, [NativeTypeName("const unsigned char [32]")] byte* key);
public static extern int crypto_kdf_blake2b_derive_from_key([NativeTypeName("unsigned char *")] byte* subkey, [NativeTypeName("size_t")] nuint subkey_len, [NativeTypeName("uint64_t")] ulong subkey_id, [NativeTypeName("const char[8]")] sbyte* ctx, [NativeTypeName("const unsigned char[32]")] byte* key);
[NativeTypeName("#define crypto_kdf_blake2b_BYTES_MIN 16")]
public const int crypto_kdf_blake2b_BYTES_MIN = 16;
[NativeTypeName("#define crypto_kdf_blake2b_BYTES_MAX 64")]
public const int crypto_kdf_blake2b_BYTES_MAX = 64;
[NativeTypeName("#define crypto_kdf_blake2b_CONTEXTBYTES 8")]
public const int crypto_kdf_blake2b_CONTEXTBYTES = 8;
[NativeTypeName("#define crypto_kdf_blake2b_KEYBYTES 32")]
public const int crypto_kdf_blake2b_KEYBYTES = 32;
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
@@ -1315,16 +1320,16 @@ namespace SpaceWizards.Sodium.Interop
public static extern sbyte* crypto_kx_primitive();
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_kx_seed_keypair([NativeTypeName("unsigned char [32]")] byte* pk, [NativeTypeName("unsigned char [32]")] byte* sk, [NativeTypeName("const unsigned char [32]")] byte* seed);
public static extern int crypto_kx_seed_keypair([NativeTypeName("unsigned char[32]")] byte* pk, [NativeTypeName("unsigned char[32]")] byte* sk, [NativeTypeName("const unsigned char[32]")] byte* seed);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_kx_keypair([NativeTypeName("unsigned char [32]")] byte* pk, [NativeTypeName("unsigned char [32]")] byte* sk);
public static extern int crypto_kx_keypair([NativeTypeName("unsigned char[32]")] byte* pk, [NativeTypeName("unsigned char[32]")] byte* sk);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_kx_client_session_keys([NativeTypeName("unsigned char [32]")] byte* rx, [NativeTypeName("unsigned char [32]")] byte* tx, [NativeTypeName("const unsigned char [32]")] byte* client_pk, [NativeTypeName("const unsigned char [32]")] byte* client_sk, [NativeTypeName("const unsigned char [32]")] byte* server_pk);
public static extern int crypto_kx_client_session_keys([NativeTypeName("unsigned char[32]")] byte* rx, [NativeTypeName("unsigned char[32]")] byte* tx, [NativeTypeName("const unsigned char[32]")] byte* client_pk, [NativeTypeName("const unsigned char[32]")] byte* client_sk, [NativeTypeName("const unsigned char[32]")] byte* server_pk);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_kx_server_session_keys([NativeTypeName("unsigned char [32]")] byte* rx, [NativeTypeName("unsigned char [32]")] byte* tx, [NativeTypeName("const unsigned char [32]")] byte* server_pk, [NativeTypeName("const unsigned char [32]")] byte* server_sk, [NativeTypeName("const unsigned char [32]")] byte* client_pk);
public static extern int crypto_kx_server_session_keys([NativeTypeName("unsigned char[32]")] byte* rx, [NativeTypeName("unsigned char[32]")] byte* tx, [NativeTypeName("const unsigned char[32]")] byte* server_pk, [NativeTypeName("const unsigned char[32]")] byte* server_sk, [NativeTypeName("const unsigned char[32]")] byte* client_pk);
[NativeTypeName("#define crypto_kx_PUBLICKEYBYTES 32")]
public const int crypto_kx_PUBLICKEYBYTES = 32;
@@ -1339,7 +1344,7 @@ namespace SpaceWizards.Sodium.Interop
public const int crypto_kx_SESSIONKEYBYTES = 32;
[NativeTypeName("#define crypto_kx_PRIMITIVE \"x25519blake2b\"")]
public static ReadOnlySpan<byte> crypto_kx_PRIMITIVE => new byte[] { 0x78, 0x32, 0x35, 0x35, 0x31, 0x39, 0x62, 0x6C, 0x61, 0x6B, 0x65, 0x32, 0x62, 0x00 };
public static ReadOnlySpan<byte> crypto_kx_PRIMITIVE => "x25519blake2b"u8;
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
@@ -1373,7 +1378,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_onetimeauth_final([NativeTypeName("crypto_onetimeauth_state *")] crypto_onetimeauth_poly1305_state* state, [NativeTypeName("unsigned char *")] byte* @out);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_onetimeauth_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_onetimeauth_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[NativeTypeName("#define crypto_onetimeauth_BYTES crypto_onetimeauth_poly1305_BYTES")]
public const uint crypto_onetimeauth_BYTES = 16U;
@@ -1382,7 +1387,7 @@ namespace SpaceWizards.Sodium.Interop
public const uint crypto_onetimeauth_KEYBYTES = 32U;
[NativeTypeName("#define crypto_onetimeauth_PRIMITIVE \"poly1305\"")]
public static ReadOnlySpan<byte> crypto_onetimeauth_PRIMITIVE => new byte[] { 0x70, 0x6F, 0x6C, 0x79, 0x31, 0x33, 0x30, 0x35, 0x00 };
public static ReadOnlySpan<byte> crypto_onetimeauth_PRIMITIVE => "poly1305"u8;
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
@@ -1412,7 +1417,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_onetimeauth_poly1305_final(crypto_onetimeauth_poly1305_state* state, [NativeTypeName("unsigned char *")] byte* @out);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_onetimeauth_poly1305_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_onetimeauth_poly1305_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[NativeTypeName("#define crypto_onetimeauth_poly1305_BYTES 16U")]
public const uint crypto_onetimeauth_poly1305_BYTES = 16U;
@@ -1501,16 +1506,16 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_pwhash([NativeTypeName("unsigned char *const")] byte* @out, [NativeTypeName("unsigned long long")] ulong outlen, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("const unsigned char *const")] byte* salt, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit, int alg);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_pwhash_str([NativeTypeName("char [128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit);
public static extern int crypto_pwhash_str([NativeTypeName("char[128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_pwhash_str_alg([NativeTypeName("char [128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit, int alg);
public static extern int crypto_pwhash_str_alg([NativeTypeName("char[128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit, int alg);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_pwhash_str_verify([NativeTypeName("const char [128]")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen);
public static extern int crypto_pwhash_str_verify([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_pwhash_str_needs_rehash([NativeTypeName("const char [128]")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit);
public static extern int crypto_pwhash_str_needs_rehash([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("const char *")]
@@ -1544,7 +1549,7 @@ namespace SpaceWizards.Sodium.Interop
public const uint crypto_pwhash_STRBYTES = 128U;
[NativeTypeName("#define crypto_pwhash_STRPREFIX crypto_pwhash_argon2id_STRPREFIX")]
public static ReadOnlySpan<byte> crypto_pwhash_STRPREFIX => new byte[] { 0x24, 0x61, 0x72, 0x67, 0x6F, 0x6E, 0x32, 0x69, 0x64, 0x24, 0x00 };
public static ReadOnlySpan<byte> crypto_pwhash_STRPREFIX => "$argon2id$"u8;
[NativeTypeName("#define crypto_pwhash_OPSLIMIT_MIN crypto_pwhash_argon2id_OPSLIMIT_MIN")]
public const uint crypto_pwhash_OPSLIMIT_MIN = 1U;
@@ -1576,8 +1581,8 @@ namespace SpaceWizards.Sodium.Interop
[NativeTypeName("#define crypto_pwhash_MEMLIMIT_SENSITIVE crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE")]
public const uint crypto_pwhash_MEMLIMIT_SENSITIVE = 1073741824U;
[NativeTypeName("#define crypto_pwhash_PRIMITIVE \"argon2i\"")]
public static ReadOnlySpan<byte> crypto_pwhash_PRIMITIVE => new byte[] { 0x61, 0x72, 0x67, 0x6F, 0x6E, 0x32, 0x69, 0x00 };
[NativeTypeName("#define crypto_pwhash_PRIMITIVE \"argon2id,argon2i\"")]
public static ReadOnlySpan<byte> crypto_pwhash_PRIMITIVE => "argon2id,argon2i"u8;
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_pwhash_argon2i_alg_argon2i13();
@@ -1654,13 +1659,13 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_pwhash_argon2i([NativeTypeName("unsigned char *const")] byte* @out, [NativeTypeName("unsigned long long")] ulong outlen, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("const unsigned char *const")] byte* salt, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit, int alg);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_pwhash_argon2i_str([NativeTypeName("char [128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit);
public static extern int crypto_pwhash_argon2i_str([NativeTypeName("char[128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_pwhash_argon2i_str_verify([NativeTypeName("const char [128]")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen);
public static extern int crypto_pwhash_argon2i_str_verify([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_pwhash_argon2i_str_needs_rehash([NativeTypeName("const char [128]")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit);
public static extern int crypto_pwhash_argon2i_str_needs_rehash([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit);
[NativeTypeName("#define crypto_pwhash_argon2i_ALG_ARGON2I13 1")]
public const int crypto_pwhash_argon2i_ALG_ARGON2I13 = 1;
@@ -1684,7 +1689,7 @@ namespace SpaceWizards.Sodium.Interop
public const uint crypto_pwhash_argon2i_STRBYTES = 128U;
[NativeTypeName("#define crypto_pwhash_argon2i_STRPREFIX \"$argon2i$\"")]
public static ReadOnlySpan<byte> crypto_pwhash_argon2i_STRPREFIX => new byte[] { 0x24, 0x61, 0x72, 0x67, 0x6F, 0x6E, 0x32, 0x69, 0x24, 0x00 };
public static ReadOnlySpan<byte> crypto_pwhash_argon2i_STRPREFIX => "$argon2i$"u8;
[NativeTypeName("#define crypto_pwhash_argon2i_OPSLIMIT_MIN 3U")]
public const uint crypto_pwhash_argon2i_OPSLIMIT_MIN = 3U;
@@ -1791,13 +1796,13 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_pwhash_argon2id([NativeTypeName("unsigned char *const")] byte* @out, [NativeTypeName("unsigned long long")] ulong outlen, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("const unsigned char *const")] byte* salt, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit, int alg);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_pwhash_argon2id_str([NativeTypeName("char [128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit);
public static extern int crypto_pwhash_argon2id_str([NativeTypeName("char[128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_pwhash_argon2id_str_verify([NativeTypeName("const char [128]")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen);
public static extern int crypto_pwhash_argon2id_str_verify([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_pwhash_argon2id_str_needs_rehash([NativeTypeName("const char [128]")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit);
public static extern int crypto_pwhash_argon2id_str_needs_rehash([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit);
[NativeTypeName("#define crypto_pwhash_argon2id_ALG_ARGON2ID13 2")]
public const int crypto_pwhash_argon2id_ALG_ARGON2ID13 = 2;
@@ -1821,7 +1826,7 @@ namespace SpaceWizards.Sodium.Interop
public const uint crypto_pwhash_argon2id_STRBYTES = 128U;
[NativeTypeName("#define crypto_pwhash_argon2id_STRPREFIX \"$argon2id$\"")]
public static ReadOnlySpan<byte> crypto_pwhash_argon2id_STRPREFIX => new byte[] { 0x24, 0x61, 0x72, 0x67, 0x6F, 0x6E, 0x32, 0x69, 0x64, 0x24, 0x00 };
public static ReadOnlySpan<byte> crypto_pwhash_argon2id_STRPREFIX => "$argon2id$"u8;
[NativeTypeName("#define crypto_pwhash_argon2id_OPSLIMIT_MIN 1U")]
public const uint crypto_pwhash_argon2id_OPSLIMIT_MIN = 1U;
@@ -1917,16 +1922,16 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_pwhash_scryptsalsa208sha256([NativeTypeName("unsigned char *const")] byte* @out, [NativeTypeName("unsigned long long")] ulong outlen, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("const unsigned char *const")] byte* salt, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_pwhash_scryptsalsa208sha256_str([NativeTypeName("char [102]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit);
public static extern int crypto_pwhash_scryptsalsa208sha256_str([NativeTypeName("char[102]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_pwhash_scryptsalsa208sha256_str_verify([NativeTypeName("const char [102]")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen);
public static extern int crypto_pwhash_scryptsalsa208sha256_str_verify([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_pwhash_scryptsalsa208sha256_ll([NativeTypeName("const uint8_t *")] byte* passwd, [NativeTypeName("size_t")] nuint passwdlen, [NativeTypeName("const uint8_t *")] byte* salt, [NativeTypeName("size_t")] nuint saltlen, [NativeTypeName("uint64_t")] ulong N, [NativeTypeName("uint32_t")] uint r, [NativeTypeName("uint32_t")] uint p, [NativeTypeName("uint8_t *")] byte* buf, [NativeTypeName("size_t")] nuint buflen);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_pwhash_scryptsalsa208sha256_str_needs_rehash([NativeTypeName("const char [102]")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit);
public static extern int crypto_pwhash_scryptsalsa208sha256_str_needs_rehash([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit);
[NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_BYTES_MIN 16U")]
public const uint crypto_pwhash_scryptsalsa208sha256_BYTES_MIN = 16U;
@@ -1947,7 +1952,7 @@ namespace SpaceWizards.Sodium.Interop
public const uint crypto_pwhash_scryptsalsa208sha256_STRBYTES = 102U;
[NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_STRPREFIX \"$7$\"")]
public static ReadOnlySpan<byte> crypto_pwhash_scryptsalsa208sha256_STRPREFIX => new byte[] { 0x24, 0x37, 0x24, 0x00 };
public static ReadOnlySpan<byte> crypto_pwhash_scryptsalsa208sha256_STRPREFIX => "$7$"u8;
[NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN 32768U")]
public const uint crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN = 32768U;
@@ -1998,7 +2003,7 @@ namespace SpaceWizards.Sodium.Interop
public const uint crypto_scalarmult_SCALARBYTES = 32U;
[NativeTypeName("#define crypto_scalarmult_PRIMITIVE \"curve25519\"")]
public static ReadOnlySpan<byte> crypto_scalarmult_PRIMITIVE => new byte[] { 0x63, 0x75, 0x72, 0x76, 0x65, 0x32, 0x35, 0x35, 0x31, 0x39, 0x00 };
public static ReadOnlySpan<byte> crypto_scalarmult_PRIMITIVE => "curve25519"u8;
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
@@ -2099,7 +2104,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_secretbox_open_detached([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_secretbox_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_secretbox_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
@@ -2125,7 +2130,7 @@ namespace SpaceWizards.Sodium.Interop
public const uint crypto_secretbox_MACBYTES = 16U;
[NativeTypeName("#define crypto_secretbox_PRIMITIVE \"xsalsa20poly1305\"")]
public static ReadOnlySpan<byte> crypto_secretbox_PRIMITIVE => new byte[] { 0x78, 0x73, 0x61, 0x6C, 0x73, 0x61, 0x32, 0x30, 0x70, 0x6F, 0x6C, 0x79, 0x31, 0x33, 0x30, 0x35, 0x00 };
public static ReadOnlySpan<byte> crypto_secretbox_PRIMITIVE => "xsalsa20poly1305"u8;
[NativeTypeName("#define crypto_secretbox_MESSAGEBYTES_MAX crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX")]
public const ulong crypto_secretbox_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U);
@@ -2199,7 +2204,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_secretbox_xsalsa20poly1305_open([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_secretbox_xsalsa20poly1305_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_secretbox_xsalsa20poly1305_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
@@ -2264,16 +2269,16 @@ namespace SpaceWizards.Sodium.Interop
public static extern nuint crypto_secretstream_xchacha20poly1305_statebytes();
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_secretstream_xchacha20poly1305_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_secretstream_xchacha20poly1305_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_secretstream_xchacha20poly1305_init_push(crypto_secretstream_xchacha20poly1305_state* state, [NativeTypeName("unsigned char [24]")] byte* header, [NativeTypeName("const unsigned char [32]")] byte* k);
public static extern int crypto_secretstream_xchacha20poly1305_init_push(crypto_secretstream_xchacha20poly1305_state* state, [NativeTypeName("unsigned char[24]")] byte* header, [NativeTypeName("const unsigned char[32]")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_secretstream_xchacha20poly1305_push(crypto_secretstream_xchacha20poly1305_state* state, [NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned long long *")] ulong* clen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("unsigned char")] byte tag);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_secretstream_xchacha20poly1305_init_pull(crypto_secretstream_xchacha20poly1305_state* state, [NativeTypeName("const unsigned char [24]")] byte* header, [NativeTypeName("const unsigned char [32]")] byte* k);
public static extern int crypto_secretstream_xchacha20poly1305_init_pull(crypto_secretstream_xchacha20poly1305_state* state, [NativeTypeName("const unsigned char[24]")] byte* header, [NativeTypeName("const unsigned char[32]")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int crypto_secretstream_xchacha20poly1305_pull(crypto_secretstream_xchacha20poly1305_state* state, [NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned long long *")] ulong* mlen_p, [NativeTypeName("unsigned char *")] byte* tag_p, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen);
@@ -2321,7 +2326,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_shorthash([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_shorthash_keygen([NativeTypeName("unsigned char [16]")] byte* k);
public static extern void crypto_shorthash_keygen([NativeTypeName("unsigned char[16]")] byte* k);
[NativeTypeName("#define crypto_shorthash_BYTES crypto_shorthash_siphash24_BYTES")]
public const uint crypto_shorthash_BYTES = 8U;
@@ -2330,7 +2335,7 @@ namespace SpaceWizards.Sodium.Interop
public const uint crypto_shorthash_KEYBYTES = 16U;
[NativeTypeName("#define crypto_shorthash_PRIMITIVE \"siphash24\"")]
public static ReadOnlySpan<byte> crypto_shorthash_PRIMITIVE => new byte[] { 0x73, 0x69, 0x70, 0x68, 0x61, 0x73, 0x68, 0x32, 0x34, 0x00 };
public static ReadOnlySpan<byte> crypto_shorthash_PRIMITIVE => "siphash24"u8;
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
@@ -2440,7 +2445,7 @@ namespace SpaceWizards.Sodium.Interop
public const ulong crypto_sign_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 64U);
[NativeTypeName("#define crypto_sign_PRIMITIVE \"ed25519\"")]
public static ReadOnlySpan<byte> crypto_sign_PRIMITIVE => new byte[] { 0x65, 0x64, 0x32, 0x35, 0x35, 0x31, 0x39, 0x00 };
public static ReadOnlySpan<byte> crypto_sign_PRIMITIVE => "ed25519"u8;
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
@@ -2524,12 +2529,15 @@ namespace SpaceWizards.Sodium.Interop
public const ulong crypto_sign_ed25519_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 64U);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[Obsolete]
public static extern int crypto_sign_edwards25519sha512batch([NativeTypeName("unsigned char *")] byte* sm, [NativeTypeName("unsigned long long *")] ulong* smlen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* sk);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[Obsolete]
public static extern int crypto_sign_edwards25519sha512batch_open([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned long long *")] ulong* mlen_p, [NativeTypeName("const unsigned char *")] byte* sm, [NativeTypeName("unsigned long long")] ulong smlen, [NativeTypeName("const unsigned char *")] byte* pk);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[Obsolete]
public static extern int crypto_sign_edwards25519sha512batch_keypair([NativeTypeName("unsigned char *")] byte* pk, [NativeTypeName("unsigned char *")] byte* sk);
[NativeTypeName("#define crypto_sign_edwards25519sha512batch_BYTES 64U")]
@@ -2567,7 +2575,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_stream_xor([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_stream_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_stream_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[NativeTypeName("#define crypto_stream_KEYBYTES crypto_stream_xsalsa20_KEYBYTES")]
public const uint crypto_stream_KEYBYTES = 32U;
@@ -2579,7 +2587,7 @@ namespace SpaceWizards.Sodium.Interop
public const ulong crypto_stream_MESSAGEBYTES_MAX = ((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL));
[NativeTypeName("#define crypto_stream_PRIMITIVE \"xsalsa20\"")]
public static ReadOnlySpan<byte> crypto_stream_PRIMITIVE => new byte[] { 0x78, 0x73, 0x61, 0x6C, 0x73, 0x61, 0x32, 0x30, 0x00 };
public static ReadOnlySpan<byte> crypto_stream_PRIMITIVE => "xsalsa20"u8;
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
@@ -2603,7 +2611,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_stream_chacha20_xor_ic([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("uint64_t")] ulong ic, [NativeTypeName("const unsigned char *")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_stream_chacha20_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_stream_chacha20_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
@@ -2627,7 +2635,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_stream_chacha20_ietf_xor_ic([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("uint32_t")] uint ic, [NativeTypeName("const unsigned char *")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_stream_chacha20_ietf_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_stream_chacha20_ietf_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[NativeTypeName("#define crypto_stream_chacha20_KEYBYTES 32U")]
public const uint crypto_stream_chacha20_KEYBYTES = 32U;
@@ -2678,7 +2686,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_stream_salsa20_xor_ic([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("uint64_t")] ulong ic, [NativeTypeName("const unsigned char *")] byte* k);
[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;
@@ -2691,24 +2699,30 @@ namespace SpaceWizards.Sodium.Interop
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
[Obsolete]
public static extern nuint crypto_stream_salsa208_keybytes();
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
[Obsolete]
public static extern nuint crypto_stream_salsa208_noncebytes();
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
[Obsolete]
public static extern nuint crypto_stream_salsa208_messagebytes_max();
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[Obsolete]
public static extern int crypto_stream_salsa208([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[Obsolete]
public static extern int crypto_stream_salsa208_xor([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_stream_salsa208_keygen([NativeTypeName("unsigned char [32]")] byte* k);
[Obsolete]
public static extern void crypto_stream_salsa208_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[NativeTypeName("#define crypto_stream_salsa208_KEYBYTES 32U")]
public const uint crypto_stream_salsa208_KEYBYTES = 32U;
@@ -2738,7 +2752,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_stream_salsa2012_xor([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_stream_salsa2012_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_stream_salsa2012_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[NativeTypeName("#define crypto_stream_salsa2012_KEYBYTES 32U")]
public const uint crypto_stream_salsa2012_KEYBYTES = 32U;
@@ -2771,7 +2785,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_stream_xchacha20_xor_ic([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("uint64_t")] ulong ic, [NativeTypeName("const unsigned char *")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_stream_xchacha20_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_stream_xchacha20_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[NativeTypeName("#define crypto_stream_xchacha20_KEYBYTES 32U")]
public const uint crypto_stream_xchacha20_KEYBYTES = 32U;
@@ -2804,7 +2818,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int crypto_stream_xsalsa20_xor_ic([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("uint64_t")] ulong ic, [NativeTypeName("const unsigned char *")] byte* k);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void crypto_stream_xsalsa20_keygen([NativeTypeName("unsigned char [32]")] byte* k);
public static extern void crypto_stream_xsalsa20_keygen([NativeTypeName("unsigned char[32]")] byte* k);
[NativeTypeName("#define crypto_stream_xsalsa20_KEYBYTES 32U")]
public const uint crypto_stream_xsalsa20_KEYBYTES = 32U;
@@ -2856,7 +2870,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern void randombytes_buf([NativeTypeName("void *const")] void* buf, [NativeTypeName("const size_t")] nuint size);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void randombytes_buf_deterministic([NativeTypeName("void *const")] void* buf, [NativeTypeName("const size_t")] nuint size, [NativeTypeName("const unsigned char [32]")] byte* seed);
public static extern void randombytes_buf_deterministic([NativeTypeName("void *const")] void* buf, [NativeTypeName("const size_t")] nuint size, [NativeTypeName("const unsigned char[32]")] byte* seed);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("uint32_t")]
@@ -2873,7 +2887,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern int randombytes_close();
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int randombytes_set_implementation(randombytes_implementation* impl);
public static extern int randombytes_set_implementation([NativeTypeName("const randombytes_implementation *")] randombytes_implementation* impl);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("const char *")]
@@ -2891,6 +2905,9 @@ namespace SpaceWizards.Sodium.Interop
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int sodium_runtime_has_neon();
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int sodium_runtime_has_armcrypto();
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int sodium_runtime_has_sse2();
@@ -2953,7 +2970,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern sbyte* sodium_bin2hex([NativeTypeName("char *const")] sbyte* hex, [NativeTypeName("const size_t")] nuint hex_maxlen, [NativeTypeName("const unsigned char *const")] byte* bin, [NativeTypeName("const size_t")] nuint bin_len);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int sodium_hex2bin([NativeTypeName("unsigned char *const")] byte* bin, [NativeTypeName("const size_t")] nuint bin_maxlen, [NativeTypeName("const char *const")] sbyte* hex, [NativeTypeName("const size_t")] nuint hex_len, [NativeTypeName("const char *const")] sbyte* ignore, [NativeTypeName("size_t *const")] nuint* bin_len, [NativeTypeName("const char **const")] sbyte** hex_end);
public static extern int sodium_hex2bin([NativeTypeName("unsigned char *const")] byte* bin, [NativeTypeName("const size_t")] nuint bin_maxlen, [NativeTypeName("const char *const")] sbyte* hex, [NativeTypeName("const size_t")] nuint hex_len, [NativeTypeName("const char *const")] sbyte* ignore, [NativeTypeName("size_t *")] nuint* bin_len, [NativeTypeName("const char **const")] sbyte** hex_end);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("size_t")]
@@ -2964,7 +2981,7 @@ namespace SpaceWizards.Sodium.Interop
public static extern sbyte* sodium_bin2base64([NativeTypeName("char *const")] sbyte* b64, [NativeTypeName("const size_t")] nuint b64_maxlen, [NativeTypeName("const unsigned char *const")] byte* bin, [NativeTypeName("const size_t")] nuint bin_len, [NativeTypeName("const int")] int variant);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int sodium_base642bin([NativeTypeName("unsigned char *const")] byte* bin, [NativeTypeName("const size_t")] nuint bin_maxlen, [NativeTypeName("const char *const")] sbyte* b64, [NativeTypeName("const size_t")] nuint b64_len, [NativeTypeName("const char *const")] sbyte* ignore, [NativeTypeName("size_t *const")] nuint* bin_len, [NativeTypeName("const char **const")] sbyte** b64_end, [NativeTypeName("const int")] int variant);
public static extern int sodium_base642bin([NativeTypeName("unsigned char *const")] byte* bin, [NativeTypeName("const size_t")] nuint bin_maxlen, [NativeTypeName("const char *const")] sbyte* b64, [NativeTypeName("const size_t")] nuint b64_len, [NativeTypeName("const char *const")] sbyte* ignore, [NativeTypeName("size_t *")] nuint* bin_len, [NativeTypeName("const char **const")] sbyte** b64_end, [NativeTypeName("const int")] int variant);
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int sodium_mlock([NativeTypeName("void *const")] void* addr, [NativeTypeName("const size_t")] nuint len);
@@ -3024,13 +3041,13 @@ namespace SpaceWizards.Sodium.Interop
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int sodium_library_minimal();
[NativeTypeName("#define SODIUM_VERSION_STRING \"1.0.18\"")]
public static ReadOnlySpan<byte> SODIUM_VERSION_STRING => new byte[] { 0x31, 0x2E, 0x30, 0x2E, 0x31, 0x38, 0x00 };
[NativeTypeName("#define SODIUM_VERSION_STRING \"1.0.20\"")]
public static ReadOnlySpan<byte> SODIUM_VERSION_STRING => "1.0.20"u8;
[NativeTypeName("#define SODIUM_LIBRARY_VERSION_MAJOR 10")]
public const int SODIUM_LIBRARY_VERSION_MAJOR = 10;
[NativeTypeName("#define SODIUM_LIBRARY_VERSION_MAJOR 26")]
public const int SODIUM_LIBRARY_VERSION_MAJOR = 26;
[NativeTypeName("#define SODIUM_LIBRARY_VERSION_MINOR 3")]
public const int SODIUM_LIBRARY_VERSION_MINOR = 3;
[NativeTypeName("#define SODIUM_LIBRARY_VERSION_MINOR 2")]
public const int SODIUM_LIBRARY_VERSION_MINOR = 2;
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Diagnostics;
namespace CSSUDII.Sodium.Interop
{
/// <summary>Defines the annotation found in a native declaration.</summary>
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
[Conditional("DEBUG")]
internal sealed partial class NativeAnnotationAttribute : Attribute
{
private readonly string _annotation;
/// <summary>Initializes a new instance of the <see cref="NativeAnnotationAttribute" /> class.</summary>
/// <param name="annotation">The annotation that was used in the native declaration.</param>
public NativeAnnotationAttribute(string annotation)
{
_annotation = annotation;
}
/// <summary>Gets the annotation that was used in the native declaration.</summary>
public string Annotation => _annotation;
}
}

View File

@@ -1,7 +1,7 @@
using System;
using System.Diagnostics;
namespace SpaceWizards.Sodium.Interop
namespace CSSUDII.Sodium.Interop
{
/// <summary>Defines the type of a member as it was used in the native signature.</summary>
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = false, Inherited = true)]

View File

@@ -0,0 +1,16 @@
using System.Runtime.CompilerServices;
namespace CSSUDII.Sodium.Interop
{
public partial struct crypto_aead_aes256gcm_state
{
[NativeTypeName("unsigned char[512]")]
public _opaque_e__FixedBuffer opaque;
[InlineArray(512)]
public partial struct _opaque_e__FixedBuffer
{
public byte e0;
}
}
}

View File

@@ -1,4 +1,4 @@
namespace SpaceWizards.Sodium.Interop
namespace CSSUDII.Sodium.Interop
{
public partial struct crypto_auth_hmacsha256_state
{

View File

@@ -1,4 +1,4 @@
namespace SpaceWizards.Sodium.Interop
namespace CSSUDII.Sodium.Interop
{
public partial struct crypto_auth_hmacsha512256_state
{

View File

@@ -0,0 +1,16 @@
using System.Runtime.CompilerServices;
namespace CSSUDII.Sodium.Interop
{
public partial struct crypto_generichash_blake2b_state
{
[NativeTypeName("unsigned char[384]")]
public _opaque_e__FixedBuffer opaque;
[InlineArray(384)]
public partial struct _opaque_e__FixedBuffer
{
public byte e0;
}
}
}

View File

@@ -0,0 +1,28 @@
using System.Runtime.CompilerServices;
namespace CSSUDII.Sodium.Interop
{
public partial struct crypto_hash_sha256_state
{
[NativeTypeName("uint32_t[8]")]
public _state_e__FixedBuffer state;
[NativeTypeName("uint64_t")]
public ulong count;
[NativeTypeName("uint8_t[64]")]
public _buf_e__FixedBuffer buf;
[InlineArray(8)]
public partial struct _state_e__FixedBuffer
{
public uint e0;
}
[InlineArray(64)]
public partial struct _buf_e__FixedBuffer
{
public byte e0;
}
}
}

View File

@@ -0,0 +1,34 @@
using System.Runtime.CompilerServices;
namespace CSSUDII.Sodium.Interop
{
public partial struct crypto_hash_sha512_state
{
[NativeTypeName("uint64_t[8]")]
public _state_e__FixedBuffer state;
[NativeTypeName("uint64_t[2]")]
public _count_e__FixedBuffer count;
[NativeTypeName("uint8_t[128]")]
public _buf_e__FixedBuffer buf;
[InlineArray(8)]
public partial struct _state_e__FixedBuffer
{
public ulong e0;
}
[InlineArray(2)]
public partial struct _count_e__FixedBuffer
{
public ulong e0;
}
[InlineArray(128)]
public partial struct _buf_e__FixedBuffer
{
public byte e0;
}
}
}

View File

@@ -0,0 +1,16 @@
using System.Runtime.CompilerServices;
namespace CSSUDII.Sodium.Interop
{
public partial struct crypto_onetimeauth_poly1305_state
{
[NativeTypeName("unsigned char[256]")]
public _opaque_e__FixedBuffer opaque;
[InlineArray(256)]
public partial struct _opaque_e__FixedBuffer
{
public byte e0;
}
}
}

View File

@@ -0,0 +1,34 @@
using System.Runtime.CompilerServices;
namespace CSSUDII.Sodium.Interop
{
public partial struct crypto_secretstream_xchacha20poly1305_state
{
[NativeTypeName("unsigned char[32]")]
public _k_e__FixedBuffer k;
[NativeTypeName("unsigned char[12]")]
public _nonce_e__FixedBuffer nonce;
[NativeTypeName("unsigned char[8]")]
public __pad_e__FixedBuffer _pad;
[InlineArray(32)]
public partial struct _k_e__FixedBuffer
{
public byte e0;
}
[InlineArray(12)]
public partial struct _nonce_e__FixedBuffer
{
public byte e0;
}
[InlineArray(8)]
public partial struct __pad_e__FixedBuffer
{
public byte e0;
}
}
}

View File

@@ -1,4 +1,4 @@
namespace SpaceWizards.Sodium.Interop
namespace CSSUDII.Sodium.Interop
{
public partial struct crypto_sign_ed25519ph_state
{

View File

@@ -1,4 +1,4 @@
namespace SpaceWizards.Sodium.Interop
namespace CSSUDII.Sodium.Interop
{
public unsafe partial struct randombytes_implementation
{

View File

@@ -1,4 +1,4 @@
namespace SpaceWizards.Sodium.Interop;
namespace CSSUDII.Sodium.Interop;
public partial class Libsodium
{

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -18,8 +18,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SpaceWizards.Sodium.Interop\SpaceWizards.Sodium.Interop.csproj" />
<ProjectReference Include="..\SpaceWizards.Sodium\SpaceWizards.Sodium.csproj" />
<ProjectReference Include="..\CSSUDII.Sodium.Interop\CSSUDII.Sodium.Interop.csproj" />
<ProjectReference Include="..\CSSUDII.Sodium\CSSUDII.Sodium.csproj" />
</ItemGroup>
</Project>

View File

@@ -2,7 +2,7 @@
using System.Text;
using NUnit.Framework;
namespace SpaceWizards.Sodium.Tests;
namespace CSSUDII.Sodium.Tests;
[TestFixture]
[TestOf(typeof(CryptoGenericHashBlake2B))]
@@ -65,7 +65,7 @@ public sealed class GenericHashBlake2BTest
var expected = Convert.FromHexString(expectedHex);
var output = new byte[expected.Length];
CryptoGenericHashBlake2B.State state;
CryptoGenericHashBlake2B.State state = new CryptoGenericHashBlake2B.State();
CryptoGenericHashBlake2B.Init(ref state, key, expected.Length);
CryptoGenericHashBlake2B.Update(ref state, input);
CryptoGenericHashBlake2B.Final(ref state, output);
@@ -97,7 +97,7 @@ public sealed class GenericHashBlake2BTest
var expected = Convert.FromHexString(expectedHex);
var output = new byte[expected.Length];
CryptoGenericHashBlake2B.State state;
CryptoGenericHashBlake2B.State state = new CryptoGenericHashBlake2B.State();
CryptoGenericHashBlake2B.InitSaltPersonal(ref state, key, expected.Length, salt, personal);
CryptoGenericHashBlake2B.Update(ref state, input);
CryptoGenericHashBlake2B.Final(ref state, output);

View File

@@ -2,7 +2,7 @@
using System.Text;
using NUnit.Framework;
namespace SpaceWizards.Sodium.Tests;
namespace CSSUDII.Sodium.Tests;
[TestFixture]
[Parallelizable(ParallelScope.All)]

View File

@@ -1,8 +1,8 @@
using System.Security.Cryptography;
using NUnit.Framework;
using static SpaceWizards.Sodium.Interop.Libsodium;
using static CSSUDII.Sodium.Interop.Libsodium;
namespace SpaceWizards.Sodium.Tests;
namespace CSSUDII.Sodium.Tests;
[TestFixture]
public sealed class SecretBoxTest

View File

@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30114.105
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWizards.Sodium", "SpaceWizards.Sodium\SpaceWizards.Sodium.csproj", "{52EC2D2E-B57B-45E3-944A-247C750731C0}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSSUDII.Sodium", "CSSUDII.Sodium\CSSUDII.Sodium.csproj", "{52EC2D2E-B57B-45E3-944A-247C750731C0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution Files", "{40BDE6AC-8B1C-4E85-960E-B3D9EA0FEC6C}"
ProjectSection(SolutionItems) = preProject
@@ -14,14 +14,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution
Directory.build.props = Directory.build.props
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWizards.Sodium.Interop", "SpaceWizards.Sodium.Interop\SpaceWizards.Sodium.Interop.csproj", "{4565084B-3F40-44EA-B0B8-75DBFB9398EB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSSUDII.Sodium.Interop", "CSSUDII.Sodium.Interop\CSSUDII.Sodium.Interop.csproj", "{4565084B-3F40-44EA-B0B8-75DBFB9398EB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{7F6778F9-368B-4F4E-BC12-88AA25F85329}"
ProjectSection(SolutionItems) = preProject
Scripts\GenBindings.rsp = Scripts\GenBindings.rsp
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWizards.Sodium.Tests", "SpaceWizards.Sodium.Tests\SpaceWizards.Sodium.Tests.csproj", "{5E1C1FFF-6F86-4D33-9038-CF314CF1320B}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSSUDII.Sodium.Tests", "CSSUDII.Sodium.Tests\CSSUDII.Sodium.Tests.csproj", "{5E1C1FFF-6F86-4D33-9038-CF314CF1320B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PackageId>SpaceWizards.Sodium</PackageId>
<PackageId>CSSUDII.Sodium</PackageId>
<Version>0.2.1</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Description>Simple API binding for libsodium.</Description>
@@ -14,7 +14,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\SpaceWizards.Sodium.Interop\SpaceWizards.Sodium.Interop.csproj" />
<ProjectReference Include="..\CSSUDII.Sodium.Interop\CSSUDII.Sodium.Interop.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,4 +1,4 @@
namespace SpaceWizards.Sodium;
namespace CSSUDII.Sodium;
using static Interop.Libsodium;
/// <summary>

View File

@@ -1,4 +1,4 @@
namespace SpaceWizards.Sodium;
namespace CSSUDII.Sodium;
using static Interop.Libsodium;

View File

@@ -1,6 +1,6 @@
using SpaceWizards.Sodium.Interop;
using CSSUDII.Sodium.Interop;
namespace SpaceWizards.Sodium;
namespace CSSUDII.Sodium;
using static Interop.Libsodium;

View File

@@ -1,6 +1,6 @@
using static SpaceWizards.Sodium.Interop.Libsodium;
using static CSSUDII.Sodium.Interop.Libsodium;
namespace SpaceWizards.Sodium;
namespace CSSUDII.Sodium;
public static class SodiumCore
{

View File

@@ -1,4 +1,4 @@
namespace SpaceWizards.Sodium;
namespace CSSUDII.Sodium;
public sealed class SodiumException : Exception
{

View File

@@ -1,7 +1,7 @@
using System.Buffers;
using System.Text;
namespace SpaceWizards.Sodium;
namespace CSSUDII.Sodium;
using static Interop.Libsodium;

View File

@@ -1,4 +1,4 @@
namespace SpaceWizards.Sodium;
namespace CSSUDII.Sodium;
[Serializable]
public sealed class SodiumInitException : Exception

View File

@@ -3,9 +3,9 @@
<PropertyGroup>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryType>Git</RepositoryType>
<RepositoryUrl>https://github.com/space-wizards/SpaceWizards.Sodium</RepositoryUrl>
<RepositoryUrl>https://git.119.224.65.18.sslip.io/CSSUDII/CSSUDII.Sodium</RepositoryUrl>
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
<Authors>Space Wizards</Authors>
<Authors>CSSUDII</Authors>
</PropertyGroup>
<!--SourceLink stuff-->

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,23 @@
using System;
using System.Diagnostics;
namespace CSSUDII.Sodium.Interop
{
/// <summary>Defines the annotation found in a native declaration.</summary>
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
[Conditional("DEBUG")]
internal sealed partial class NativeAnnotationAttribute : Attribute
{
private readonly string _annotation;
/// <summary>Initializes a new instance of the <see cref="NativeAnnotationAttribute" /> class.</summary>
/// <param name="annotation">The annotation that was used in the native declaration.</param>
public NativeAnnotationAttribute(string annotation)
{
_annotation = annotation;
}
/// <summary>Gets the annotation that was used in the native declaration.</summary>
public string Annotation => _annotation;
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Diagnostics;
namespace CSSUDII.Sodium.Interop
{
/// <summary>Defines the type of a member as it was used in the native signature.</summary>
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = false, Inherited = true)]
[Conditional("DEBUG")]
internal sealed partial class NativeTypeNameAttribute : Attribute
{
private readonly string _name;
/// <summary>Initializes a new instance of the <see cref="NativeTypeNameAttribute" /> class.</summary>
/// <param name="name">The name of the type that was used in the native signature.</param>
public NativeTypeNameAttribute(string name)
{
_name = name;
}
/// <summary>Gets the name of the type that was used in the native signature.</summary>
public string Name => _name;
}
}

View File

@@ -0,0 +1,16 @@
using System.Runtime.CompilerServices;
namespace CSSUDII.Sodium.Interop
{
public partial struct crypto_aead_aes256gcm_state
{
[NativeTypeName("unsigned char[512]")]
public _opaque_e__FixedBuffer opaque;
[InlineArray(512)]
public partial struct _opaque_e__FixedBuffer
{
public byte e0;
}
}
}

View File

@@ -0,0 +1,9 @@
namespace CSSUDII.Sodium.Interop
{
public partial struct crypto_auth_hmacsha256_state
{
public crypto_hash_sha256_state ictx;
public crypto_hash_sha256_state octx;
}
}

View File

@@ -0,0 +1,9 @@
namespace CSSUDII.Sodium.Interop
{
public partial struct crypto_auth_hmacsha512256_state
{
public crypto_hash_sha512_state ictx;
public crypto_hash_sha512_state octx;
}
}

View File

@@ -0,0 +1,16 @@
using System.Runtime.CompilerServices;
namespace CSSUDII.Sodium.Interop
{
public partial struct crypto_generichash_blake2b_state
{
[NativeTypeName("unsigned char[384]")]
public _opaque_e__FixedBuffer opaque;
[InlineArray(384)]
public partial struct _opaque_e__FixedBuffer
{
public byte e0;
}
}
}

View File

@@ -0,0 +1,28 @@
using System.Runtime.CompilerServices;
namespace CSSUDII.Sodium.Interop
{
public partial struct crypto_hash_sha256_state
{
[NativeTypeName("uint32_t[8]")]
public _state_e__FixedBuffer state;
[NativeTypeName("uint64_t")]
public ulong count;
[NativeTypeName("uint8_t[64]")]
public _buf_e__FixedBuffer buf;
[InlineArray(8)]
public partial struct _state_e__FixedBuffer
{
public uint e0;
}
[InlineArray(64)]
public partial struct _buf_e__FixedBuffer
{
public byte e0;
}
}
}

View File

@@ -0,0 +1,34 @@
using System.Runtime.CompilerServices;
namespace CSSUDII.Sodium.Interop
{
public partial struct crypto_hash_sha512_state
{
[NativeTypeName("uint64_t[8]")]
public _state_e__FixedBuffer state;
[NativeTypeName("uint64_t[2]")]
public _count_e__FixedBuffer count;
[NativeTypeName("uint8_t[128]")]
public _buf_e__FixedBuffer buf;
[InlineArray(8)]
public partial struct _state_e__FixedBuffer
{
public ulong e0;
}
[InlineArray(2)]
public partial struct _count_e__FixedBuffer
{
public ulong e0;
}
[InlineArray(128)]
public partial struct _buf_e__FixedBuffer
{
public byte e0;
}
}
}

View File

@@ -0,0 +1,16 @@
using System.Runtime.CompilerServices;
namespace CSSUDII.Sodium.Interop
{
public partial struct crypto_onetimeauth_poly1305_state
{
[NativeTypeName("unsigned char[256]")]
public _opaque_e__FixedBuffer opaque;
[InlineArray(256)]
public partial struct _opaque_e__FixedBuffer
{
public byte e0;
}
}
}

View File

@@ -0,0 +1,34 @@
using System.Runtime.CompilerServices;
namespace CSSUDII.Sodium.Interop
{
public partial struct crypto_secretstream_xchacha20poly1305_state
{
[NativeTypeName("unsigned char[32]")]
public _k_e__FixedBuffer k;
[NativeTypeName("unsigned char[12]")]
public _nonce_e__FixedBuffer nonce;
[NativeTypeName("unsigned char[8]")]
public __pad_e__FixedBuffer _pad;
[InlineArray(32)]
public partial struct _k_e__FixedBuffer
{
public byte e0;
}
[InlineArray(12)]
public partial struct _nonce_e__FixedBuffer
{
public byte e0;
}
[InlineArray(8)]
public partial struct __pad_e__FixedBuffer
{
public byte e0;
}
}
}

View File

@@ -0,0 +1,7 @@
namespace CSSUDII.Sodium.Interop
{
public partial struct crypto_sign_ed25519ph_state
{
public crypto_hash_sha512_state hs;
}
}

View File

@@ -0,0 +1,23 @@
namespace CSSUDII.Sodium.Interop
{
public unsafe partial struct randombytes_implementation
{
[NativeTypeName("const char *(*)()")]
public delegate* unmanaged[Cdecl]<sbyte*> implementation_name;
[NativeTypeName("uint32_t (*)()")]
public delegate* unmanaged[Cdecl]<uint> random;
[NativeTypeName("void (*)()")]
public delegate* unmanaged[Cdecl]<void> stir;
[NativeTypeName("uint32_t (*)(const uint32_t)")]
public delegate* unmanaged[Cdecl]<uint, uint> uniform;
[NativeTypeName("void (*)(void *const, const size_t)")]
public delegate* unmanaged[Cdecl]<void*, nuint, void> buf;
[NativeTypeName("int (*)()")]
public delegate* unmanaged[Cdecl]<int> close;
}
}

View File

@@ -1,23 +0,0 @@
using System;
using System.Diagnostics;
namespace SpaceWizards.Sodium.Interop
{
/// <summary>Defines the base type of a struct as it was in the native signature.</summary>
[AttributeUsage(AttributeTargets.Struct, AllowMultiple = false, Inherited = true)]
[Conditional("DEBUG")]
internal sealed partial class NativeInheritanceAttribute : Attribute
{
private readonly string _name;
/// <summary>Initializes a new instance of the <see cref="NativeInheritanceAttribute" /> class.</summary>
/// <param name="name">The name of the base type that was inherited from in the native signature.</param>
public NativeInheritanceAttribute(string name)
{
_name = name;
}
/// <summary>Gets the name of the base type that was inherited from in the native signature.</summary>
public string Name => _name;
}
}

View File

@@ -1,17 +0,0 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace SpaceWizards.Sodium.Interop
{
/// <summary>Specifies that the given method sets the last system error and it can be retrieved via <see cref="Marshal.GetLastSystemError" />.</summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
[Conditional("DEBUG")]
internal sealed partial class SetsLastSystemErrorAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="SetsLastSystemErrorAttribute" /> class.</summary>
public SetsLastSystemErrorAttribute()
{
}
}
}

View File

@@ -1,23 +0,0 @@
using System;
using System.Diagnostics;
namespace SpaceWizards.Sodium.Interop
{
/// <summary>Defines the vtbl index of a method as it was in the native signature.</summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
[Conditional("DEBUG")]
internal sealed partial class VtblIndexAttribute : Attribute
{
private readonly uint _index;
/// <summary>Initializes a new instance of the <see cref="VtblIndexAttribute" /> class.</summary>
/// <param name="index">The vtbl index of a method as it was in the native signature.</param>
public VtblIndexAttribute(uint index)
{
_index = index;
}
/// <summary>Gets the vtbl index of a method as it was in the native signature.</summary>
public uint Index => _index;
}
}

View File

@@ -1,8 +0,0 @@
namespace SpaceWizards.Sodium.Interop
{
public unsafe partial struct crypto_aead_aes256gcm_state
{
[NativeTypeName("unsigned char [512]")]
public fixed byte opaque[512];
}
}

View File

@@ -1,8 +0,0 @@
namespace SpaceWizards.Sodium.Interop
{
public unsafe partial struct crypto_generichash_blake2b_state
{
[NativeTypeName("unsigned char [384]")]
public fixed byte opaque[384];
}
}

View File

@@ -1,14 +0,0 @@
namespace SpaceWizards.Sodium.Interop
{
public unsafe partial struct crypto_hash_sha256_state
{
[NativeTypeName("uint32_t [8]")]
public fixed uint state[8];
[NativeTypeName("uint64_t")]
public ulong count;
[NativeTypeName("uint8_t [64]")]
public fixed byte buf[64];
}
}

View File

@@ -1,14 +0,0 @@
namespace SpaceWizards.Sodium.Interop
{
public unsafe partial struct crypto_hash_sha512_state
{
[NativeTypeName("uint64_t [8]")]
public fixed ulong state[8];
[NativeTypeName("uint64_t [2]")]
public fixed ulong count[2];
[NativeTypeName("uint8_t [128]")]
public fixed byte buf[128];
}
}

View File

@@ -1,8 +0,0 @@
namespace SpaceWizards.Sodium.Interop
{
public unsafe partial struct crypto_onetimeauth_poly1305_state
{
[NativeTypeName("unsigned char [256]")]
public fixed byte opaque[256];
}
}

View File

@@ -1,14 +0,0 @@
namespace SpaceWizards.Sodium.Interop
{
public unsafe partial struct crypto_secretstream_xchacha20poly1305_state
{
[NativeTypeName("unsigned char [32]")]
public fixed byte k[32];
[NativeTypeName("unsigned char [12]")]
public fixed byte nonce[12];
[NativeTypeName("unsigned char [8]")]
public fixed byte _pad[8];
}
}

View File

@@ -1,10 +0,0 @@
namespace SpaceWizards.Sodium.Interop;
/// <summary>
/// WARNING: This type MUST be aligned to a 16-byte boundary.
/// .NET does not currently have a method of specifying this at the type level,
/// so you need to manage this yourself when allocating space or such.
/// </summary>
public unsafe partial struct crypto_aead_aes256gcm_state
{
}

View File

@@ -1,10 +0,0 @@
namespace SpaceWizards.Sodium.Interop;
/// <summary>
/// WARNING: This type MUST be aligned to a 64-byte boundary.
/// .NET does not currently have a method of specifying this at the type level,
/// so you need to manage this yourself when allocating space or such.
/// </summary>
public unsafe partial struct crypto_generichash_blake2b_state
{
}

View File

@@ -1,10 +0,0 @@
namespace SpaceWizards.Sodium.Interop;
/// <summary>
/// WARNING: This type MUST be aligned to a 16-byte boundary.
/// .NET does not currently have a method of specifying this at the type level,
/// so you need to manage this yourself when allocating space or such.
/// </summary>
public unsafe partial struct crypto_onetimeauth_poly1305_state
{
}