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

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

?? zdmwrite.c

?? IBE是一種非對稱密碼技術
?? C
?? 第 1 頁 / 共 4 頁
字號:
   VtStorageCtx storageCtx,
   VtTransportCtx transportCtx,
   VoltZDRLocationList *locationList,
   char **address,
   unsigned int *addressLen
   )
{
  int status, status2;
  unsigned int index, maxIndex, recipCount, voteCount, sameIdentity;
  UInt32 lenLo, lenHi;
  VoltPolicyCtx *pCtx = (VoltPolicyCtx *)policyCtx;
  VtIdentityObject getId;
  VtItem *getDefLocation = (VtItem *)0;
  VtItem *getDefDomain = (VtItem *)0;
  unsigned char* defaultDomain = (unsigned char*)0;
  VtDistrictObject defaultZDMDistrict = (VtDistrictObject)0;
  VtItem *votedLocation;
  VtItem *location;
  int isSenderLocation;
  unsigned int count;
  unsigned int theTag, lengthLen, valueLen;
  int isSenderRecipient = 0;
  VtItem senderLocation;
  unsigned int recipientCount;
  VtMpIntCtx mpIntCtx = (VtMpIntCtx)0;
  VOLT_DECLARE_ERROR_TYPE (errorType)
  VOLT_DECLARE_FNCT_LINE (fnctLine)
  
  /* Logic.
   *   1. Does at least one of the recipients use a ZDR location?
   *     yes, move on to step 2.
   *     no, move on to step 6.
   *
   *   2. At least one of the recipients has a ZDR location. Do all
   *   recipients use the same ZDR location?
   *     yes, return that location.
   *     no, move on to step 3.
   *
   *   3. At least one of the recipients has a ZDR location, but not
   *   all share the same location. Do some recipients have no ZDR
   *   location, but all others specify the same location?
   *     yes, use the ZDR location the recipients share.
   *     no, move on to step 4.
   *
   *   4. There are multiple ZDR locations among the recipients. Is
   *   there a default location in the (sender's) policy?
   *     yes, use the default location.
   *     no, move on to step 5.
   *
   *   5. There are multiple ZDR locations among the recipients and no
   *   default location in the policy. Take a "vote". Does one location
   *   appear among the recipients more than any other location?
   *     yes, return that location.
   *     no, return the first location recorded.
   *
   *   6. There are no ZDR locations among the recipients. Is there a
   *   default location in the (sender's) policy?
   *     yes, return that location
   *     no, move on to step 7.
   *
   *   7. There are no ZDR locations among the recipients and there is
   *   no default location in the policy. Does the sender have a ZDR
   *   location?
   *     yes, return that location.
   *     no, return an error, we cannot build a ZDM message.
   */

  do
  {
    Z2Memset(&senderLocation, 0, sizeof(senderLocation));
    
    /* Get the ZDR location of each recipient.
     */
    VOLT_SET_ERROR_TYPE (errorType, 0)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VtGetIdentityListCount (
      writeCtx->recipListRef, &recipCount, &maxIndex);
    if (status != 0)
      break;

    for (index = 0; index <= maxIndex; ++index)
    {
      /* To get a ZDR location, get an identity, get the district from
       * that identity, get the district extensions from that district,
       * and get the ZDR location extension from the extension list.
       */
      VOLT_SET_FNCT_LINE (fnctLine)
      status = VtGetIdentityListIdentity (
        writeCtx->recipListRef, index, &getId);
      if (status == VT_ERROR_NO_ID_AT_INDEX)
        continue;
      if (status != 0)
        break;

      VOLT_SET_FNCT_LINE (fnctLine)
      status = GetZDRLocationFromIdentity (
        libCtx, getId, policyCtx, storageCtx, transportCtx, &location);
      if (status != 0)
        break;

      /* Is this the sender? If so, set a flag so we know that the
       * sender is also a recipient.
       */
      VoltIsSameIdentity (getId, writeCtx->senderIdRef, &sameIdentity);
      if (sameIdentity != 0)
      {
        isSenderRecipient = 1;
        if (location != (VtItem*)0)
        {
          VOLT_SET_FNCT_LINE (fnctLine)
          status = VoltDecodeTagAndLen (
            libCtx, location->data, location->len, &theTag, &lengthLen,
            &lenLo, &lenHi, sizeof (unsigned int));
          if (status != 0)
            break;

          valueLen = (unsigned int)lenLo;
          
          VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
          VOLT_SET_FNCT_LINE (fnctLine)
          status = VT_ERROR_MEMORY;
          senderLocation.data = (unsigned char *)Z2Malloc (valueLen, 0);
          if (senderLocation.data == (unsigned char *)0)
            break;
          
          Z2Memcpy (senderLocation.data, location->data + lengthLen + 1, valueLen);
          senderLocation.len = valueLen;
        }
      }
      
      if (location != (VtItem *)0)
      {
        VOLT_SET_ERROR_TYPE (errorType, 0)
        VOLT_SET_FNCT_LINE (fnctLine)
        status = AddToLocationList (
          libCtx, getId, location, locationList);
        if (status != 0)
          break;
      }
    }
    if (status != 0)
      break;

    /* If none of the recipients' districts support ZDM, then we
     * shouldn't send a ZDM, since none of them will be able to read it.
     */
    VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_NO_ZDM_LOCATION;
    if (locationList->count == 0)
      break;

    /* If all of the recipients use the same location, then we use that
     * as the ZDM location. We need this to handle the case where all
     * the recipients and the sender have the same location. There's
     * another test below after voting that catches the case where
     * all the recipients (not including the sender) have the same
     * location.
     */
    if (locationList->count == locationList->locationCount[0])
    {
      VOLT_SET_ERROR_TYPE (errorType, 0)
      VOLT_SET_FNCT_LINE (fnctLine)
      status = CopyZDRLocation (
        libCtx, &locationList->location[0], address, addressLen);
      break;
    }
    
    /* If the sender is also a recipient, we have the sender's ZDR
     * location already. If not, get it now. If there is one, the
     * sender will be included in the Form's Select list.
     */
    if (isSenderRecipient == 0)
    {
      VOLT_SET_ERROR_TYPE (errorType, 0)
      VOLT_SET_FNCT_LINE (fnctLine)
      status = GetSenderZDRLocationAlloc (
        libCtx, obj, writeCtx, policyCtx, storageCtx, transportCtx,
        &senderLocation);
      if (status != 0)
        break;
    }

    /* Figure out which location is used by the majority of the
     * recipients. We'll use the final vote count to determine
     * if all of the recipients (not including the sender) use
     * the same district. If that's the case we'll use that
     * district (i.e. case 2 in the logic described above).
     * Otherwise we'll continue on to check the default ZDM
     * location. If there's no default location, then we'll
     * use the majority location determined here.
     */
    votedLocation = (VtItem*)0;
    voteCount = 0;
    
    for (index = 0; index < locationList->count; ++index)
    {
      location = &locationList->location[index];
      count = locationList->locationCount[index];
      isSenderLocation = (location->len == senderLocation.len) &&
        (Z2Memcmp(location->data, senderLocation.data, location->len) == 0);
      if (!isSenderLocation && (count > voteCount))
      {
        votedLocation = location;
        voteCount = count;
      }
    }
    
    /* Figure out how many recipients we have (not including the sender)
     */
    recipientCount = locationList->count;
    if (isSenderRecipient)
      recipientCount--;
    
    /* If all the recipients (not including the sender) are using the
     * same district, then use it.
     */
    if ((voteCount > 0) && (voteCount == recipientCount))
    {
      VOLT_SET_ERROR_TYPE (errorType, 0)
      VOLT_SET_FNCT_LINE (fnctLine)
      status = CopyZDRLocation (
        libCtx, votedLocation, address, addressLen);
      break;
    }
    
    /* We don't have a location yet, get the default location from the
     * policy. The value that's stored in client policy is the domain
     * name of the district whose location we want to use, so we need
     * to translate from the domain name to the district to the ZDM
     * location.
     */
    VOLT_SET_ERROR_TYPE (errorType, 0)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = pCtx->PolicyGetInfoAlloc (
      policyCtx, VOLT_POLICY_GET_DEFAULT_ZDR_LOCATION,
      (Pointer)0, (Pointer *)&getDefDomain);
    if ( (status != 0) && (status != VT_ERROR_POLICY_NOT_SUPPORTED) )
      break;

    if ( (getDefDomain != (VtItem *)0) && (getDefDomain->len > 0) )
    {
      /* Copy the VtItem domain name over to null-terminated string */
      VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
      VOLT_SET_FNCT_LINE (fnctLine)
      status = VT_ERROR_MEMORY;
      defaultDomain = Z3Malloc(getDefDomain->len + 1);
      if (defaultDomain == (unsigned char*)0)
        break;
      Z2Memcpy(defaultDomain, getDefDomain->data, getDefDomain->len);
      defaultDomain[getDefDomain->len] = 0;
      
      /* If there's a problem retrieving the default ZDM location,
       * we convert the error to the INVALID_ZDM_LOCATION error.
       */
      status = VT_ERROR_INVALID_ZDM_LOCATION;

      if (writeCtx->senderIdRef != (VtIdentityObject)0)
        mpIntCtx = writeCtx->senderIdRef->mpCtx;
      
      VOLT_SET_ERROR_TYPE (errorType, 0)
      VOLT_SET_FNCT_LINE (fnctLine)
      status2 = VtCreateDistrictObject (
        libCtx,
        (mpIntCtx != 0) ? VtDistrictImplMpCtx : VtDistrictImplBasic,
        (Pointer)mpIntCtx, &defaultZDMDistrict);
      if (status2 != 0)
        break;

      VOLT_SET_FNCT_LINE (fnctLine)
      status2 = VtSetDistrictParam (
        defaultZDMDistrict, VtDistrictParamDomainName,
        (Pointer) defaultDomain);
      if (status2 != 0)
        break;

      VOLT_SET_FNCT_LINE (fnctLine)
      status2 = VtObtainIBEParams(defaultZDMDistrict, policyCtx,
        storageCtx, transportCtx);
      if (status2 != 0)
        break;
      
      VOLT_SET_FNCT_LINE (fnctLine)
      status2 = GetZDRLocationFromDistrict(libCtx, defaultZDMDistrict,
        &getDefLocation);
      if (status2 != 0)
        break;

      if (getDefLocation != (VtItem*)0)
      {
        VOLT_SET_FNCT_LINE (fnctLine)
        status = VoltDecodeTagAndLen (
          libCtx, getDefLocation->data, getDefLocation->len, &theTag, &lengthLen,
          &lenLo, &lenHi, sizeof (unsigned int));
        if (status != 0)
          break;

        valueLen = (unsigned int)lenLo;
          
        VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
        VOLT_SET_FNCT_LINE (fnctLine)
        status = VT_ERROR_MEMORY;
        *address = (char *)Z2Malloc (valueLen, 0);
        if (*address == (char *)0)
          break;
        Z2Memcpy (*address, getDefLocation->data + lengthLen + 1, valueLen);
        *addressLen = valueLen;
      }
      
      break;
    }

    if (votedLocation != (VtItem*)0)
    {
      VOLT_SET_ERROR_TYPE (errorType, 0)
      VOLT_SET_FNCT_LINE (fnctLine)
      status = CopyZDRLocation (libCtx, votedLocation, address, addressLen);
      break;
    }

    /* Use the sender's location as the final try. If the sender's district
     * doesn't have ZDM enabled, then we return an error.
     */
    VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_NO_ZDM_LOCATION;
    if (senderLocation.data == (unsigned char *)0)
      break;

    VOLT_SET_ERROR_TYPE (errorType, 0)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = CopyZDRLocation (
      libCtx, &senderLocation, address, addressLen);

  } while (0);

  Z2Free (senderLocation.data);
  if (getDefDomain != (VtItem *)0)
    pCtx->PolicyGetInfoFree (policyCtx, (Pointer)getDefDomain);
  Z2Free (defaultDomain);
  VtDestroyDistrictObject(&defaultZDMDistrict);

  VOLT_LOG_ERROR_INFO_COMPARE (
    status, libCtx, obj, status, 0, errorType,
    (char *)0, "GetFormAddressAlloc", fnctLine, (char *)0)

  return (status);
}

static int CopyZDRLocation (
   VoltLibCtx *libCtx,
   VtItem *location,
   char **address,
   unsigned int *addressLen
   )
{
  char *newVal = (char *)0;
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  VOLT_SET_FNCT_LINE (fnctLine)
  newVal = (char *)Z2Malloc (location->len, 0);
  if (newVal != (char *)0)
  {
    Z2Memcpy (newVal, location->data, location->len);

    *address = newVal;
    *addressLen = location->len;

    return (0);
  }

  VOLT_LOG_ERROR_INFO (
    libCtx, 0, VT_ERROR_MEMORY, 0, VT_ERROR_TYPE_PRIMARY,
    (char *)0, "CopyZDRLocation", fnctLine, (char *)0)

  return (VT_ERROR_MEMORY);
}

static int AddToLocationList (
   VoltLibCtx *libCtx,
   VtIdentityObject idToAdd,
   VtItem *location,
   VoltZDRLocationList *locationList
   )
{
  int status;
  unsigned int index, theTag, lengthLen, valueLen;
  UInt32 lenLo, lenHi;
  unsigned char *value;
  VOLT_DECLARE_ERROR_TYPE (errorType)
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  do
  {
    /* Add the id to the list of selections.
     */
    VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_MEMORY;
    locationList->recipientSelections = (VtIdentityObject *)Z2Realloc (
      locationList->recipientSelections,
      (locationList->count + 1) * sizeof (VtIdentityObject));
    if (locationList->recipientSelections == (VtIdentityObject *)0)
      break;

    locationList->recipientSelections[locationList->count] = idToAdd;

    /* The location returned is TLV of some encoding.
     */
    VOLT_SET_ERROR_TYPE (errorType, 0)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VoltDecodeTagAndLen (
      libCtx, location->data, location->len, &theTag, &lengthLen,
      &lenLo, &lenHi, sizeof (unsigned int));
    if (status != 0)
      break;

    valueLen = (unsigned int)lenLo;
    value = location->data + (lengthLen + 1);

    /* First, is this a location already logged?
     */
    for (index = 0; index < locationList->count; ++index)
    {
      if (valueLen != locationList->location[index].len)
        continue;
      if (Z2Memcmp (
        value, locationList->location[index].data, valueLen) == 0)
        break;
    }
    /* If we broke out before the end, we found a match.
     */
    if (index < locationList->count)
    {
      /* Increment the count of this location.
       */
      locationList->locationCount[index] =
        locationList->locationCount[index] + 1;
    }

    /* Add this location to the list.
     */
    VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_MEMORY;
    locationList->location = (VtItem *)Z2Realloc (
      locationList->location, (locationList->count + 1) * sizeof (VtItem));
    if (locationList->location == (VtItem *)0)
      break;
    locationList->location[locationList->count].data = value;
    locationList->location[locationList->count].len = valueLen;

    VOLT_SET_FNCT_LINE (fnctLine)
    locationList->locationCount = (unsigned int *)Z2Realloc (
      locationList->locationCount,
      (locationList->count + 1) * sizeof (unsigned int));
    if (locationList->locationCount == (unsigned int *)0)
      break;
    locationList->locationCount[locationList->count] = 1;

    locationList->count = locationList->count + 1;

    status = 0;

  } while (0);

  VOLT_LOG_ERROR_INFO_COMPARE (
    status, libCtx, 0, status, 0, errorType,
    (char *)0, "AddToLocationList", fnctLine, (char *)0)

  return (status);
}

static int GetSenderZDRLocationAlloc (
   VoltLibCtx *libCtx,
   VoltSecureMailObject *obj,
   VoltSecureMailWriteCtx *writeCtx,

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品成人在线观看| 亚洲成av人片| 亚洲香肠在线观看| 精品一区二区在线观看| 91看片淫黄大片一级在线观看| 欧美一区二区三区播放老司机| 中文字幕欧美一区| 久久99精品久久只有精品| 色综合天天视频在线观看| 久久久久久久久久看片| 日本欧美在线看| 欧美午夜一区二区三区| 国产精品视频麻豆| 夫妻av一区二区| 精品国精品国产| 麻豆91在线播放| 这里只有精品电影| 亚洲成人一区二区在线观看| 不卡区在线中文字幕| 欧美精品一区二区三区蜜桃 | 91小视频免费观看| 久久精品一区蜜桃臀影院| 日韩av电影免费观看高清完整版| 日本道精品一区二区三区| 国产精品久久夜| 成人国产亚洲欧美成人综合网 | 欧美精三区欧美精三区| 亚洲精品国产一区二区三区四区在线| 激情深爱一区二区| 欧美成人三级电影在线| 免费在线观看视频一区| 6080yy午夜一二三区久久| 亚洲第四色夜色| 在线电影欧美成精品| 亚洲高清视频中文字幕| 欧美吻胸吃奶大尺度电影 | 国产精品美女久久久久久久久久久| 国内不卡的二区三区中文字幕| 日韩一级欧美一级| 久久99国产精品久久99| 日韩欧美精品在线| 国产乱子轮精品视频| 欧美精彩视频一区二区三区| 国产乱码精品1区2区3区| 国产欧美一区二区精品久导航| 国产麻豆精品一区二区| 中文字幕欧美国产| 94-欧美-setu| 午夜欧美电影在线观看| 日韩一区二区在线免费观看| 捆绑调教一区二区三区| 久久美女高清视频| 91免费版pro下载短视频| 亚洲永久免费av| 555www色欧美视频| 久久精品国产精品亚洲综合| 日本一区二区三区高清不卡| 在线免费视频一区二区| 美国av一区二区| 综合av第一页| 91精品国产欧美一区二区18| 精品在线免费视频| 亚洲日本在线看| 51久久夜色精品国产麻豆| 国产高清视频一区| 亚洲自拍偷拍图区| 久久精品欧美日韩精品| 欧洲一区在线观看| 国产精品一区二区x88av| 亚洲精品乱码久久久久久久久 | 欧美日韩一二三| 国产一区二区三区视频在线播放| 国产精品久久久久久妇女6080| 欧美日韩国产a| 国产丶欧美丶日本不卡视频| 亚洲一区视频在线观看视频| 国产欧美一区二区精品性色| 欧美美女bb生活片| 成人黄页在线观看| 精品一区二区日韩| 性欧美疯狂xxxxbbbb| 日本一区二区视频在线| 欧美一区二区观看视频| 91久久奴性调教| 国产成人在线视频免费播放| 青青草91视频| 亚洲午夜国产一区99re久久| 国产精品美女一区二区三区| 精品日韩99亚洲| 欧美日韩国产精品自在自线| av一区二区三区黑人| 久久99精品国产麻豆不卡| 亚洲午夜久久久| 亚洲欧美日韩在线| 国产精品电影院| 国产欧美精品一区aⅴ影院 | 久久99国产精品成人| 亚洲国产日韩av| 一区二区三区国产精华| 国产精品久久久久久久午夜片| 精品国一区二区三区| 欧美一二三四在线| 日韩欧美美女一区二区三区| 在线成人av网站| 欧美日韩精品二区第二页| 在线视频中文字幕一区二区| 97se亚洲国产综合自在线观| 成人h动漫精品一区二区| 国产成人av在线影院| 国产精品亚洲一区二区三区妖精| 麻豆精品视频在线观看免费| 麻豆久久久久久| 久久99精品久久久久| 韩国毛片一区二区三区| 久久国产婷婷国产香蕉| 捆绑调教美女网站视频一区| 久久99精品一区二区三区| 黄网站免费久久| 黑人巨大精品欧美一区| 国产成a人亚洲| 99久久99久久精品免费观看| av日韩在线网站| 91免费视频网| 欧美日韩激情一区| 日韩一级大片在线观看| 久久中文娱乐网| 欧美国产乱子伦| 亚洲欧美视频一区| 视频一区欧美日韩| 精品一区二区三区免费毛片爱| 国产精品99久久久| 91网址在线看| 欧美三级电影在线观看| 精品国产网站在线观看| 日本一区二区三区免费乱视频| 亚洲日本一区二区| 青青草视频一区| 国产91精品精华液一区二区三区| 91亚洲精品久久久蜜桃网站 | 亚洲国产精品一区二区久久 | 久久人人爽爽爽人久久久| 国产欧美日韩激情| 亚洲一区二区不卡免费| 蜜臀av国产精品久久久久 | 1区2区3区精品视频| 一区二区三区中文字幕电影 | 欧洲精品中文字幕| 精品日韩一区二区| 伊人色综合久久天天| 捆绑调教一区二区三区| 99热国产精品| 日韩欧美成人一区二区| 亚洲婷婷综合久久一本伊一区| 午夜久久福利影院| 成人午夜激情在线| 欧美色图12p| 国产色婷婷亚洲99精品小说| 亚洲影院久久精品| 国产二区国产一区在线观看| 欧美人与性动xxxx| 国产精品视频yy9299一区| 日韩影院在线观看| 成年人国产精品| 精品久久人人做人人爽| 亚洲电影第三页| 99r精品视频| 久久久久久久久久看片| 日韩av中文在线观看| 色999日韩国产欧美一区二区| 精品国产乱码久久| 天堂影院一区二区| 在线精品观看国产| 国产精品激情偷乱一区二区∴| 日韩av在线发布| 欧美丝袜丝交足nylons图片| 国产精品美女久久久久久久| 精品一二三四区| 91精品国产综合久久精品图片| 成人欧美一区二区三区1314| 国产91丝袜在线18| 久久精品欧美日韩精品| 国产一区在线精品| 欧美一区二区三区视频| 亚洲国产成人av网| 欧美日韩一级二级三级| 亚洲欧美国产三级| av激情亚洲男人天堂| 国产午夜精品一区二区三区嫩草 | 偷拍一区二区三区| 在线观看av不卡| 亚洲综合色噜噜狠狠| 欧美性猛交xxxxxxxx| 一区二区三区在线免费观看| 91色porny| 亚洲最色的网站| 欧美少妇xxx| 性做久久久久久| 欧美一级二级在线观看| 强制捆绑调教一区二区| 日韩亚洲欧美综合|