Set output buffer len variable if padding removed.
This commit is contained in:
parent
cd1116ac7c
commit
2741f23641
|
@ -166,9 +166,10 @@ sc_pkcs1_strip_02_padding(sc_context_t *ctx, const u8 *data, size_t len, u8 *out
|
||||||
LOG_FUNC_RETURN(ctx, SC_SUCCESS);
|
LOG_FUNC_RETURN(ctx, SC_SUCCESS);
|
||||||
|
|
||||||
/* Now move decrypted contents to head of buffer */
|
/* Now move decrypted contents to head of buffer */
|
||||||
if (*out_len < len - n)
|
if (*out_len < len - n)
|
||||||
LOG_FUNC_RETURN(ctx, SC_ERROR_INTERNAL);
|
LOG_FUNC_RETURN(ctx, SC_ERROR_INTERNAL);
|
||||||
memmove(out, data + n, len - n);
|
*out_len = len - n;
|
||||||
|
memmove(out, data + n, *out_len);
|
||||||
|
|
||||||
sc_log(ctx, "stripped output(%i): %s", len - n, sc_dump_hex(out, len - n));
|
sc_log(ctx, "stripped output(%i): %s", len - n, sc_dump_hex(out, len - n));
|
||||||
LOG_FUNC_RETURN(ctx, len - n);
|
LOG_FUNC_RETURN(ctx, len - n);
|
||||||
|
|
|
@ -2726,7 +2726,6 @@ DWORD WINAPI CardRSADecrypt(__in PCARD_DATA pCardData,
|
||||||
logprintf(pCardData, 2, "Cannot strip PKCS1 padding: %i\n", r);
|
logprintf(pCardData, 2, "Cannot strip PKCS1 padding: %i\n", r);
|
||||||
return SCARD_F_INTERNAL_ERROR;
|
return SCARD_F_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
pInfo->cbData = r;
|
|
||||||
}
|
}
|
||||||
else if (pInfo->dwPaddingType == CARD_PADDING_OAEP) {
|
else if (pInfo->dwPaddingType == CARD_PADDING_OAEP) {
|
||||||
/* TODO: Handle OAEP padding if present - can call PFN_CSP_UNPAD_DATA */
|
/* TODO: Handle OAEP padding if present - can call PFN_CSP_UNPAD_DATA */
|
||||||
|
|
Loading…
Reference in New Issue