From 4320486a3bf7250a77edb7762662aa55fbc51fdc Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 29 Jan 2021 19:04:35 +0100 Subject: [PATCH] cppchecker fixes --- common/cryptorf/cryptolib.c | 2 +- tools/cryptorf/sma.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/cryptorf/cryptolib.c b/common/cryptorf/cryptolib.c index a59f4109a..ec6ab7468 100644 --- a/common/cryptorf/cryptolib.c +++ b/common/cryptorf/cryptolib.c @@ -310,7 +310,7 @@ static void cm_crypt(const CryptoAction ca, const uint8_t offset, const uint8_t void cm_encrypt(const uint8_t offset, const uint8_t len, const uint8_t *pt, uint8_t *ct, crypto_state s) { next_n(true, 5, 0, s); next(true, 0, s); - cm_crypt(CA_ENCRYPT, offset, len, ct, pt, s); + cm_crypt(CA_ENCRYPT, offset, len, pt, ct, s); } void cm_decrypt(const uint8_t offset, const uint8_t len, const uint8_t *ct, uint8_t *pt, crypto_state s) { diff --git a/tools/cryptorf/sma.cpp b/tools/cryptorf/sma.cpp index 05b9f344f..a51281ad8 100644 --- a/tools/cryptorf/sma.cpp +++ b/tools/cryptorf/sma.cpp @@ -701,7 +701,7 @@ void combine_valid_left_right_states(vector *plcstates, vector *prcs } } printf("Found a total of " _YELLOW_("%llu")" combinations, ", ((unsigned long long)plcstates->size()) * prcstates->size()); - printf("but only " _GREEN_("%lu")" were valid!\n", pgc_candidates->size()); + printf("but only " _GREEN_("%zu")" were valid!\n", pgc_candidates->size()); } int main(int argc, const char *argv[]) { @@ -814,7 +814,7 @@ int main(int argc, const char *argv[]) { printf("Determing the right states that correspond to the keystream\n"); rbits = sm_right(ks, mask, &rstates); - printf("Top-bin for the right state contains " _GREEN_("%d")" correct bits\n", rbits); + printf("Top-bin for the right state contains " _GREEN_("%u")" correct bits\n", rbits); printf("Total count of right bins: " _YELLOW_("%lu") "\n", (unsigned long)rstates.size()); if (rbits < 96) { @@ -827,16 +827,16 @@ int main(int argc, const char *argv[]) { printf("Using the state from the top-right bin: " _YELLOW_("0x%07" PRIx64)"\n", rstate_after_gc); search_gc_candidates_right(rstate_before_gc, rstate_after_gc, Q, &crstates); - printf("Found " _YELLOW_("%lu")" right candidates using the meet-in-the-middle attack\n", crstates.size()); + printf("Found " _YELLOW_("%zu")" right candidates using the meet-in-the-middle attack\n", crstates.size()); if (crstates.size() == 0) continue; printf("Calculating left states using the (unknown bits) mask from the top-right state\n"); sm_left(ks, mask, &clstates); - printf("Found a total of " _YELLOW_("%lu")" left cipher states, recovering left candidates...\n", clstates.size()); + printf("Found a total of " _YELLOW_("%zu")" left cipher states, recovering left candidates...\n", clstates.size()); if (clstates.size() == 0) continue; search_gc_candidates_left(lstate_before_gc, Q, &clstates); - printf("The meet-in-the-middle attack returned " _YELLOW_("%lu")" left cipher candidates\n", clstates.size()); + printf("The meet-in-the-middle attack returned " _YELLOW_("%zu")" left cipher candidates\n", clstates.size()); if (clstates.size() == 0) continue; printf("Combining left and right states, disposing invalid combinations\n");