aboutsummaryrefslogtreecommitdiff
path: root/hal.h
diff options
context:
space:
mode:
Diffstat (limited to 'hal.h')
-rw-r--r--hal.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/hal.h b/hal.h
index 43ea6a0..f01e47d 100644
--- a/hal.h
+++ b/hal.h
@@ -109,6 +109,9 @@
#define MODEXPA7_NAME "modexpa7"
#define MODEXPA7_VERSION "0.25"
+#define MODEXPNG_NAME "modexpng"
+#define MODEXPNG_VERSION "0.10"
+
#define MKMIF_NAME "mkmif "
#define MKMIF_VERSION "0.10"
@@ -417,6 +420,37 @@ extern void hal_modexp_set_debug(const int onoff);
extern hal_error_t hal_modexp( const int precalc, hal_modexp_arg_t *args);
extern hal_error_t hal_modexp2(const int precalc, hal_modexp_arg_t *args1, hal_modexp_arg_t *args2);
+/* ModExpNG extensions */
+
+typedef struct {
+ hal_core_t *core;
+ const uint8_t *msg; size_t msg_len; /* Message */
+ const uint8_t *exp; size_t exp_len; /* Exponent */
+ const uint8_t *mod; size_t mod_len; /* Modulus */
+ uint8_t *result; size_t result_len; /* Result of exponentiation */
+ uint8_t *coeff; size_t coeff_len; /* Modulus coefficient (r/w) */
+ uint8_t *mont; size_t mont_len; /* Montgomery factor (r/w)*/
+
+ uint8_t *p; size_t p_len;
+ uint8_t *pC; size_t pC_len;
+ uint8_t *pF; size_t pF_len;
+
+ uint8_t *q; size_t q_len;
+ uint8_t *qC; size_t qC_len;
+ uint8_t *qF; size_t qF_len;
+
+ uint8_t *dP; size_t dP_len;
+ uint8_t *dQ; size_t dQ_len;
+ uint8_t *qInv; size_t qInv_len;
+
+ uint8_t *bf; size_t bf_len;
+ uint8_t *ubf; size_t ubf_len;
+} hal_modexpng_arg_t;
+
+extern hal_error_t hal_modexp_use_modexpng(const int onoff);
+extern int hal_modexp_using_modexpng(void);
+extern hal_error_t hal_modexpng(hal_modexpng_arg_t *a);
+
/*
* Master Key Memory Interface
*/
@@ -465,6 +499,8 @@ extern void hal_rsa_set_debug(const int onoff);
extern void hal_rsa_set_blinding(const int onoff);
+extern void hal_rsa_set_crt(const int onoff);
+
extern hal_error_t hal_rsa_key_load_private(hal_rsa_key_t **key,
void *keybuf, const size_t keybuf_len,
const uint8_t * const n, const size_t n_len,