no more clicks on SPDIF & CSpot

This commit is contained in:
Philippe G
2022-01-13 18:21:36 -08:00
parent 3fb1c16f56
commit 60584ae207
11 changed files with 57 additions and 34 deletions

View File

@@ -88,7 +88,7 @@ std::vector<uint8_t> CryptoMbedTLS::sha1HMAC(const std::vector<uint8_t> &inputKe
}
// AES CTR
void CryptoMbedTLS::aesCTRXcrypt(const std::vector<uint8_t> &key, std::vector<uint8_t> &iv, std::vector<uint8_t> &data)
void CryptoMbedTLS::aesCTRXcrypt(const std::vector<uint8_t> &key, std::vector<uint8_t> &iv, uint8_t* buffer, size_t nbytes)
{
// needed for internal cache
size_t off = 0;
@@ -99,12 +99,12 @@ void CryptoMbedTLS::aesCTRXcrypt(const std::vector<uint8_t> &key, std::vector<ui
// Perform decrypt
mbedtls_aes_crypt_ctr(&aesCtx,
data.size(),
nbytes,
&off,
iv.data(),
streamBlock,
data.data(),
data.data());
buffer,
buffer);
}
void CryptoMbedTLS::aesECBdecrypt(const std::vector<uint8_t> &key, std::vector<uint8_t> &data)
@@ -115,7 +115,7 @@ void CryptoMbedTLS::aesECBdecrypt(const std::vector<uint8_t> &key, std::vector<u
// Mbedtls's decrypt only works on 16 byte blocks
for (unsigned int x = 0; x < data.size() / 16; x++)
{
// Perform decrypt
// Perform finalize
mbedtls_aes_crypt_ecb(&aesCtx,
MBEDTLS_AES_DECRYPT,
data.data() + (x * 16),

View File

@@ -99,7 +99,7 @@ std::vector<uint8_t> CryptoOpenSSL::sha1HMAC(const std::vector<uint8_t>& inputKe
}
// AES CTR
void CryptoOpenSSL::aesCTRXcrypt(const std::vector<uint8_t>& key, std::vector<uint8_t>& iv, std::vector<uint8_t> &data)
void CryptoOpenSSL::aesCTRXcrypt(const std::vector<uint8_t>& key, std::vector<uint8_t>& iv, uint8_t* buffer, size_t nbytes)
{
// Prepare AES_KEY
auto cryptoKey = AES_KEY();
@@ -110,9 +110,9 @@ void CryptoOpenSSL::aesCTRXcrypt(const std::vector<uint8_t>& key, std::vector<ui
unsigned int offsetInBlock = 0;
CRYPTO_ctr128_encrypt(
data.data(),
data.data(),
data.size(),
buffer,
buffer,
nbytes,
&cryptoKey,
iv.data(),
ecountBuf,

View File

@@ -287,7 +287,7 @@ std::string HTTPClient::HTTPResponse::readToString() {
return result;
}
std::string result;
char buffer[BUF_SIZE];
char buffer[BUF_SIZE+1]; // make space for null-terminator
size_t len;
do {
len = this->read(buffer, BUF_SIZE);