| 1 |
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 |
// SPDX-License-Identifier: Apache-2.0 OR ISC |
| 3 |
|
| 4 |
#ifndef OPENSSL_HEADER_CRYPTO_TEST_UBE_TEST_H |
| 5 |
#define OPENSSL_HEADER_CRYPTO_TEST_UBE_TEST_H |
| 6 |
|
| 7 |
#include <gtest/gtest.h> |
| 8 |
|
| 9 |
#include "../ube/internal.h" |
| 10 |
|
| 11 |
class UbeBase { |
| 12 |
private: |
| 13 |
bool ube_detection_supported_ = false; |
| 14 |
|
| 15 |
public: |
| 16 |
void SetUp() { |
| 17 |
uint64_t current_generation_number = 0; |
| 18 |
if (CRYPTO_get_ube_generation_number(¤t_generation_number) == 1) { |
| 19 |
ube_detection_supported_ = true; |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
void TearDown() { |
| 24 |
disable_mocked_ube_detection_FOR_TESTING(); |
| 25 |
} |
| 26 |
|
| 27 |
bool UbeIsSupported() const { |
| 28 |
return ube_detection_supported_; |
| 29 |
} |
| 30 |
|
| 31 |
void allowMockedUbe() const { |
| 32 |
allow_mocked_ube_detection_FOR_TESTING(); |
| 33 |
} |
| 34 |
}; |
| 35 |
|
| 36 |
#endif // OPENSSL_HEADER_CRYPTO_TEST_UBE_TEST_H |