mirror of
https://github.com/stefanberger/libtpms
synced 2025-08-25 01:41:06 +00:00
tpm2: Check return code of BN_div()
Check the return code of BN_div() when calculating Q and Qr of a private key. Resolves: https://github.com/stefanberger/libtpms/issues/304 Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
7a64b3e41e
commit
8590849b65
@ -521,8 +521,7 @@ InitOpenSSLRSAPrivateKey(OBJECT *rsaKey, // IN
|
||||
ERROR_RETURN(TPM_RC_FAILURE);
|
||||
/* Q = N/P; no remainder */
|
||||
BN_set_flags(P, BN_FLG_CONSTTIME); // P is secret
|
||||
BN_div(Q, Qr, N, P, ctx);
|
||||
if(!BN_is_zero(Qr))
|
||||
if (!BN_div(Q, Qr, N, P, ctx) || !BN_is_zero(Qr))
|
||||
ERROR_RETURN(TPM_RC_BINDING);
|
||||
BN_set_flags(Q, BN_FLG_CONSTTIME); // Q is secret
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user