1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2016, 2017 by piwi
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
7 //-----------------------------------------------------------------------------
8 // Implements a card only attack based on crypto text (encrypted nonces
9 // received during a nested authentication) only. Unlike other card only
10 // attacks this doesn't rely on implementation errors but only on the
11 // inherent weaknesses of the crypto1 cypher. Described in
12 // Carlo Meijer, Roel Verdult, "Ciphertext-only Cryptanalysis on Hardened
13 // Mifare Classic Cards" in Proceedings of the 22nd ACM SIGSAC Conference on
14 // Computer and Communications Security, 2015
15 //-----------------------------------------------------------------------------
17 #ifndef HARDNESTED_BRUTEFORCE_H__
18 #define HARDNESTED_BRUTEFORCE_H__
22 #include "cmdhfmfhard.h"
30 extern void prepare_bf_test_nonces(noncelist_t
*nonces
, uint8_t best_first_byte
);
31 extern bool brute_force_bs(float *bf_rate
, statelist_t
*candidates
, uint32_t cuid
, uint32_t num_acquired_nonces
, uint64_t maximum_states
, noncelist_t
*nonces
, uint8_t *best_first_bytes
);
32 extern float brute_force_benchmark();
33 extern uint8_t trailing_zeros(uint8_t byte
);
34 extern bool verify_key(uint32_t cuid
, noncelist_t
*nonces
, uint8_t *best_first_bytes
, uint32_t odd
, uint32_t even
);