Notify about invalid number of arguments

This commit is contained in:
Manuel Thalmann 2023-12-12 18:58:20 +01:00
parent d84200498b
commit 06783ae22b

View file

@ -1,5 +1,9 @@
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <system_error>
/* AES-128 simple implementation template and testing */ /* AES-128 simple implementation template and testing */
@ -184,6 +188,11 @@ void aes(uint8_t *in, uint8_t *out, uint8_t *skey)
//**************************** //****************************
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
if (argc > 1) {
std::cerr << "Invalid number of arguments\n";
exit(EXIT_FAILURE);
}
for (int i = 0; i < 1000000; i++) { for (int i = 0; i < 1000000; i++) {
uint8_t key[16] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }; 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}; uint8_t in[16] = { 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89};