fix(Envelope): mac/clang compile

This commit is contained in:
Alex Fabijanic 2022-04-13 19:58:50 +02:00
parent e6afb8749c
commit 4080ee275a
2 changed files with 6 additions and 4 deletions

View File

@ -87,7 +87,9 @@
"memory_resource": "cpp",
"random": "cpp",
"ranges": "cpp",
"cfenv": "cpp"
"cfenv": "cpp",
"__bits": "cpp",
"variant": "cpp"
},
"files.exclude": {
"**/.dep": true,

View File

@ -62,14 +62,14 @@ void Envelope::addKey(const EVPPKey& key)
const Envelope::ByteVec& Envelope::seal(const ByteVec& plainData)
{
Byte* pEncKeys[_encKeys.size()] = {};
int encKeysSizes[_encKeys.size()] = {};
std::vector<Byte*> pEncKeys(_encKeys.size(), 0);
std::vector<int> encKeysSizes(_encKeys.size(), 0);
int i = 0;
for (const auto& k : _encKeys)
pEncKeys[i++] = new Byte[k.size()];
int noOfKeys = static_cast<int>(_pubKeys.size());
if (_encKeys.size() != EVP_SealInit(_pCtx, _pCipher, pEncKeys, encKeysSizes, &_iv[0], &_pubKeys[0], noOfKeys))
if (_encKeys.size() != EVP_SealInit(_pCtx, _pCipher, &pEncKeys[0], &encKeysSizes[0], &_iv[0], &_pubKeys[0], noOfKeys))
{
i = 0;
for (; i < _encKeys.size(); ++i) delete [] pEncKeys[i];