diff options
-rw-r--r-- | hal_internal.h | 7 | ||||
-rw-r--r-- | last_gasp_pin_internal.h | 6 | ||||
-rw-r--r-- | rpc_misc.c | 16 | ||||
-rwxr-xr-x | utils/last_gasp_default_pin | 2 |
4 files changed, 23 insertions, 8 deletions
diff --git a/hal_internal.h b/hal_internal.h index 56d0936..36f24d4 100644 --- a/hal_internal.h +++ b/hal_internal.h @@ -99,9 +99,14 @@ extern void hal_ks_lock(void); extern void hal_ks_unlock(void); /* - * Logging. + * Thread sleep. Currently used only for bad-PIN delays. */ +extern void hal_sleep(const unsigned seconds); + +/* + * Logging. + */ typedef enum { HAL_LOG_DEBUG, HAL_LOG_INFO, HAL_LOG_WARN, HAL_LOG_ERROR, HAL_LOG_SILENT diff --git a/last_gasp_pin_internal.h b/last_gasp_pin_internal.h index bbcac76..901f797 100644 --- a/last_gasp_pin_internal.h +++ b/last_gasp_pin_internal.h @@ -3,7 +3,7 @@ */ static const hal_ks_pin_t hal_last_gasp_pin = { - 10000, - {0x06, 0xe2, 0x10, 0x7b, 0xb8, 0x40, 0xb5, 0x90, 0x33, 0xc8, 0xdb, 0xcc, 0xde, 0x3e, 0xb0, 0x33, 0x2b, 0x7c, 0x60, 0x7c, 0xb4, 0x52, 0xb1, 0x43, 0xa2, 0x20, 0x71, 0xdd, 0xbc, 0x95, 0x92, 0x04, 0xe6, 0x51, 0x90, 0xda, 0x6e, 0x2b, 0x6d, 0x8c, 0xb8, 0x63, 0x8d, 0x59, 0xad, 0xc5, 0xae, 0x6c, 0xf5, 0x7c, 0x75, 0x5e, 0x38, 0x72, 0x06, 0xc5, 0xa9, 0x3b, 0xaa, 0xe9, 0x64, 0x6e, 0xb1, 0x1a}, - {0x40, 0x49, 0xe4, 0xb6, 0x18, 0x0e, 0xe2, 0xbf, 0x3b, 0x22, 0xc8, 0xfe, 0xeb, 0xef, 0x09, 0x81} + 1000, + {0xd5, 0xde, 0xe9, 0x9f, 0x0c, 0xd0, 0xc1, 0x72, 0xfe, 0xe1, 0x8e, 0xe2, 0xad, 0x94, 0x9e, 0x9a, 0xb2, 0x11, 0x14, 0xe4, 0xa4, 0x04, 0xf0, 0x98, 0xd1, 0x44, 0x22, 0x8a, 0x7c, 0x23, 0x5d, 0xdb, 0xe4, 0x29, 0xa6, 0x95, 0x4b, 0xbb, 0x34, 0xf7, 0x16, 0x8b, 0x3f, 0x67, 0x65, 0xc9, 0xa2, 0x2b, 0xcc, 0x5a, 0x25, 0xa7, 0xef, 0xd5, 0x2e, 0x99, 0x75, 0xc8, 0x0f, 0xd9, 0xff, 0x76, 0xf6, 0x1c}, + {0x34, 0x3f, 0x18, 0x36, 0x94, 0xeb, 0xda, 0xb6, 0x5a, 0x5c, 0xbe, 0xc7, 0x61, 0xa0, 0x43, 0x5f} }; @@ -78,15 +78,23 @@ typedef struct { } client_slot_t; #ifndef HAL_PIN_MINIMUM_ITERATIONS -#define HAL_PIN_MINIMUM_ITERATIONS 10000 +#define HAL_PIN_MINIMUM_ITERATIONS 1000 #endif #ifndef HAL_PIN_DEFAULT_ITERATIONS -#define HAL_PIN_DEFAULT_ITERATIONS 20000 +#define HAL_PIN_DEFAULT_ITERATIONS 2000 #endif static uint32_t hal_pin_default_iterations = HAL_PIN_DEFAULT_ITERATIONS; +/* + * Seconds to delay when given a bad PIN. + */ + +#ifndef HAL_PIN_DELAY_ON_FAILURE +#define HAL_PIN_DELAY_ON_FAILURE 5 +#endif + #ifndef HAL_STATIC_CLIENT_STATE_BLOCKS #define HAL_STATIC_CLIENT_STATE_BLOCKS 10 #endif @@ -155,8 +163,10 @@ static hal_error_t login(const hal_client_handle_t client, for (int i = 0; i < sizeof(buf); i++) diff |= buf[i] ^ p->pin[i]; - if (diff != 0) + if (diff != 0) { + hal_sleep(HAL_PIN_DELAY_ON_FAILURE); return HAL_ERROR_PIN_INCORRECT; + } client_slot_t *slot = find_handle(client); diff --git a/utils/last_gasp_default_pin b/utils/last_gasp_default_pin index 50d822f..8a91b8a 100755 --- a/utils/last_gasp_default_pin +++ b/utils/last_gasp_default_pin @@ -54,7 +54,7 @@ parser.add_argument("-p", "--pin", help = "PIN plaintext before PBKDF2 processing") parser.add_argument("-i", "--iterations", type = int, - default = 10000, + default = 1000, help = "PBKDF2 iteration count") parser.add_argument("-d", "--derived-key-length", type = int, |