aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-08-07 21:14:53 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2024-08-07 21:14:53 -0400
commitf58245b0d249fc162feacc610eedf81656a481a3 (patch)
tree7b58cf4d50311dce4cc4fdfe0b60c4faea006a32 /src
parent7c8f910e5be9a1d86af5bdcb7e51e8092cc06cf6 (diff)
feat: Add cipher mode mask and fix cc
Diffstat (limited to 'src')
-rw-r--r--src/noscryptutil.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/noscryptutil.c b/src/noscryptutil.c
index 0d7a55c..89e0f35 100644
--- a/src/noscryptutil.c
+++ b/src/noscryptutil.c
@@ -665,6 +665,10 @@ NC_EXPORT NCUtilCipherContext* NC_CC NCUtilCipherAlloc(uint32_t encVersion, uint
if (encCtx != NULL)
{
+ /*
+ * Technically I should be using the NCEncSetProperty but this
+ * is an acceptable shortcut for now, may break in future
+ */
encCtx->encArgs.version = encVersion;
encCtx->_flags = flags;
}
@@ -706,7 +710,7 @@ NC_EXPORT NCResult NC_CC NCUtilCipherInit(
CHECK_NULL_ARG(encCtx, 0);
CHECK_NULL_ARG(inputData, 1);
- if ((encCtx->_flags & NC_UTIL_CIPHER_MODE_DECRYPT) > 0)
+ if ((encCtx->_flags & NC_UTIL_CIPHER_MODE) == NC_UTIL_CIPHER_MODE_DECRYPT)
{
/*
* Validate the input data for proper format for
@@ -854,7 +858,7 @@ NC_EXPORT NCResult NC_CC NCUtilCipherReadOutput(
return (NCResult)encCtx->buffer.actualOutput.size;
}
-NC_EXPORT NCResult NCUtilCipherSetProperty(
+NC_EXPORT NCResult NC_CC NCUtilCipherSetProperty(
NCUtilCipherContext* ctx,
uint32_t property,
uint8_t* value,
@@ -901,7 +905,7 @@ NC_EXPORT NCResult NC_CC NCUtilCipherUpdate(
{
case NC_ENC_VERSION_NIP44:
- if ((encCtx->_flags & NC_UTIL_CIPHER_MODE_DECRYPT) > 0)
+ if ((encCtx->_flags & NC_UTIL_CIPHER_MODE) == NC_UTIL_CIPHER_MODE_DECRYPT)
{
return _nip44DecryptCompleteCore(libContext, sk, pk, encCtx);
}