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

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

?? gmpwrap.c

?? IBE是一種非對(duì)稱密碼技術(shù)
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  /* Check the arguments.
   * If NULL, can't log, no libCtx.
   */
  if (theInt == (VoltMpInt *)0)
    return (VT_ERROR_NULL_ARG);

  VOLT_SET_FNCT_LINE (fnctLine)
  if (bitLen != (unsigned int *)0)
  {
    /* How big is the integer?
     */
    *bitLen = (unsigned int)mpz_sizeinbase ((mpz_ptr)(theInt->mpInt), 2);
    return (0);
  }

  VOLT_LOG_ERROR (
    theInt->mpCtx->voltObject.libraryCtx, VT_ERROR_NULL_ARG,
    VT_ERROR_TYPE_PRIMARY, fnctLine, "GMPWrapGetBitLength", (char *)0)

  return (VT_ERROR_NULL_ARG);
}

int GMPWrapSetBit (
   VoltMpInt *theInt,
   unsigned int bitIndex,
   unsigned int value
   )
{
  /* Check the arguments.
   * If NULL, can't log, no libCtx.
   */
  if (theInt == (VoltMpInt *)0)
    return (VT_ERROR_NULL_ARG);

  if (value != 0)
  {
    mpz_setbit ((mpz_ptr)(theInt->mpInt), bitIndex);
    return (0);
  }
  mpz_clrbit ((mpz_ptr)(theInt->mpInt), bitIndex);

  return (0);
}

int GMPWrapGetBit (
   VoltMpInt *theInt,
   unsigned int bitIndex,
   unsigned int *value
   )
{
  int status;
  unsigned int bitLen;
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  /* Check the arguments.
   * If NULL, can't log, no libCtx.
   */
  if (theInt == (VoltMpInt *)0)
    return (VT_ERROR_NULL_ARG);

  do
  {
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_NULL_ARG;
    if (value == (unsigned int *)0)
      break;
    status = 0;

    /* How big is the integer?
     */
    bitLen = (unsigned int)mpz_sizeinbase ((mpz_ptr)(theInt->mpInt), 2);

    /* If the index requested is beyond the end, set the value to 0.
     * We could return VT_ERROR_MP_INT_RANGE, but it is true that the
     * bit is 0. (Think of the decimal number 3,142, it is 03,142).
     */
    *value = 0;
    if (bitIndex >= bitLen)
      break;

    *value = (unsigned int)mpz_tstbit ((mpz_ptr)(theInt->mpInt), bitIndex);

  } while (0);

  VOLT_LOG_ERROR_COMPARE (
    status, theInt->mpCtx->voltObject.libraryCtx, status,
    VT_ERROR_TYPE_PRIMARY, fnctLine, "GMPWrapGetBit", (char *)0)

  return (status);
}

int GMPWrapShiftLeftBits (
   VoltMpInt *theInt,
   unsigned int shiftCount
   )
{
  /* Check the arguments.
   * If NULL, can't log, no libCtx.
   */
  if (theInt == (VoltMpInt *)0)
    return (VT_ERROR_NULL_ARG);

  mpz_mul_2exp (
    (mpz_ptr)(theInt->mpInt), (mpz_ptr)(theInt->mpInt), shiftCount);

  return (0);
}

int GMPWrapShiftRightBits (
   VoltMpInt *theInt,
   unsigned int shiftCount
   )
{
  /* Check the arguments.
   * If NULL, can't log, no libCtx.
   */
  if (theInt == (VoltMpInt *)0)
    return (VT_ERROR_NULL_ARG);

  mpz_tdiv_q_2exp (
    (mpz_ptr)(theInt->mpInt), (mpz_ptr)(theInt->mpInt), shiftCount);

  return (0);
}

int GMPWrapSubtract (
   VoltMpInt *minuend,
   VoltMpInt *subtrahend,
   VoltMpInt *difference
   )
{
  /* Check the arguments.
   * If NULL, can't log, no libCtx.
   * We could check for one NULL, the other not, but this is the kind
   * of error an app expects not to log.
   */
  if ( (minuend == (VoltMpInt *)0) ||
       (subtrahend == (VoltMpInt *)0) ||
       (difference == (VoltMpInt *)0) )
    return (VT_ERROR_NULL_ARG);

  mpz_sub (
    (mpz_ptr)(difference->mpInt), (mpz_ptr)(minuend->mpInt),
    (mpz_ptr)(subtrahend->mpInt));

  return (0);
}

int GMPWrapAdd (
   VoltMpInt *addend1,
   VoltMpInt *addend2,
   VoltMpInt *sum
   )
{
  /* Check the arguments.
   * If NULL, can't log, no libCtx.
   * We could check for one NULL, the other not, but this is the kind
   * of error an app expects not to log.
   */
  if ( (addend1 == (VoltMpInt *)0) ||
       (addend2 == (VoltMpInt *)0) ||
       (sum == (VoltMpInt *)0) )
    return (VT_ERROR_NULL_ARG);

  mpz_add (
    (mpz_ptr)(sum->mpInt), (mpz_ptr)(addend1->mpInt),
    (mpz_ptr)(addend2->mpInt));

  return (0);
}

int GMPWrapMultiply (
   VoltMpInt *multiplicand,
   VoltMpInt *multiplier,
   VoltMpInt *product
   )
{
  /* Check the arguments.
   * If NULL, can't log, no libCtx.
   * We could check for one NULL, the other not, but this is the kind
   * of error an app expects not to log.
   */
  if ( (multiplicand == (VoltMpInt *)0) ||
       (multiplier == (VoltMpInt *)0) ||
       (product == (VoltMpInt *)0) )
    return (VT_ERROR_NULL_ARG);

  mpz_mul (
    (mpz_ptr)(product->mpInt), (mpz_ptr)(multiplicand->mpInt),
    (mpz_ptr)(multiplier->mpInt));

  return (0);
}

int GMPWrapSquare (
   VoltMpInt *operand,
   VoltMpInt *product
   )
{
  /* Check the arguments.
   * If NULL, can't log, no libCtx.
   * We could check for one NULL, the other not, but this is the kind
   * of error an app expects not to log.
   */
  if ( (operand == (VoltMpInt *)0) ||
       (product == (VoltMpInt *)0) )
    return (VT_ERROR_NULL_ARG);

  mpz_mul (
    (mpz_ptr)(product->mpInt), (mpz_ptr)(operand->mpInt),
    (mpz_ptr)(operand->mpInt));

  return (0);
}

int GMPWrapDivide (
   VoltMpInt *dividend,
   VoltMpInt *divisor,
   VoltMpInt *quotient,
   VoltMpInt *remainder
   )
{
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  /* Check the arguments.
   * If NULL, can't log, no libCtx.
   * We could check for one NULL, the other not, but this is the kind
   * of error an app expects not to log.
   */
  if ( (dividend == (VoltMpInt *)0) ||
       (divisor == (VoltMpInt *)0) ||
       (quotient == (VoltMpInt *)0) ||
       (remainder == (VoltMpInt *)0) ) 
    return (VT_ERROR_NULL_ARG);

  /* Can't divide by zero. So check to see that the divisor is not 0.
   */
  VOLT_SET_FNCT_LINE (fnctLine)
  if (mpz_sgn ((mpz_ptr)(divisor->mpInt)) != 0)
  {
    mpz_tdiv_qr (
      (mpz_ptr)(quotient->mpInt), (mpz_ptr)(remainder->mpInt),
      (mpz_ptr)(dividend->mpInt), (mpz_ptr)(divisor->mpInt));

    return (0);
  }

  VOLT_LOG_ERROR (
    divisor->mpCtx->voltObject.libraryCtx, VT_ERROR_DIVIDE_BY_ZERO,
    VT_ERROR_TYPE_PRIMARY, fnctLine, "GMPWrapDivide", (char *)0)

  return (VT_ERROR_DIVIDE_BY_ZERO);
}

int GMPWrapGCD (
   VoltMpInt *operand1,
   VoltMpInt *operand2,
   VoltMpInt *result
   )
{
  /* Check the arguments.
   * If NULL, can't log, no libCtx.
   * We could check for one NULL, the other not, but this is the kind
   * of error an app expects not to log.
   */
  if ( (operand1 == (VoltMpInt *)0) ||
       (operand2 == (VoltMpInt *)0) ||
       (result == (VoltMpInt *)0) )
    return (VT_ERROR_NULL_ARG);

  mpz_gcd (
    (mpz_ptr)(result->mpInt), (mpz_ptr)(operand1->mpInt),
    (mpz_ptr)(operand2->mpInt));

  return (0);
}

int GMPWrapModReduce (
   VoltMpInt *operand,
   VoltMpInt *modulus,
   VoltMpInt *result
   )
{
  /* Check the arguments.
   * If NULL, can't log, no libCtx.
   * We could check for one NULL, the other not, but this is the kind
   * of error an app expects not to log.
   */
  if ( (operand == (VoltMpInt *)0) ||
       (modulus == (VoltMpInt *)0) ||
       (result == (VoltMpInt *)0) )
    return (VT_ERROR_NULL_ARG);

  mpz_mod (
    (mpz_ptr)(result->mpInt), (mpz_ptr)(operand->mpInt),
    (mpz_ptr)(modulus->mpInt));

  return (0);
}

int GMPWrapModInvert (
   VoltMpInt *operand,
   VoltMpInt *modulus,
   VoltMpInt *result
   )
{
  int gmpRes;
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  /* Check the arguments.
   * If NULL, can't log, no libCtx.
   * We could check for one NULL, the other not, but this is the kind
   * of error an app expects not to log.
   */
  if ( (operand == (VoltMpInt *)0) ||
       (modulus == (VoltMpInt *)0) ||
       (result == (VoltMpInt *)0) )
    return (VT_ERROR_NULL_ARG);

  VOLT_SET_FNCT_LINE (fnctLine)
  gmpRes = mpz_invert (
    (mpz_ptr)(result->mpInt), (mpz_ptr)(operand->mpInt),
    (mpz_ptr)(modulus->mpInt));

  /* The GMP mod invert returns non-zero for success.
   */
  if (gmpRes != 0)
    return (0);

  /* There is no inverse for the operand.
   */
  VOLT_LOG_ERROR (
    operand->mpCtx->voltObject.libraryCtx, VT_ERROR_NO_INVERSE,
    VT_ERROR_TYPE_PRIMARY, fnctLine, "GMPWrapModInvert", (char *)0)

  return (VT_ERROR_NO_INVERSE);
}

int GMPWrapModExp (
   VoltMpInt *base,
   VoltMpInt *exponent,
   VoltMpInt *modulus,
   VoltMpInt *result
   )
{
  /* Check the arguments.
   * If NULL, can't log, no libCtx.
   * We could check for one NULL, the other not, but this is the kind
   * of error an app expects not to log.
   */
  if ( (base == (VoltMpInt *)0) ||
       (exponent == (VoltMpInt *)0) ||
       (modulus == (VoltMpInt *)0) ||
       (result == (VoltMpInt *)0) ) 
    return (VT_ERROR_NULL_ARG);

  mpz_powm (
    (mpz_ptr)(result->mpInt), (mpz_ptr)(base->mpInt),
    (mpz_ptr)(exponent->mpInt), (mpz_ptr)(modulus->mpInt));

  return (0);
}

#ifdef _WINCE
#pragma optimize( "g", off )
#endif

int GMPWrapGeneratePrime (
   unsigned int primeSizeBits,
   VtRandomObject random,
   unsigned char *SEED,
   unsigned int bufferSize,
   unsigned int *seedLen,
   VoltMpInt *prime
   )
{
  int status;
  unsigned int bitMask, bitSet;
  unsigned char *buffer = (unsigned char *)0;
  VoltMpIntCtx *mpCtx;
  VoltLibCtx *libCtx;
  VOLT_DECLARE_ERROR_TYPE (errorType)
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  /* Check the arguments.
   * Can't log an error if NULL, no libCtx.
   */
  if (prime == (VoltMpInt *)0)
    return (VT_ERROR_NULL_ARG);

  do
  {
    /* If a SEED buffer is given, the caller wants a FIPS-certified
     * prime, this implementation does not do that, return the error.
     */
    VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_FIPS;
    if (SEED != (unsigned char *)0)
      break;

    mpCtx = (VoltMpIntCtx *)(prime->mpCtx);
    libCtx = (VoltLibCtx *)(mpCtx->voltObject.libraryCtx);

    /* Create a buffer of the appropriate size. We'll fill it with
     * random bytes and use that as a starting point.
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_MEMORY;
    bufferSize = (primeSizeBits + 7) / 8;
    buffer = (unsigned char *)Z2Malloc (bufferSize, VOLT_MEMORY_SENSITIVE);
    if (buffer == (unsigned char *)0)
      break;

    /* Create a mask for the first byte. Depending on the bit length,
     * we may want to trim some bits off the top.
     */
    bitSet = primeSizeBits % 8;
    if (bitSet == 0)
      bitSet = 8;
    bitMask = 0xff >> (8 - bitSet);
    /* Make sure the msbit is set. Create a value to OR with the first
     * byte that will set the msbit.
     */
    bitSet = 1 << (bitSet - 1);

    /* Generate random bytes of the appropriate bit length.
     */
    VOLT_SET_ERROR_TYPE (errorType, 0)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VtGenerateRandomBytes (random, buffer, bufferSize);
    if (status != 0)
      break;

    /* Make sure the msbyte is set properly.
     */
    buffer[0] &= (unsigned char)bitMask;
    buffer[0] |= (unsigned char)bitSet;

    /* Set the lsbit to guarantee it is odd.
     */
    buffer[bufferSize - 1] |= 1;

    /* Set the MpInt to this value.
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = mpCtx->OctetStringToMpInt (0, buffer, bufferSize, prime);
    if (status != 0)
      break;

    /* The nextprime function will find the next prime after the
     * starting point.
     */
    mpz_nextprime ((mpz_ptr)(prime->mpInt), (mpz_ptr)(prime->mpInt));

  } while (0);

  if (buffer != (unsigned char *)0)
    Z2Free (buffer);

  VOLT_LOG_ERROR_COMPARE (
    status, prime->mpCtx->voltObject.libraryCtx, status, errorType,
    fnctLine, "GMPWrapGeneratePrime", (char *)0)

  return (status);
}

#ifdef _WINCE
#pragma optimize( "g", on )
#endif

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色香蕉久久蜜桃| 成人黄色一级视频| 亚洲国产综合视频在线观看| 中文字幕在线观看一区二区| 国产清纯白嫩初高生在线观看91 | 日韩一区二区三区精品视频| 色爱区综合激月婷婷| 色丁香久综合在线久综合在线观看| 91免费国产在线| 日本韩国精品在线| 欧美精品久久99久久在免费线| 在线中文字幕一区| 91精品国产一区二区三区| 欧美大片在线观看| 国产视频亚洲色图| 一区二区三区在线观看国产| 亚洲线精品一区二区三区| 亚洲国产成人tv| 日韩精品一二三| 国产精品456| 91麻豆免费视频| 欧美剧情电影在线观看完整版免费励志电影| 欧美色国产精品| 精品不卡在线视频| 成人免费在线视频| 首页综合国产亚洲丝袜| 精品午夜久久福利影院| 国产99久久精品| 欧美性猛交xxxxxxxx| 日韩精品中文字幕一区 | 国产成人精品三级| 欧美影院午夜播放| 久久影视一区二区| 亚洲一区日韩精品中文字幕| 狠狠色狠狠色综合日日91app| 成人网男人的天堂| 欧美一区二区私人影院日本| 中文一区二区在线观看| 一区二区三区不卡视频在线观看| 亚洲综合色噜噜狠狠| 久久国产尿小便嘘嘘| 91免费在线播放| 久久久久久久久岛国免费| 亚洲激情在线激情| 国产成人精品一区二| 欧美日本在线一区| 中文字幕亚洲在| 国模一区二区三区白浆| 欧美在线色视频| 1024国产精品| 国产福利一区二区三区| 91麻豆精品国产91久久久久| 亚洲图片另类小说| 国产精品一区二区在线播放| 欧美日韩激情一区二区三区| 亚洲天堂网中文字| 成人开心网精品视频| 欧美成人乱码一区二区三区| 亚洲影院在线观看| fc2成人免费人成在线观看播放| 精品国产一区二区三区四区四| 亚洲成年人网站在线观看| 色综合久久中文综合久久牛| 国产精品视频一二| 国产成人免费视频网站| 精品久久久久av影院| 青青草97国产精品免费观看 | 欧美日韩成人高清| 香蕉乱码成人久久天堂爱免费| 91首页免费视频| 成人免费一区二区三区在线观看| 福利电影一区二区| 国产日产欧美一区| 成人免费视频国产在线观看| 国产精品欧美经典| av动漫一区二区| 亚洲黄色片在线观看| 色老汉av一区二区三区| 亚洲曰韩产成在线| 制服丝袜国产精品| 日产欧产美韩系列久久99| 日韩免费看网站| 欧美美女bb生活片| 天天色天天操综合| 欧美一级爆毛片| 国产精品一品视频| 国产三级一区二区| 99久久亚洲一区二区三区青草| 国产精品传媒入口麻豆| 日本精品一区二区三区高清 | 国产九九视频一区二区三区| 久久亚洲精精品中文字幕早川悠里| 国产麻豆精品一区二区| 国产精品成人免费在线| 在线观看成人免费视频| 蜜桃一区二区三区在线观看| 国产欧美精品国产国产专区 | 久久久亚洲欧洲日产国码αv| 国产一区二区不卡在线| 亚洲免费观看在线观看| 91精品久久久久久久久99蜜臂| 美女视频一区在线观看| 国产精品入口麻豆原神| 欧美日韩激情在线| 国产精品1024久久| 一区二区成人在线视频| 久久亚洲精华国产精华液| 99国产精品久久久| 美女视频黄频大全不卡视频在线播放| 久久精品亚洲精品国产欧美| 91久久免费观看| 国产综合色精品一区二区三区| 中文字幕一区在线观看视频| 日韩三级视频在线看| 91久久精品一区二区三区| 激情综合色综合久久| 亚洲一二三区视频在线观看| 久久精品一区二区三区四区| 欧美唯美清纯偷拍| 成人视屏免费看| 久久99国产精品久久99| 亚洲美女视频在线观看| 久久久噜噜噜久噜久久综合| 欧美高清视频不卡网| 91在线视频18| 国产二区国产一区在线观看| 日韩黄色在线观看| 亚洲香肠在线观看| 亚洲视频中文字幕| 国产女同性恋一区二区| 日韩欧美电影一二三| 欧美麻豆精品久久久久久| 一本大道综合伊人精品热热| 成人黄色综合网站| 国产成人在线电影| 久久超碰97中文字幕| 日本aⅴ免费视频一区二区三区| 亚洲欧美电影一区二区| 国产精品久久久久久户外露出| 久久久久久久久久久久久夜| 精品国产一区a| 欧美电影免费提供在线观看| 欧美一级理论片| 在线成人av网站| 欧美日韩1234| 欧美一区二区啪啪| 在线成人午夜影院| 欧美猛男gaygay网站| 欧美亚洲免费在线一区| 欧美日韩精品高清| 欧美日韩国产综合一区二区 | 欧美猛男gaygay网站| 欧美三级乱人伦电影| 欧美色区777第一页| 欧美日本一区二区三区| 欧美精品一二三区| 欧美一区二区三区免费观看视频| 91麻豆精品国产自产在线观看一区 | 欧美日韩一区国产| 欧美在线观看一区二区| 欧美日韩免费高清一区色橹橹| 在线免费av一区| 欧美日韩高清一区二区| 在线不卡中文字幕| 久久综合成人精品亚洲另类欧美| 久久久亚洲精华液精华液精华液| 2023国产精品| 国产精品人人做人人爽人人添| 亚洲视频一区二区免费在线观看 | 亚洲综合激情小说| 香蕉久久夜色精品国产使用方法 | 亚洲午夜精品久久久久久久久| 亚洲高清在线视频| 久久福利视频一区二区| 国产成人免费av在线| 色偷偷成人一区二区三区91| 制服丝袜中文字幕亚洲| 久久久久久久综合狠狠综合| 亚洲日本va在线观看| 日韩极品在线观看| 国产91在线观看| 欧美精选一区二区| 国产精品色噜噜| 日韩av一区二| 91在线视频播放地址| 日韩一区二区在线看片| 国产精品伦一区| 日韩精品一二区| bt7086福利一区国产| 91精品国产综合久久久久| 国产欧美日韩亚州综合| 日韩国产欧美在线观看| av中文字幕亚洲| 日韩精品专区在线影院观看| 亚洲黄色小说网站| 国产不卡视频在线播放| 欧美福利视频一区| 国产精品国产a级| 久久99久久99| 欧美理论电影在线|