Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.

Commit 23c1879

Browse files
committed
fix: Format error of wrong type argument
The error message when building the endpoint Legato app: error: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘uint64_t {aka long long unsigned int}’
1 parent a71b296 commit 23c1879

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

utils/cipher.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
#include "cipher.h"
10+
#include <inttypes.h>
1011
#include <stdio.h>
1112
#include <stdlib.h>
1213
#include <string.h>
@@ -46,7 +47,7 @@ status_t aes_decrypt(ta_cipher_ctx* cipher_ctx) {
4647
}
4748

4849
// concatenate (Device_ID, timestamp)
49-
snprintf((char*)nonce, IMSI_LEN + MAX_TIMESTAMP_LEN + 1, "%s-%ld", cipher_ctx->device_id, cipher_ctx->timestamp);
50+
snprintf((char*)nonce, IMSI_LEN + MAX_TIMESTAMP_LEN + 1, "%s-%" PRIu64, cipher_ctx->device_id, cipher_ctx->timestamp);
5051
// hash base data
5152
mbedtls_md_starts(&sha_ctx);
5253
mbedtls_md_update(&sha_ctx, digest, AES_BLOCK_SIZE * 2);
@@ -126,7 +127,7 @@ status_t aes_encrypt(ta_cipher_ctx* cipher_ctx) {
126127
mbedtls_platform_zeroize(ciphertext, sizeof(ciphertext));
127128

128129
// concatenate (Device_ID, timestamp)
129-
snprintf((char*)nonce, IMSI_LEN + MAX_TIMESTAMP_LEN + 1, "%s-%ld", cipher_ctx->device_id, cipher_ctx->timestamp);
130+
snprintf((char*)nonce, IMSI_LEN + MAX_TIMESTAMP_LEN + 1, "%s-%" PRIu64, cipher_ctx->device_id, cipher_ctx->timestamp);
130131
// hash base data
131132
mbedtls_md_starts(&sha_ctx);
132133
mbedtls_md_update(&sha_ctx, digest, AES_BLOCK_SIZE * 2);

0 commit comments

Comments
 (0)