BN_generate_prime_ex function

  1. @RecordUse.new()
  2. @Native<Int Function(Pointer<BIGNUM>, Int, Int, Pointer<BIGNUM>, Pointer<BIGNUM>, Pointer<BN_GENCB>)>(ffi.Pointer<BIGNUM>, ffi.Int, ffi.Int, ffi.Pointer<BIGNUM>, ffi.Pointer<BIGNUM>, ffi.Pointer<BN_GENCB>)>(symbol: 'bssl_dart_BN_generate_prime_ex')
int BN_generate_prime_ex(
  1. Pointer<BIGNUM> ret,
  2. int bits,
  3. int safe,
  4. Pointer<BIGNUM> add,
  5. Pointer<BIGNUM> rem,
  6. Pointer<BN_GENCB> cb,
)

BN_generate_prime_ex sets |ret| to a prime number of |bits| length. If safe is non-zero then the prime will be such that (ret-1)/2 is also a prime. (This is needed for Diffie-Hellman groups to ensure that the only subgroups are of size 2 and (p-1)/2.).

If |add| is not NULL, the prime will fulfill the condition |ret| % |add| == |rem| in order to suit a given generator. (If |rem| is NULL then |ret| % |add| == 1.)

If |cb| is not NULL, it will be called during processing to give an indication of progress. See the comments for |BN_GENCB|. It returns one on success and zero otherwise.

Implementation

@meta.RecordUse()
@ffi.Native<
  ffi.Int Function(
    ffi.Pointer<BIGNUM>,
    ffi.Int,
    ffi.Int,
    ffi.Pointer<BIGNUM>,
    ffi.Pointer<BIGNUM>,
    ffi.Pointer<BN_GENCB>,
  )
>(symbol: 'bssl_dart_BN_generate_prime_ex')
external int BN_generate_prime_ex(
  ffi.Pointer<BIGNUM> ret,
  int bits,
  int safe,
  ffi.Pointer<BIGNUM> add,
  ffi.Pointer<BIGNUM> rem,
  ffi.Pointer<BN_GENCB> cb,
);