@@ -118,7 +118,13 @@ static void qat_rsa_cb(struct icp_qat_fw_pke_resp *resp)
struct device *dev = &GET_DEV(req->ctx->inst->accel_dev);
int err = ICP_QAT_FW_PKE_RESP_PKE_STAT_GET(
resp->pke_resp_hdr.comn_resp_flags);
- char *ptr = areq->dst;
+#if BYTES_PER_MPI_LIMB == 4
+ u32 *ptr = areq->dst;
+#elif BYTES_PER_MPI_LIMB == 8
+ u64 *ptr = areq->dst;
+#else
+#error please implement for this limb size.
+#endif
err = (err == ICP_QAT_FW_COMN_STATUS_FLAG_OK) ? 0 : -EINVAL;
@@ -140,12 +146,12 @@ static void qat_rsa_cb(struct icp_qat_fw_pke_resp *resp)
areq->dst_len = req->ctx->key_sz;
/* Need to set the corect length of the output */
while (!(*ptr) && areq->dst_len) {
- areq->dst_len--;
+ areq->dst_len -= sizeof(*ptr);
ptr++;
}
if (areq->dst_len != req->ctx->key_sz)
- memcpy(areq->dst, ptr, areq->dst_len);
+ memmove(areq->dst, ptr, areq->dst_len);
akcipher_request_complete(areq, err);
}