⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 block.h

📁 IBE是一种非对称密码技术
💻 H
字号:
/* 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"
#include "cipher.h"

#ifndef _BLOCK_H
#define _BLOCK_H

#ifdef __cplusplus
extern "C" {
#endif

/* A function that implements this typedef will be able to load the
 * appropriate code into the given object, setting it with the code
 * necessary to perform the algorithm's operations.
 *
 * @param obj The object to set.
 * @param info The associated info the cipher object needs.
 * @param flag A flag to indicate that the caller is indeed calling a
 * Block Algorithm (VOLT_BLOCK_ALG_SET_TYPE_FLAG).
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
typedef int VOLT_CALLING_CONV (*VoltBlockAlgSetter) VOLT_PROTO_LIST ((
   VoltAlgorithmObject *obj,
   Pointer info,
   unsigned int flag
));

/* This function behaves as a VtAlgorithmSetter. It sets the object to
 * perform a block cipher. Normally, an application will call a
 * specific cipher VtAlgorithmSetter (such as VtAlgorithmSetAES). That
 * Setter will turn around and call this general purpose "Setter".
 * <p>This function will not check the arguments.
 *
 * @param object The object to set.
 * @param Cipher This is similar to a VtAlgorithmSetter, but is
 * specific to block ciphers.
 * @param blockInfo The application-supplied info containing the
 * cipher's info, feedback mode, and padding scheme.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
int VOLT_CALLING_CONV VoltAlgorithmSetBlockCipher VOLT_PROTO_LIST ((
   VoltAlgorithmObject *object,
   VoltBlockAlgSetter Cipher,
   VtBlockCipherInfo *blockInfo
));

/* This is the localCipherCtx for block ciphers.
 */

typedef struct
{
  Pointer algCtx;
  VCtxDestroy AlgCtxDestroy;
  Pointer feedbackCtx;
  VCtxDestroy FeedbackCtxDestroy;
} VoltBlockCipherCtx;

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

/* This is the "base class" for all feedbacks.
 */
typedef struct
{
  unsigned int blockSize;
  unsigned char *initVector;
  unsigned char *xorVector;
} VoltFeedbackCtx;

typedef struct VtFeedbackInfoDef
{
  Pointer info;
} VoltFeedbackInfo;

#ifdef __cplusplus
}
#endif

#endif /* _BLOCK_H */

⌨️ 快捷键说明

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