[openssl/openssl] 9ff9bf: OSSL_FN: Size contexts in bytes

"'Richard Levitte' via openssl-commits" <[email protected]> Wed, 15 Jul 2026 06:06:38 -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: 9ff9bf1c0ab2eb16b45aa0550df2f2b3a74b323a
      https://github.com/openssl/openssl/commit/9ff9bf1c0ab2eb16b45aa0550df2f2b3a74b323a
  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
    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:
  -----------
  OSSL_FN: Size contexts in bytes

OSSL_FN_CTX callers currently describe the arena in frames, numbers
and limbs.  That works for a single operation, but it makes higher
level sizing awkward because each caller has to keep redoing the same
conversion.

Add an overflow-checked OSSL_FN_CTX_size() helper that returns the
arena payload size, plus byte-sized constructors for normal and secure
contexts.  The existing frame/number/limb constructors become wrappers
around it so current callers keep working while newer code can compose
byte sizes directly.  The old internal ossl_fn_ctx_calculate_arena_size()
inline is replaced by the public, overflow-checked helper.

Add per-operation ctx-size helpers OSSL_FN_mul_ctx_size() and
OSSL_FN_sqr_ctx_size(), which fold in the aliasing and
destination-width considerations of OSSL_FN_mul() / OSSL_FN_sqr().

Assisted-by: Pi:openai/gpt-5.5
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: Wed Jul 15 13:04:48 2026
(Merged from https://github.com/openssl/openssl/pull/31794)


  Commit: 496092d36f67f14bdbf101d829bd728850b13b78
      https://github.com/openssl/openssl/commit/496092d36f67f14bdbf101d829bd728850b13b78
  Author: Richard Levitte <[email protected]>
  Date:   2026-07-14 (Tue, 14 Jul 2026)

  Changed paths:
    M test/fntest.c

  Log Message:
  -----------
  OSSL_FN: use ctx-size helpers in fntest

The mul and sqr tests in test/fntest.c sized their OSSL_FN_CTX arenas
by hand, passing fixed frame/number/limb counts to OSSL_FN_CTX_new().
Switch them to OSSL_FN_CTX_new_size() driven by OSSL_FN_mul_ctx_size()
/ OSSL_FN_sqr_ctx_size(), passing the actual result and operand
OSSL_FNs so the per-op helpers can account for aliasing and
destination width.

This gives the ctx-size helpers real callers in the tree and makes the
test sizing match what OSSL_FN_mul() / OSSL_FN_sqr() actually need
instead of the previous oversized estimates.

Assisted-by: Pi:z-ai/glm-5.2
Signed-off-by: Richard Levitte <[email protected]>
Assisted-by: Pi:openai/gpt-5.5

Reviewed-by: Igor Ustinov <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Wed Jul 15 13:04:50 2026
(Merged from https://github.com/openssl/openssl/pull/31794)


Compare: https://github.com/openssl/openssl/compare/3923fd51b1e6...496092d36f67

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/3923fd-496092%40github.com.