mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
CR50: set result size in _cpri__GenerateKeyEcc, _cpri__GetEphemeralEcc
_cpri__GenerateKeyEcc, and _cpri__GetEphemeralEcc are expected to set the size of the result in accordance with the curve being used. BRANCH=none BUG=chrome-os-partner:43025,chrome-os-partner:47524 TEST=tests in test/tpm/tpmtest.py, test CPCTPM_TC2_2_14_02_05 passes Change-Id: I558cc56f689c2d33c12876ddbfde7e9659613d2c Signed-off-by: nagendra modadugu <ngm@google.com> Reviewed-on: https://chromium-review.googlesource.com/331210 Commit-Ready: Nagendra Modadugu <ngm@google.com> Tested-by: Nagendra Modadugu <ngm@google.com> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
86d94fa3b5
commit
6e0309ffa9
@@ -114,8 +114,12 @@ CRYPT_RESULT _cpri__GenerateKeyEcc(
|
||||
if (DCRYPTO_p256_key_from_bytes(
|
||||
(p256_int *) q->x.b.buffer,
|
||||
(p256_int *) q->y.b.buffer,
|
||||
(p256_int *) d->b.buffer, key_bytes))
|
||||
(p256_int *) d->b.buffer, key_bytes)) {
|
||||
q->x.b.size = sizeof(p256_int);
|
||||
q->y.b.size = sizeof(p256_int);
|
||||
d->b.size = sizeof(p256_int);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
@@ -203,10 +207,14 @@ CRYPT_RESULT _cpri__GetEphemeralEcc(TPMS_ECC_POINT *q, TPM2B_ECC_PARAMETER *d,
|
||||
if (DCRYPTO_p256_key_from_bytes((p256_int *) q->x.b.buffer,
|
||||
(p256_int *) q->y.b.buffer,
|
||||
(p256_int *) d->b.buffer,
|
||||
key_bytes))
|
||||
key_bytes)) {
|
||||
q->x.b.size = sizeof(p256_int);
|
||||
q->y.b.size = sizeof(p256_int);
|
||||
d->b.size = sizeof(p256_int);
|
||||
return CRYPT_SUCCESS;
|
||||
else
|
||||
} else {
|
||||
return CRYPT_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CRYPTO_TEST_SETUP
|
||||
|
||||
Reference in New Issue
Block a user