Skip to content

Commit e4dc17a

Browse files
authored
Merge pull request #77 from ColtonWilley/wp_rsa_import_fix
Fix RSA import use case for python
2 parents 5eeba61 + 512f50f commit e4dc17a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/wp_rsa_kmgmt.c

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

964+
static int wp_params_count(const OSSL_PARAM *p)
965+
{
966+
int cnt = 0;
967+
while ((p != NULL) && (p->key != NULL)) {
968+
cnt++;
969+
p++;
970+
}
971+
return cnt;
972+
}
973+
964974
/**
965975
* Import the key data into RSA key object from parameters.
966976
*
@@ -977,7 +987,7 @@ static int wp_rsa_import_key_data(wp_Rsa* rsa, const OSSL_PARAM params[],
977987
int i;
978988
int cnt;
979989

980-
if (priv) {
990+
if (priv && (wp_params_count(params) > 2)) {
981991
cnt = WP_RSA_PARAM_NUMS_CNT;
982992
}
983993
else {

0 commit comments

Comments
 (0)