BN_enhanced_miller_rabin_primality_test function

  1. @RecordUse.new()
  2. @Native<Int Function(Pointer<UnsignedInt>, Pointer<BIGNUM>, Int, Pointer<BN_CTX>, Pointer<BN_GENCB>)>(ffi.Pointer<ffi.UnsignedInt>, ffi.Pointer<BIGNUM>, ffi.Int, ffi.Pointer<BN_CTX>, ffi.Pointer<BN_GENCB>)>(symbol: 'bssl_dart_BN_enhanced_miller_rabin_primality_test')
int BN_enhanced_miller_rabin_primality_test(
  1. Pointer<UnsignedInt> out_result,
  2. Pointer<BIGNUM> w,
  3. int checks,
  4. Pointer<BN_CTX> ctx,
  5. Pointer<BN_GENCB> cb,
)

BN_enhanced_miller_rabin_primality_test tests whether |w| is probably a prime number using the Enhanced Miller-Rabin Test (FIPS 186-5 B.3.2) with |checks| iterations and returns the result in |out_result|. Enhanced Miller-Rabin tests primality for odd integers greater than 3, returning |bn_probably_prime| if the number is probably prime, |bn_non_prime_power_composite| if the number is a composite that is not the power of a single prime, and |bn_composite| otherwise. It returns one on success and zero on failure. If |cb| is not NULL, then it is called during each iteration of the primality test.

See |BN_prime_checks_for_validation| and |BN_prime_checks_for_generation| for recommended values of |checks|.

Implementation

@meta.RecordUse()
@ffi.Native<
  ffi.Int Function(
    ffi.Pointer<ffi.UnsignedInt>,
    ffi.Pointer<BIGNUM>,
    ffi.Int,
    ffi.Pointer<BN_CTX>,
    ffi.Pointer<BN_GENCB>,
  )
>(symbol: 'bssl_dart_BN_enhanced_miller_rabin_primality_test')
external int BN_enhanced_miller_rabin_primality_test(
  ffi.Pointer<ffi.UnsignedInt> out_result,
  ffi.Pointer<BIGNUM> w,
  int checks,
  ffi.Pointer<BN_CTX> ctx,
  ffi.Pointer<BN_GENCB> cb,
);