亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美精品第1页| 最新中文字幕一区二区三区| 欧美日韩成人在线一区| 欧美体内she精高潮| 在线免费亚洲电影| 欧美午夜一区二区三区免费大片| 91成人在线观看喷潮| 色综合久久精品| 欧美最猛性xxxxx直播| 欧美日韩一级二级| 91精品综合久久久久久| 91精品国产手机| 日韩无一区二区| 精品成人免费观看| 国产亚洲成年网址在线观看| 国产清纯在线一区二区www| 亚洲国产激情av| 亚洲色大成网站www久久九九| 亚洲精品中文字幕在线观看| 亚洲午夜精品网| 日韩精品欧美精品| 久久国产夜色精品鲁鲁99| 国产精品911| 91麻豆国产在线观看| 欧美视频日韩视频在线观看| 欧美日本乱大交xxxxx| 欧美一区二区女人| 久久久久久久久久久久久女国产乱| 欧美极品少妇xxxxⅹ高跟鞋 | 国产精品乱子久久久久| 欧美高清在线一区二区| 一区二区三区在线免费| 午夜欧美在线一二页| 蜜桃av一区二区在线观看| 国产suv精品一区二区三区| 99精品视频中文字幕| 色婷婷综合久久久久中文一区二区| 欧美亚洲动漫精品| 日韩精品一区二区三区视频播放| 26uuu色噜噜精品一区| 国产精品嫩草影院com| 亚洲高清免费视频| 国产精品中文字幕日韩精品 | av在线这里只有精品| 岛国一区二区三区| 欧美精品久久一区| 国产精品日日摸夜夜摸av| 亚洲成人一二三| 国产成人av电影在线观看| 欧洲色大大久久| 精品国产自在久精品国产| 亚洲免费在线看| 九色|91porny| 欧美手机在线视频| 久久精品视频一区| 亚洲国产日韩a在线播放| 激情图区综合网| 91成人在线免费观看| 欧美精品一区二区久久婷婷| 一级精品视频在线观看宜春院 | 欧美三级一区二区| 国产女同性恋一区二区| 日韩精品视频网站| 91一区在线观看| 2021中文字幕一区亚洲| 香蕉成人啪国产精品视频综合网| 国产精品一区二区久久精品爱涩| 欧美性猛交xxxx黑人交| 中文字幕电影一区| 精品一区二区三区不卡| 欧美另类变人与禽xxxxx| 中文av一区二区| 精品一区二区免费在线观看| 欧美日韩国产系列| 综合自拍亚洲综合图不卡区| 国产真实乱子伦精品视频| 欧美日韩成人在线| 亚洲精品中文字幕乱码三区 | 久久久久久久精| 奇米影视在线99精品| 欧美天堂一区二区三区| 亚洲色欲色欲www在线观看| 国产精品99久久久| 日韩免费观看高清完整版在线观看| 亚洲午夜在线电影| 色婷婷av一区| 亚洲视频 欧洲视频| 国产成人无遮挡在线视频| 欧美成va人片在线观看| 欧美bbbbb| 欧美精品日韩一区| 午夜精品成人在线| 欧美午夜一区二区三区免费大片| 亚洲视频1区2区| 91欧美一区二区| 亚洲丝袜另类动漫二区| 成人久久视频在线观看| 欧美国产欧美亚州国产日韩mv天天看完整| 精品99999| 精品一区二区三区影院在线午夜| 日韩一区二区免费视频| 蜜臀va亚洲va欧美va天堂| 欧美一区二区三区在线观看 | 色婷婷综合久久久久中文| 国产精品成人免费| 9色porny自拍视频一区二区| 国产精品欧美极品| a美女胸又www黄视频久久| 亚洲欧洲成人av每日更新| 99久久久无码国产精品| 日韩一区有码在线| 一本在线高清不卡dvd| 尤物视频一区二区| 欧美日精品一区视频| 亚洲一区二区在线免费观看视频 | 欧美少妇bbb| 亚洲一区二区在线播放相泽| 欧美日韩亚洲国产综合| 奇米精品一区二区三区在线观看| 日韩欧美的一区二区| 国产二区国产一区在线观看| 国产精品日产欧美久久久久| 91美女在线视频| 亚洲电影第三页| 欧美不卡一二三| 国产福利一区二区三区视频| 国产精品卡一卡二卡三| 日本国产一区二区| 秋霞国产午夜精品免费视频| 久久久久亚洲综合| 99精品视频在线观看免费| 亚洲综合久久av| 欧美成人精品高清在线播放| 粉嫩aⅴ一区二区三区四区五区 | 国产一区二区三区在线观看免费| 国产亚洲1区2区3区| 在线中文字幕不卡| 免费欧美在线视频| 中国av一区二区三区| 欧美日韩一区二区不卡| 狠狠色丁香久久婷婷综合_中| 国产精品色哟哟| 欧美日韩国产精品成人| 国产精品123| 亚洲午夜免费电影| 日韩欧美高清dvd碟片| 9久草视频在线视频精品| 五月天视频一区| 国产欧美一区二区精品性色| 在线视频欧美区| 国产精品自产自拍| 99精品欧美一区二区三区综合在线| 中文字幕一区二区三区蜜月| 欧美精品一二三| 国产乱子轮精品视频| 18成人在线视频| 日韩一级欧美一级| 91色综合久久久久婷婷| 老汉av免费一区二区三区| 亚洲丝袜精品丝袜在线| 精品久久国产老人久久综合| 在线视频亚洲一区| 国产精品1区2区| 午夜伊人狠狠久久| 亚洲国产精品ⅴa在线观看| 欧美一区二区三区在| 91麻豆精品在线观看| 国产一区二区三区美女| 亚洲韩国精品一区| 国产精品国产精品国产专区不片| 91精品久久久久久久91蜜桃| 色综合天天性综合| 日韩国产一区二| 欧美一级生活片| 91亚洲精品久久久蜜桃| 国产乱子伦一区二区三区国色天香| 亚洲狠狠爱一区二区三区| 国产精品青草久久| 久久综合久久鬼色| 欧美日韩高清不卡| 日本韩国视频一区二区| 成人精品免费看| 韩国精品在线观看| 视频一区中文字幕| 亚洲第一主播视频| 亚洲三级在线播放| 中文字幕av在线一区二区三区| 精品久久国产字幕高潮| 日韩一区二区在线观看| 欧美性做爰猛烈叫床潮| 99久久国产综合精品色伊| 国产福利视频一区二区三区| 麻豆国产欧美一区二区三区| 亚洲成人av福利| 亚洲激情图片qvod| 一区二区在线免费观看| 亚洲三级在线免费观看| 一色桃子久久精品亚洲| 99精品久久只有精品| 国产九九视频一区二区三区|