summaryrefslogtreecommitdiff
path: root/utils/nwztools/upgtools/keysig_search.h
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2016-10-27 23:06:16 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2016-10-27 23:06:16 +0200
commit37f95f67fec2b2460903ffa5255b1beeba1731fd (patch)
tree6a932718139104406ab576ba89065c53f8dd20e7 /utils/nwztools/upgtools/keysig_search.h
parent794104dd17a28a2db09ca1ed44ba7dfb18a1f0ca (diff)
downloadrockbox-37f95f67fec2b2460903ffa5255b1beeba1731fd.tar.gz
rockbox-37f95f67fec2b2460903ffa5255b1beeba1731fd.zip
nwztools/upgtools: rewrite keysig brute force search
The new search has two new features: - it takes advantage of the fact that DES keys are only 56-bit long (and not 64) - it is now multithreaded As a proof of concept, I ran it on the A10 series firmware upgrade and was able to find the key in a few seconds using 4 threads. The search is still limited to ascii hex passwords (seems to work on all devices I have tried thus far). Change-Id: Ied080286d2bbdc493a6ceaecaaadba802b429666
Diffstat (limited to 'utils/nwztools/upgtools/keysig_search.h')
-rw-r--r--utils/nwztools/upgtools/keysig_search.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/utils/nwztools/upgtools/keysig_search.h b/utils/nwztools/upgtools/keysig_search.h
index 9009a73284..f419e2621c 100644
--- a/utils/nwztools/upgtools/keysig_search.h
+++ b/utils/nwztools/upgtools/keysig_search.h
@@ -23,30 +23,30 @@
23 23
24#include <stdbool.h> 24#include <stdbool.h>
25#include <stdint.h> 25#include <stdint.h>
26#include <stddef.h>
26#include "fwp.h" 27#include "fwp.h"
27 28
28enum keysig_search_method_t 29enum keysig_search_method_t
29{ 30{
30 KEYSIG_SEARCH_NONE = 0, 31 KEYSIG_SEARCH_NONE = 0,
31 KEYSIG_SEARCH_FIRST, 32 KEYSIG_SEARCH_FIRST,
32 KEYSIG_SEARCH_ASCII_STUPID = KEYSIG_SEARCH_FIRST, 33 KEYSIG_SEARCH_ASCII_HEX = KEYSIG_SEARCH_FIRST,
33 KEYSIG_SEARCH_ASCII_BRUTE,
34 KEYSIG_SEARCH_LAST 34 KEYSIG_SEARCH_LAST
35}; 35};
36 36
37/* notify returns true if the key seems ok */ 37/* notify returns true if the key seems ok */
38typedef bool (*keysig_notify_fn_t)(void *user, uint8_t key[NWZ_KEY_SIZE], 38typedef bool (*keysig_notify_fn_t)(void *user, uint8_t key[NWZ_KEY_SIZE],
39 uint8_t sig[NWZ_SIG_SIZE]); 39 uint8_t sig[NWZ_SIG_SIZE]);
40/* returns true if a key was accepted by notify */
41typedef bool (*keysig_search_fn_t)(uint8_t *cipher, keysig_notify_fn_t notify, void *user);
42 40
43struct keysig_search_desc_t 41struct keysig_search_desc_t
44{ 42{
45 const char *name; 43 const char *name;
46 const char *comment; 44 const char *comment;
47 keysig_search_fn_t fn;
48}; 45};
49 46
50struct keysig_search_desc_t keysig_search_desc[KEYSIG_SEARCH_LAST]; 47struct keysig_search_desc_t keysig_search_desc[KEYSIG_SEARCH_LAST];
51 48
49bool keysig_search(int method, uint8_t *enc_buf, size_t buf_sz,
50 keysig_notify_fn_t notify, void *user, int nr_threads);
51
52#endif /* __keysig_search_h__ */ 52#endif /* __keysig_search_h__ */