Message ID | 20150813035445.25108.76927.stgit@tstruk-mobl1 (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Herbert Xu |
Headers | show |
On 08/12/2015 08:54 PM, Tadeusz Struk wrote: > Don't need to move data inside of the output buffer > because SW doen't need to do this anymore sice the new MPI > mpi_read_buf() has been added. Just set the correct output len. > > Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com> > --- > drivers/crypto/qat/qat_common/qat_asym_algs.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/crypto/qat/qat_common/qat_asym_algs.c b/drivers/crypto/qat/qat_common/qat_asym_algs.c > index fe352a6..6ddb13c 100644 > --- a/drivers/crypto/qat/qat_common/qat_asym_algs.c > +++ b/drivers/crypto/qat/qat_common/qat_asym_algs.c > @@ -144,9 +144,6 @@ static void qat_rsa_cb(struct icp_qat_fw_pke_resp *resp) > ptr++; > } > > - if (areq->dst_len != req->ctx->key_sz) > - memcpy(areq->dst, ptr, areq->dst_len); > - > akcipher_request_complete(areq, err); > } > > Herbert, Could you take this one and I'll work with David on the rest. Thanks, T -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Aug 12, 2015 at 08:54:45PM -0700, Tadeusz Struk wrote: > Don't need to move data inside of the output buffer > because SW doen't need to do this anymore sice the new MPI > mpi_read_buf() has been added. Just set the correct output len. > > Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com> > --- > drivers/crypto/qat/qat_common/qat_asym_algs.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/crypto/qat/qat_common/qat_asym_algs.c b/drivers/crypto/qat/qat_common/qat_asym_algs.c > index fe352a6..6ddb13c 100644 > --- a/drivers/crypto/qat/qat_common/qat_asym_algs.c > +++ b/drivers/crypto/qat/qat_common/qat_asym_algs.c > @@ -144,9 +144,6 @@ static void qat_rsa_cb(struct icp_qat_fw_pke_resp *resp) > ptr++; > } > > - if (areq->dst_len != req->ctx->key_sz) > - memcpy(areq->dst, ptr, areq->dst_len); > - This looks wrong. It appears to be trying to remove leading zeroes so you can't just change the length because then you end up removing the trailing digits equal to the number of leading zeroes. The existing code is also wrong as you should be using memmove instead of memcpy. Cheers,
On 08/13/2015 10:14 PM, Herbert Xu wrote: >> diff --git a/drivers/crypto/qat/qat_common/qat_asym_algs.c b/drivers/crypto/qat/qat_common/qat_asym_algs.c >> > index fe352a6..6ddb13c 100644 >> > --- a/drivers/crypto/qat/qat_common/qat_asym_algs.c >> > +++ b/drivers/crypto/qat/qat_common/qat_asym_algs.c >> > @@ -144,9 +144,6 @@ static void qat_rsa_cb(struct icp_qat_fw_pke_resp *resp) >> > ptr++; >> > } >> > >> > - if (areq->dst_len != req->ctx->key_sz) >> > - memcpy(areq->dst, ptr, areq->dst_len); >> > - > This looks wrong. It appears to be trying to remove leading > zeroes so you can't just change the length because then you end > up removing the trailing digits equal to the number of leading > zeroes. What it does is it sets the size of the output number, not the size of the output buffer. The size of the buffer is set beforehand to the size of the modulo, which is the biggest possible output. > > The existing code is also wrong as you should be using memmove > instead of memcpy. Right, but we don't need that anymore. -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Aug 13, 2015 at 11:14:11PM -0700, Tadeusz Struk wrote: > > Right, but we don't need that anymore. Why not? If you reduce the size without moving the buffer wouldn't it begin with a bunch of zeroes and wouldn't you lose the real bytes at the end? Cheers,
diff --git a/drivers/crypto/qat/qat_common/qat_asym_algs.c b/drivers/crypto/qat/qat_common/qat_asym_algs.c index fe352a6..6ddb13c 100644 --- a/drivers/crypto/qat/qat_common/qat_asym_algs.c +++ b/drivers/crypto/qat/qat_common/qat_asym_algs.c @@ -144,9 +144,6 @@ static void qat_rsa_cb(struct icp_qat_fw_pke_resp *resp) ptr++; } - if (areq->dst_len != req->ctx->key_sz) - memcpy(areq->dst, ptr, areq->dst_len); - akcipher_request_complete(areq, err); }
Don't need to move data inside of the output buffer because SW doen't need to do this anymore sice the new MPI mpi_read_buf() has been added. Just set the correct output len. Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com> --- drivers/crypto/qat/qat_common/qat_asym_algs.c | 3 --- 1 file changed, 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html