add debugging
CodeQL / Get language matrix (push) Successful in -6s
CodeQL / Analyze (${{ matrix.name }}) (push) Failing after 1m56s

This commit is contained in:
2025-06-27 01:11:44 -06:00
parent 64544e7960
commit 8570d7f356
+23
View File
@@ -361,8 +361,19 @@ namespace nvhttp {
auto salt = util::from_hex<std::array<uint8_t, 16>>(salt_view, true);
auto key = crypto::gen_aes_key(salt, pin);
std::ostringstream cipher_key_hex;
for (auto b = key.begin(); b != key.end(); ++b) {
cipher_key_hex << std::hex // Output in hexadecimal
<< std::setw(2) // Each byte prints as two characters
<< std::setfill('0') // Fill with '0' if less than two characters
<< static_cast<unsigned int>(*b); // Cast to unsigned int for correct printing
}
BOOST_LOG(debug) << "cipher_key_hex: " << cipher_key_hex.str();
sess.cipher_key = std::make_unique<crypto::aes_t>(key);
tree.put("root.paired", 1);
tree.put("root.plaincert", util::hex_vec(conf_intern.servercert, true));
tree.put("root.<xmlattr>.status_code", 200);
@@ -471,11 +482,23 @@ namespace nvhttp {
data.insert(std::end(data), std::begin(x509_sign), std::end(x509_sign));
data.insert(std::end(data), std::begin(secret), std::end(secret));
std::ostringstream data_hex;
for (auto d = data.begin(); d != data.end(); ++d) {
data_hex << std::hex // Output in hexadecimal
<< std::setw(2) // Each byte prints as two characters
<< std::setfill('0') // Fill with '0' if less than two characters
<< static_cast<unsigned int>(*d); // Cast to unsigned int for correct printing
}
BOOST_LOG(debug) << "data_hex: " << data_hex.str();
auto hash = crypto::hash(data);
// if hash not correct, probably MITM
bool same_hash = hash.size() == sess.clienthash.size() && std::equal(hash.begin(), hash.end(), sess.clienthash.begin());
auto verify = crypto::verify256(crypto::x509(client.cert), secret, sign);
BOOST_LOG(debug) << "same_hash: " << same_hash;
BOOST_LOG(debug) << "verify: " << verify;
if (same_hash && verify) {
tree.put("root.paired", 1);
add_cert->raise(crypto::x509(client.cert));