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

Commit

Permalink
fix: Format error of wrong type argument
Browse files Browse the repository at this point in the history
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}’
  • Loading branch information
marktwtn committed Jun 1, 2020
1 parent a71b296 commit 23c1879
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions utils/cipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

#include "cipher.h"
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -46,7 +47,7 @@ status_t aes_decrypt(ta_cipher_ctx* cipher_ctx) {
}

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

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

0 comments on commit 23c1879

Please sign in to comment.