mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-05 13:40:49 +02:00
Merge pull request #10812 from douzzer/20260629-linuxkm-fixes
20260629-linuxkm-fixes
This commit is contained in:
@@ -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; \
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user