test fixes

This commit is contained in:
iceman1001 2019-04-17 14:48:32 +02:00
parent e0bd6b2019
commit 524346901a
2 changed files with 12 additions and 3 deletions

View file

@ -287,7 +287,7 @@ static int CmdEMVGPO(const char *Cmd) {
PrintAndLogEx(ERR, "Can't create PDOL data.");
tlvdb_free(tmp_ext);
tlvdb_free(tlvRoot);
free(pdol_data_tlv);
free(data_tlv);
return 4;
}
PrintAndLogEx(INFO, "PDOL data[%d]: %s", pdol_data_tlv_data_len, sprint_hex(pdol_data_tlv_data, pdol_data_tlv_data_len));

View file

@ -253,20 +253,29 @@ static size_t crypto_pk_polarssl_get_nbits(const struct crypto_pk *_cp) {
static unsigned char *crypto_pk_polarssl_get_parameter(const struct crypto_pk *_cp, unsigned param, size_t *plen) {
struct crypto_pk_polarssl *cp = (struct crypto_pk_polarssl *)_cp;
unsigned char *result = NULL;
int res;
switch (param) {
// mod
case 0:
*plen = mbedtls_mpi_size(&cp->ctx.N);
result = malloc(*plen);
memset(result, 0x00, *plen);
mbedtls_mpi_write_binary(&cp->ctx.N, result, *plen);
res = mbedtls_mpi_write_binary(&cp->ctx.N, result, *plen);
if ( res == 0 ) {
printf("Error write_binary.");
result = 0;
}
break;
// exp
case 1:
*plen = mbedtls_mpi_size(&cp->ctx.E);
result = malloc(*plen);
memset(result, 0x00, *plen);
mbedtls_mpi_write_binary(&cp->ctx.E, result, *plen);
res = mbedtls_mpi_write_binary(&cp->ctx.E, result, *plen);
if ( res == 0 ) {
printf("Error write_binary.");
result = 0;
}
break;
default:
printf("Error get parameter. Param = %u", param);