CR50: point multiply should check point for curve membership

_cpri__EccPointMultiply should check whether the provided
point is on the curve prior to doing a multiply.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=TCG test CPCTPM_TC2_4_13_01_01 passes

Change-Id: Ia92494070c62f7e03b395975138c0c8446a7284d
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/341112
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
This commit is contained in:
nagendra modadugu
2016-04-27 23:19:27 -07:00
committed by chrome-bot
parent 61e0653261
commit b2280c24b4

View File

@@ -75,7 +75,9 @@ CRYPT_RESULT _cpri__EccPointMultiply(
return CRYPT_PARAMETER;
if (n1 != NULL && !check_p256_param(n1))
return CRYPT_PARAMETER;
if (in != NULL && !check_p256_point(in))
if (in != NULL &&
(!check_p256_point(in) ||
!_cpri__EccIsPointOnCurve(curve_id, in)))
return CRYPT_POINT;
if (n2 != NULL && !check_p256_param(n2))
return CRYPT_PARAMETER;