make style

This commit is contained in:
merlokk 2022-02-05 13:32:50 +02:00
commit 3ae9070dd8
15 changed files with 126 additions and 121 deletions

View file

@ -63,19 +63,19 @@ static int decrypt(uint8_t ciphertext[], int ciphertext_len, uint8_t key[], uint
int len;
int plaintext_len;
if(!(ctx = EVP_CIPHER_CTX_new()))
if (!(ctx = EVP_CIPHER_CTX_new()))
handleErrors();
if(1 != EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv))
if (1 != EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv))
handleErrors();
EVP_CIPHER_CTX_set_padding(ctx, 0);
if(1 != EVP_DecryptUpdate(ctx, plaintext, &len, ciphertext, ciphertext_len))
if (1 != EVP_DecryptUpdate(ctx, plaintext, &len, ciphertext, ciphertext_len))
handleErrors();
plaintext_len = len;
if(1 != EVP_DecryptFinal_ex(ctx, plaintext + len, &len))
if (1 != EVP_DecryptFinal_ex(ctx, plaintext + len, &len))
handleErrors();
plaintext_len += len;
@ -89,7 +89,7 @@ static int hexstr_to_byte_array(char hexstr[], uint8_t bytes[], size_t byte_len)
if (hexstr_len % 16) {
return 1;
}
if (byte_len < hexstr_len/2) {
if (byte_len < hexstr_len / 2) {
return 2;
}
char *pos = &hexstr[0];
@ -100,7 +100,7 @@ static int hexstr_to_byte_array(char hexstr[], uint8_t bytes[], size_t byte_len)
return 0;
}
int main (int argc, char* argv[]) {
int main(int argc, char *argv[]) {
uint8_t iv[16] = {0x00};
uint8_t key[16] = {0x00};
@ -116,10 +116,10 @@ int main (int argc, char* argv[]) {
return 1;
}
if(hexstr_to_byte_array(argv[2], tag_challenge, sizeof(tag_challenge)))
if (hexstr_to_byte_array(argv[2], tag_challenge, sizeof(tag_challenge)))
return 2;
if(hexstr_to_byte_array(argv[3], lock_challenge, sizeof(lock_challenge)))
if (hexstr_to_byte_array(argv[3], lock_challenge, sizeof(lock_challenge)))
return 3;
uint64_t start_time = time(NULL);