fix cleanup_pop

This commit is contained in:
NIIBE Yutaka
2015-09-10 14:23:07 +09:00
parent 4b7cfd04af
commit d423678f59

View File

@@ -38,7 +38,7 @@
static rsa_context rsa_ctx; static rsa_context rsa_ctx;
static struct chx_cleanup clp; static struct chx_cleanup clp;
sttic void static void
rsa_cleanup (void *arg) rsa_cleanup (void *arg)
{ {
free (arg); free (arg);
@@ -90,7 +90,7 @@ rsa_sign (const uint8_t *raw_message, uint8_t *output, int msg_len,
msg_len, raw_message, temp); msg_len, raw_message, temp);
memcpy (output, temp, pubkey_len); memcpy (output, temp, pubkey_len);
chopstx_setcancelstate (cs); chopstx_setcancelstate (cs);
chopstx_cleanup_pop (&clp); chopstx_cleanup_pop (0);
} }
rsa_free (&rsa_ctx); rsa_free (&rsa_ctx);
@@ -181,7 +181,7 @@ rsa_decrypt (const uint8_t *input, uint8_t *output, int msg_len,
RSA_PRIVATE, output_len_p, input, RSA_PRIVATE, output_len_p, input,
output, MAX_RES_APDU_DATA_SIZE); output, MAX_RES_APDU_DATA_SIZE);
chopstx_setcancelstate (cs); chopstx_setcancelstate (cs);
chopstx_cleanup_pop (&clp); chopstx_cleanup_pop (0);
} }
rsa_free (&rsa_ctx); rsa_free (&rsa_ctx);
@@ -264,7 +264,7 @@ rsa_genkey (int pubkey_len)
if (ret != 0) if (ret != 0)
{ {
chopstx_setcancelstate (cs); chopstx_setcancelstate (cs);
chopstx_cleanup_pop (&clp); chopstx_cleanup_pop (0);
free (p_q_modulus); free (p_q_modulus);
rsa_free (&rsa_ctx); rsa_free (&rsa_ctx);
return NULL; return NULL;
@@ -276,7 +276,7 @@ rsa_genkey (int pubkey_len)
cleanup: cleanup:
chopstx_setcancelstate (cs); chopstx_setcancelstate (cs);
chopstx_cleanup_pop (&clp); chopstx_cleanup_pop (0);
rsa_free (&rsa_ctx); rsa_free (&rsa_ctx);
if (ret != 0) if (ret != 0)
return NULL; return NULL;