[openssl/openssl] 17c4d1: Some bugfixes for OSSL_FN
"'Richard Levitte' via openssl-commits" <[email protected]> Tue, 14 Jul 2026 07:14:35 -0700
| Newsgroups | gmane.comp.encryption.openssl.cvs |
|---|---|
| Message-ID | <openssl/openssl/push/refs/heads/feature/ossl_fn/[email protected]> |
Branch: refs/heads/feature/ossl_fn
Home: https://github.com/openssl/openssl
Commit: 17c4d15971470b42a2a6bb40a5920689903af210
https://github.com/openssl/openssl/commit/17c4d15971470b42a2a6bb40a5920689903af210
Author: Igor Ustinov <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/bn/bnw_mul.c
M crypto/fn/fn_addsub.c
M crypto/fn/fn_ctx.c
M crypto/fn/fn_lib.c
M include/crypto/fn.h
M test/fn_api_test.c
M test/fn_internal_test.c
Log Message:
-----------
Some bugfixes for OSSL_FN
- Fixed the stage 2 exit criteria in OSSL_FN_add() and OSSL_FN_sub().
- Fixed the calculation of a-b when a is shorter than b and borrow==1
after stage 1.
- Added sanity check in OSSL_FN_CTX_end().
- Do not set the is_dynamically_allocated flag when getting a
new OSSL_FN from OSSL_FN_CTX.
- Added units of measurement to the error message in the OSSL_FN_copy()
function.
- is_dynamically_allocated and is_securely_allocated shouldn't be
copied in OSSL_BN_copy().
- Fixed the comment in OSSL_FN_add().
- Added a comment to bn_mul_truncated() that it is a duty of the calling
function to zero out the rest of r in case of rn>an+bn.
Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Richard Levitte <[email protected]>
MergeDate: Fri Apr 17 16:02:44 2026
(Merged from https://github.com/openssl/openssl/pull/30833)
Commit: f53cc8e2138f7197113495ff3ae7ece5a210d45e
https://github.com/openssl/openssl/commit/f53cc8e2138f7197113495ff3ae7ece5a210d45e
Author: Igor Ustinov <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/fn/fn_ctx.c
M crypto/fn/fn_mul.c
M crypto/fn/fn_sqr.c
M include/crypto/fn.h
M test/fn_internal_test.c
Log Message:
-----------
Add an ownership token for OSSL_FN_CTX frames
This prevents ending a frame that wasn't started by the caller.
Reviewed-by: Richard Levitte <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Thu Apr 30 09:18:52 2026
(Merged from https://github.com/openssl/openssl/pull/30886)
Commit: 54f13a2ef703de7ba8237cd7e084031b92ff86af
https://github.com/openssl/openssl/commit/54f13a2ef703de7ba8237cd7e084031b92ff86af
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/bn/bn_add.c
Log Message:
-----------
Use top to size BN add/sub results
Size the acquired result OSSL_FN from the significant operand limbs instead of
the allocated operand width. This keeps BN_uadd() and BN_usub() consistent
with the other wrappers that already use top for result sizing.
This follows a realization that applying OSSL_FN semantics onto BIGNUM too much
is pointless, and as demonstrated with BN_mul(), may be harmful, especially when
the result BIGNUM as the same as one of the operands.
Assisted-by: Pi:openai/gpt-5.5
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
MergeDate: Fri Jun 12 15:16:33 2026
(Merged from https://github.com/openssl/openssl/pull/31448)
Commit: f03efd47b7421004a0e0407cc890b6c0526e6c3f
https://github.com/openssl/openssl/commit/f03efd47b7421004a0e0407cc890b6c0526e6c3f
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/bn/bn_mul.c
Log Message:
-----------
Acquire BN_mul result before ctx sizing
Acquire the writable result before reading operand dmax values for the
OSSL_FN_CTX arena size. This avoids stale context sizing when the result
aliases an operand and acquisition expands that BIGNUM.
Assisted-by: Pi:openai/gpt-5.5
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
MergeDate: Fri Jun 12 15:16:34 2026
(Merged from https://github.com/openssl/openssl/pull/31448)
Commit: 76f93f270ef770c972a6f383324e800f737462fe
https://github.com/openssl/openssl/commit/76f93f270ef770c972a6f383324e800f737462fe
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/bn/bn_sqr.c
Log Message:
-----------
Acquire BN_sqr result before ctx sizing
Acquire the writable result before reading the operand dmax value for the
OSSL_FN_CTX arena size. This avoids stale context sizing when the result
aliases the operand and acquisition expands that BIGNUM.
Assisted-by: Pi:openai/gpt-5.5
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
MergeDate: Fri Jun 12 15:16:36 2026
(Merged from https://github.com/openssl/openssl/pull/31448)
Commit: 96609d570ac3bcd874db414759d0122407146bdd
https://github.com/openssl/openssl/commit/96609d570ac3bcd874db414759d0122407146bdd
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/fn/fn_local.h
M test/fn_internal_test.c
Log Message:
-----------
Add OSSL_FN_BITS, use it instead of 'OSSL_FN_BYTES * 8'
Reviewed-by: Dmitry Belyavskiy <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
MergeDate: Sun Jun 14 08:35:04 2026
(Merged from https://github.com/openssl/openssl/pull/31452)
Commit: 277448082dd25df80e86ca3197c684067d00ce9a
https://github.com/openssl/openssl/commit/277448082dd25df80e86ca3197c684067d00ce9a
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M include/crypto/fn.h
Log Message:
-----------
Document OSSL_FN_copy zero-padding of oversized destination limbs
The OSSL_FN_copy() function already zeroes any high destination limbs
beyond the source size, but this was not stated in the public header.
Add an explicit note so callers know unused high bytes are cleared.
Assisted-by: Pi:moonshotai/kimi-k2.6
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Dmitry Belyavskiy <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
MergeDate: Sun Jun 14 08:35:06 2026
(Merged from https://github.com/openssl/openssl/pull/31452)
Commit: e77ef334283482f926dad9b73b6fbdc161c565aa
https://github.com/openssl/openssl/commit/e77ef334283482f926dad9b73b6fbdc161c565aa
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/fn/fn_ctx.c
M include/crypto/fn.h
Log Message:
-----------
Add OSSL_FN_CTX_peak_usage() for arena usage instrumentation
Track the maximum number of frames, numbers and limbs ever consumed
from an OSSL_FN_CTX arena during its lifetime. This allows callers
to empirically size their contexts instead of predicting precise
max_n_frames / max_n_numbers / max_n_limbs ahead of time.
These peak usages are updated whenever a frame is started or an OSSL_FN
is obtained. They never decrease, reflecting the worst-case simultaneous
allocation across all nested frames.
Assisted-by: Pi:moonshotai/kimi-k2.6
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Sun Jun 14 08:40:38 2026
(Merged from https://github.com/openssl/openssl/pull/31431)
Commit: 3a5594d70e55c3009e82329b509261ffc880e060
https://github.com/openssl/openssl/commit/3a5594d70e55c3009e82329b509261ffc880e060
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M test/fn_internal_test.c
Log Message:
-----------
Add test for OSSL_FN_CTX_peak_usage
Verify that peak_usage starts at zero, rises after frame start and
allocation, and never decreases after a frame is ended.
Also correct misleading comments that claimed OSSL_FN_CTX_new()
takes a size in bytes -- the last parameter is actually max_n_limbs.
Assisted-by: Pi:moonshotai/kimi-k2.6
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Sun Jun 14 08:40:40 2026
(Merged from https://github.com/openssl/openssl/pull/31431)
Commit: 5678648723973482d09c5efd87f1f10c4def1319
https://github.com/openssl/openssl/commit/5678648723973482d09c5efd87f1f10c4def1319
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/fn/fn_ctx.c
M crypto/fn/fn_local.h
Log Message:
-----------
Expose OSSL_FN_CTX internals via fn_local.h
Move struct ossl_fn_ctx_st and struct ossl_fn_ctx_frame_st from
fn_ctx.c to fn_local.h, making them accessible to internal code in
the bn/ directory and elsewhere. Also expose
ossl_fn_ctx_calculate_arena_size() as an inline helper so callers
can determine the required arena size without duplicating the formula.
This is groundwork for BN_CTX integration.
Assisted-by: Pi:moonshotai/kimi-k2.6
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Sun Jun 14 08:40:42 2026
(Merged from https://github.com/openssl/openssl/pull/31431)
Commit: 0e8b647fdbe320c2ec15f2b764b66755bde2a8a0
https://github.com/openssl/openssl/commit/0e8b647fdbe320c2ec15f2b764b66755bde2a8a0
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/bn/bn_ctx.c
M include/crypto/bn.h
M test/bn_internal_test.c
Log Message:
-----------
Add OSSL_FN_CTX integration with BN_CTX
Add an OSSL_FN_CTX * pointer to struct bignum_ctx, allowing a BN_CTX
to cache an OSSL_FN_CTX for use by BIGNUM wrapper functions. The
pointer is freed automatically when BN_CTX_free() is called.
Also add bn_ctx_acquire_ossl_fn_ctx() and bn_ctx_release_ossl_fn_ctx():
- acquire creates (or reuses if large enough) an OSSL_FN_CTX inside
the BN_CTX, sizing it according to the caller's needs.
- release checks that no frames remain in the cached OSSL_FN_CTX.
The acquire function respects BN_FLG_SECURE: if the BN_CTX was created
with BN_CTX_secure_new(), the OSSL_FN_CTX is also allocated in secure
memory.
Assisted-by: Pi:moonshotai/kimi-k2.6
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Sun Jun 14 08:40:44 2026
(Merged from https://github.com/openssl/openssl/pull/31431)
Commit: ac0e2da45e40da66a23d25de5382b286738b9aa6
https://github.com/openssl/openssl/commit/ac0e2da45e40da66a23d25de5382b286738b9aa6
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/bn/bn_mul.c
M crypto/bn/bn_sqr.c
Log Message:
-----------
Use BN_CTX cached OSSL_FN_CTX in BN_mul() and BN_sqr()
The previous commit added bn_ctx_acquire_ossl_fn_ctx() and
bn_ctx_release_ossl_fn_ctx() to cache an OSSL_FN_CTX inside a BN_CTX.
However, BN_mul() and BN_sqr() were still creating and freeing their own
temporary OSSL_FN_CTX on every call, ignoring the passed-in BN_CTX entirely.
Update both functions to acquire the OSSL_FN_CTX from the BN_CTX and release
it afterwards, allowing the cached context to be reused across calls.
Assisted-by: Pi:moonshotai/kimi-k2.6
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Sun Jun 14 08:40:47 2026
(Merged from https://github.com/openssl/openssl/pull/31431)
Commit: 04566a1781a12fe0349eca89b6afe7cfc8bdbac9
https://github.com/openssl/openssl/commit/04566a1781a12fe0349eca89b6afe7cfc8bdbac9
Author: Tomas Mraz <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/bn/bn_add.c
M crypto/bn/bn_mul.c
M crypto/bn/bn_sqr.c
Log Message:
-----------
Check result of acquiring OSSL_FN or OSSL_FN_CTX
These calls might return NULL because they
allocate memory.
Reviewed-by: Igor Ustinov <[email protected]>
Reviewed-by: Daniel Kubec <[email protected]>
MergeDate: Fri Jun 26 14:09:33 2026
(Merged from https://github.com/openssl/openssl/pull/31613)
Commit: 0b478aba2c8f3314965734509d4295b538ce80fb
https://github.com/openssl/openssl/commit/0b478aba2c8f3314965734509d4295b538ce80fb
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/err/openssl.txt
M crypto/fn/build.info
M crypto/fn/fn_err.c
M crypto/fn/fn_lib.c
A crypto/fn/fn_shift.c
M include/crypto/fn.h
M include/crypto/fnerr.h
M test/fn_api_test.c
Log Message:
-----------
OSSL_FN: Add basic shift and compare functions
The following functions are added:
- OSSL_FN_num_bits
- OSSL_FN_cmp
- OSSL_FN_lshift
- OSSL_FN_lshift1
Assisted-by: Pi:openai/gpt-5.5
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Fri Jun 26 14:23:17 2026
(Merged from https://github.com/openssl/openssl/pull/31460)
Commit: d07d760f8cdbee7108b34b23c02d933044e8d882
https://github.com/openssl/openssl/commit/d07d760f8cdbee7108b34b23c02d933044e8d882
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/bn/bn_lib.c
M crypto/bn/bn_shift.c
Log Message:
-----------
OSSL_FN: Wrap BN shift and compare functions around OSSL_FN functions
Assisted-by: Pi:openai/gpt-5.5
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Fri Jun 26 14:23:18 2026
(Merged from https://github.com/openssl/openssl/pull/31460)
Commit: e3a6ede280fb9d13528ec0fe81bf17b7c66239f7
https://github.com/openssl/openssl/commit/e3a6ede280fb9d13528ec0fe81bf17b7c66239f7
Author: Igor Ustinov <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/bn/bn_shift.c
Log Message:
-----------
Check result of acquiring OSSL_FN
These calls might return NULL because they allocate memory.
Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Richard Levitte <[email protected]>
MergeDate: Tue Jun 30 06:45:42 2026
(Merged from https://github.com/openssl/openssl/pull/31754)
Commit: 910c2fcfc0ffa5cf16f60a2b440745d0acb9493d
https://github.com/openssl/openssl/commit/910c2fcfc0ffa5cf16f60a2b440745d0acb9493d
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/bn/bn_intern.c
M crypto/bn/bn_local.h
M doc/designs/fixed-size-large-numbers.md
Log Message:
-----------
Decouple BIGNUM from OSSL_FN in the design doc
Reflect the decision (openssl/project#2018) to stop wrapping BN_
operator functions around OSSL_FN_ operator functions: BN functions
keep their current behaviour, and BIGNUM<->OSSL_FN conversion
happens at top-level crypto call sites.
Also drop the "Dropping top from BIGNUM" section and the stale
TODO(FIXNUM) field-removal comments, since `top` stays in BIGNUM.
Refs: https://github.com/openssl/project/issues/2019
Assisted-by: Pi:z-ai/glm-5.2
Assisted-by: Pi:openai/gpt-5.5
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
MergeDate: Thu Jul 9 10:54:20 2026
(Merged from https://github.com/openssl/openssl/pull/31847)
Commit: 3b2c8afdc1166fa24150d4d597d579ddf054cd34
https://github.com/openssl/openssl/commit/3b2c8afdc1166fa24150d4d597d579ddf054cd34
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/bn/bn_add.c
Log Message:
-----------
OSSL_FN: unwrap the BIGNUM 'add' and 'sub' functions
Restore the top-aware BN_add/BN_sub/BN_uadd/BN_usub implementations to
their pre-wrap form, removing the OSSL_FN call-site wrapping introduced in:
e3ae863a2d ("OSSL_FN: Wrap BIGNUM 'add' and 'sub' functions around OSSL_FN functions")
This also reverts the in-body tuning that landed on top of that wrapping:
3eb0b45e63 ("Use top to size BN add/sub results")
cbc3f0b448 ("Check result of acquiring OSSL_FN or OSSL_FN_CTX")
(only the BN_add/BN_sub portions of cbc3f0b448 are affected).
The conversion helpers bn_acquire_ossl_fn()/bn_release() and the
foundational BN_MAX_WORDS hardening in bn_lib.c/bn_local.h are left in
place; BN->OSSL_FN conversion moves to top-level crypto call sites
instead.
Issue: https://github.com/openssl/project/issues/2020
Assisted-by: Pi:z-ai/glm-5.2
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Thu Jul 9 15:34:20 2026
(Merged from https://github.com/openssl/openssl/pull/31884)
Commit: d8f17e7d37a67dcd15bc6a7de5d3411e781985cc
https://github.com/openssl/openssl/commit/d8f17e7d37a67dcd15bc6a7de5d3411e781985cc
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/bn/bn_mul.c
Log Message:
-----------
OSSL_FN: unwrap the BIGNUM 'mul' function
Restore the top-aware BN_mul implementation to its pre-wrap form, removing
the OSSL_FN call-site wrapping introduced in:
8f77f825fa ("OSSL_FN: Wrap BIGNUM the 'mul' function around the OSSL_FN 'mul' function")
This also reverts the in-body tuning that landed on top of that wrapping:
06bc8339d9 ("Acquire BN_mul result before ctx sizing")
a7b662c282 ("Use BN_CTX cached OSSL_FN_CTX in BN_mul() and BN_sqr()")
cbc3f0b448 ("Check result of acquiring OSSL_FN or OSSL_FN_CTX")
(only the BN_mul portions of a7b662c282 and cbc3f0b448 are affected).
The conversion helpers bn_acquire_ossl_fn()/bn_release() and the
foundational BN_MAX_WORDS hardening in bn_lib.c/bn_local.h are left in
place; BN->OSSL_FN conversion moves to top-level crypto call sites
instead.
Issue: https://github.com/openssl/project/issues/2020
Assisted-by: Pi:z-ai/glm-5.2
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Thu Jul 9 15:34:22 2026
(Merged from https://github.com/openssl/openssl/pull/31884)
Commit: ebc87a83dcf2b6aae786ce79940a935ef7e7cfd8
https://github.com/openssl/openssl/commit/ebc87a83dcf2b6aae786ce79940a935ef7e7cfd8
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/bn/bn_sqr.c
Log Message:
-----------
OSSL_FN: unwrap the BIGNUM 'sqr' function
Restore the top-aware BN_sqr implementation to its pre-wrap form, removing
the OSSL_FN call-site wrapping introduced in:
f52bf9d167 ("OSSL_FN: Wrap the BIGNUM 'sqr' function around the OSSL_FN 'sqr' function")
This also reverts the in-body tuning that landed on top of that wrapping:
1763d6aff3 ("Acquire BN_sqr result before ctx sizing")
a7b662c282 ("Use BN_CTX cached OSSL_FN_CTX in BN_mul() and BN_sqr()")
cbc3f0b448 ("Check result of acquiring OSSL_FN or OSSL_FN_CTX")
(only the BN_sqr portions of a7b662c282 and cbc3f0b448 are affected).
The conversion helpers bn_acquire_ossl_fn()/bn_release() and the
foundational BN_MAX_WORDS hardening in bn_lib.c/bn_local.h are left in
place; BN->OSSL_FN conversion moves to top-level crypto call sites
instead.
Issue: https://github.com/openssl/project/issues/2020
Assisted-by: Pi:z-ai/glm-5.2
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Thu Jul 9 15:34:24 2026
(Merged from https://github.com/openssl/openssl/pull/31884)
Commit: 9a90994e395dfbbffce12f73b7fc8010b0228e7b
https://github.com/openssl/openssl/commit/9a90994e395dfbbffce12f73b7fc8010b0228e7b
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/bn/bn_lib.c
M crypto/bn/bn_shift.c
Log Message:
-----------
OSSL_FN: unwrap the BIGNUM shift and compare functions
Restore the top-aware implementations of BN_num_bits, BN_ucmp, BN_cmp,
BN_lshift1, and BN_lshift to their pre-wrap form, removing the OSSL_FN
call-site wrapping (the dual-path `if (a->data == NULL) { legacy } else
{ OSSL_FN_* }` branches, each marked TODO(FIXNUM): TO BE REMOVED)
introduced in:
5072424737 ("OSSL_FN: Wrap BN shift and compare functions around OSSL_FN functions")
This also reverts the in-body tuning that landed on top of that wrapping:
1a87fdb411 ("Check result of acquiring OSSL_FN")
The foundational BN_MAX_WORDS bound in bn_expand_internal (bn_lib.c) and
the bn_check_top dmax assert (bn_local.h), both from e3ae863a2d, are
preserved -- restoring bn_lib.c to 5072424737^ keeps them, since they
predate the shift/compare wrapper and were never modified by it.
The conversion helpers bn_acquire_ossl_fn()/bn_release() are left in
place; BN->OSSL_FN conversion moves to top-level crypto call sites
instead.
Issue: https://github.com/openssl/project/issues/2020
Assisted-by: Pi:z-ai/glm-5.2
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Thu Jul 9 15:34:26 2026
(Merged from https://github.com/openssl/openssl/pull/31884)
Commit: 312250036e1a0f268559ee40d536c8999c807d94
https://github.com/openssl/openssl/commit/312250036e1a0f268559ee40d536c8999c807d94
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/bn/bn_lib.c
M crypto/bn/bn_local.h
M include/crypto/bn.h
Log Message:
-----------
OSSL_FN: Expose BN OSSL_FN acquire helpers
Move the BIGNUM to OSSL_FN acquire/release helpers out of
bn_local.h and declare them in the internal BN header. This makes
them available to call sites that need to operate temporarily on the
fixed-width representation.
Assisted-by: Pi:openai/gpt-5.5
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Sun Jul 12 08:37:00 2026
(Merged from https://github.com/openssl/openssl/pull/31881)
Commit: 0df3c5e1de3676d6b9a8028d5f901c121a4069df
https://github.com/openssl/openssl/commit/0df3c5e1de3676d6b9a8028d5f901c121a4069df
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/bn/bn_lib.c
M include/crypto/bn.h
Log Message:
-----------
OSSL_FN: Add read-only BIGNUM OSSL_FN accessor
Add bn_get_ossl_fn(), a read-only counterpart to bn_acquire_ossl_fn().
Unlike the latter, it neither acquires nor resizes the BIGNUM: the
BIGNUM stays usable with BN_ functions, no bn_release() is needed, and
the returned OSSL_FN keeps the BIGNUM's current allocated width. This
suits read-only operands at OSSL_FN call sites.
Assisted-by: Pi:openai/gpt-5.5
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Sun Jul 12 08:37:02 2026
(Merged from https://github.com/openssl/openssl/pull/31881)
Commit: 5c2f95c4b0eea4057a2712547856fb1a5f2fa72d
https://github.com/openssl/openssl/commit/5c2f95c4b0eea4057a2712547856fb1a5f2fa72d
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M test/build.info
A test/fntest.c
A test/recipes/11-test_fn.t
M test/recipes/11-test_fn_api.t
Log Message:
-----------
OSSL_FN: Add OSSL_FN stanza arithmetic test
Add fntest as a stanza-driven arithmetic test for the OSSL_FN
operations currently available in this branch. The test reuses the
existing BN input files and reports known but unsupported stanza types
as skipped.
Wire the new test program into the build and add a test_fn recipe for
sum, multiplication, square, and left-shift coverage.
Assisted-by: Pi:openai/gpt-5.5
Assisted-by: Pi:z-ai/glm-5.2
Signed-off-by: Richard Levitte <[email protected]>
Resolves: https://github.com/openssl/project/issues/2021
Reviewed-by: Igor Ustinov <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Sun Jul 12 08:37:03 2026
(Merged from https://github.com/openssl/openssl/pull/31881)
Commit: 3923fd51b1e6d4f5d56800bb19bec7509729df5e
https://github.com/openssl/openssl/commit/3923fd51b1e6d4f5d56800bb19bec7509729df5e
Author: Richard Levitte <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M crypto/bn/bn_ctx.c
M include/crypto/bn.h
M test/bn_internal_test.c
Log Message:
-----------
OSSL_FN: unwrap BN_CTX's wrapping of OSSL_FN_CTX
The BN_CTX -> OSSL_FN_CTX acquisition machinery
(bn_ctx_acquire_ossl_fn_ctx / bn_ctx_release_ossl_fn_ctx and the
fn_ctx field on struct bignum_ctx) existed only to serve the BN_*
arithmetic wrappers that delegated to OSSL_FN. Those wrappers were
removed in previous commits, leaving the machinery orphaned except
for the self-test that exercised it; OSSL_FN consumers obtain their
OSSL_FN_CTX directly via OSSL_FN_CTX_new() / OSSL_FN_CTX_secure_new().
Remove the wrapping machinery and its dedicated test
(test_bn_ctx_fn_ctx) by reverting:
e3213b0c03 ("Add OSSL_FN_CTX integration with BN_CTX")
Assisted-by: Pi:z-ai/glm-5.2
Signed-off-by: Richard Levitte <[email protected]>
Reviewed-by: Dmitry Belyavskiy <[email protected]>
Reviewed-by: Igor Ustinov <[email protected]>
MergeDate: Tue Jul 14 11:06:24 2026
(Merged from https://github.com/openssl/openssl/pull/31895)
Compare: https://github.com/openssl/openssl/compare/9c2bfa9f26ef...3923fd51b1e6
To unsubscribe from these emails, change your notification settings at https://github.com/openssl/openssl/settings/notifications
--
You received this message because you are subscribed to the Google Groups "openssl-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/a/openssl.org/d/msgid/openssl-commits/openssl/openssl/push/refs/heads/feature/ossl_fn/9c2bfa-3923fd%40github.com.