aboutsummaryrefslogtreecommitdiff
path: root/src/noscrypt.c
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-07-12 22:14:00 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2024-07-12 22:14:00 -0400
commit5dfafbc5a9214587533ec8b1dae2a962118d3650 (patch)
tree03bee9bd074962a65924b63e66612b95fb9e2546 /src/noscrypt.c
parent8df8c5aed4ac626171b451b5422c3b207e88000b (diff)
feat: add decryption functionality to public api
Diffstat (limited to 'src/noscrypt.c')
-rw-r--r--src/noscrypt.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/noscrypt.c b/src/noscrypt.c
index 01ec136..f3c28cb 100644
--- a/src/noscrypt.c
+++ b/src/noscrypt.c
@@ -843,8 +843,6 @@ NC_EXPORT NCResult NC_CC NCEncrypt(
CHECK_INVALID_ARG(args->inputData, 3)
CHECK_INVALID_ARG(args->outputData, 3)
CHECK_INVALID_ARG(args->nonceData, 3)
- CHECK_INVALID_ARG(args->keyData, 3)
- CHECK_ARG_RANGE(args->dataSize, NIP44_MIN_ENC_MESSAGE_SIZE, NIP44_MAX_ENC_MESSAGE_SIZE, 3)
result = E_OPERATION_FAILED;
@@ -852,6 +850,10 @@ NC_EXPORT NCResult NC_CC NCEncrypt(
{
case NC_ENC_VERSION_NIP44:
{
+ /* Mac key output is only needed for nip44 */
+ CHECK_INVALID_ARG(args->keyData, 3)
+ CHECK_ARG_RANGE(args->dataSize, NIP44_MIN_ENC_MESSAGE_SIZE, NIP44_MAX_ENC_MESSAGE_SIZE, 3)
+
/* Compute the shared point */
if ((result = _computeSharedSecret(ctx, sk, pk, &sharedSecret)) != NC_SUCCESS)
{