Skip to content

Commit 5c21551

Browse files
authored
Merge pull request #8816 from philljj/crypto_sig_sign_ret_value
linuxkm rsa: fix ret value usage for crypto_sig_sign.
2 parents 9bd5834 + 0b64a55 commit 5c21551

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

linuxkm/lkcapi_rsa_glue.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,13 @@ static int km_pkcs1_sign(struct crypto_sig *tfm,
13641364
goto pkcs1_sign_out;
13651365
}
13661366

1367+
/* in 6.15 crypto_sig_sign switched from returning 0 on success to
1368+
* returning sig_len. */
1369+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
13671370
err = sig_len;
1371+
#else
1372+
err = 0;
1373+
#endif /* linux >= 6.15.0 */
13681374
pkcs1_sign_out:
13691375
if (msg != NULL) { free(msg); msg = NULL; }
13701376

@@ -3107,12 +3113,16 @@ static int linuxkm_test_pkcs1_driver(const char * driver, int nbits,
31073113
goto test_pkcs1_end;
31083114
}
31093115

3116+
/* in 6.15 crypto_sig_sign switched from returning 0 on success to
3117+
* returning sig_len. */
3118+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
31103119
if ((word32) ret != sig_len) {
31113120
pr_err("error: crypto_sig_sign returned %d, expected %d\n", ret,
31123121
sig_len);
31133122
test_rc = BAD_FUNC_ARG;
31143123
goto test_pkcs1_end;
31153124
}
3125+
#endif /* linux >= 6.15.0 */
31163126

31173127
n_diff = memcmp(km_sig, sig, sig_len);
31183128
if (n_diff) {

0 commit comments

Comments
 (0)