fix mac build 3

This commit is contained in:
t1amak
2025-12-10 12:07:56 +01:00
parent 465a5c6350
commit 75ccbfc7f2
2 changed files with 4 additions and 3 deletions

View File

@@ -36,8 +36,9 @@ uint64_t mx25519_cpu_cycles() {
uint64_t vct; uint64_t vct;
__asm__ volatile("mrs %0, cntvct_el0" : "=r"(vct)); __asm__ volatile("mrs %0, cntvct_el0" : "=r"(vct));
return vct; return vct;
#endif #else
return clock(); /* fallback */ return clock(); /* fallback */
#endif
} }
double mx25519_wall_clock() { double mx25519_wall_clock() {

View File

@@ -82,7 +82,8 @@ static void debug_hex(const char* label, const uint8_t* data, size_t len)
static constexpr char log_category_prefix[] = "CarrotCrypto "; static constexpr char log_category_prefix[] = "CarrotCrypto ";
char hex[130] = {0}; char hex[130] = {0};
for (size_t i = 0; i < len && i < 64; ++i) { for (size_t i = 0; i < len && i < 64; ++i) {
sprintf(hex + i*2, "%02x", data[i]); // Use snprintf to avoid deprecated sprintf and keep bounds safe
snprintf(hex + i*2, sizeof(hex) - (i*2), "%02x", data[i]);
} }
LOGINFO(0, label << ": " << static_cast<const char*>(hex)); LOGINFO(0, label << ": " << static_cast<const char*>(hex));
} }
@@ -420,4 +421,3 @@ void encrypt_anchor(
} // namespace carrot } // namespace carrot
} // namespace p2pool } // namespace p2pool