亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? bn_mont.c

?? LINUX AU12XX BOOTLADER
?? C
字號:
/* crypto/bn/bn_mont.c *//* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. *  * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to.  The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code.  The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). *  * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. *  * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software *    must display the following acknowledgement: *    "This product includes cryptographic software written by *     Eric Young (eay@cryptsoft.com)" *    The word 'cryptographic' can be left out if the rouines from the library *    being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from  *    the apps directory (application code) you must include an acknowledgement: *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" *  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. *  * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed.  i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] *//* * Details about Montgomery multiplication algorithms can be found at * http://security.ece.orst.edu/publications.html, e.g. * http://security.ece.orst.edu/koc/papers/j37acmon.pdf and * sections 3.8 and 4.2 in http://security.ece.orst.edu/koc/papers/r01rsasw.pdf */#include <stdio.h>#include "cryptlib.h"#include "bn_lcl.h"#include "workaround.h"#define MONT_WORD		/* use the faster word-based algorithm */int BN_mod_mul_montgomery(BIGNUM * r, BIGNUM * a, BIGNUM * b,			  BN_MONT_CTX * mont, BN_CTX * ctx){    BIGNUM *tmp, *tmp2;    int ret = 0;    BN_CTX_start(ctx);    tmp = BN_CTX_get(ctx);    tmp2 = BN_CTX_get(ctx);    if (tmp == NULL || tmp2 == NULL)	goto err;    bn_check_top(tmp);    bn_check_top(tmp2);    if (a == b) {	if (!BN_sqr(tmp, a, ctx))	    goto err;    } else {	if (!BN_mul(tmp, a, b, ctx))	    goto err;    }    /* reduce from aRR to aR */    if (!BN_from_montgomery(r, tmp, mont, ctx))	goto err;    ret = 1;  err:    BN_CTX_end(ctx);    return (ret);}int BN_from_montgomery(BIGNUM * ret, BIGNUM * a, BN_MONT_CTX * mont,		       BN_CTX * ctx){    int retn = 0;#ifdef MONT_WORD    BIGNUM *n, *r;    BN_ULONG *ap, *np, *rp, n0, v, *nrp;    int al, nl, max, i, x, ri;    BN_CTX_start(ctx);    if ((r = BN_CTX_get(ctx)) == NULL)	goto err;    if (!BN_copy(r, a))	goto err;    n = &(mont->N);    ap = a->d;    /* mont->ri is the size of mont->N in bits (rounded up       to the word size) */    al = ri = mont->ri / BN_BITS2;    nl = n->top;    if ((al == 0) || (nl == 0)) {	r->top = 0;	return (1);    }    max = (nl + al + 1);	/* allow for overflow (no?) XXX */    if (bn_wexpand(r, max) == NULL)	goto err;    if (bn_wexpand(ret, max) == NULL)	goto err;    r->neg = a->neg ^ n->neg;    np = n->d;    rp = r->d;    nrp = &(r->d[nl]);    /* clear the top words of T */#if 1    for (i = r->top; i < max; i++)	/* memset? XXX */	r->d[i] = 0;#else    memset(&(r->d[r->top]), 0, (max - r->top) * sizeof(BN_ULONG));#endif    r->top = max;    n0 = mont->n0;#ifdef BN_COUNT    printf("word BN_from_montgomery %d * %d\n", nl, nl);#endif    for (i = 0; i < nl; i++) {#ifdef __TANDEM	{	    long long t1;	    long long t2;	    long long t3;	    t1 = rp[0] * (n0 & 0177777);	    t2 = 037777600000l;	    t2 = n0 & t2;	    t3 = rp[0] & 0177777;	    t2 = (t3 * t2) & BN_MASK2;	    t1 = t1 + t2;	    v = bn_mul_add_words(rp, np, nl, (BN_ULONG) t1);	}#else	v = bn_mul_add_words(rp, np, nl, (rp[0] * n0) & BN_MASK2);#endif	nrp++;	rp++;	if (((nrp[-1] += v) & BN_MASK2) >= v)	    continue;	else {	    if (((++nrp[0]) & BN_MASK2) != 0)		continue;	    if (((++nrp[1]) & BN_MASK2) != 0)		continue;	    for (x = 2; (((++nrp[x]) & BN_MASK2) == 0); x++);	}    }    bn_fix_top(r);    /* mont->ri will be a multiple of the word size */#if 0    BN_rshift(ret, r, mont->ri);#else    ret->neg = r->neg;    x = ri;    rp = ret->d;    ap = &(r->d[x]);    if (r->top < x)	al = 0;    else	al = r->top - x;    ret->top = al;    al -= 4;    for (i = 0; i < al; i += 4) {	BN_ULONG t1, t2, t3, t4;	t1 = ap[i + 0];	t2 = ap[i + 1];	t3 = ap[i + 2];	t4 = ap[i + 3];	rp[i + 0] = t1;	rp[i + 1] = t2;	rp[i + 2] = t3;	rp[i + 3] = t4;    }    al += 4;    for (; i < al; i++)	rp[i] = ap[i];#endif#else				/* !MONT_WORD */    BIGNUM *t1, *t2;    BN_CTX_start(ctx);    t1 = BN_CTX_get(ctx);    t2 = BN_CTX_get(ctx);    if (t1 == NULL || t2 == NULL)	goto err;    if (!BN_copy(t1, a))	goto err;    BN_mask_bits(t1, mont->ri);    if (!BN_mul(t2, t1, &mont->Ni, ctx))	goto err;    BN_mask_bits(t2, mont->ri);    if (!BN_mul(t1, t2, &mont->N, ctx))	goto err;    if (!BN_add(t2, a, t1))	goto err;    if (!BN_rshift(ret, t2, mont->ri))	goto err;#endif				/* MONT_WORD */    if (BN_ucmp(ret, &(mont->N)) >= 0) {	BN_usub(ret, ret, &(mont->N));    }    retn = 1;  err:    BN_CTX_end(ctx);    return (retn);}BN_MONT_CTX *BN_MONT_CTX_new(void){    BN_MONT_CTX *ret;    if ((ret = (BN_MONT_CTX *) Our_malloc(sizeof(BN_MONT_CTX))) == NULL)	return (NULL);    BN_MONT_CTX_init(ret);    ret->flags = BN_FLG_MALLOCED;    return (ret);}void BN_MONT_CTX_init(BN_MONT_CTX * ctx){    ctx->ri = 0;    BN_init(&(ctx->RR));    BN_init(&(ctx->N));    BN_init(&(ctx->Ni));    ctx->flags = 0;}void BN_MONT_CTX_free(BN_MONT_CTX * mont){    if (mont == NULL)	return;    BN_free(&(mont->RR));    BN_free(&(mont->N));    BN_free(&(mont->Ni));    if (mont->flags & BN_FLG_MALLOCED)	OPENSSL_free(mont);}int BN_MONT_CTX_set(BN_MONT_CTX * mont, const BIGNUM * mod, BN_CTX * ctx){    BIGNUM Ri, *R;    BN_init(&Ri);    R = &(mont->RR);		/* grab RR as a temp */    BN_copy(&(mont->N), mod);	/* Set N */#ifdef MONT_WORD    {	BIGNUM tmod;	BN_ULONG buf[2];	mont->ri =	    (BN_num_bits(mod) + (BN_BITS2 - 1)) / BN_BITS2 * BN_BITS2;	if (!(BN_zero(R)))	    goto err;	if (!(BN_set_bit(R, BN_BITS2)))	    goto err;		/* R */	buf[0] = mod->d[0];	/* tmod = N mod word size */	buf[1] = 0;	tmod.d = buf;	tmod.top = 1;	tmod.dmax = 2;	tmod.neg = mod->neg;	/* Ri = R^-1 mod N */	if ((BN_mod_inverse(&Ri, R, &tmod, ctx)) == NULL)	    goto err;	/* R*Ri */	if (!(BN_lshift(&Ri, &Ri, BN_BITS2)))	    goto err;	if (!BN_is_zero(&Ri)) {	    if (!BN_sub_word(&Ri, 1))		goto err;	} else {		/* if N mod word size == 1 */	    /* Ri-- (mod word size) */	    if (!BN_set_word(&Ri, BN_MASK2))		goto err;	}	/* Ni = (R*Ri-1)/N, keep only least significant word: */	if (!(BN_div(&Ri, NULL, &Ri, &tmod, ctx)))	    goto err;	mont->n0 = Ri.d[0];	BN_free(&Ri);    }#else				/* !MONT_WORD */    {				/* bignum version */	mont->ri = BN_num_bits(mod);	if (!(BN_zero(R)))	    goto err;	/* R = 2^ri */	if (!(BN_set_bit(R, mont->ri)))	    goto err;	/* Ri = R^-1 mod N */	if ((BN_mod_inverse(&Ri, R, mod, ctx)) == NULL)	    goto err;	/* R*Ri */	if (!(BN_lshift(&Ri, &Ri, mont->ri)))	    goto err;	if (!(BN_sub_word(&Ri, 1)))	    goto err;	/* Ni = (R*Ri-1) / N */	if (!(BN_div(&(mont->Ni), NULL, &Ri, mod, ctx)))	    goto err;	BN_free(&Ri);    }#endif    /* setup RR for conversions */    if (!(BN_zero(&(mont->RR))))	goto err;    if (!(BN_set_bit(&(mont->RR), mont->ri * 2)))	goto err;    if (!(BN_mod(&(mont->RR), &(mont->RR), &(mont->N), ctx)))	goto err;    return (1);  err:    return (0);}BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX * to, BN_MONT_CTX * from){    if (to == from)	return (to);    if (!(BN_copy(&(to->RR), &(from->RR))))	return NULL;    if (!(BN_copy(&(to->N), &(from->N))))	return NULL;    if (!(BN_copy(&(to->Ni), &(from->Ni))))	return NULL;    to->ri = from->ri;    to->n0 = from->n0;    return (to);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一卡二卡欧美日韩| 麻豆成人久久精品二区三区小说| 亚洲大片免费看| 国产一区在线观看视频| 日本高清不卡在线观看| 久久婷婷成人综合色| 亚洲国产一二三| 成人av电影在线观看| 日韩欧美国产三级| 亚洲国产精品一区二区久久恐怖片| 国产曰批免费观看久久久| 欧美日韩美女一区二区| 中文字幕一区av| 国产精品123区| 欧美videossexotv100| 亚洲国产视频a| 日本韩国精品在线| 中文字幕一区二区日韩精品绯色| 极品少妇一区二区| 日韩精品在线网站| 青草av.久久免费一区| 欧美视频一区在线| 亚洲黄色片在线观看| 99视频在线精品| 国产精品视频一区二区三区不卡| 国产一区二区三区日韩 | 欧美性淫爽ww久久久久无| 欧美激情综合网| 国产盗摄女厕一区二区三区 | 日本一区二区三区四区在线视频| 蜜桃一区二区三区四区| 69久久夜色精品国产69蝌蚪网 | 亚洲欧洲在线观看av| 懂色中文一区二区在线播放| 国产午夜久久久久| 国产精品一二三在| 国产蜜臀97一区二区三区| 国产精品自拍网站| 国产欧美日韩视频一区二区| 成人污视频在线观看| 国产精品护士白丝一区av| 99久免费精品视频在线观看| 综合激情成人伊人| 色婷婷av一区二区三区软件| 亚洲一区在线免费观看| 6080午夜不卡| 久99久精品视频免费观看| 久久综合久久99| 成人永久看片免费视频天堂| 最新国产精品久久精品| 欧美在线观看视频一区二区三区| 亚洲第一搞黄网站| 欧美精品一区二区三区在线播放 | 久久se精品一区二区| 精品国产伦一区二区三区观看方式 | 久久国产成人午夜av影院| 欧美精品一区二区三区很污很色的 | 欧美日韩精品一区二区三区 | 精品国产一区二区三区不卡| 国产精品1区2区3区在线观看| 国产精品欧美一级免费| 在线欧美小视频| 久久99精品一区二区三区| 中文字幕va一区二区三区| 91成人在线精品| 精品一区二区三区免费播放| 国产精品午夜在线| 欧美日韩精品一区二区在线播放| 国产剧情一区在线| 亚洲成人一区在线| 国产亚洲欧美日韩俺去了| 在线视频国内自拍亚洲视频| 久久不见久久见免费视频1| 亚洲欧美成人一区二区三区| 777亚洲妇女| 成人一二三区视频| 午夜激情综合网| 国产精品乱子久久久久| 这里只有精品视频在线观看| 成人a免费在线看| 免费在线看一区| 日韩一区在线播放| www久久久久| 欧美一区二区在线不卡| 99精品欧美一区二区三区综合在线| 日韩精品亚洲一区二区三区免费| 中文字幕av免费专区久久| 91精品国产综合久久香蕉的特点| www.成人在线| 国产麻豆视频精品| 肉肉av福利一精品导航| 亚洲免费在线看| 国产免费久久精品| 久久综合色鬼综合色| 91精品在线免费观看| 99精品久久99久久久久| 国产精品99久| 精品一区二区三区免费视频| 五月天久久比比资源色| 亚洲制服丝袜在线| 一区在线观看视频| 国产婷婷色一区二区三区在线| 欧美疯狂做受xxxx富婆| 在线亚洲一区二区| 91伊人久久大香线蕉| 成人在线视频一区二区| 成人一区二区视频| 成人免费观看av| 不卡的电影网站| 成人av午夜电影| 国产99久久久国产精品潘金 | 色久综合一二码| av一区二区三区四区| 国产成人av在线影院| 国产99久久久国产精品潘金| 国产很黄免费观看久久| 国产成人免费xxxxxxxx| 粉嫩aⅴ一区二区三区四区五区 | 麻豆91精品视频| 日韩精品成人一区二区三区| 日韩国产欧美在线播放| 视频一区二区不卡| 免费精品99久久国产综合精品| 日本成人中文字幕| 久久99精品国产麻豆不卡| 激情成人午夜视频| 国产成人自拍网| 91视视频在线直接观看在线看网页在线看| 成人精品电影在线观看| 99久久精品费精品国产一区二区| 91色视频在线| 欧美片在线播放| 日韩精品一区国产麻豆| 久久免费偷拍视频| 日韩理论片在线| 日韩成人免费看| 国产在线精品一区二区夜色 | 亚洲黄色小视频| 青青草原综合久久大伊人精品| 国产精品成人在线观看| 亚洲伦理在线精品| 美腿丝袜在线亚洲一区| 国产在线不卡一区| 91久久免费观看| 日韩一区二区三区四区| 国产精品午夜在线| 午夜精品影院在线观看| 激情综合网天天干| 一本色道a无线码一区v| 精品久久久久av影院| 国产精品大尺度| 麻豆精品视频在线观看视频| 成人激情黄色小说| 欧美日韩在线直播| 国产午夜亚洲精品理论片色戒| 亚洲精品乱码久久久久久| 奇米四色…亚洲| 色琪琪一区二区三区亚洲区| 欧美一区二区三区视频免费播放| 欧美国产一区二区在线观看| 亚洲永久精品大片| 粉嫩高潮美女一区二区三区 | 韩国成人福利片在线播放| 不卡一二三区首页| 欧美一区二区三区免费| 欧美国产日产图区| 视频一区在线播放| 91麻豆国产自产在线观看| 欧美不卡一区二区三区| 一区二区中文字幕在线| 久久国产生活片100| 91精品福利在线| 久久久久久久久久久久久女国产乱| 国产精品国产三级国产专播品爱网| 久久综合九色欧美综合狠狠| 午夜一区二区三区视频| 国产成人综合亚洲网站| 91精品国产高清一区二区三区| 亚洲激情在线激情| 国产乱淫av一区二区三区| 欧美中文一区二区三区| 欧美一级在线免费| 偷拍日韩校园综合在线| 成人av综合在线| 日韩欧美一区在线| 亚洲a一区二区| 91小视频免费看| 国产日韩视频一区二区三区| 一级做a爱片久久| 盗摄精品av一区二区三区| 日韩免费视频一区| 亚洲福中文字幕伊人影院| 色综合久久久久网| 国产精品久久免费看| 国产真实乱对白精彩久久| 欧美精品一区二区不卡 | 国产成人综合在线| 精品电影一区二区三区| 精品写真视频在线观看| 欧美一区二区三区电影|