Merge pull request #10812 from douzzer/20260629-linuxkm-fixes

20260629-linuxkm-fixes
This commit is contained in:
philljj
2026-06-30 13:36:04 -05:00
committed by GitHub
4 changed files with 99 additions and 12 deletions
+1 -1
View File
@@ -2000,7 +2000,7 @@
#define WC_LINUXKM_ROUND_UP_P_OF_2(x) ( \
{ \
size_t _alloc_sz = (x); \
if ((_alloc_sz < 8192) && (_alloc_sz != 0)) \
if ((_alloc_sz < 8192) && (_alloc_sz > 1)) \
_alloc_sz = 1UL << \
((sizeof(_alloc_sz) * 8UL) - __builtin_clzl(_alloc_sz - 1)); \
_alloc_sz; \
+12
View File
@@ -1259,6 +1259,12 @@ static int km_pkcs1pad_verify(struct akcipher_request *req)
goto pkcs1pad_verify_out;
}
/* bail if the padded ASN.1-prefixed digest won't fit in the given RSA key. */
if ((word64)ctx->digest_len + (word64)hash_enc_len + RSA_MIN_PAD_SZ > ctx->key_len) {
err = -EOVERFLOW;
goto pkcs1pad_verify_out;
}
work_buffer = malloc(2 * ctx->key_len);
if (unlikely(work_buffer == NULL)) {
err = -ENOMEM;
@@ -1513,6 +1519,12 @@ static int km_pkcs1_verify(struct crypto_sig *tfm,
goto pkcs1_verify_out;
}
/* bail if the padded ASN.1-prefixed digest won't fit in the given RSA key. */
if ((word64)ctx->digest_len + (word64)hash_enc_len + RSA_MIN_PAD_SZ > ctx->key_len) {
err = -EOVERFLOW;
goto pkcs1_verify_out;
}
work_buffer = malloc(2 * ctx->key_len);
if (unlikely(work_buffer == NULL)) {
err = -ENOMEM;