diff options
| author | Ankur Tyagi <ankur.tyagi85@gmail.com> | 2026-04-30 23:46:41 +1200 |
|---|---|---|
| committer | Anuj Mittal <anuj.mittal@oss.qualcomm.com> | 2026-05-08 07:27:43 +0530 |
| commit | 6ed3dfda05118dcdca1497754e0e24f8c8bdb50e (patch) | |
| tree | 3dccd224aea69b07a0874a0e7be64c1a4ecc74ef /meta-networking | |
| parent | 657e8af9b5ee7cfdda9f87b770941561e81f227a (diff) | |
| download | meta-openembedded-6ed3dfda05118dcdca1497754e0e24f8c8bdb50e.tar.gz | |
wolfssl: patch CVE-2026-3580
Backport commit from the PR[1] mentioned in the nvd[2]
[1]https://github.com/wolfSSL/wolfssl/pull/9855
[2]https://nvd.nist.gov/vuln/detail/CVE-2026-3580
Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
Diffstat (limited to 'meta-networking')
| -rw-r--r-- | meta-networking/recipes-connectivity/wolfssl/files/CVE-2026-3580.patch | 425 | ||||
| -rw-r--r-- | meta-networking/recipes-connectivity/wolfssl/wolfssl_5.8.0.bb | 1 |
2 files changed, 426 insertions, 0 deletions
diff --git a/meta-networking/recipes-connectivity/wolfssl/files/CVE-2026-3580.patch b/meta-networking/recipes-connectivity/wolfssl/files/CVE-2026-3580.patch new file mode 100644 index 0000000000..245ed606d2 --- /dev/null +++ b/meta-networking/recipes-connectivity/wolfssl/files/CVE-2026-3580.patch | |||
| @@ -0,0 +1,425 @@ | |||
| 1 | From 2741f67d1cd56887991fc09d6dccc9b25b3ed79b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Sean Parkinson <sean@wolfssl.com> | ||
| 3 | Date: Tue, 3 Mar 2026 23:18:52 +1000 | ||
| 4 | Subject: [PATCH] RISC-V 32 no mul SP C: implement multiplication | ||
| 5 | |||
| 6 | No multiplication instructions when M extension not included. | ||
| 7 | Standard implementation of __muldi3 is not constant time. | ||
| 8 | Include a constant time implementation when SP_NO_MUL_INSTRUCTION is | ||
| 9 | defined | ||
| 10 | Define it when compiling for RISC-V 32 and no multiplication extension. | ||
| 11 | |||
| 12 | Also fix get_entry in SP C implementation to do constant time | ||
| 13 | comparison. | ||
| 14 | |||
| 15 | (cherry picked from commit 71226b68b69404206c74694715f11bb6630750dc) | ||
| 16 | |||
| 17 | CVE: CVE-2026-3580 | ||
| 18 | Upstream-Status: Backport [https://github.com/wolfSSL/wolfssl/commit/71226b68b69404206c74694715f11bb6630750dc] | ||
| 19 | Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com> | ||
| 20 | --- | ||
| 21 | .wolfssl_known_macro_extras | 1 + | ||
| 22 | wolfcrypt/src/sp_arm32.c | 24 +++++++--- | ||
| 23 | wolfcrypt/src/sp_armthumb.c | 24 +++++++--- | ||
| 24 | wolfcrypt/src/sp_c32.c | 77 +++++++++++++++++++++++++++++++-- | ||
| 25 | wolfcrypt/src/sp_c64.c | 12 +++-- | ||
| 26 | wolfcrypt/src/sp_cortexm.c | 24 +++++++--- | ||
| 27 | wolfcrypt/src/sp_x86_64_asm.asm | 2 +- | ||
| 28 | wolfssl/wolfcrypt/sp.h | 4 ++ | ||
| 29 | 8 files changed, 143 insertions(+), 25 deletions(-) | ||
| 30 | |||
| 31 | diff --git a/.wolfssl_known_macro_extras b/.wolfssl_known_macro_extras | ||
| 32 | index 3e728fa5f..301b1a211 100644 | ||
| 33 | --- a/.wolfssl_known_macro_extras | ||
| 34 | +++ b/.wolfssl_known_macro_extras | ||
| 35 | @@ -1000,6 +1000,7 @@ __must_check | ||
| 36 | __ppc64__ | ||
| 37 | __ppc__ | ||
| 38 | __riscv | ||
| 39 | +__riscv_mul | ||
| 40 | __riscv_xlen | ||
| 41 | __s390x__ | ||
| 42 | __sparc | ||
| 43 | diff --git a/wolfcrypt/src/sp_arm32.c b/wolfcrypt/src/sp_arm32.c | ||
| 44 | index a70eb35eb..ed8cd0296 100644 | ||
| 45 | --- a/wolfcrypt/src/sp_arm32.c | ||
| 46 | +++ b/wolfcrypt/src/sp_arm32.c | ||
| 47 | @@ -75850,7 +75850,9 @@ static void sp_256_get_entry_16_8(sp_point_256* r, | ||
| 48 | r->y[6] = 0; | ||
| 49 | r->y[7] = 0; | ||
| 50 | for (i = 1; i < 16; i++) { | ||
| 51 | - mask = (sp_digit)0 - (i == idx); | ||
| 52 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 53 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 54 | + mask = gte & lte; | ||
| 55 | r->x[0] |= mask & table[i].x[0]; | ||
| 56 | r->x[1] |= mask & table[i].x[1]; | ||
| 57 | r->x[2] |= mask & table[i].x[2]; | ||
| 58 | @@ -76271,7 +76273,9 @@ static void sp_256_get_entry_256_8(sp_point_256* r, | ||
| 59 | r->y[6] = 0; | ||
| 60 | r->y[7] = 0; | ||
| 61 | for (i = 1; i < 256; i++) { | ||
| 62 | - mask = (sp_digit)0 - (i == idx); | ||
| 63 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 64 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 65 | + mask = gte & lte; | ||
| 66 | r->x[0] |= mask & table[i].x[0]; | ||
| 67 | r->x[1] |= mask & table[i].x[1]; | ||
| 68 | r->x[2] |= mask & table[i].x[2]; | ||
| 69 | @@ -93989,7 +93993,9 @@ static void sp_384_get_entry_16_12(sp_point_384* r, | ||
| 70 | r->y[10] = 0; | ||
| 71 | r->y[11] = 0; | ||
| 72 | for (i = 1; i < 16; i++) { | ||
| 73 | - mask = (sp_digit)0 - (i == idx); | ||
| 74 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 75 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 76 | + mask = gte & lte; | ||
| 77 | r->x[0] |= mask & table[i].x[0]; | ||
| 78 | r->x[1] |= mask & table[i].x[1]; | ||
| 79 | r->x[2] |= mask & table[i].x[2]; | ||
| 80 | @@ -94426,7 +94432,9 @@ static void sp_384_get_entry_256_12(sp_point_384* r, | ||
| 81 | r->y[10] = 0; | ||
| 82 | r->y[11] = 0; | ||
| 83 | for (i = 1; i < 256; i++) { | ||
| 84 | - mask = (sp_digit)0 - (i == idx); | ||
| 85 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 86 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 87 | + mask = gte & lte; | ||
| 88 | r->x[0] |= mask & table[i].x[0]; | ||
| 89 | r->x[1] |= mask & table[i].x[1]; | ||
| 90 | r->x[2] |= mask & table[i].x[2]; | ||
| 91 | @@ -121504,7 +121512,9 @@ static void sp_521_get_entry_16_17(sp_point_521* r, | ||
| 92 | r->y[15] = 0; | ||
| 93 | r->y[16] = 0; | ||
| 94 | for (i = 1; i < 16; i++) { | ||
| 95 | - mask = (sp_digit)0 - (i == idx); | ||
| 96 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 97 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 98 | + mask = gte & lte; | ||
| 99 | r->x[0] |= mask & table[i].x[0]; | ||
| 100 | r->x[1] |= mask & table[i].x[1]; | ||
| 101 | r->x[2] |= mask & table[i].x[2]; | ||
| 102 | @@ -121961,7 +121971,9 @@ static void sp_521_get_entry_256_17(sp_point_521* r, | ||
| 103 | r->y[15] = 0; | ||
| 104 | r->y[16] = 0; | ||
| 105 | for (i = 1; i < 256; i++) { | ||
| 106 | - mask = (sp_digit)0 - (i == idx); | ||
| 107 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 108 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 109 | + mask = gte & lte; | ||
| 110 | r->x[0] |= mask & table[i].x[0]; | ||
| 111 | r->x[1] |= mask & table[i].x[1]; | ||
| 112 | r->x[2] |= mask & table[i].x[2]; | ||
| 113 | diff --git a/wolfcrypt/src/sp_armthumb.c b/wolfcrypt/src/sp_armthumb.c | ||
| 114 | index 4868f7f93..0f112aaef 100644 | ||
| 115 | --- a/wolfcrypt/src/sp_armthumb.c | ||
| 116 | +++ b/wolfcrypt/src/sp_armthumb.c | ||
| 117 | @@ -101420,7 +101420,9 @@ static void sp_256_get_entry_16_8(sp_point_256* r, | ||
| 118 | r->y[6] = 0; | ||
| 119 | r->y[7] = 0; | ||
| 120 | for (i = 1; i < 16; i++) { | ||
| 121 | - mask = (sp_digit)0 - (i == idx); | ||
| 122 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 123 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 124 | + mask = gte & lte; | ||
| 125 | r->x[0] |= mask & table[i].x[0]; | ||
| 126 | r->x[1] |= mask & table[i].x[1]; | ||
| 127 | r->x[2] |= mask & table[i].x[2]; | ||
| 128 | @@ -101841,7 +101843,9 @@ static void sp_256_get_entry_256_8(sp_point_256* r, | ||
| 129 | r->y[6] = 0; | ||
| 130 | r->y[7] = 0; | ||
| 131 | for (i = 1; i < 256; i++) { | ||
| 132 | - mask = (sp_digit)0 - (i == idx); | ||
| 133 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 134 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 135 | + mask = gte & lte; | ||
| 136 | r->x[0] |= mask & table[i].x[0]; | ||
| 137 | r->x[1] |= mask & table[i].x[1]; | ||
| 138 | r->x[2] |= mask & table[i].x[2]; | ||
| 139 | @@ -112269,7 +112273,9 @@ static void sp_384_get_entry_16_12(sp_point_384* r, | ||
| 140 | r->y[10] = 0; | ||
| 141 | r->y[11] = 0; | ||
| 142 | for (i = 1; i < 16; i++) { | ||
| 143 | - mask = (sp_digit)0 - (i == idx); | ||
| 144 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 145 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 146 | + mask = gte & lte; | ||
| 147 | r->x[0] |= mask & table[i].x[0]; | ||
| 148 | r->x[1] |= mask & table[i].x[1]; | ||
| 149 | r->x[2] |= mask & table[i].x[2]; | ||
| 150 | @@ -112706,7 +112712,9 @@ static void sp_384_get_entry_256_12(sp_point_384* r, | ||
| 151 | r->y[10] = 0; | ||
| 152 | r->y[11] = 0; | ||
| 153 | for (i = 1; i < 256; i++) { | ||
| 154 | - mask = (sp_digit)0 - (i == idx); | ||
| 155 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 156 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 157 | + mask = gte & lte; | ||
| 158 | r->x[0] |= mask & table[i].x[0]; | ||
| 159 | r->x[1] |= mask & table[i].x[1]; | ||
| 160 | r->x[2] |= mask & table[i].x[2]; | ||
| 161 | @@ -125892,7 +125900,9 @@ static void sp_521_get_entry_16_17(sp_point_521* r, | ||
| 162 | r->y[15] = 0; | ||
| 163 | r->y[16] = 0; | ||
| 164 | for (i = 1; i < 16; i++) { | ||
| 165 | - mask = (sp_digit)0 - (i == idx); | ||
| 166 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 167 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 168 | + mask = gte & lte; | ||
| 169 | r->x[0] |= mask & table[i].x[0]; | ||
| 170 | r->x[1] |= mask & table[i].x[1]; | ||
| 171 | r->x[2] |= mask & table[i].x[2]; | ||
| 172 | @@ -126349,7 +126359,9 @@ static void sp_521_get_entry_256_17(sp_point_521* r, | ||
| 173 | r->y[15] = 0; | ||
| 174 | r->y[16] = 0; | ||
| 175 | for (i = 1; i < 256; i++) { | ||
| 176 | - mask = (sp_digit)0 - (i == idx); | ||
| 177 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 178 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 179 | + mask = gte & lte; | ||
| 180 | r->x[0] |= mask & table[i].x[0]; | ||
| 181 | r->x[1] |= mask & table[i].x[1]; | ||
| 182 | r->x[2] |= mask & table[i].x[2]; | ||
| 183 | diff --git a/wolfcrypt/src/sp_c32.c b/wolfcrypt/src/sp_c32.c | ||
| 184 | index 10d646a81..13e3abe00 100644 | ||
| 185 | --- a/wolfcrypt/src/sp_c32.c | ||
| 186 | +++ b/wolfcrypt/src/sp_c32.c | ||
| 187 | @@ -63,6 +63,71 @@ | ||
| 188 | |||
| 189 | #ifndef WOLFSSL_SP_ASM | ||
| 190 | #if SP_WORD_SIZE == 32 | ||
| 191 | +#ifdef SP_NO_MUL_INSTRUCTION | ||
| 192 | +sp_uint64 __muldi3(sp_uint64 a, sp_uint64 b); | ||
| 193 | +sp_uint64 __muldi3(sp_uint64 a, sp_uint64 b) | ||
| 194 | +{ | ||
| 195 | + sp_uint64 r; | ||
| 196 | + sp_uint64 am[16]; | ||
| 197 | + | ||
| 198 | + /* if b is negative, convert it to positive and negate a. */ | ||
| 199 | + r = 0 - (b >> 63); | ||
| 200 | + a = a ^ r; | ||
| 201 | + b = b ^ r; | ||
| 202 | + a -= r; | ||
| 203 | + b -= r; | ||
| 204 | + | ||
| 205 | +#if defined(WOLFSSL_SP_SMALL) | ||
| 206 | + int i; | ||
| 207 | + | ||
| 208 | + am[0] = 0; | ||
| 209 | + for (i = 1; i < 16; i++) { | ||
| 210 | + am[i] = am[i-1] + a; | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + r = am[(b >> 28) & 0xf]; | ||
| 214 | + for (i = 24; i >= 0; i -= 4) { | ||
| 215 | + r <<= 4; | ||
| 216 | + r += am[(b >> i) & 0xf]; | ||
| 217 | + } | ||
| 218 | +#else | ||
| 219 | + am[ 0] = 0; | ||
| 220 | + am[ 1] = a; | ||
| 221 | + am[ 2] = a << 1; | ||
| 222 | + am[ 3] = am[ 2] + a; | ||
| 223 | + am[ 4] = a << 2; | ||
| 224 | + am[ 5] = am[ 4] + a; | ||
| 225 | + am[ 6] = am[ 5] + a; | ||
| 226 | + am[ 7] = am[ 6] + a; | ||
| 227 | + am[ 8] = a << 3; | ||
| 228 | + am[ 9] = am[ 8] + a; | ||
| 229 | + am[10] = am[ 9] + a; | ||
| 230 | + am[11] = am[10] + a; | ||
| 231 | + am[12] = am[11] + a; | ||
| 232 | + am[13] = am[12] + a; | ||
| 233 | + am[14] = am[13] + a; | ||
| 234 | + am[15] = am[14] + a; | ||
| 235 | + | ||
| 236 | + r = am[(b >> 28) & 0xf]; | ||
| 237 | + r <<= 4; | ||
| 238 | + r += am[(b >> 24) & 0xf]; | ||
| 239 | + r <<= 4; | ||
| 240 | + r += am[(b >> 20) & 0xf]; | ||
| 241 | + r <<= 4; | ||
| 242 | + r += am[(b >> 16) & 0xf]; | ||
| 243 | + r <<= 4; | ||
| 244 | + r += am[(b >> 12) & 0xf]; | ||
| 245 | + r <<= 4; | ||
| 246 | + r += am[(b >> 8) & 0xf]; | ||
| 247 | + r <<= 4; | ||
| 248 | + r += am[(b >> 4) & 0xf]; | ||
| 249 | + r <<= 4; | ||
| 250 | + r += am[(b >> 0) & 0xf]; | ||
| 251 | +#endif | ||
| 252 | + | ||
| 253 | + return r; | ||
| 254 | +} | ||
| 255 | +#endif /* SP_NO_MUL_INSTRUCTION */ | ||
| 256 | #define SP_PRINT_NUM(var, name, total, words, bits) \ | ||
| 257 | do { \ | ||
| 258 | int ii; \ | ||
| 259 | @@ -22891,7 +22956,9 @@ static void sp_256_get_entry_256_9(sp_point_256* r, | ||
| 260 | r->y[7] = 0; | ||
| 261 | r->y[8] = 0; | ||
| 262 | for (i = 1; i < 256; i++) { | ||
| 263 | - mask = (sp_digit)0 - (i == idx); | ||
| 264 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 265 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 266 | + mask = gte & lte; | ||
| 267 | r->x[0] |= mask & table[i].x[0]; | ||
| 268 | r->x[1] |= mask & table[i].x[1]; | ||
| 269 | r->x[2] |= mask & table[i].x[2]; | ||
| 270 | @@ -30408,7 +30475,9 @@ static void sp_384_get_entry_256_15(sp_point_384* r, | ||
| 271 | r->y[13] = 0; | ||
| 272 | r->y[14] = 0; | ||
| 273 | for (i = 1; i < 256; i++) { | ||
| 274 | - mask = (sp_digit)0 - (i == idx); | ||
| 275 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 276 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 277 | + mask = gte & lte; | ||
| 278 | r->x[0] |= mask & table[i].x[0]; | ||
| 279 | r->x[1] |= mask & table[i].x[1]; | ||
| 280 | r->x[2] |= mask & table[i].x[2]; | ||
| 281 | @@ -37975,7 +38044,9 @@ static void sp_521_get_entry_256_21(sp_point_521* r, | ||
| 282 | r->y[19] = 0; | ||
| 283 | r->y[20] = 0; | ||
| 284 | for (i = 1; i < 256; i++) { | ||
| 285 | - mask = (sp_digit)0 - (i == idx); | ||
| 286 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 287 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 288 | + mask = gte & lte; | ||
| 289 | r->x[0] |= mask & table[i].x[0]; | ||
| 290 | r->x[1] |= mask & table[i].x[1]; | ||
| 291 | r->x[2] |= mask & table[i].x[2]; | ||
| 292 | diff --git a/wolfcrypt/src/sp_c64.c b/wolfcrypt/src/sp_c64.c | ||
| 293 | index 06dc0bd69..66397f64f 100644 | ||
| 294 | --- a/wolfcrypt/src/sp_c64.c | ||
| 295 | +++ b/wolfcrypt/src/sp_c64.c | ||
| 296 | @@ -23795,7 +23795,9 @@ static void sp_256_get_entry_256_5(sp_point_256* r, | ||
| 297 | r->y[3] = 0; | ||
| 298 | r->y[4] = 0; | ||
| 299 | for (i = 1; i < 256; i++) { | ||
| 300 | - mask = (sp_digit)0 - (i == idx); | ||
| 301 | + sp_digit gte = (sp_digit)((((sp_uint64)i - (sp_uint64)idx) >> 63) - 1); | ||
| 302 | + sp_digit lte = (sp_digit)((((sp_uint64)idx - (sp_uint64)i) >> 63) - 1); | ||
| 303 | + mask = gte & lte; | ||
| 304 | r->x[0] |= mask & table[i].x[0]; | ||
| 305 | r->x[1] |= mask & table[i].x[1]; | ||
| 306 | r->x[2] |= mask & table[i].x[2]; | ||
| 307 | @@ -30747,7 +30749,9 @@ static void sp_384_get_entry_256_7(sp_point_384* r, | ||
| 308 | r->y[5] = 0; | ||
| 309 | r->y[6] = 0; | ||
| 310 | for (i = 1; i < 256; i++) { | ||
| 311 | - mask = (sp_digit)0 - (i == idx); | ||
| 312 | + sp_digit gte = (sp_digit)((((sp_uint64)i - (sp_uint64)idx) >> 63) - 1); | ||
| 313 | + sp_digit lte = (sp_digit)((((sp_uint64)idx - (sp_uint64)i) >> 63) - 1); | ||
| 314 | + mask = gte & lte; | ||
| 315 | r->x[0] |= mask & table[i].x[0]; | ||
| 316 | r->x[1] |= mask & table[i].x[1]; | ||
| 317 | r->x[2] |= mask & table[i].x[2]; | ||
| 318 | @@ -38160,7 +38164,9 @@ static void sp_521_get_entry_256_9(sp_point_521* r, | ||
| 319 | r->y[7] = 0; | ||
| 320 | r->y[8] = 0; | ||
| 321 | for (i = 1; i < 256; i++) { | ||
| 322 | - mask = (sp_digit)0 - (i == idx); | ||
| 323 | + sp_digit gte = (sp_digit)((((sp_uint64)i - (sp_uint64)idx) >> 63) - 1); | ||
| 324 | + sp_digit lte = (sp_digit)((((sp_uint64)idx - (sp_uint64)i) >> 63) - 1); | ||
| 325 | + mask = gte & lte; | ||
| 326 | r->x[0] |= mask & table[i].x[0]; | ||
| 327 | r->x[1] |= mask & table[i].x[1]; | ||
| 328 | r->x[2] |= mask & table[i].x[2]; | ||
| 329 | diff --git a/wolfcrypt/src/sp_cortexm.c b/wolfcrypt/src/sp_cortexm.c | ||
| 330 | index fc756ffbe..d4af12332 100644 | ||
| 331 | --- a/wolfcrypt/src/sp_cortexm.c | ||
| 332 | +++ b/wolfcrypt/src/sp_cortexm.c | ||
| 333 | @@ -37267,7 +37267,9 @@ static void sp_256_get_entry_16_8(sp_point_256* r, | ||
| 334 | r->y[6] = 0; | ||
| 335 | r->y[7] = 0; | ||
| 336 | for (i = 1; i < 16; i++) { | ||
| 337 | - mask = (sp_digit)0 - (i == idx); | ||
| 338 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 339 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 340 | + mask = gte & lte; | ||
| 341 | r->x[0] |= mask & table[i].x[0]; | ||
| 342 | r->x[1] |= mask & table[i].x[1]; | ||
| 343 | r->x[2] |= mask & table[i].x[2]; | ||
| 344 | @@ -37688,7 +37690,9 @@ static void sp_256_get_entry_256_8(sp_point_256* r, | ||
| 345 | r->y[6] = 0; | ||
| 346 | r->y[7] = 0; | ||
| 347 | for (i = 1; i < 256; i++) { | ||
| 348 | - mask = (sp_digit)0 - (i == idx); | ||
| 349 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 350 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 351 | + mask = gte & lte; | ||
| 352 | r->x[0] |= mask & table[i].x[0]; | ||
| 353 | r->x[1] |= mask & table[i].x[1]; | ||
| 354 | r->x[2] |= mask & table[i].x[2]; | ||
| 355 | @@ -47354,7 +47358,9 @@ static void sp_384_get_entry_16_12(sp_point_384* r, | ||
| 356 | r->y[10] = 0; | ||
| 357 | r->y[11] = 0; | ||
| 358 | for (i = 1; i < 16; i++) { | ||
| 359 | - mask = (sp_digit)0 - (i == idx); | ||
| 360 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 361 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 362 | + mask = gte & lte; | ||
| 363 | r->x[0] |= mask & table[i].x[0]; | ||
| 364 | r->x[1] |= mask & table[i].x[1]; | ||
| 365 | r->x[2] |= mask & table[i].x[2]; | ||
| 366 | @@ -47791,7 +47797,9 @@ static void sp_384_get_entry_256_12(sp_point_384* r, | ||
| 367 | r->y[10] = 0; | ||
| 368 | r->y[11] = 0; | ||
| 369 | for (i = 1; i < 256; i++) { | ||
| 370 | - mask = (sp_digit)0 - (i == idx); | ||
| 371 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 372 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 373 | + mask = gte & lte; | ||
| 374 | r->x[0] |= mask & table[i].x[0]; | ||
| 375 | r->x[1] |= mask & table[i].x[1]; | ||
| 376 | r->x[2] |= mask & table[i].x[2]; | ||
| 377 | @@ -59584,7 +59592,9 @@ static void sp_521_get_entry_16_17(sp_point_521* r, | ||
| 378 | r->y[15] = 0; | ||
| 379 | r->y[16] = 0; | ||
| 380 | for (i = 1; i < 16; i++) { | ||
| 381 | - mask = (sp_digit)0 - (i == idx); | ||
| 382 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 383 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 384 | + mask = gte & lte; | ||
| 385 | r->x[0] |= mask & table[i].x[0]; | ||
| 386 | r->x[1] |= mask & table[i].x[1]; | ||
| 387 | r->x[2] |= mask & table[i].x[2]; | ||
| 388 | @@ -60041,7 +60051,9 @@ static void sp_521_get_entry_256_17(sp_point_521* r, | ||
| 389 | r->y[15] = 0; | ||
| 390 | r->y[16] = 0; | ||
| 391 | for (i = 1; i < 256; i++) { | ||
| 392 | - mask = (sp_digit)0 - (i == idx); | ||
| 393 | + sp_digit gte = (sp_digit)((((sp_uint32)i - (sp_uint32)idx) >> 31) - 1); | ||
| 394 | + sp_digit lte = (sp_digit)((((sp_uint32)idx - (sp_uint32)i) >> 31) - 1); | ||
| 395 | + mask = gte & lte; | ||
| 396 | r->x[0] |= mask & table[i].x[0]; | ||
| 397 | r->x[1] |= mask & table[i].x[1]; | ||
| 398 | r->x[2] |= mask & table[i].x[2]; | ||
| 399 | diff --git a/wolfcrypt/src/sp_x86_64_asm.asm b/wolfcrypt/src/sp_x86_64_asm.asm | ||
| 400 | index 4df93a976..30bdc8add 100644 | ||
| 401 | --- a/wolfcrypt/src/sp_x86_64_asm.asm | ||
| 402 | +++ b/wolfcrypt/src/sp_x86_64_asm.asm | ||
| 403 | @@ -1,6 +1,6 @@ | ||
| 404 | ; /* sp_x86_64_asm.asm */ | ||
| 405 | ; /* | ||
| 406 | -; * Copyright (C) 2006-2025 wolfSSL Inc. | ||
| 407 | +; * Copyright (C) 2006-2026 wolfSSL Inc. | ||
| 408 | ; * | ||
| 409 | ; * This file is part of wolfSSL. | ||
| 410 | ; * | ||
| 411 | diff --git a/wolfssl/wolfcrypt/sp.h b/wolfssl/wolfcrypt/sp.h | ||
| 412 | index 9e7a9c945..fcfd2dd8e 100644 | ||
| 413 | --- a/wolfssl/wolfcrypt/sp.h | ||
| 414 | +++ b/wolfssl/wolfcrypt/sp.h | ||
| 415 | @@ -26,6 +26,10 @@ | ||
| 416 | #include <wolfssl/wolfcrypt/types.h> | ||
| 417 | #include <wolfssl/wolfcrypt/settings.h> | ||
| 418 | |||
| 419 | +#if defined(__riscv) && (__riscv_xlen == 32) && !defined(__riscv_mul) | ||
| 420 | + #define SP_NO_MUL_INSTRUCTION | ||
| 421 | +#endif | ||
| 422 | + | ||
| 423 | #if defined(WOLFSSL_HAVE_SP_RSA) || defined(WOLFSSL_HAVE_SP_DH) || \ | ||
| 424 | defined(WOLFSSL_HAVE_SP_ECC) | ||
| 425 | #ifdef _WIN32_WCE | ||
diff --git a/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.8.0.bb b/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.8.0.bb index e1147a8028..69ad34dc2f 100644 --- a/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.8.0.bb +++ b/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.8.0.bb | |||
| @@ -38,6 +38,7 @@ SRC_URI = " \ | |||
| 38 | file://CVE-2026-4159.patch \ | 38 | file://CVE-2026-4159.patch \ |
| 39 | file://CVE-2026-4395.patch \ | 39 | file://CVE-2026-4395.patch \ |
| 40 | file://CVE-2026-1005.patch \ | 40 | file://CVE-2026-1005.patch \ |
| 41 | file://CVE-2026-3580.patch \ | ||
| 41 | " | 42 | " |
| 42 | 43 | ||
| 43 | SRCREV = "b077c81eb635392e694ccedbab8b644297ec0285" | 44 | SRCREV = "b077c81eb635392e694ccedbab8b644297ec0285" |
