parent
4b51b99748
commit
090aed2fc2
|
@ -1207,7 +1207,7 @@ isoApplet_compute_signature(struct sc_card *card,
|
|||
if(drvdata->sec_env_alg_ref == ISOAPPLET_ALG_REF_ECDSA)
|
||||
{
|
||||
u8* p = NULL;
|
||||
size_t len = drvdata->sec_env_ec_field_length / 4;
|
||||
size_t len = (drvdata->sec_env_ec_field_length + 7) / 8 * 2;
|
||||
|
||||
if (len > outlen)
|
||||
LOG_FUNC_RETURN(ctx, SC_ERROR_BUFFER_TOO_SMALL);
|
||||
|
|
|
@ -816,10 +816,10 @@ myeid_convert_ec_signature(struct sc_context *ctx, size_t s_len, unsigned char *
|
|||
if (*data != 0x30 || *(data + 1) != (datalen - 2) || *(data + 2) != 0x02)
|
||||
return SC_ERROR_INVALID_DATA;
|
||||
|
||||
buf = calloc(1, s_len/4);
|
||||
buf = calloc(1, (s_len + 7)/8*2);
|
||||
if (!buf)
|
||||
LOG_FUNC_RETURN(ctx, SC_ERROR_OUT_OF_MEMORY);
|
||||
buflen = s_len/4;
|
||||
buflen = (s_len + 7)/8*2;
|
||||
|
||||
r = sc_asn1_sig_value_sequence_to_rs(ctx, data, datalen, buf, buflen);
|
||||
LOG_TEST_RET(ctx, r, "Failed to cenvert Sig-Value to the raw RS format");
|
||||
|
|
|
@ -218,8 +218,8 @@ int sc_pkcs15_derive(struct sc_pkcs15_card *p15card,
|
|||
LOG_FUNC_RETURN(ctx, SC_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
if (out == NULL || *poutlen < (prkey->field_length +7) / 8) {
|
||||
*poutlen = (prkey->field_length +7) / 8;
|
||||
if (out == NULL || *poutlen < (prkey->field_length + 7) / 8) {
|
||||
*poutlen = (prkey->field_length + 7) / 8;
|
||||
r = 0; /* say no data to return */
|
||||
goto out;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue