Set output buffer len variable if padding removed.

This commit is contained in:
Tim Taylor 2013-09-24 12:00:49 -04:00 committed by Viktor Tarasov
parent cd1116ac7c
commit 2741f23641
2 changed files with 3 additions and 3 deletions

View File

@ -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);
/* 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);
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));
LOG_FUNC_RETURN(ctx, len - n);

View File

@ -2726,7 +2726,6 @@ DWORD WINAPI CardRSADecrypt(__in PCARD_DATA pCardData,
logprintf(pCardData, 2, "Cannot strip PKCS1 padding: %i\n", r);
return SCARD_F_INTERNAL_ERROR;
}
pInfo->cbData = r;
}
else if (pInfo->dwPaddingType == CARD_PADDING_OAEP) {
/* TODO: Handle OAEP padding if present - can call PFN_CSP_UNPAD_DATA */