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

📄 ibe.h

📁 voltage 公司提供的一个开发Ibe的工具包
💻 H
📖 第 1 页 / 共 2 页
字号:
));

/* The implementation of this typedef will do what is necessary for the
 * particular bfCtxCache to indicate that the caller is no longer using
 * this bfCtx. This will likely involve simply decrementing a reference
 * count.
 * <p>If the call succeeds, the input pointer bfCtx will be set to
 * NULL. If not (the bfCtx was not in the cache, for example), the
 * input pointer bfCtx will still contain the pointer to the active
 * bfCtx.
 *
 * @param libCtx The libCtx containing the cache to check.
 * @param bfCtxCache The cache from which the ctx is to be released.
 * @param bfCtx The address where the function will find the ctx to
 * release.
 * @return none.
 */
typedef void VOLT_CALLING_CONV (*VReleaseBfCtxFromCache) VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VoltBfCtxCache *bfCtxCache,
   bf_context_t **bfCtx
));

/* A bfCtxCache consists of some functions and a local cache. Each
 * implementation of bfCtx caching will have its own localCache struct
 * and will be able to cast it to the appropriate type once inside a
 * function.
 */
struct VoltBfCtxCacheDef
{
  VSearchBfCtxCache       SearchBfCtxCache;
  VAddToBfCtxCache        AddToBfCtxCache;
  VReleaseBfCtxFromCache  ReleaseBfCtxFromCache;
  Pointer                 lock;
  Pointer                 localCache;
};

/* Implements VReleaseBfCtxFromCache.
 */
void VOLT_CALLING_CONV VoltReleaseBfCtxFromCache VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VoltBfCtxCache *bfCtxCache,
   bf_context_t **bfCtx
));

/* Implements VSearchBfCtxCache.
 */
int VOLT_CALLING_CONV VoltSearchBfCtxCache VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VoltBfCtxCache *bfCtxCache,
   VtBFType1IBECurveInfo *curve,
   bf_context_t **bfCtx
));

/* Implements VAddToBfCtxCache.
 */
int VOLT_CALLING_CONV VoltAddToBfCtxCache VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VoltBfCtxCache *bfCtxCache,
   VtBFType1IBECurveInfo *curveInfo,
   bf_context_t *bfCtx
));

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

/* This call will either release the ctx from the cache or it will
 * destroy it (bfDel).
 *
 * @param libCtx The libCtx to use.
 * @param bfCtx The address where the function will find the ctx to
 * release.
 * @return none.
 */
void VOLT_CALLING_CONV VoltReleaseBfCtx VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   bf_context_t **bfCtx
));

/* This function extracts the IBE params (prime, subprime, basePoint,
 * pubPoint) from a bf_context_t (bfCtx) and puts them into
 * VtBFType1IBEParamInfo format.
 * <p>If you call this function, you must call DemolishIBEParams.
 *
 * @param libCtx The library context to use.
 * @param bfCtx The bfCtx containing the IBE information.
 * @param theParams The address where this routine will deposit a
 * pointer to the built ibeParams struct.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
int VOLT_CALLING_CONV VoltBuildIBEParamsFromBfCtx VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   bf_context_t *bfCtx,
   VtBFType1IBEParamInfo **theParams
));

/* Demolish the ibeParams struct that was built by the
 * BuildIBEParamsFromBfCtx function.
 * <p>Do not call this function to destroy or free an ibeParams struct
 * unless you built it using the BuildIBEParamsFromBfCtx call.
 *
 * @param libCtx The library context to use.
 * @param ibeParams The address where this routine will find the struct
 * to demolish.
 * @return none
 */
void VOLT_CALLING_CONV VoltDemolishIBEParams VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VtBFType1IBEParamInfo **theParams
));

/* Given the x-coordinate of a point, get the y-coordinate.
 * <p>The x-coordinate data will actually be a first byte indicating
 * the low order bit of the y-coordinate.
 * <p>This function does no argument checking.
 *
 * @param libCtx The libCtx to use.
 * @param mpCtx The mpCtx to use.
 * @param paramInfo The parameter data (prime, subprime, etc.).
 * @param xCoord The buffer containing the x-coordinate (with the y-bit
 * "prefix").
 * @param xCoordLen The length, in bytes, of the x-coordinate.
 * @param yCoord The buffer into which the result will be placed.
 * @param bufferSize The size, in bytes, of the output buffer.
 * @param yCoordLen The address where this routine will deposit the
 * length, in bytes, of the resulting y-coordinate.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
int VOLT_CALLING_CONV VoltGetYCoordFromX VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VoltMpIntCtx *mpCtx,
   VtBFType1IBEParamInfo *paramInfo,
   unsigned char *xCoord,
   unsigned int xCoordLen,
   unsigned char *yCoord,
   unsigned int bufferSize,
   unsigned int *yCoordLen
));

/* Given the y-coordinate of a point, get the x-coordinate.
 * <p>This function does no argument checking.
 *
 * @param libCtx The libCtx to use.
 * @param mpCtx The mpCtx to use.
 * @param paramInfo The parameter data (prime, subprime, etc.).
 * @param yCoord The buffer containing the y-coordinate.
 * @param yCoordLen The length, in bytes, of the y-coordinate.
 * @param xCoord The buffer into which the result will be placed.
 * @param bufferSize The size, in bytes, of the output buffer.
 * @param xCoordLen The address where this routine will deposit the
 * length, in bytes, of the resulting x-coordinate.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
int VOLT_CALLING_CONV VoltGetXCoordFromY VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VoltMpIntCtx *mpCtx,
   VtBFType1IBEParamInfo *paramInfo,
   unsigned char *yCoord,
   unsigned int yCoordLen,
   unsigned char *xCoord,
   unsigned int bufferSize,
   unsigned int *xCoordLen
));

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

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

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

/* Implements VGetOutputSize.
 */
int VOLT_CALLING_CONV BFType1IBEGetOutputSize VOLT_PROTO_LIST ((
   VoltAlgorithmObject *obj,
   unsigned int callFlag,
   unsigned char *input,
   unsigned int inputLen,
   unsigned int *outputSize,
   unsigned int *leftovers,
   VtRandomObject random
));

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

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

/* Implements VDecryptInit.
 */
int VOLT_CALLING_CONV BFType1IBEPriDecryptInit VOLT_PROTO_LIST ((
   VoltAlgorithmObject *algObj,
   VoltKeyObject *keyObj
));

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

/* These are the security and prime/subprime sizes we support.
 * These three arrays match. That is, the prime size for the security
 * size at the 0 index is at the 0 index in the prime size array. And
 * so on.
 * <p>For security sizes < 4096, prime size is 1/2 * security size, and
 * subprime size is (security size / 32) + 128.
 * <p>For security sizes > 4096, prime size is 1/2 * security size, and
 * subprime size is (security size / 64) + 192.
 */
#define VALID_SECURITY_SIZES {1024,1536,2048,3072,4096}
#define VALID_PRIME_SIZES {512,768,1024,1536,2048}
#define VALID_SUBPRIME_SIZES {160,176,192,224,256}
#define VALID_SECURITY_SIZES_COUNT 5

#ifdef __cplusplus
}
#endif

#endif /* _IBE_H */

⌨️ 快捷键说明

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