aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-03-03 15:06:26 -0500
committerLibravatar vnugent <public@vaughnnugent.com>2024-03-03 15:06:26 -0500
commita8603e00e390b07c036384285412eda5e07beda7 (patch)
treee0cdaffc3eff61502731829c7906d6e5962b22a1 /lib
parente4b5b937a05a9869249619a3b17a7269648d93bd (diff)
fix: fix library handle leak in hot-reload
Diffstat (limited to 'lib')
-rw-r--r--lib/NVault.Crypto.Noscrypt/src/NostrCrypto.cs20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/NVault.Crypto.Noscrypt/src/NostrCrypto.cs b/lib/NVault.Crypto.Noscrypt/src/NostrCrypto.cs
index e4d4574..1bfccb0 100644
--- a/lib/NVault.Crypto.Noscrypt/src/NostrCrypto.cs
+++ b/lib/NVault.Crypto.Noscrypt/src/NostrCrypto.cs
@@ -15,11 +15,11 @@
using System;
using System.Runtime.CompilerServices;
-using System.Xml;
using VNLib.Utils;
using NCResult = System.Int64;
+using static NVault.Crypto.Noscrypt.LibNoscrypt;
namespace NVault.Crypto.Noscrypt
{
@@ -56,10 +56,10 @@ namespace NVault.Crypto.Noscrypt
//Copy nonce to struct memory buffer
Unsafe.CopyBlock(
- ref Unsafe.AsRef<byte>(data.nonce),
- in nonce,
- LibNoscrypt.NC_ENCRYPTION_NONCE_SIZE
- );
+ ref Unsafe.AsRef<byte>(data.nonce),
+ in nonce,
+ NC_ENCRYPTION_NONCE_SIZE
+ );
fixed (NCSecretKey* pSecKey = &secretKey)
fixed (NCPublicKey* pPubKey = &publicKey)
@@ -96,7 +96,7 @@ namespace NVault.Crypto.Noscrypt
Unsafe.CopyBlock(
ref Unsafe.AsRef<byte>(data.nonce),
in nonce,
- LibNoscrypt.NC_ENCRYPTION_NONCE_SIZE
+ NC_ENCRYPTION_NONCE_SIZE
);
fixed (NCSecretKey* pSecKey = &secretKey)
@@ -187,7 +187,7 @@ namespace NVault.Crypto.Noscrypt
NCResult result = Functions.NCVerifyData.Invoke(libCtx, pPubKey, pData, dataSize, pSig);
NCUtil.CheckResult<FunctionTable.NCVerifyDataDelegate>(result, false);
- return result == LibNoscrypt.NC_SUCCESS;
+ return result == NC_SUCCESS;
}
}
@@ -230,14 +230,14 @@ namespace NVault.Crypto.Noscrypt
Unsafe.CopyBlock(
ref Unsafe.AsRef<byte>(args.nonce),
in nonce32,
- LibNoscrypt.NC_ENCRYPTION_NONCE_SIZE
+ NC_ENCRYPTION_NONCE_SIZE
);
//Copy mac to struct memory buffer
Unsafe.CopyBlock(
ref Unsafe.AsRef<byte>(args.mac),
in mac32,
- LibNoscrypt.NC_ENCRYPTION_MAC_SIZE
+ NC_ENCRYPTION_MAC_SIZE
);
fixed(NCSecretKey* pSecKey = &secretKey)
@@ -251,7 +251,7 @@ namespace NVault.Crypto.Noscrypt
NCUtil.CheckResult<FunctionTable.NCVerifyMacDelegate>(result, false);
//Result should be success if the hmac is valid
- return result == LibNoscrypt.NC_SUCCESS;
+ return result == NC_SUCCESS;
}
}