]> cvs.zerfleddert.de Git - proxmark3-svn/blob - client/hardnested/hardnested_bruteforce.h
Fix memory bounds error
[proxmark3-svn] / client / hardnested / hardnested_bruteforce.h
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2016, 2017 by piwi
3 //
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
6 // the license.
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 //-----------------------------------------------------------------------------
16
17 #ifndef HARDNESTED_BRUTEFORCE_H__
18 #define HARDNESTED_BRUTEFORCE_H__
19
20 #include <stdint.h>
21 #include <stdbool.h>
22 #include "cmdhfmfhard.h"
23
24 typedef struct {
25 uint32_t *states[2];
26 uint32_t len[2];
27 void* next;
28 } statelist_t;
29
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);
35
36 #endif
Impressum, Datenschutz