[openssl/openssl] 6174c7: include/internal/safe_math.h: extend the domain of...

0 views
Skip to first unread message

esyr

unread,
1:27 PM (9 hours ago) 1:27 PM
to openssl...@openssl.org
Branch: refs/heads/openssl-3.5
Home: https://github.openssl.org/openssl/openssl
Commit: 6174c73cbe4e695d85ece5854ea2e7a9f1967961
https://github.openssl.org/openssl/openssl/commit/6174c73cbe4e695d85ece5854ea2e7a9f1967961
Author: Paul Dale <paul...@oracle.com>
Date: 2026-11-24 (Tue, 24 Nov 2026)

Changed paths:
M include/internal/safe_math.h

Log Message:
-----------
include/internal/safe_math.h: extend the domain of safe fused multiply and divide

Keep the direct multiplication fast path and use binary addition of
quotient/remainder pairs when the product does not fit. Store signed
magnitudes as negative values so that the minimum value is supported
without a wider integer type.

Fixes: b037e3637a49 "header: add integer overflow helper functions"
Assisted-by: ChatGPT:gpt-6-Sol
Reviewed-by: Eugene Syromiatnikov <es...@openssl.org>
Reviewed-by: Neil Horman <nho...@openssl.org>
Merge-date: Tue Nov 24 18:13:13 2026
Merged-from: https://github.com/openssl/openssl/pull/33917
(cherry picked from commit 84782b18e404e4970df7afe045077a2e9436680c)


Commit: 2190a6eb4c2d56bc20795ff8602550a2621ded0d
https://github.openssl.org/openssl/openssl/commit/2190a6eb4c2d56bc20795ff8602550a2621ded0d
Author: Paul Dale <paul...@oracle.com>
Date: 2026-11-24 (Tue, 24 Nov 2026)

Changed paths:
M test/build.info
A test/recipes/02-test_safe_math.t
M test/safe_math_test.c

Log Message:
-----------
Test the extended safe multiply and divide range

Check exact results, overflow, both operand orders and existing error
bits for signed and unsigned inputs through 64 bits. Cover products at
the signed minimum and intermediate products that do not fit.

Add a recipe that runs the safe arithmetic tests with built-in overflow
checks both enabled and disabled.

Assisted-by: ChatGPT:gpt-6-Sol
Reviewed-by: Eugene Syromiatnikov <es...@openssl.org>
Reviewed-by: Neil Horman <nho...@openssl.org>
Merge-date: Tue Nov 24 18:13:14 2026
Merged-from: https://github.com/openssl/openssl/pull/33917
(cherry picked from commit a90517c22487dec7df69aed515f5e166f4f5db32)


Commit: 233e0cde29f11b4d08a8bf2fee45be8d2f1e1f5b
https://github.openssl.org/openssl/openssl/commit/233e0cde29f11b4d08a8bf2fee45be8d2f1e1f5b
Author: Paul Dale <paul...@oracle.com>
Date: 2026-11-24 (Tue, 24 Nov 2026)

Changed paths:
M include/internal/safe_math.h

Log Message:
-----------
include/internal/safe_math.h: fix unsigned multiplication overflow results

Return the result already produced by the overflow builtin.
In the portable helper, keep the product unsigned when narrow inputs
promote to int so that an overflowing product remains defined.

Fixes: b037e3637a49 "header: add integer overflow helper functions"
Assisted-by: ChatGPT:gpt-6-Sol
Reviewed-by: Eugene Syromiatnikov <es...@openssl.org>
Reviewed-by: Neil Horman <nho...@openssl.org>
Merge-date: Tue Nov 24 18:13:15 2026
Merged-from: https://github.com/openssl/openssl/pull/33917
(cherry picked from commit 83eed255aa534700df51dadb2c5ff8677bbdd831)


Commit: edca56c0ae90d3640d5c2c217154e3c6242578c0
https://github.openssl.org/openssl/openssl/commit/edca56c0ae90d3640d5c2c217154e3c6242578c0
Author: Paul Dale <paul...@oracle.com>
Date: 2026-11-24 (Tue, 24 Nov 2026)

Changed paths:
M include/internal/safe_math.h

Log Message:
-----------
include/internal/safe_math.h: allow minimum signed products in the portable helper

Accept a negative product equal to the signed minimum when neither
factor is one. After the positive-limit check fails, equality
with the minimum quotient identifies the additional representable
product.

Fixes: b037e3637a49 "header: add integer overflow helper functions"
Link: https://github.com/openssl/openssl/pull/33891
Co-Authored-by: Juan C <juanc...@protonmail.com>
Assisted-by: ChatGPT:gpt-6-Sol
Reviewed-by: Eugene Syromiatnikov <es...@openssl.org>
Reviewed-by: Neil Horman <nho...@openssl.org>
Merge-date: Tue Nov 24 18:13:16 2026
Merged-from: https://github.com/openssl/openssl/pull/33917
(cherry picked from commit c576d35a85d9fbd8d84b9d0a0e75afd7eeb8c6b5)


Commit: 1635e7c0a487cd795cdeed476d3f8f363c5fe0e9
https://github.openssl.org/openssl/openssl/commit/1635e7c0a487cd795cdeed476d3f8f363c5fe0e9
Author: Paul Dale <paul...@oracle.com>
Date: 2026-11-24 (Tue, 24 Nov 2026)

Changed paths:
M include/internal/safe_math.h

Log Message:
-----------
include/internal/safe_math.h: fix unsigned limits for narrow integer types

Cast the complemented value back to the requested type. Otherwise,
integer promotion makes the unsigned char and short limits equal -1.

Fixes: b037e3637a49 "header: add integer overflow helper functions"
Assisted-by: ChatGPT:gpt-6-Sol
Reviewed-by: Eugene Syromiatnikov <es...@openssl.org>
Reviewed-by: Neil Horman <nho...@openssl.org>
Merge-date: Tue Nov 24 18:13:17 2026
Merged-from: https://github.com/openssl/openssl/pull/33917
(cherry picked from commit 7c3d99088bdf115cd82316a7aa322038882423f2)


Commit: e0d47fc18a6da9972d27778647526d2235ce3e5b
https://github.openssl.org/openssl/openssl/commit/e0d47fc18a6da9972d27778647526d2235ce3e5b
Author: Paul Dale <paul...@oracle.com>
Date: 2026-11-24 (Tue, 24 Nov 2026)

Changed paths:
M test/safe_math_test.c

Log Message:
-----------
test/safe_math_test.c: test general safe arithmetic boundaries

Check signed and unsigned limits and boundary operations for char
and short, including multiplication overflow and their use in fused
multiply and divide operations.

Cover signed products equal to the minimum value and products just
outside the type range.

Link: https://github.com/openssl/openssl/pull/33891
Co-Authored-by: Juan C <juanc...@protonmail.com>
Assisted-by: ChatGPT:gpt-6-Sol
Reviewed-by: Eugene Syromiatnikov <es...@openssl.org>
Reviewed-by: Neil Horman <nho...@openssl.org>
Merge-date: Tue Nov 24 18:13:18 2026
Merged-from: https://github.com/openssl/openssl/pull/33917
(cherry picked from commit 933a44fa966ddaf61a160753322e2702e25835c6)


Commit: 12a9bec2e54aff7d967a00a84bc0b0713589cb28
https://github.openssl.org/openssl/openssl/commit/12a9bec2e54aff7d967a00a84bc0b0713589cb28
Author: Pauli <paul...@oracle.com>
Date: 2026-11-24 (Tue, 24 Nov 2026)

Changed paths:
M doc/internal/man3/OSSL_SAFE_MATH_SIGNED.pod

Log Message:
-----------
doc: remove note about safe-math's muldiv being imperfect

There should be no inputs that error when they shouldn't.
The converse was and still is true.

Reviewed-by: Eugene Syromiatnikov <es...@openssl.org>
Reviewed-by: Neil Horman <nho...@openssl.org>
Merge-date: Tue Nov 24 18:13:19 2026
Merged-from: https://github.com/openssl/openssl/pull/33917
(cherry picked from commit f13c02fe2d47d063e568452a95c134aec4a2ebd9)


Compare: https://github.openssl.org/openssl/openssl/compare/2d7723cb5feb...12a9bec2e54a

To unsubscribe from these emails, change your notification settings at https://github.openssl.org/openssl/openssl/settings/notifications
Reply all
Reply to author
Forward
0 new messages