Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions tools/replay/SConscript
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
Import('env', 'arch', 'common', 'messaging', 'visionipc', 'cereal')

replay_env = env.Clone()
replay_env['CCFLAGS'] += ['-Wno-deprecated-declarations']

base_frameworks = []
base_libs = [common, messaging, cereal, visionipc, 'm', 'ssl', 'crypto', 'pthread']
base_libs = [common, messaging, cereal, visionipc, 'crypto', 'pthread']

if arch == "Darwin":
base_frameworks.append('OpenCL')
Expand Down
15 changes: 11 additions & 4 deletions tools/replay/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <bzlib.h>
#include <curl/curl.h>
#include <openssl/evp.h>
#include <openssl/sha.h>

#include <cassert>
Expand Down Expand Up @@ -383,10 +384,16 @@ void precise_nano_sleep(int64_t nanoseconds, std::atomic<bool> &interrupt_reques

std::string sha256(const std::string &str) {
unsigned char hash[SHA256_DIGEST_LENGTH];
SHA256_CTX sha256;
SHA256_Init(&sha256);
SHA256_Update(&sha256, str.c_str(), str.size());
SHA256_Final(hash, &sha256);
EVP_MD_CTX *mdctx = EVP_MD_CTX_new();
if (mdctx == nullptr) return "";

if (EVP_DigestInit_ex(mdctx, EVP_sha256(), nullptr) != 1 ||
EVP_DigestUpdate(mdctx, str.c_str(), str.size()) != 1 ||
EVP_DigestFinal_ex(mdctx, hash, nullptr) != 1) {
EVP_MD_CTX_free(mdctx);
return "";
}
EVP_MD_CTX_free(mdctx);
return util::hexdump(hash, SHA256_DIGEST_LENGTH);
}

Expand Down