cfb.h

来自「IBE是一种非对称密码技术」· C头文件 代码 · 共 108 行

H
108
字号
/* Copyright 2003-2006, Voltage Security, all rights reserved.
 */

#include "vibecrypto.h"
#include "environment.h"
#include "base.h"
#include "libctx.h"
#include "algobj.h"
#include "keyobj.h"

#ifndef _CFB_H
#define _CFB_H

#ifdef __cplusplus
extern "C" {
#endif

/* Implements VEncryptInit.
 */
int VOLT_CALLING_CONV CFBEncryptInit VOLT_PROTO_LIST ((
   VoltAlgorithmObject *algObj,
   VoltKeyObject *keyObj
));

/* Implements VEncryptUpdate.
 */
int VOLT_CALLING_CONV CFBEncryptUpdateBlock VOLT_PROTO_LIST ((
   VoltAlgorithmObject *algObj,
   VtRandomObject random,
   unsigned char *dataToEncrypt,
   unsigned int dataToEncryptLen,
   unsigned char *encryptedData
));
int VOLT_CALLING_CONV CFBEncryptUpdate1Bit VOLT_PROTO_LIST ((
   VoltAlgorithmObject *algObj,
   VtRandomObject random,
   unsigned char *dataToEncrypt,
   unsigned int dataToEncryptLen,
   unsigned char *encryptedData
));
int VOLT_CALLING_CONV CFBEncryptUpdate8Bit VOLT_PROTO_LIST ((
   VoltAlgorithmObject *algObj,
   VtRandomObject random,
   unsigned char *dataToEncrypt,
   unsigned int dataToEncryptLen,
   unsigned char *encryptedData
));

/* Implments VDecryptInit.
 */
int VOLT_CALLING_CONV CFBDecryptInit VOLT_PROTO_LIST ((
   VoltAlgorithmObject *algObj,
   VoltKeyObject *keyObj
));

/* Implements VDecryptUpdate.
 */
int VOLT_CALLING_CONV CFBDecryptUpdateBlock VOLT_PROTO_LIST ((
   VoltAlgorithmObject *algObj,
   VtRandomObject random,
   unsigned char *dataToDecrypt,
   unsigned int dataToDecryptLen,
   unsigned char *decryptedData
));
int VOLT_CALLING_CONV CFBDecryptUpdate1Bit VOLT_PROTO_LIST ((
   VoltAlgorithmObject *algObj,
   VtRandomObject random,
   unsigned char *dataToDecrypt,
   unsigned int dataToDecryptLen,
   unsigned char *decryptedData
));
int VOLT_CALLING_CONV CFBDecryptUpdate8Bit VOLT_PROTO_LIST ((
   VoltAlgorithmObject *algObj,
   VtRandomObject random,
   unsigned char *dataToDecrypt,
   unsigned int dataToDecryptLen,
   unsigned char *decryptedData
));

/* The feedCtx for CFB looks like this.
 * Note: The xorUsed field is measured in bytes. For 1 or 8-bit
 * transfer sizes, the xorUsed is not applicable. Because it is only
 * for the full blockSize version, it might as well be in bytes.
 */
typedef struct
{
  VoltFeedbackCtx feedCtx;
  unsigned char *currentVector;
  unsigned int xorUsed;
  unsigned int transferSizeBits;
  unsigned int bitCount;
  VEncryptInit AlgEncryptInit;
  VEncryptUpdate AlgEncryptUpdate;
} VoltCFBCtx;

/* Implements VCtxDestroy.
 */
void VOLT_CALLING_CONV CFBFeedCtxDestroy VOLT_PROTO_LIST ((
   Pointer obj,
   Pointer ctx
));

#ifdef __cplusplus
}
#endif

#endif /* _CFB_H */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?