|
8 | 8 | #include <openssl/pkcs12.h> |
9 | 9 | #include <openssl/rand.h> |
10 | 10 | #include <openssl/x509v3.h> |
11 | | -#include "openssl/cipher.h" |
12 | 11 |
|
13 | 12 | #ifndef NCRYPTO_NO_KDF_H |
14 | 13 | #include <openssl/kdf.h> |
@@ -473,11 +472,9 @@ int BignumPointer::isPrime(int nchecks, |
473 | 472 | // TODO(@jasnell): This could be refactored to allow inlining. |
474 | 473 | // Not too important right now tho. |
475 | 474 | [](int a, int b, BN_GENCB* ctx) mutable -> int { |
476 | | - PrimeCheckCallback& ptr = *static_cast<PrimeCheckCallback*>(ctx->arg); |
477 | | - // Newer versions of openssl and boringssl define the BN_GENCB_get_arg |
478 | | - // API which is what is supposed to be used here. Older versions, |
479 | | - // however, omit that API. |
480 | | - // *static_cast<PrimeCheckCallback*>(BN_GENCB_get_arg(ctx)); |
| 475 | + // BN_GENCB is opaque in OpenSSL 3.x, must use accessor |
| 476 | + PrimeCheckCallback& ptr = |
| 477 | + *static_cast<PrimeCheckCallback*>(BN_GENCB_get_arg(ctx)); |
481 | 478 | return ptr(a, b) ? 1 : 0; |
482 | 479 | }, |
483 | 480 | &innerCb); |
@@ -507,11 +504,9 @@ bool BignumPointer::generate(const PrimeConfig& params, |
507 | 504 | BN_GENCB_set( |
508 | 505 | cb.get(), |
509 | 506 | [](int a, int b, BN_GENCB* ctx) mutable -> int { |
510 | | - PrimeCheckCallback& ptr = *static_cast<PrimeCheckCallback*>(ctx->arg); |
511 | | - // Newer versions of openssl and boringssl define the BN_GENCB_get_arg |
512 | | - // API which is what is supposed to be used here. Older versions, |
513 | | - // however, omit that API. |
514 | | - // *static_cast<PrimeCheckCallback*>(BN_GENCB_get_arg(ctx)); |
| 507 | + // BN_GENCB is opaque in OpenSSL 3.x, must use accessor |
| 508 | + PrimeCheckCallback& ptr = |
| 509 | + *static_cast<PrimeCheckCallback*>(BN_GENCB_get_arg(ctx)); |
515 | 510 | return ptr(a, b) ? 1 : 0; |
516 | 511 | }, |
517 | 512 | &innerCb); |
|
0 commit comments