예제 #1
0
        /// <summary>
        /// Allocates a new OpenSSL <c>BN_MONT_CTX</c> structure
        /// and returns a handle to it.
        ///
        /// The returned handle is guaranteed to point to be valid,
        /// i.e., point to a valid <c>BN_MONT_CTX</c> structure.
        /// </summary>
        /// <returns>
        /// A valid <see cref="BigNumberMontgomeryContextHandle" /> pointing to a
        /// freshly allocated <c>BN_MONT_CTX</c> structure.
        /// </returns>
        public static BigNumberMontgomeryContextHandle Create()
        {
            var ctx = new BigNumberMontgomeryContextHandle(BN_MONT_CTX_new(), ownsHandle: true);

            if (ctx.IsInvalid)
            {
                throw new OpenSslNativeException();
            }
            return(ctx);
        }
예제 #2
0
 private extern static int BN_mod_exp_mont_consttime(BigNumberHandle result, BigNumberHandle a, BigNumberHandle exponent,
                                                     BigNumberHandle modulo, BigNumberContextHandle ctx, BigNumberMontgomeryContextHandle montCtx);