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

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

?? zdmsmwrite.c

?? IBE是一種非對稱密碼技術
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* Copyright 2003-2006, Voltage Security, all rights reserved.
 */
#include "vibe.h"
#include "environment.h"
#include "base.h"
#include "libctx.h"
#include "securemail.h"
#include "zdm.h"
#include "policy.h"
#include "stringutil.h"
#include "errorctx.h"

/* A SecureMail message looks like this.
 * <code>
 * <pre>
 *     -----BEGIN ... -----
 *     <app-supplied header>
 *     -----BEGIN ... -----
 *     <message data>
 *     -----END ... -----
 *     -----END ... -----
 * </pre>
 * </code>
 * The ZDM From SecureMail object will copy only the message data (it
 * replaces headers and footers with its own values).
 * <p>The inputData for this function will be part or all of a
 * SecureMail message. This function will determine the address of the
 * beginning of the message data. If the SM headers have not yet been
 * stripped, the routine will figure out what is header, skip it and
 * return the beginning of the message data. If the pertinant address
 * is not available (the inputData consists of only some of the
 * SecureMail header and does not reach the message data), it will
 * return NULL. If the SM headers have been stripped, the routine will
 * consider the inputData to be the start of data. However, if the
 * inputData is actually the start of the footer (the first byte of
 * inputData is the first dash of the first -----END footer), the
 * function will return a NULL dataStart result.
 * <p>The obj->state variable will further define a NULL dataStart
 * return. If the state is INIT or WRITE_HEADER, NULL means we have not
 * yet reached the message data. If it is WRITE_BODY, a NULL means
 * we've reached the footer.
 *
 * @param libCtx
 * @param obj
 * @param inputData
 * @param inputDataLen
 * @param dataStart The address where the routine will deposit the
 * address of the beginning of the SecureMail data to copy.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV ComputeSMStartAddress VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VoltSecureMailObject *obj,
   VoltSecureMailWriteCtx *writeCtx,
   unsigned char *inputData,
   unsigned int inputDataLen,
   unsigned char **dataStart
));

/* A SecureMail message looks like this.
 * <code>
 * <pre>
 *     -----BEGIN ... -----
 *     <app-supplied header>
 *     -----BEGIN ... -----
 *     <message data>
 *     -----END ... -----
 *     -----END ... -----
 * </pre>
 * </code>
 * The ZDM From SecureMail object will copy only the message data (it
 * replaces headers and footers with its own values).
 * <p>The inputData for this function will be part or all of a
 * SecureMail message. This function will determine the address of the
 * beginning of the footer material (the first dash of the first
 * -----END line).
 * <p>The function will go to the addresses given for the result
 * (footStart) and deposit the address. If the pertinant address is
 * not available (the inputData consists of only message data), it will
 * deposit NULL at footStart.
 *
 * @param libCtx
 * @param obj
 * @param msgData
 * @param msgDataLen
 * @param footStart The address where the routine will deposit the
 * address of the beginning of the SecureMail footer material.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV ComputeSMFootAddress VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VoltSecureMailObject *obj,
   unsigned char *msgData,
   unsigned int msgDataLen,
   unsigned char **footStart
));

int VoltOldZDMFromSMWriteUpdate (
   VtZDMObject zdmObj,
   VtRandomObject random,
   unsigned char *inputData,
   unsigned int inputDataLen,
   unsigned char *message,
   unsigned int bufferSize,
   unsigned int *messageLen
   )
{
  int status;
  VoltZDMObject *zObj = (VoltZDMObject *)zdmObj;
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  VOLT_SET_FNCT_LINE (fnctLine)
  status = VoltZDMFromSMWriteUpdate (
    (VtSecureMailObject)(zObj->localCtx), random, inputData, inputDataLen,
    message, bufferSize, messageLen);

  VOLT_LOG_ERROR_INFO_COMPARE (
    status, 0, zdmObj, status, 0, 0,
    (char *)0, "VoltOldZDMFromSMWriteUpdate", fnctLine, (char *)0)

  return (status);
}

int VoltOldZDMFromSMWriteFinal (
   VtZDMObject zdmObj,
   VtRandomObject random,
   unsigned char *inputData,
   unsigned int inputDataLen,
   unsigned char *message,
   unsigned int bufferSize,
   unsigned int *messageLen
   )
{
  int status;
  VoltZDMObject *zObj = (VoltZDMObject *)zdmObj;
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  VOLT_SET_FNCT_LINE (fnctLine)
  status = VoltZDMFromSMWriteFinal (
    (VtSecureMailObject)(zObj->localCtx), random, inputData, inputDataLen,
    message, bufferSize, messageLen);

  VOLT_LOG_ERROR_INFO_COMPARE (
    status, 0, zdmObj, status, 0, 0,
    (char *)0, "VoltOldZDMFromSMWriteFinal", fnctLine, (char *)0)

  return (status);
}

int VoltZDMFromSMWriteUpdate (
   VtSecureMailObject secureMailObj,
   VtRandomObject random,
   unsigned char *inputData,
   unsigned int inputDataLen,
   unsigned char *message,
   unsigned int bufferSize,
   unsigned int *messageLen
   )
{
  int status;
  unsigned int index, dataLen, b64Len, newLineLen, elementLen, offset;
  VoltSecureMailObject *obj = (VoltSecureMailObject *)(secureMailObj);
  VoltLibCtx *libCtx = (VoltLibCtx *)(obj->voltObject.libraryCtx);
  VoltZDMFromSecureMailCtx *zdmCtx =
    (VoltZDMFromSecureMailCtx *)(obj->localCtx);
  VoltSecureMailWriteCtx *writeCtx = &(zdmCtx->baseCtx);
  unsigned char *newLine;
  unsigned char *dataStart = (unsigned char *)0;
  unsigned char *footStart = (unsigned char *)0;
  VoltEncodeDecodeSizeInfo encodeDecodeSizeInfo;
  VOLT_DECLARE_ERROR_TYPE (errorType)
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  *messageLen = 0;

  /* Writing the footer is the responsibility of Final.
   */
  if (obj->state == VOLT_ZDM_FROM_SM_STATE_WRITE_FOOTER)
    return (0);
  if (obj->state == VOLT_ZDM_FROM_SM_STATE_WRITE_COMPLETE)
    return (0);
  if (inputDataLen == 0)
    return (0);

  do
  {
    /* If inputData is NULL, we won't know which of the data to throw
     * away and which to copy, so assume it's all to be copied and the
     * footer will not be reached.
     * If prelimLen is not 0, we'll want to write out the ZDM header
     * material as well.
     */
    if (inputData == (unsigned char *)0)
    {
      VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
      VOLT_SET_FNCT_LINE (fnctLine)
      status = VT_ERROR_BUFFER_TOO_SMALL;
      *messageLen = inputDataLen + writeCtx->prelimLen;
      break;
    }

    /* Where, in the inputData, is the message data we're going to copy?
     */
    VOLT_SET_ERROR_TYPE (errorType, 0)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = ComputeSMStartAddress (
      libCtx, obj, writeCtx, inputData, inputDataLen, &dataStart);
    if (status != 0)
      break;

    /* If we don't have a data start, figure out why.
     * After the call to ComputeStartAddress, the state will be one of
     * the following three.
     *   VOLT_ZDM_FROM_SM_STATE_WRITE_HEADER
     *   VOLT_ZDM_FROM_SM_STATE_WRITE_HEAD_2
     *   VOLT_ZDM_FROM_SM_STATE_WRITE_BODY
     * If the state is HEADER or HEAD_2, we have not yet written out the
     * ZDM header, then we know a NULL dataStart means the inputData has
     * not yet reached the message data. So we'll want to output the ZDM
     * header only.
     * If the state is WRITE_BODY, a NULL dataStart means we've reached
     * the end, we'll write out the ZDM footer in WriteFinal.
     *
     * If the dataStart is not NULL, see if we can find the start of
     * the footer. If we find a footer, the dataLen is the number of
     * bytes between the dataStart and footStart. If there is no
     * footStart, the dataLen is everything after the dataStart.
     */
    if (dataStart == (unsigned char *)0)
    {
      if (obj->state == VOLT_ZDM_FROM_SM_STATE_WRITE_BODY)
      {
        obj->state = VOLT_ZDM_FROM_SM_STATE_WRITE_FOOTER;
        break;
      }
      dataLen = 0;
    }
    else
    {
      /* How many bytes are we skipping?
       */
      dataLen = (unsigned int)(dataStart - inputData);
      dataLen = inputDataLen - dataLen;
      VOLT_SET_FNCT_LINE (fnctLine)
      status = ComputeSMFootAddress (
        libCtx, obj, dataStart, dataLen, &footStart);
      if (status != 0)
        break;

      /* If there is no footStart, we'll write out all the dataLen
       * bytes beginning at dataStart.
       * If there is a footStart, we'll write out the bytes up to the
       * footStart.
       */
      if (footStart != (unsigned char *)0)
      {
        dataLen = (unsigned int)(footStart - dataStart);

        /* We have a footer, which means we have all the input data,
         * which means we can compute the ZDM pad.
         */
        VOLT_SET_FNCT_LINE (fnctLine)
        status = VoltAddZDMPad (
          obj, writeCtx, (UInt32)(zdmCtx->fourKLen + dataLen), (UInt32)0);
        if (status != 0)
          break;
      }
    }

    /* How many bytes will the Base64 encoded data be?
     */
    encodeDecodeSizeInfo.dataToProcess = (unsigned char *)0;
#if VT_64_BIT_LENGTH == 64
    encodeDecodeSizeInfo.dataToProcessLen = (VtUInt64)dataLen;
#else
    encodeDecodeSizeInfo.dataToProcessLen = dataLen;
#endif
    VOLT_SET_FNCT_LINE (fnctLine)
    status = obj->GetEncodeDecodeSize (
      obj->base64, (VtRandomObject)0, VOLT_CALLER_ENCODE_UPDATE,
      &encodeDecodeSizeInfo);
    if (status != VT_ERROR_BUFFER_TOO_SMALL)
      break;

    VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_INVALID_INPUT_LENGTH;
#if VT_64_BIT_LENGTH == 64
    if (encodeDecodeSizeInfo.processedDataLen > 0xffffffff)
      break;

    b64Len = (unsigned int)(encodeDecodeSizeInfo.processedDataLen);
#else
    b64Len = encodeDecodeSizeInfo.processedDataLen;
#endif

    /* Determine the totalLen. It is either the dataLen or the dataLen
     * plus the prelimLen if the ZDM header has not yet be output. If
     * the ZDM header has already been output, prelimLen will be 0.
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    *messageLen = b64Len + writeCtx->prelimLen;
    if (*messageLen < b64Len)
      break;

    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_BUFFER_TOO_SMALL;
    if (bufferSize < *messageLen)
      break;

    offset = 0;
    if (writeCtx->prelimLen != 0)
    {
      newLine = writeCtx->itemArray[VOLT_WRITE_SM_ITEM_NEW_LINE].data;
      newLineLen = writeCtx->itemArray[VOLT_WRITE_SM_ITEM_NEW_LINE].len;
      for (index = VOLT_WRITE_SM_HEAD_INDEX_START;
           index <= VOLT_WRITE_SM_HEAD_INDEX_END; ++index)
      {
        /* Add in the length of the actual data to write out.
         * If there is data to write out, add a newLine.
         */
        elementLen = writeCtx->itemArray[index].len;
        if (elementLen == 0)
          continue;

        Z2Memcpy (
          message + offset, writeCtx->itemArray[index].data, elementLen);
        offset += elementLen;
        Z2Memcpy (message + offset, newLine, newLineLen);
        offset += newLineLen;
      }

      /* Now that we've written out the ZDM header material, set
       * prelimLen to 0 so we'll never try to write it again.
       */
      writeCtx->prelimLen = 0;
    }

    if (dataLen != 0)
    {
      VOLT_SET_ERROR_TYPE (errorType, 0)
      VOLT_SET_FNCT_LINE (fnctLine)
      status = VtEncodeUpdate (
        obj->base64, (VtRandomObject)0, dataStart, dataLen,
        message + offset, bufferSize - offset, &b64Len);
      if (status != 0)
        break;

      zdmCtx->fourKLen += b64Len;

      /* If there's a footStart, we'll move to state WRITE_FOOTER. If
       * not, we'll be in WRITE_BODY.
       */
      obj->state = VOLT_ZDM_FROM_SM_STATE_WRITE_FOOTER;
      if (footStart == (unsigned char *)0)
        obj->state = VOLT_ZDM_FROM_SM_STATE_WRITE_BODY;
    }

    status = 0;

  } while (0);

  VOLT_LOG_ERROR_INFO_COMPARE (
    status, 0, secureMailObj, status, 0, errorType,
    (char *)0, "VoltZDMFromSMWriteUpdate", fnctLine, (char *)0)

  return (status);
}

int VoltZDMFromSMWriteFinal (
   VtSecureMailObject secureMailObj,
   VtRandomObject random,
   unsigned char *inputData,
   unsigned int inputDataLen,
   unsigned char *message,
   unsigned int bufferSize,
   unsigned int *messageLen
   )
{
  int status;
  unsigned int index, outputLenUpdate, b64Len, newLineLen, elementLen, offset;
  VoltSecureMailObject *obj = (VoltSecureMailObject *)(secureMailObj);
  VoltLibCtx *libCtx = (VoltLibCtx *)(obj->voltObject.libraryCtx);
  VoltSecureMailWriteCtx *writeCtx = (VoltSecureMailWriteCtx *)(obj->localCtx);
  unsigned char *newLine;
  VoltEncodeDecodeSizeInfo encodeDecodeSizeInfo;
  VOLT_DECLARE_ERROR_TYPE (errorType)
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  if (obj->state == VOLT_ZDM_FROM_SM_STATE_WRITE_COMPLETE)
    return (0);

  offset = 0;
  switch (obj->state)
  {
    default:
      VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
      VOLT_SET_FNCT_LINE (fnctLine)
      status = VT_ERROR_INVALID_CALL_ORDER;
      break;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲乱码一区二区三区在线观看| 91麻豆精品91久久久久同性| 日韩在线卡一卡二| 久久久精品免费网站| 欧美亚洲另类激情小说| 极品瑜伽女神91| 亚洲桃色在线一区| 欧美精品一区二区三| 日韩中文字幕区一区有砖一区| 一本久久精品一区二区| 久久国产麻豆精品| 亚洲va欧美va人人爽午夜| 中文字幕av一区二区三区高| 日韩一区二区三区四区| 在线日韩av片| 91在线观看地址| 国产成人丝袜美腿| 久久成人综合网| 日韩电影在线免费观看| 一二三四社区欧美黄| 综合自拍亚洲综合图不卡区| 国产色综合久久| 2023国产精华国产精品| 欧美一级视频精品观看| 欧美日韩成人在线| 欧美特级限制片免费在线观看| av中文字幕在线不卡| 国产成人在线视频网址| 国产在线精品一区二区三区不卡| 日韩va亚洲va欧美va久久| 亚洲国产视频a| 一区二区成人在线视频| 一区二区三区四区激情| 亚洲免费观看视频| 亚洲色图制服诱惑| 中文字幕色av一区二区三区| 国产精品伦理在线| 国产精品美女久久久久久| 欧美激情一区二区三区全黄| 久久久久高清精品| 国产清纯美女被跳蛋高潮一区二区久久w| 日韩欧美国产综合| 精品伦理精品一区| 日韩欧美成人午夜| 欧美大黄免费观看| 亚洲精品一区二区三区99| 精品精品国产高清a毛片牛牛| 日韩欧美在线不卡| 26uuuu精品一区二区| 国产欧美精品一区二区三区四区 | 99在线精品免费| 99视频一区二区三区| 91国偷自产一区二区开放时间 | 亚洲午夜在线电影| 午夜精品一区二区三区免费视频 | 国产精品白丝jk黑袜喷水| 美女脱光内衣内裤视频久久网站| 七七婷婷婷婷精品国产| 精品一区免费av| 成人a区在线观看| 在线免费观看视频一区| 欧美男同性恋视频网站| 26uuu另类欧美| 亚洲欧洲在线观看av| 亚洲一区二区精品久久av| 亚洲成av人影院在线观看网| 美女视频一区二区| 国产91富婆露脸刺激对白| 色94色欧美sute亚洲13| 555夜色666亚洲国产免| 久久久久久亚洲综合影院红桃| 国产精品视频在线看| 亚洲成人免费视| 麻豆一区二区99久久久久| 成人av网站免费| 欧美日韩国产在线观看| 久久精品一区二区三区不卡牛牛| 1024精品合集| 毛片av一区二区| 不卡视频一二三| 日韩一二在线观看| 国产精品超碰97尤物18| 日本女优在线视频一区二区| 豆国产96在线|亚洲| 欧美日本国产视频| 亚洲国产精品成人久久综合一区 | 日本vs亚洲vs韩国一区三区二区 | 久久久不卡网国产精品一区| 夜夜操天天操亚洲| 激情深爱一区二区| 色综合久久久网| 久久免费视频一区| 天堂精品中文字幕在线| 成人一区二区三区| 日韩一区二区三区视频| 国产精品久久久久aaaa| 久久国产精品区| 在线观看91视频| 国产精品传媒视频| 激情小说欧美图片| 欧美日产国产精品| 亚洲三级电影全部在线观看高清| 免费在线看成人av| 欧美午夜理伦三级在线观看| 国产亚洲女人久久久久毛片| 日本成人中文字幕在线视频| 91香蕉国产在线观看软件| 欧美精品一区二区久久久| 天天射综合影视| 色婷婷精品大在线视频| 国产亚洲精品超碰| 久久97超碰国产精品超碰| 首页国产丝袜综合| 粉嫩aⅴ一区二区三区四区| 日韩免费看的电影| 天堂资源在线中文精品| 99在线精品免费| 国产女主播视频一区二区| 麻豆一区二区三区| 日韩一本二本av| 日韩av电影天堂| 欧美喷潮久久久xxxxx| 一区二区三区 在线观看视频| 不卡高清视频专区| 亚洲国产精品国自产拍av| 国产在线乱码一区二区三区| 日韩欧美色综合| 蜜臀久久久99精品久久久久久| 欧美日韩三级视频| 亚洲图片欧美综合| 欧美婷婷六月丁香综合色| 一区二区三区日本| 色婷婷综合久久久中文字幕| 亚洲色图视频网| 色综合天天天天做夜夜夜夜做| 亚洲欧洲另类国产综合| 99国产精品久久久久| 中文字幕一区二区视频| jizzjizzjizz欧美| |精品福利一区二区三区| 99久久精品国产观看| 亚洲柠檬福利资源导航| 欧美少妇性性性| 亚洲成人av一区二区| 欧美精品99久久久**| 天堂成人免费av电影一区| 日韩欧美国产一区二区在线播放| 精品中文字幕一区二区小辣椒| 久久嫩草精品久久久精品一| 国产**成人网毛片九色| 亚洲婷婷在线视频| 欧美自拍丝袜亚洲| 视频一区欧美精品| 久久综合狠狠综合久久综合88| 国产一区二区三区久久久| 国产精品人成在线观看免费| 91亚洲精品久久久蜜桃| 亚洲国产精品麻豆| 日韩精品中文字幕一区二区三区| 久久成人羞羞网站| ●精品国产综合乱码久久久久| 欧美亚洲一区三区| 久久精品国产在热久久| 国产片一区二区三区| 欧美影院一区二区| 麻豆精品视频在线观看免费| 国产性做久久久久久| 在线视频亚洲一区| 麻豆中文一区二区| 中文字幕在线不卡一区 | 久久精品欧美日韩| 91社区在线播放| 日韩高清欧美激情| 国产精品国产自产拍在线| 欧美色视频在线| 国产精品亚洲第一| 亚洲成人免费在线| 国产蜜臀97一区二区三区| 欧美日韩一区成人| 国产乱码精品1区2区3区| 亚洲激情男女视频| 精品国产乱码久久久久久久久| av午夜精品一区二区三区| 美美哒免费高清在线观看视频一区二区 | 欧美激情艳妇裸体舞| 欧美视频日韩视频在线观看| 狠狠色丁香九九婷婷综合五月| 亚洲美女精品一区| 2021久久国产精品不只是精品| 91精品福利视频| 国产精品一区在线观看你懂的| 亚洲一区二区精品久久av| 欧美国产一区在线| 91精品国产欧美日韩| 99精品1区2区| 国产黄人亚洲片| 日本aⅴ精品一区二区三区 | 精品粉嫩超白一线天av| 日本福利一区二区| 成人夜色视频网站在线观看|