-void load_priv_conventional(void){
- bigint_t *epriv;
- epriv = malloc(sizeof(bigint_t));
- if(!epriv){
- cli_putstr_P(PSTR("\r\nERROR: OOM!"));
- return;
- }
- epriv->length_B = (sizeof(PRIV_EXPONENT) + sizeof(bigint_word_t) - 1) / sizeof(bigint_word_t);
- epriv->wordv = malloc(epriv->length_B * sizeof(bigint_word_t));
- if(!epriv->wordv){
- cli_putstr_P(PSTR("\r\nERROR: OOM!"));
- return;
- }
- memcpy(epriv->wordv, PRIV_EXPONENT, sizeof(PRIV_EXPONENT));
- priv_key.components = malloc(sizeof(bigint_t*));
- priv_key.components[0] = epriv;
- priv_key.n = 1;
- bigint_changeendianess(epriv);
- bigint_adjust(epriv);
-}
-
-
-void load_priv_crt_mono(void){
- bigint_t **v;
- const uint8_t *bv[5] = {P,Q,DP,DQ,QINV};
- uint16_t sv[5] = {sizeof(P), sizeof(Q), sizeof(DP), sizeof(DQ), sizeof(QINV)};
- uint8_t i;
- v = malloc(5 * sizeof(bigint_t));
- if(!v){
- cli_putstr_P(PSTR("\r\nERROR: OOM!"));
- return;
- }
- priv_key.components = malloc(5*sizeof(bigint_t*));
- if(!priv_key.components){
- cli_putstr_P(PSTR("\r\nERROR: OOM!"));
- return;
- }
- priv_key.n = 5;
- for(i=0; i<5; ++i){
- v[i] = malloc(sizeof(bigint_t));
- v[i]->info = 0;
- v[i]->length_B = (sv[i] + sizeof(bigint_word_t) - 1) / sizeof(bigint_word_t);
- v[i]->wordv = calloc(v[i]->length_B , sizeof(bigint_word_t));
- if(!v[i]->wordv){
- cli_putstr_P(PSTR("\r\nERROR: OOM!"));
- return;
- }
- memcpy(v[i]->wordv, bv[i], sv[i]);
- bigint_changeendianess(v[i]);
- bigint_adjust(v[i]);
- priv_key.components[i] = v[i];
- }
-}
-