diff options
author | vnugent <public@vaughnnugent.com> | 2024-04-25 17:45:42 -0400 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2024-04-25 17:45:42 -0400 |
commit | 6ff8bb11774c51fd341b7699a3938fd894995fbf (patch) | |
tree | 823ef4f5397e7ed96a5198a83d0c3b3145b3d127 /src/noscrypt.c | |
parent | 7cb7a93de4f6f5e741bc5129e3d928e44f050930 (diff) |
refactor: Finish support and testing for mbedtls
Diffstat (limited to 'src/noscrypt.c')
-rw-r--r-- | src/noscrypt.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/noscrypt.c b/src/noscrypt.c index 00684b8..fac3dfb 100644 --- a/src/noscrypt.c +++ b/src/noscrypt.c @@ -21,10 +21,10 @@ #include "noscrypt.h" #include "nc-util.h" -#include "crypto/nc-crypto.h" +#include "nc-crypto.h" -#include <secp256k1_ecdh.h> -#include <secp256k1_schnorrsig.h> +#include <secp256k1/secp256k1_ecdh.h> +#include <secp256k1/secp256k1_schnorrsig.h> /* * Local macro for secure zero buffer fill @@ -768,19 +768,30 @@ NC_EXPORT NCResult NC_CC NCEncrypt( CHECK_INVALID_ARG(args->hmacKeyOut32, 3) CHECK_ARG_RANGE(args->dataSize, NIP44_MIN_ENC_MESSAGE_SIZE, NIP44_MAX_ENC_MESSAGE_SIZE, 3) + switch(args->version) + { + case NC_ENC_VERSION_NIP44: + break; /* Allow nip44 */ + + /* At the moment nip04 compatability is not supported */ + case NC_ENC_VERSION_NIP04: + default: + return E_VERSION_NOT_SUPPORTED; + } + /* Compute the shared point */ if ((result = _computeSharedSecret(ctx, sk, pk, &sharedSecret)) != NC_SUCCESS) { goto Cleanup; } - + /* Compute the conversation key from secret and pubkic keys */ if ((result = _computeConversationKey(ctx, &sharedSecret, &conversationKey)) != NC_SUCCESS) { goto Cleanup; } - result = _encryptEx(ctx, &conversationKey, args->hmacKeyOut32, args); + result = _encryptEx(ctx, &conversationKey, args->hmacKeyOut32, args); Cleanup: /* Clean up sensitive data */ |