Prevent optimizations
This commit is contained in:
parent
ba48c564ce
commit
ff140ca40e
1 changed files with 3 additions and 2 deletions
|
@ -188,6 +188,8 @@ void aes(uint8_t *in, uint8_t *out, uint8_t *skey)
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
uint32_t cycles = 1000000;
|
uint32_t cycles = 1000000;
|
||||||
|
uint8_t key[16] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff };
|
||||||
|
uint8_t in[16] = { 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89};
|
||||||
|
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
std::cerr << "Invalid number of arguments\n";
|
std::cerr << "Invalid number of arguments\n";
|
||||||
|
@ -199,8 +201,6 @@ int main(int argc, char* argv[])
|
||||||
const auto start{std::chrono::steady_clock::now()};
|
const auto start{std::chrono::steady_clock::now()};
|
||||||
{
|
{
|
||||||
for (int i = 0; i < cycles; i++) {
|
for (int i = 0; i < cycles; i++) {
|
||||||
uint8_t key[16] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff };
|
|
||||||
uint8_t in[16] = { 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89};
|
|
||||||
aes(in, in, key);
|
aes(in, in, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,4 +210,5 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
std::cout << "AES (" << cycles << " runs)\nElapsed time: ";
|
std::cout << "AES (" << cycles << " runs)\nElapsed time: ";
|
||||||
std::cout << milliseconds << "ms\n"; // Before C++20
|
std::cout << milliseconds << "ms\n"; // Before C++20
|
||||||
|
exit(in[0]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue