Skip to content

Authcrypt - stop using \r\n and use just \n #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions authcrypt/authcrypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,22 @@ int Authcrypt::run()
int ret = mbedtls_ctr_drbg_seed(&drbg, mbedtls_entropy_func, &entropy,
secret_key, sizeof(secret_key));
if (ret != 0) {
mbedtls_printf("mbedtls_ctr_drbg_seed() returned -0x%04X\r\n", -ret);
mbedtls_printf("mbedtls_ctr_drbg_seed() returned -0x%04X\n", -ret);
return ret;
}

/* Setup AES-CCM contex */
ret = mbedtls_cipher_setup(&cipher,
mbedtls_cipher_info_from_type(MBEDTLS_CIPHER_AES_128_CCM));
if (ret != 0) {
mbedtls_printf("mbedtls_cipher_setup() returned -0x%04X\r\n", -ret);
mbedtls_printf("mbedtls_cipher_setup() returned -0x%04X\n", -ret);
return ret;
}

ret = mbedtls_cipher_setkey(&cipher, secret_key,
8 * sizeof(secret_key), MBEDTLS_ENCRYPT);
if (ret != 0) {
mbedtls_printf("mbedtls_cipher_setkey() returned -0x%04X\r\n", -ret);
mbedtls_printf("mbedtls_cipher_setkey() returned -0x%04X\n", -ret);
return ret;
}

Expand Down Expand Up @@ -125,7 +125,7 @@ int Authcrypt::run()
ciphertext + nonce_len + sizeof(message),
tag_len);
if (ret != 0) {
mbedtls_printf("mbedtls_cipher_auth_encrypt() returned -0x%04X\r\n",
mbedtls_printf("mbedtls_cipher_auth_encrypt() returned -0x%04X\n",
-ret);
return ret;
}
Expand All @@ -144,7 +144,7 @@ int Authcrypt::run()
ret = mbedtls_cipher_setkey(&cipher, secret_key, 8 * sizeof(secret_key),
MBEDTLS_DECRYPT);
if (ret != 0) {
mbedtls_printf("mbedtls_cipher_setkey() returned -0x%04X\r\n", -ret);
mbedtls_printf("mbedtls_cipher_setkey() returned -0x%04X\n", -ret);
return ret;
}

Expand All @@ -160,14 +160,14 @@ int Authcrypt::run()
"authentic!\r\n");
return ret;
} else if (ret != 0) {
mbedtls_printf("mbedtls_cipher_authdecrypt() returned -0x%04X\r\n",
mbedtls_printf("mbedtls_cipher_authdecrypt() returned -0x%04X\n",
-ret);
return ret;
}

print_hex("decrypted", decrypted, decrypted_len);

mbedtls_printf("\r\nDONE\r\n");
mbedtls_printf("\nDONE\n");

return 0;
}
Expand All @@ -181,5 +181,5 @@ void Authcrypt::print_hex(const char *title,
for (size_t i = 0; i < len; i++)
mbedtls_printf("%02x", buf[i]);

mbedtls_printf("\r\n");
mbedtls_printf("\n");
}
2 changes: 1 addition & 1 deletion authcrypt/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int main() {

if (authcrypt->run() != 0) {
exit_code = MBEDTLS_EXIT_FAILURE;
mbedtls_printf("\r\nFAIL\r\n");
mbedtls_printf("\nFAIL\n");
}

delete authcrypt;
Expand Down
7 changes: 6 additions & 1 deletion authcrypt/mbed_app.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"macros": ["MBEDTLS_USER_CONFIG_FILE=\"mbedtls_entropy_config.h\""]
"macros": ["MBEDTLS_USER_CONFIG_FILE=\"mbedtls_entropy_config.h\""],
"target_overrides": {
"*": {
"platform.stdio-convert-newlines": true
}
}
}