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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? netrand.c

?? 一個(gè)tcp/ip協(xié)議棧,帶有PPP、IP、TCP、UDP等協(xié)議
?? C
字號(hào):
/*****************************************************************************
* netrand.c - Random number generator program file.
*
* Copyright (c) 1998 by Global Election Systems Inc.
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice and the following disclaimer are included verbatim in any 
* distributions. No written agreement, license, or royalty fee is required
* for any of the authorized uses.
*
* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *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 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.
*
******************************************************************************
* REVISION HISTORY
*
* 98-06-03 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
*   Extracted from avos.
*****************************************************************************/

#include <string.h>
#include "netconf.h"
//#include <string.h>
#include "net.h"
#include "netmd5.h"
#include "netrand.h"

//#include <stdio.h>
#include "netdebug.h"

//#include <stdlib.h>
#include "netos.h"

#if MD5_SUPPORT>0   /* this module depends on MD5 */
#define RANDPOOLSZ 16   /* Bytes stored in the pool of randomness. */

/*****************************/
/*** LOCAL DATA STRUCTURES ***/
/*****************************/
static char randPool[RANDPOOLSZ];   /* Pool of randomness. */
static long randCount = 0;      /* Pseudo-random incrementer */


/***********************************/
/*** PUBLIC FUNCTION DEFINITIONS ***/
/***********************************/
/*
 * Initialize the random number generator.
 *
 * Since this is to be called on power up, we don't have much
 *  system randomess to work with.  Here all we use is the
 *  real-time clock.  We'll accumulate more randomness as soon
 *  as things start happening.
 */
void avRandomInit()
{
    avChurnRand(NULL, 0);
}

/*
 * Churn the randomness pool on a random event.  Call this early and often
 *  on random and semi-random system events to build randomness in time for
 *  usage.  For randomly timed events, pass a null pointer and a zero length
 *  and this will use the system timer and other sources to add randomness.
 *  If new random data is available, pass a pointer to that and it will be
 *  included.
 *
 * Ref: Applied Cryptography 2nd Ed. by Bruce Schneier p. 427
 */
void avChurnRand(char *randData, UINT randLen)
{
    MD5_CTX md5;

//  trace(LOG_INFO, "churnRand: %u@%P", randLen, randData);
    MD5Init(&md5);
    MD5Update(&md5, (u_char *)randPool, sizeof(randPool));
    if (randData)
        MD5Update(&md5, (u_char *)randData, randLen);
    else {
        struct {
            // INCLUDE fields for any system sources of randomness
            char foobar;
        } sysData;

        // Load sysData fields here.
        ;
        MD5Update(&md5, (u_char *)&sysData, sizeof(sysData));
    }
    MD5Final((u_char *)randPool, &md5);
//  trace(LOG_INFO, "churnRand: -> 0");
}

/*
 * Use the random pool to generate random data.  This degrades to pseudo
 *  random when used faster than randomness is supplied using churnRand().
 * Note: It's important that there be sufficient randomness in randPool
 *  before this is called for otherwise the range of the result may be
 *  narrow enough to make a search feasible.
 *
 * Ref: Applied Cryptography 2nd Ed. by Bruce Schneier p. 427
 *
 * XXX Why does he not just call churnRand() for each block?  Probably
 *  so that you don't ever publish the seed which could possibly help
 *  predict future values.
 * XXX Why don't we preserve md5 between blocks and just update it with
 *  randCount each time?  Probably there is a weakness but I wish that
 *  it was documented.
 */
void avGenRand(char *buf, UINT bufLen)
{
    MD5_CTX md5;
    u_char tmp[16];
    UINT n;

    while (bufLen > 0) {
        n = MIN(bufLen, RANDPOOLSZ);
        MD5Init(&md5);
        MD5Update(&md5, (u_char *)randPool, sizeof(randPool));
        MD5Update(&md5, (u_char *)&randCount, sizeof(randCount));
        MD5Final(tmp, &md5);
        randCount++;
        memcpy(buf, tmp, n);
        buf += n;
        bufLen -= n;
    }
}

/*
 * Return a new random number.
 */
ULONG avRandom()
{
    ULONG newRand;

    avGenRand((char *)&newRand, sizeof(newRand));

    return newRand;
}

#else /* MD5_SUPPORT */


char clockBuf[16];      // added by robert to make build
//extern int TM1;                // added by robert to make build
void readClk(void) { }  // added by robert to make build



/*****************************/
/*** LOCAL DATA STRUCTURES ***/
/*****************************/
static int  avRandomized = 0;       // Set when truely randomized.
static ULONG avRandomSeed = 0;      // Seed used for random number generation.


/***********************************/
/*** PUBLIC FUNCTION DEFINITIONS ***/
/***********************************/
/*
 * Initialize the random number generator.
 *
 * Here we attempt to compute a random number seed but even if
 * it isn't random, we'll randomize it later.
 *
 * The current method uses the fields from the real time clock,
 * the idle process counter, the millisecond counter, and the
 * hardware timer tick counter.  When this is invoked
 * in startup(), then the idle counter and timer values may
 * repeat after each boot and the real time clock may not be
 * operational.  Thus we call it again on the first random
 * event.
 */
void avRandomInit()
{
    /* Get a pointer into the last 4 bytes of clockBuf. */
    ULONG *lptr1 = (ULONG *)((char *)&clockBuf[3]);

    /*
     * Initialize our seed using the real-time clock, the idle
     * counter, the millisecond timer, and the hardware timer
     * tick counter.  The real-time clock and the hardware
     * tick counter are the best sources of randomness but
     * since the tick counter is only 16 bit (and truncated
     * at that), the idle counter and millisecond timer
     * (which may be small values) are added to help
     * randomize the lower 16 bits of the seed.
     */
    readClk();
//    avRandomSeed += *(ULONG *)clockBuf + *lptr1 + OSIdleCtr
//             + mtime() + ((ULONG)TM1 << 16) + TM1;
        
    /* Initialize the Borland random number generator. */
    srand((unsigned)avRandomSeed);
}

/*
 * Randomize our random seed value.  Here we use the fact that
 * this function is called at *truely random* times by the polling
 * and network functions.  Here we only get 16 bits of new random
 * value but we use the previous value to randomize the other 16
 * bits.
 */
void avRandomize(void)
{
    if (!avRandomized) {
        avRandomized = !0;
        avRandomInit();
        /* The initialization function also updates the seed. */
    } else {
//        avRandomSeed += (avRandomSeed << 16) + TM1;
    }
}

/*
 * Return a new random number.
 * Here we use the Borland rand() function to supply a pseudo random
 * number which we make truely random by combining it with our own
 * seed which is randomized by truely random events. 
 * Thus the numbers will be truely random unless there have been no
 * operator or network events in which case it will be pseudo random
 * seeded by the real time clock.
 */
ULONG avRandom()
{
    return ((((ULONG)rand() << 16) + rand()) + avRandomSeed);
}



#endif /* MD5_SUPPORT */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产你懂的| 午夜视频久久久久久| 欧美日韩一区视频| eeuss鲁一区二区三区| 极品美女销魂一区二区三区| 亚洲国产精品麻豆| 一区二区三区四区激情| 国产精品日韩精品欧美在线| 欧美大胆人体bbbb| 色伊人久久综合中文字幕| 韩国女主播一区| 无码av免费一区二区三区试看| 成人免费一区二区三区视频| 欧美国产一区在线| 国产免费久久精品| 久久精品欧美一区二区三区不卡| 日韩美女视频在线| 在线电影国产精品| 宅男噜噜噜66一区二区66| 91黄色在线观看| 在线观看www91| 在线免费观看不卡av| 99久久综合精品| 99综合电影在线视频| 不卡高清视频专区| 99这里只有精品| 色又黄又爽网站www久久| 97久久久精品综合88久久| av网站免费线看精品| 国产精品一品二品| 岛国av在线一区| 国产a视频精品免费观看| 成人一道本在线| 97se亚洲国产综合自在线观| 色综合天天综合网国产成人综合天 | 色综合久久久久久久| 色视频欧美一区二区三区| 欧美午夜不卡视频| 欧美精品成人一区二区三区四区| 3d成人动漫网站| 日韩三级精品电影久久久 | 欧美日韩激情在线| 91精品国产综合久久久久久| 欧美一级黄色录像| 久久久国产精品不卡| 国产精品视频yy9299一区| 国产精品日韩成人| 一区二区在线观看视频| 日韩va亚洲va欧美va久久| 久久机这里只有精品| 国产高清成人在线| 色狠狠综合天天综合综合| 欧美精品第1页| 久久品道一品道久久精品| 国产亚洲精品久| 中文字幕永久在线不卡| 亚洲人成精品久久久久久 | 日本不卡视频在线观看| 国产剧情一区二区| 91麻豆国产在线观看| 欧美美女一区二区| 国产日韩欧美一区二区三区乱码| 亚洲欧美欧美一区二区三区| 日韩av高清在线观看| 成人午夜视频在线| 欧美肥妇bbw| 欧美激情一区二区三区四区| 亚洲国产成人91porn| 国产宾馆实践打屁股91| 99re视频精品| 日韩手机在线导航| 中文字幕一区二区三区视频 | 麻豆久久一区二区| 91美女视频网站| 日韩免费视频一区| 亚洲久草在线视频| 国产精品中文欧美| 欧美亚洲精品一区| 国产人成亚洲第一网站在线播放| 亚洲777理论| 99热这里都是精品| 2017欧美狠狠色| 亚洲国产精品久久久久婷婷884| 国产精品乡下勾搭老头1| 欧美色窝79yyyycom| 精品国产免费一区二区三区四区| 欧美国产一区在线| 亚洲一区二区三区在线看| 国产精一区二区三区| 欧美日本在线观看| 亚洲欧洲日韩在线| 国产一区福利在线| 欧美日韩高清一区二区| 中文字幕亚洲成人| 国产一区二区三区电影在线观看| 欧美性猛交xxxx乱大交退制版| 久久久久久久久久久久电影 | 日本中文在线一区| 99re这里都是精品| 国产亲近乱来精品视频| 麻豆国产精品一区二区三区 | 欧美日韩一区小说| 亚洲精品日产精品乱码不卡| 国产福利不卡视频| 日韩亚洲欧美中文三级| 亚洲午夜影视影院在线观看| av网站免费线看精品| 欧美高清在线一区二区| 另类小说色综合网站| 欧美日韩一本到| 国产精品污污网站在线观看| 国产一区二区在线电影| 日韩一级黄色大片| 青青国产91久久久久久| 91麻豆精品91久久久久久清纯| 亚洲福利视频一区二区| 欧美在线|欧美| 亚洲精品欧美二区三区中文字幕| 99久久精品国产导航| 日本一二三不卡| 国产91丝袜在线播放九色| 久久久国际精品| 国产91在线|亚洲| 国产精品美女久久久久久2018 | 蜜桃久久av一区| 欧美一区二区三区男人的天堂| 亚洲免费观看高清完整版在线观看| 成人三级在线视频| 国产精品免费人成网站| 丁香桃色午夜亚洲一区二区三区| 久久久99免费| 粉嫩av一区二区三区在线播放 | 欧美一区二区大片| 美女爽到高潮91| 精品国产百合女同互慰| 国产精品一品二品| 国产精品国产精品国产专区不片| 成人黄色在线视频| 一区二区三区在线免费观看| 91视视频在线观看入口直接观看www| 亚洲四区在线观看| 欧美在线你懂得| 午夜精品久久久久久久久久| 欧美片网站yy| 日韩电影一区二区三区四区| 日韩一级免费观看| 高清beeg欧美| 亚洲欧洲综合另类在线| 欧美色男人天堂| 美女免费视频一区| 国产拍揄自揄精品视频麻豆| 91丨九色丨国产丨porny| 亚洲国产日产av| 日韩美女在线视频| 粉嫩aⅴ一区二区三区四区| 亚洲三级电影网站| 欧美精品丝袜久久久中文字幕| 韩国精品主播一区二区在线观看| 中文字幕乱码日本亚洲一区二区 | 日韩欧美久久久| 国产福利精品导航| 一区二区三区精品视频| 欧美一区日本一区韩国一区| 国产福利一区在线观看| 一区二区成人在线观看| 日韩精品一区二区三区在线| 成人avav影音| 337p粉嫩大胆色噜噜噜噜亚洲| 国产suv精品一区二区6| 日本欧美一区二区| 一区二区三区高清| 欧美激情一区二区三区| 日韩一区二区在线观看视频| 91久久精品网| av一区二区三区| 国产精品一二三四| 美女视频免费一区| 亚洲国产综合91精品麻豆| 亚洲国产精品成人综合色在线婷婷| 日韩无一区二区| 欧美日韩在线播| 在线免费视频一区二区| 不卡一二三区首页| 国产成人亚洲综合色影视| 毛片不卡一区二区| 日日欢夜夜爽一区| 亚洲午夜免费福利视频| 亚洲精品视频在线观看免费| 国产精品理论片在线观看| 久久综合一区二区| 精品国产乱码久久久久久1区2区| 欧美一区二区精品| 欧美日韩精品综合在线| 在线免费亚洲电影| 色国产综合视频| 色av成人天堂桃色av| 色妞www精品视频| 91亚洲精品一区二区乱码| 成人激情校园春色| 成人精品视频一区|