From d60b25736c12e51307a9c32cacf39671e42b9fbd Mon Sep 17 00:00:00 2001 From: bdemsky Date: Fri, 2 Mar 2018 10:29:06 -0800 Subject: [PATCH] edits --- version2/src/C/CloudComm.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/version2/src/C/CloudComm.cc b/version2/src/C/CloudComm.cc index d1ba7ca..3b5fb97 100644 --- a/version2/src/C/CloudComm.cc +++ b/version2/src/C/CloudComm.cc @@ -9,6 +9,7 @@ #include "Slot.h" #include "Crypto.h" #include "ByteBuffer.h" +#include "aes.h" #include #include @@ -246,11 +247,15 @@ Array *CloudComm::createIV(int64_t machineId, int64_t localSequenceNumber) } Array *AESEncrypt(Array *ivBytes, AESKey *key, Array *data) { - return NULL; + Array * output=new Array(data->length()); + aes_encrypt_ctr((BYTE *)data->internalArray(), data->length(), (BYTE *) output->internalArray(), (WORD *)key->getKey()->internalArray(), key->getKey()->length()/(sizeof(WORD)/sizeof(BYTE)), (BYTE *)ivBytes->internalArray()); + return output; } Array *AESDecrypt(Array *ivBytes, AESKey *key, Array *data) { - return NULL; + Array * output=new Array(data->length()); + aes_decrypt_ctr((BYTE *)data->internalArray(), data->length(), (BYTE *)output->internalArray(), (WORD *)key->getKey()->internalArray(), key->getKey()->length()/(sizeof(WORD)/sizeof(BYTE)), (BYTE *)ivBytes->internalArray()); + return output; } Array *CloudComm::encryptSlotAndPrependIV(Array *rawData, Array *ivBytes) { -- 2.34.1