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

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

?? ibecacheimpl.c

?? IBE是一種非對稱密碼技術
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* Copyright 2005-2006, Voltage Security, all rights reserved.
 */
#include "vibecrypto.h"
#include "environment.h"
#include "base.h"
#include "libctx.h"
#include "ibecache.h"
#include "ibe.h"
#include "mpint.h"
#include "ictk.h"
#include "errorctx.h"

/* The entry contains a bfCtx. Build the byte array that is the
 * element. Place the allocated byte array into the element VtItem in
 * the entry.
 *
 * @param ctx
 * @param cache
 * @param entry The entry containing the bfCtx.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV VoltBuildCacheElementBF VOLT_PROTO_LIST ((
   VoltIBECacheCtx *ctx,
   VoltIBELocalCache *cache,
   VoltIBECacheEntry *entry,
   unsigned char *element,
   unsigned int bufferSize,
   unsigned int *elementLen
));

/* The entry contains a bbCtx. Build the byte array that is the
 * element. Place the allocated byte array into the element VtItem in
 * the entry.
 *
 * @param ctx
 * @param cache
 * @param entry The entry containing the bbCtx.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV VoltBuildCacheElementBB VOLT_PROTO_LIST ((
   VoltIBECacheCtx *ctx,
   VoltIBELocalCache *cache,
   VoltIBECacheEntry *entry,
   unsigned char *element,
   unsigned int bufferSize,
   unsigned int *elementLen
));

/* Write an integer to the buffer.
 * <p>This function does no argument checking, so don't make any
 * mistakes in calling. For example, make sure the buffer is allocated
 * and big enough and make sure the byteCount is valid (not 0 and not
 * larger than the buffer, it should be 2 or 4, maybe in the future it
 * can be 8).
 * <p>It will write the low byteCount bytes of value.
 * <p>It will prepend 00 bytes if necessary.
 * <p>It will place the bytes in "big endian".
 * <pre>
 * <code>
 *    PlaceIntegerBE (buffer, 0x11223344, 4);
 *      places 4 bytes into buffer
 *      11 22 33 44
 *
 *    PlaceIntegerBE (buffer, 0x11223344, 2);
 *      places 2 bytes into buffer
 *      33 44
 *
 *    PlaceIntegerBE (buffer, 0x3344, 4);
 *      places 4 bytes into buffer
 *      00 00 33 44
 * </code>
 * </pre>
 */
static void VOLT_CALLING_CONV PlaceIntegerBE VOLT_PROTO_LIST ((
   unsigned char *buffer,
   unsigned int value,
   unsigned int byteCount
));

/* Get the integer in the buffer. The function will do no argument
 * checking, so make sure the buffer is valid and there are enough
 * bytes to extract an integer.
 * <p>The funtion will collect the integerSize bytes at buffer and
 * convert them into an unsigned int, returning that result.
 * <p>It will convert the number from big endian.
 * <p>NOTE! The return value is not an error code (status), but the
 * value computed.
 */
static unsigned int VOLT_CALLING_CONV GetIntegerBE VOLT_PROTO_LIST ((
   unsigned char *buffer,
   unsigned int integerSize
));

/* If zValue is not NULL, place that value. If it is NULL, place the
 * inputBuffer.
 * <p>This function does no argument checking, so don't make any
 * mistakes in calling. For example, make sure the buffer is allocated
 * and big enough and make sure the inputLen is valid (notlarger than
 * the buffer).
 * <p>The return is NOT an error code (status), it is the number of
 * bytes placed into the buffer.
 */
static unsigned int VOLT_CALLING_CONV PlaceBuffer VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   z_t *zValue,
   unsigned char *inputBuffer,
   unsigned int inputLen,
   unsigned int size,
   unsigned char *outputBuffer
));

/* Given the element (the size already checks out), build the bfCtx.
 * <p>This function creates a new bfCtx.
 */
static int VOLT_CALLING_CONV BuildBfCtxFromCacheEntry VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VoltMpIntCtx *mpCtx,
   unsigned int primeLen,
   unsigned int subprimeLen,
   unsigned int accelCount,
   unsigned char *element,
   bf_context_t **bfCtx
));

/* Given the element (the size already checks out), build the bbCtx.
 * <p>This function creates a new bbCtx.
 */
static int VOLT_CALLING_CONV BuildBbCtxFromCacheEntry VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VoltMpIntCtx *mpCtx,
   unsigned int primeLen,
   unsigned int subprimeLen,
   unsigned int accelCount,
   unsigned char *element,
   bb1_context_t **bbCtx
));

int VoltAddBfCtxToCache (
   Pointer ibeCacheCtx,
   unsigned int flag,
   Pointer theCtx
   )
{
  int status, status2;
  int lockAcquired = 0;
  unsigned int refLen;
  unsigned char *refBuf = (unsigned char *)0;
  VoltIBECacheCtx *ctx = (VoltIBECacheCtx *)ibeCacheCtx;
  VoltLibCtx *libCtx = (VoltLibCtx *)(ctx->voltObject.libraryCtx);
  VoltIBELocalCache *cache = (VoltIBELocalCache *)(ctx->localCtx);
  VtBFType1IBEParamInfo *bfParams = (VtBFType1IBEParamInfo *)0;
  VtBBType1IBEParamInfo *bbParams = (VtBBType1IBEParamInfo *)0;
  VoltIBECacheEntry *entry = (VoltIBECacheEntry *)0;
  VoltIBECacheEntry *nextEntry;
  VoltIBECacheEntry *newEntry = (VoltIBECacheEntry *)0;
  VOLT_DECLARE_ERROR_TYPE (errorType)
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  do
  {
    VOLT_SET_ERROR_TYPE (errorType, 0)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = ctx->LockIBECache(ibeCacheCtx);
    if (status != 0)
      break;
    
    lockAcquired = 1;
    
    /* Find the last entry. While we're looking, check to see if this
     * ctx is already in the cache. If so, we don't need to do anything.
     */
    status = 0;
    nextEntry = cache->cacheList;
    while (nextEntry != (VoltIBECacheEntry *)0)
    {
      entry = nextEntry;
      if ( (entry->ctxType == flag) && (entry->theCtx == theCtx) )
        break;

      nextEntry = (VoltIBECacheEntry *)(entry->nextEntry);
    }

    /* If nextEntry is not NULL, we broke out early because we found a
     * match. The ctx has already been added.
     */
    if (nextEntry != (VoltIBECacheEntry *)0)
      break;

    /* Get the parameter set to build the reference.
     */
    if (flag == VOLT_IBE_CTX_TYPE_BF)
    {
      VOLT_SET_ERROR_TYPE (errorType, 0)
      VOLT_SET_FNCT_LINE (fnctLine)
      status = VoltBuildIBEParamsFromBfCtx (
        libCtx, (bf_context_t *)theCtx, &bfParams);
      if (status != 0)
        break;
    }
    else
    {
      VOLT_SET_ERROR_TYPE (errorType, 0)
      VOLT_SET_FNCT_LINE (fnctLine)
      status = VoltBuildIBEParamsFromBbCtx (
        libCtx, (bb1_context_t *)theCtx, &bbParams);
      if (status != 0)
        break;
    }

    VOLT_SET_FNCT_LINE (fnctLine)
    status = VoltBuildIBECacheRefAlloc (
      libCtx, bfParams, bbParams, &refBuf, &refLen);
    if (status != 0)
      break;

    /* Create a new entry.
     */
    VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_MEMORY;
    newEntry = (VoltIBECacheEntry *)Z2Malloc (
      sizeof (VoltIBECacheEntry), 0);
    if (newEntry == (VoltIBECacheEntry *)0)
      break;
    Z2Memset (newEntry, 0, sizeof (VoltIBECacheEntry));

    newEntry->referenceCount = 1;
    newEntry->ctxType = flag;
    newEntry->reference.data = refBuf;
    newEntry->reference.len = refLen;
    newEntry->theCtx = theCtx;
    newEntry->previousEntry = (Pointer)entry;

    /* If there is a previous entry, set the newEntry as the previous
     * entry's next. If not, this newEntry is the first.
     */
    if (entry != (VoltIBECacheEntry *)0)
      entry->nextEntry = (Pointer)newEntry;
    else
      cache->cacheList = newEntry;

    cache->count++;

    status = 0;

  } while (0);

  VoltDemolishIBEParams (libCtx, &bfParams);
  VoltDemolishBBIBEParams (libCtx, &bbParams);

  if (lockAcquired)
  {
    status2 = ctx->UnlockIBECache(ibeCacheCtx);
    if (status == 0)
    {
      VOLT_SET_ERROR_TYPE (errorType, 0)
      VOLT_SET_FNCT_LINE (fnctLine)
      status = status2;
    }
  }
  
  if (status == 0)
    return (0);

  if (refBuf != (unsigned char *)0)
    Z2Free (refBuf);
  if (newEntry != (VoltIBECacheEntry *)0)
    Z2Free (newEntry);

  VOLT_LOG_ERROR_INFO (
    0, ibeCacheCtx, status, 0, errorType,
    (char *)0, "VoltAddBfCtxToCache", fnctLine, (char *)0)

  return (status);
}

int VoltSearchCacheForBfCtx (
   Pointer ibeCacheCtx,
   unsigned int flag,
   unsigned char *reference,
   unsigned int referenceLen,
   Pointer *theCtx
   )
{
  int status = 0;
  int status2;
  int lockAcquired = 0;
  unsigned int primeLen, offset, match;
  VoltIBECacheCtx *ctx = (VoltIBECacheCtx *)ibeCacheCtx;
  VoltLibCtx *libCtx = (VoltLibCtx *)(ctx->voltObject.libraryCtx);
  VoltIBELocalCache *cache = (VoltIBELocalCache *)(ctx->localCtx);
  VoltIBECacheEntry *entry;
  VoltIBECacheEntry *nextEntry;
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  do
  {
    /* Initialize the return to NULL, if we find something, we'll set it.
    */
    *theCtx = (Pointer)0;
    if ( (reference == (unsigned char *)0) || (referenceLen == 0) )
      break;

    /* Acquire the cache lock to syncronize access */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = ctx->LockIBECache(ibeCacheCtx);
    if (status != 0)
      break;
    
    lockAcquired = 1;
    
    /* Run through the entry link list. If we find a match with the
    * reference, return the ctx.
    */
    nextEntry = cache->cacheList;
    while (nextEntry != (VoltIBECacheEntry *)0)
    {
      match = 0;
      entry = nextEntry;
      nextEntry = (VoltIBECacheEntry *)(entry->nextEntry);
      if (entry->ctxType != flag)
        continue;
      if (entry->reference.len != referenceLen)
        continue;

      /* Make sure we get at least one coordinate from each point (one
      * coordinate from one point or two coordinates from one point is
      * not enough). Set the 1 bit of match if there's a coordinate from
      * the first two reference values. Set the 2 bit if there's a
      * coordinate from rht second two. If both bits are set after the
      * compares, we have a match.
      */
      primeLen = referenceLen >> 2;
      if ( (entry->reference.data[0] != 0) && (reference[0] != 0) )
      {
        if (Z2Memcmp (entry->reference.data, reference, primeLen) != 0)
          continue;
        match |= 1;
      }
      offset = primeLen;
      if ( (entry->reference.data[offset] != 0) && (reference[offset] != 0) )
      {
        if (Z2Memcmp (
          entry->reference.data + offset, reference + offset, primeLen) != 0)
          continue;
        match |= 1;
      }
      offset += primeLen;
      if ( (entry->reference.data[offset] != 0) && (reference[offset] != 0) )
      {
        if (Z2Memcmp (
          entry->reference.data + offset, reference + offset, primeLen) != 0)
          continue;
        match |= 2;
      }
      offset += primeLen;
      if ( (entry->reference.data[offset] != 0) && (reference[offset] != 0) )
      {
        if (Z2Memcmp (
          entry->reference.data + offset, reference + offset, primeLen) != 0)
          continue;
        match |= 2;
      }

      if (match != 3)
        continue;

      /* The reference matched, set theCtx to this entry's ctx and quit
      * looking.
      * Also, increment this entry's counter, indicating someone is
      * using this ctx.
      */
      *theCtx = entry->theCtx;
      entry->referenceCount++;
      break;
    }
  } while (0);
  
  if (lockAcquired)
  {
    status2 = ctx->UnlockIBECache(ibeCacheCtx);
    if (status == 0)
    {
      VOLT_SET_FNCT_LINE (fnctLine)
      status = status2;
    }
  }

  VOLT_LOG_ERROR_INFO_COMPARE (
    status, 0, ibeCacheCtx, status, 0, 0,
    (char *)0, "VoltSearchCacheForBfCtx", fnctLine, (char *)0)

  return (status);
}

int VoltReleaseBfCtxFromCache (
   Pointer ibeCacheCtx,
   Pointer *theCtx
   )
{
  int status, status2;
  int lockAcquired = 0;
  VoltIBECacheCtx *ctx = (VoltIBECacheCtx *)ibeCacheCtx;
  VoltIBELocalCache *cache = (VoltIBELocalCache *)(ctx->localCtx);
  VoltIBECacheEntry *entry;
  VoltIBECacheEntry *nextEntry;
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  do
  {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费在线观看日韩欧美| 成人福利视频网站| 国产盗摄一区二区| 色久优优欧美色久优优| 日韩限制级电影在线观看| 国产欧美一区二区精品忘忧草| 亚洲女同ⅹxx女同tv| 蜜桃91丨九色丨蝌蚪91桃色| 91亚洲午夜精品久久久久久| 精品国产乱码久久久久久影片| 亚洲综合免费观看高清完整版| 国产一区视频在线看| 欧美视频在线一区| 亚洲天堂av老司机| 国产精品一区二区果冻传媒| 欧美一二区视频| 亚洲综合区在线| 91免费视频网| 欧美韩国日本一区| 国产精品一区二区在线观看不卡 | 另类小说视频一区二区| 成人av网站大全| 精品国精品自拍自在线| 婷婷综合五月天| 一本到高清视频免费精品| 国产视频一区在线观看| 奇米精品一区二区三区四区| 欧美亚洲国产一区二区三区| 日韩一区日韩二区| youjizz久久| 欧美激情资源网| 国产91精品一区二区麻豆亚洲| 精品国产91九色蝌蚪| 久久精品国产亚洲高清剧情介绍| 欧美精选在线播放| 视频在线观看一区| 欧美剧在线免费观看网站 | 日韩精品成人一区二区在线| 99视频超级精品| 亚洲欧美另类久久久精品| 99国产麻豆精品| 中文字幕欧美一| 91丨九色丨黑人外教| 亚洲男人电影天堂| 色久优优欧美色久优优| 亚洲最大成人网4388xx| 欧美在线不卡一区| 亚洲一二三专区| 欧美精品久久99久久在免费线 | 97精品久久久午夜一区二区三区| 中文乱码免费一区二区| 99国产精品久久久久久久久久 | 中文字幕不卡三区| 成人黄色电影在线| 一区二区三区在线不卡| 欧美日韩日日骚| 卡一卡二国产精品| 国产欧美精品一区二区三区四区| av电影在线观看一区| 一二三区精品福利视频| 91.成人天堂一区| 国产一区二区三区最好精华液| 国产欧美日韩精品在线| 91高清在线观看| 精品一区二区免费| 136国产福利精品导航| 欧美日韩一区二区在线视频| 捆绑紧缚一区二区三区视频| 中文字幕中文乱码欧美一区二区| 欧美色窝79yyyycom| 激情六月婷婷综合| 亚洲精品视频在线| 日韩欧美第一区| 99国产精品国产精品久久| 日韩二区三区四区| 国产欧美一区视频| 在线观看网站黄不卡| 狠狠色丁香婷婷综合| 一区二区三区在线播放| 国产午夜三级一区二区三| 色88888久久久久久影院野外| 九九视频精品免费| 亚洲精品欧美二区三区中文字幕| 欧美xxxxxxxxx| 91国偷自产一区二区开放时间| 极品美女销魂一区二区三区 | 国产亚洲一区二区三区在线观看| 色哟哟欧美精品| 国产一区视频导航| 午夜精品福利视频网站| 国产精品人成在线观看免费| 欧美一区二区二区| 色婷婷av一区二区三区大白胸| 国产成人av电影在线| 蜜臀av性久久久久av蜜臀妖精 | 国产欧美一区二区在线观看| 欧美福利视频导航| 欧洲一区在线观看| 不卡的电影网站| 国产毛片精品视频| 蜜臀av性久久久久av蜜臀妖精| 一区二区三区高清在线| 国产区在线观看成人精品| 久久影院电视剧免费观看| 制服丝袜亚洲精品中文字幕| 91丝袜呻吟高潮美腿白嫩在线观看| 国产精品一区二区男女羞羞无遮挡| 亚洲h动漫在线| 一区二区三区在线免费播放| 国产精品区一区二区三| 国产日韩欧美一区二区三区综合| 日韩欧美激情四射| 7777精品伊人久久久大香线蕉 | 久久久久国产精品人| 日韩免费一区二区三区在线播放| 欧美日韩在线三级| 欧美色欧美亚洲另类二区| 色综合天天综合网天天看片| 成人短视频下载| 91免费在线视频观看| 97aⅴ精品视频一二三区| 成人av网站在线观看| 成人av综合在线| 97aⅴ精品视频一二三区| 色婷婷av一区二区三区大白胸| 色吊一区二区三区| 在线看日本不卡| 欧美日韩国产精品自在自线| 欧美精品一二三| 777xxx欧美| www一区二区| 国产精品欧美经典| 一区二区三区在线视频观看| 亚洲一二三区在线观看| 亚洲成人免费av| 日本欧美一区二区在线观看| 极品少妇xxxx偷拍精品少妇| 国产成人综合在线观看| 99天天综合性| 欧美精品一卡二卡| 久久久高清一区二区三区| 亚洲国产成人午夜在线一区| 一区二区三区色| 日本不卡在线视频| 国产精品一区二区三区99| 不卡电影免费在线播放一区| 欧美日韩久久久久久| 欧美不卡一区二区三区四区| 国产嫩草影院久久久久| 夜夜嗨av一区二区三区网页| 免费看日韩精品| 波多野结衣欧美| 欧美三级日本三级少妇99| 久久婷婷国产综合国色天香| 亚洲欧美一区二区三区孕妇| 奇米在线7777在线精品| 国产不卡视频在线播放| 欧美视频精品在线观看| 国产三级三级三级精品8ⅰ区| 一区二区三区高清| 国产成人自拍网| 欧美日韩美女一区二区| 中文字幕中文乱码欧美一区二区 | 欧美在线一区二区| 精品福利二区三区| 一区二区三区欧美| 国产综合色产在线精品| 欧美午夜电影网| 欧美国产视频在线| 日韩经典一区二区| 99久久精品国产一区| 精品卡一卡二卡三卡四在线| 亚洲精品欧美二区三区中文字幕| 国产乱国产乱300精品| 欧美亚洲动漫精品| 亚洲欧洲另类国产综合| 国产一区二区精品久久99| 欧美性一二三区| 国产精品国产精品国产专区不片| 青青草97国产精品免费观看| 在线中文字幕一区| 国产精品三级av在线播放| 国产一区二区三区av电影 | 91伊人久久大香线蕉| 日韩你懂的在线播放| 日韩二区三区四区| 欧美日韩精品一二三区| 亚洲自拍欧美精品| 91在线视频播放地址| 中文字幕二三区不卡| 国产精品66部| 国产情人综合久久777777| 久久99精品国产.久久久久久| 91麻豆精品国产自产在线观看一区 | 欧美日韩久久久| 亚洲bt欧美bt精品777| 日本精品一区二区三区四区的功能| 国产女主播一区| 成人免费的视频| 国产精品毛片a∨一区二区三区|