Skip to content

Conversation

@boorad
Copy link

@boorad boorad commented Dec 4, 2025

Use BN_GENCB_get_arg

The BN_GENCB structure is opaque in OpenSSL 3.x, meaning direct member access (ctx->arg) is not allowed and causes compilation failures.

This PR replaces direct struct member access with the BN_GENCB_get_arg() accessor function, which is the proper API for retrieving the callback argument in OpenSSL 1.1.0+.

The existing code had a TODO comment acknowledging this, with the correct API call commented out. This change simply uses the accessor as intended.

Changes:

  • Replace ctx->arg with BN_GENCB_get_arg(ctx) in isPrime()
  • Replace ctx->arg with BN_GENCB_get_arg(ctx) in generate()

Compatibility:

  • BN_GENCB_get_arg() is available in OpenSSL 1.1.0+ and BoringSSL
  • Required for OpenSSL 3.x where BN_GENCB is fully opaque

Remove <openssl/cipher.h>

  • this include doesn't exist in OpenSSL 3.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants