BN_CTX *ctx = BN_CTX_new();intret =0;if(!EC_GROUP_VERSION(group))gotoerr;if(group->mont_data) { BN_MONT_CTX_free(group->mont_data); group->mont_data =NULL; }if(ctx ==NULL)gotoerr; group->mont_data =BN_MONT_CTX_new();if(!group->mont_data)gotoerr;if(!BN_MONT_CTX_set...
void BN_MONT_CTX_free(BN_MONT_CTX *mont); int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *m, BN_CTX *ctx); BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from); int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_MONT_CTX *mont, BN_C...
BN_MONT_CTX *BN_MONT_CTX_new(void); void BN_MONT_CTX_init(BN_MONT_CTX *ctx); void BN_MONT_CTX_free(BN_MONT_CTX *mont); int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *m, BN_CTX *ctx); BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from); int ...
BN_CTX_start(ctx); d = BN_CTX_get(ctx); r = BN_CTX_get(ctx);if(d ==NULL|| r ==NULL)gotoerr; bits=(bits1 > bits2)?bits1:bits2;/* If this is not done, things will break in the montgomery * part */if(in_mont !=NULL) mont=in_mont;else{if((mont=BN_MONT_CTX_new(...
if ((mont=BN_MONT_CTX_new()) == NULL) goto err; if (!BN_MONT_CTX_set(mont,m,ctx)) goto err; } BN_init(&val[0]); ts=1; if (a->neg || BN_ucmp(a,m) >= 0) { if (!BN_nnmod(&(val[0]),a,m,ctx)) ...
mont = BN_MONT_CTX_new(); if (mont == NULL) goto err; if (!BN_MONT_CTX_set(mont, A, ctx)) goto err; for (i = 0; i < checks; i++) { if (!BN_pseudo_rand_range(check, A1)) goto err; if (!BN_add_word(check, 1)) goto err; /* now 1 <= check < A */ j =...
@@ -156,6 +156,56 @@ static int field_tests_ecp_mont(void) } #ifndef OPENSSL_NO_EC2M /* Test that decoding of invalid GF2m field parameters fails. */ static int ec2m_field_sanity(void) { int ret = 0; BN_CTX *ctx = BN_CTX_new(); BIGNUM *p, *a, *b; EC_GROUP *group1...
BN_CTX *ctx, BN_MONT_CTX *m_ctx); int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx); int BN_mod_exp_mont_consttime_x2(BIGNUM *rr1, const BIGNUM *a1, const BIGNUM *p1, const BIGNUM *m1, BN_MONT_CTX *in_mont1, BIGNUM *...
BN_CTX *BN_CTX_new(void);申请一个新的上下文结构 void BN_CTX_init(BN_CTX *c);将所有的项赋值为0,一般BN_CTX_init(&c) void BN_CTX_free(BN_CTX *c);释放上下文结构,释放完后c=NULL; 3.复制以及交换函数 BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b);将b复制给a,正确返回a,错误返回NULL...
BN_CTX_free(new_ctx);returnret; } 开发者ID:GrayKing,项目名称:Leakfix-on-OpenSSL,代码行数:60,代码来源:ecp_smpl.c 示例2: ec_GFp_simple_group_set_curve ▲点赞 5▼ intec_GFp_simple_group_set_curve(EC_GROUP *group,constBIGNUM *p,constBIGNUM *a,constBIGNUM *b, BN_CTX *ctx){intret ...