Skip to content

Commit

Permalink
check if rsa primes and precomputed values exists
Browse files Browse the repository at this point in the history
  • Loading branch information
qmuntal committed Sep 4, 2024
1 parent ef0d391 commit 554252b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions rsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,16 @@ func newRSAKey3(isPriv bool, N, E, D, P, Q, Dp, Dq, Qinv BigInt) (C.GO_EVP_PKEY_
// P and Q are present. See:
// https://github.com/openssl/openssl/pull/22334
if vMinor >= 2 || (P != nil && Q != nil && Dp != nil && Dq != nil && Qinv != nil) {
precomputed := [...]bigIntParam{
{paramRSA_P, P}, {paramRSA_Q, Q},
{paramRSA_Dp, Dp}, {paramRSA_Dq, Dq}, {paramRSA_Qinv, Qinv},
if P != nil && Q != nil {
comps = append(comps, bigIntParam{paramRSA_P, P}, bigIntParam{paramRSA_Q, Q})
}
if Dp != nil && Dq != nil && Qinv != nil {
comps = append(comps,
bigIntParam{paramRSA_Dp, Dp},
bigIntParam{paramRSA_Dq, Dq},
bigIntParam{paramRSA_Qinv, Qinv},
)
}
comps = append(comps, precomputed[:]...)
}

for _, comp := range comps {
Expand Down

0 comments on commit 554252b

Please sign in to comment.