Skip to content

Commit 05b3651

Browse files
committed
Fix RSA import use case for python
1 parent 5e3c051 commit 05b3651

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/wp_rsa_kmgmt.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,15 @@ static int wp_rsa_validate(const wp_Rsa* rsa, int selection, int checkType)
961961
return ok;
962962
}
963963

964+
static int numParams(const OSSL_PARAM *p) {
965+
int cnt = 0;
966+
while(p && p->key != NULL) {
967+
cnt++;
968+
p++;
969+
}
970+
return cnt;
971+
}
972+
964973
/**
965974
* Import the key data into RSA key object from parameters.
966975
*
@@ -977,7 +986,7 @@ static int wp_rsa_import_key_data(wp_Rsa* rsa, const OSSL_PARAM params[],
977986
int i;
978987
int cnt;
979988

980-
if (priv) {
989+
if (priv && (numParams(params) > 2)) {
981990
cnt = WP_RSA_PARAM_NUMS_CNT;
982991
}
983992
else {

0 commit comments

Comments
 (0)