summaryrefslogtreecommitdiff
path: root/nss-tool
diff options
context:
space:
mode:
authorFranziskus Kiefer <franziskuskiefer@gmail.com>2017-04-26 15:29:04 +0200
committerFranziskus Kiefer <franziskuskiefer@gmail.com>2017-04-26 15:29:04 +0200
commit30a2104f96d4853e06d087fc010c8e9889bed807 (patch)
treec12361b1e319df97c572bcc0499f0d7db13397df /nss-tool
parent2862293c96fdcf2ffe1204b140e7c88a96e801f3 (diff)
downloadnss-hg-30a2104f96d4853e06d087fc010c8e9889bed807.tar.gz
Bug 1355422 - make enctool windows compatible, r=ttaubert
Differential Revision: https://nss-review.dev.mozaws.net/D293
Diffstat (limited to 'nss-tool')
-rw-r--r--nss-tool/enc/enctool.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/nss-tool/enc/enctool.cc b/nss-tool/enc/enctool.cc
index abac9403f..290c26a8f 100644
--- a/nss-tool/enc/enctool.cc
+++ b/nss-tool/enc/enctool.cc
@@ -231,7 +231,7 @@ bool EncTool::DoCipher(std::string file_name, std::string out_file,
bool encrypt, key_func_t get_params) {
SECStatus rv;
unsigned int outLen = 0, chunkSize = 1024;
- char buffer[chunkSize + 16];
+ char buffer[1040];
const unsigned char* bufferStart =
reinterpret_cast<const unsigned char*>(buffer);
@@ -270,13 +270,13 @@ bool EncTool::DoCipher(std::string file_name, std::string out_file,
// Read from stdin.
if (file_name.empty()) {
std::vector<uint8_t> data = ReadInputData("");
- uint8_t out[data.size() + 16];
+ std::vector<uint8_t> out(data.size() + 16);
SECStatus rv;
if (encrypt) {
- rv = PK11_Encrypt(symKey.get(), cipher_mech_, params.get(), out, &outLen,
+ rv = PK11_Encrypt(symKey.get(), cipher_mech_, params.get(), out.data(), &outLen,
data.size() + 16, data.data(), data.size());
} else {
- rv = PK11_Decrypt(symKey.get(), cipher_mech_, params.get(), out, &outLen,
+ rv = PK11_Decrypt(symKey.get(), cipher_mech_, params.get(), out.data(), &outLen,
data.size() + 16, data.data(), data.size());
}
if (rv != SECSuccess) {
@@ -284,7 +284,7 @@ bool EncTool::DoCipher(std::string file_name, std::string out_file,
PR_GetError(), __LINE__);
return false;
};
- output.write(reinterpret_cast<char*>(out), outLen);
+ output.write(reinterpret_cast<char*>(out.data()), outLen);
output.flush();
if (output_file.good()) {
output_file.close();
@@ -302,7 +302,7 @@ bool EncTool::DoCipher(std::string file_name, std::string out_file,
if (!input.good()) {
return false;
}
- uint8_t out[chunkSize + 16];
+ uint8_t out[1040];
while (input) {
if (encrypt) {
input.read(buffer, chunkSize);