aboutsummaryrefslogtreecommitdiff
path: root/src/nc-crypto.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nc-crypto.h')
-rw-r--r--src/nc-crypto.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/nc-crypto.h b/src/nc-crypto.h
index f04ebe0..a1545de 100644
--- a/src/nc-crypto.h
+++ b/src/nc-crypto.h
@@ -29,6 +29,8 @@
#define CHACHA_NONCE_SIZE 0x0cu /* Size of 12 is set by the cipher spec */
#define CHACHA_KEY_SIZE 0x20u /* Size of 32 is set by the cipher spec */
#define SHA256_DIGEST_SIZE 0x20u /* Size of 32 is set by the cipher spec */
+#define AES_IV_SIZE 0x10u /* CBC IV size matches the AES block size of 128 */
+#define AES_KEY_SIZE 0x20u /* AES 256 key size */
typedef uint8_t cstatus_t;
#define CSTATUS_OK ((cstatus_t)0x01u)
@@ -40,13 +42,13 @@ uint32_t ncCryptoFixedTimeComp(const uint8_t* a, const uint8_t* b, uint32_t size
void ncCryptoSecureZero(void* ptr, uint32_t size);
-cstatus_t ncCryptoDigestSha256(const cspan_t* data, sha256_t digestOut32);
+cstatus_t ncCryptoDigestSha256(cspan_t data, sha256_t digestOut32);
-cstatus_t ncCryptoHmacSha256(const cspan_t* key, const cspan_t* data, sha256_t hmacOut32);
+cstatus_t ncCryptoHmacSha256(cspan_t key, cspan_t data, sha256_t hmacOut32);
-cstatus_t ncCryptoSha256HkdfExpand(const cspan_t* prk, const cspan_t* info, span_t* okm);
+cstatus_t ncCryptoSha256HkdfExpand(cspan_t prk, cspan_t info, span_t okm);
-cstatus_t ncCryptoSha256HkdfExtract(const cspan_t* salt, const cspan_t* ikm, sha256_t prk);
+cstatus_t ncCryptoSha256HkdfExtract(cspan_t salt, cspan_t ikm, sha256_t prk);
cstatus_t ncCryptoChacha20(
const uint8_t key[CHACHA_KEY_SIZE],
@@ -56,4 +58,12 @@ cstatus_t ncCryptoChacha20(
uint32_t dataSize
);
+cstatus_t ncAes256CBCEncrypt(
+ const uint8_t key[32],
+ const uint8_t iv[16],
+ const uint8_t* input,
+ uint8_t* output,
+ uint32_t dataSize
+);
+
#endif /* !_NC_CRYPTO_H */