Skip to content

Commit

Permalink
Limit the use of the DIT functions in benchmarking to AWS-LC builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
nebeid committed Aug 7, 2024
1 parent 0b74ef5 commit e4aa5d9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tool/speed.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ static inline void *BM_memset(void *dst, int c, size_t n) {
// g_print_json is true if printed output is JSON formatted.
static bool g_print_json = false;

#if defined(OPENSSL_IS_AWSLC)
// g_dit is true if the DIT macro is to be enabled before benchmarking
static bool g_dit = false;
#endif

static std::string ChunkLenSuffix(size_t chunk_len) {
char buf[32];
Expand Down Expand Up @@ -2615,9 +2617,11 @@ bool Speed(const std::vector<std::string> &args) {
}
}

#if defined(OPENSSL_IS_AWSLC)
if (args_map.count("-dit") != 0) {
g_dit = true;
}
#endif

if (args_map.count("-json") != 0) {
g_print_json = true;
Expand Down Expand Up @@ -2670,12 +2674,13 @@ bool Speed(const std::vector<std::string> &args) {
return false;
}
}

#if defined(OPENSSL_IS_AWSLC)
uint64_t original_dit = 0;
if (g_dit)
{
original_dit = armv8_enable_dit();
}
#endif

// kTLSADLen is the number of bytes of additional data that TLS passes to
// AEADs.
Expand Down Expand Up @@ -2825,9 +2830,11 @@ bool Speed(const std::vector<std::string> &args) {
puts("\n]");
}

#if defined(OPENSSL_IS_AWSLC)
if (g_dit)
{
armv8_restore_dit(&original_dit);
}
#endif
return true;
}

0 comments on commit e4aa5d9

Please sign in to comment.