ibe.h

来自「IBE是一种非对称密码技术」· C头文件 代码 · 共 742 行 · 第 1/2 页

H
742
字号
 * BuildIBEParamsFromBbCtx function.
 * <p>Do not call this function to destroy or free an ibeParams struct
 * unless you built it using the BuildIBEParamsFromBbCtx 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 VoltDemolishBBIBEParams VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VtBBType1IBEParamInfo **theParams
));

/* 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>If you have a bfCtx, pass it in, if not, pass NULL for the bfCtx
 * and this function will build one.
 * <p>This function does no argument checking.
 *
 * @param libCtx The libCtx to use.
 * @param mpCtx The mpCtx to use.
 * @param bfCtx If you have one for the params, pass it in, if not,
 * pass NULL.
 * @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,
   bf_context_t *bfCtx,
   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
));

/* For BF.
 * <p>The caller passes in an existing ParamInfo, this function will
 * copy the old point to the new point. The old point might actually be
 * one of the points in the ParamInfo struct, but it's isolated so we
 * can call this function with any of the points.
 * <p>If the oldPoint is infinity, error.
 * <p>If the y-coordinate is not NULL, this function checks to make
 * sure it is valid. If valid, it allocates a new buffer in the data
 * field of the newPoint and copies the data. If the y-coordinate is
 * NULL, the function will use the ParamInfo and the x-coordinate to
 * compute the y-coordinate (the x-coordinate is supposed to be a
 * leading marker byte with the actual x-coordinate following).
 * <p>The function then checks the x-coordinate. If not NULL, it copies
 * the data (if the y-coordinate had been missing, the function copies
 * only the actual data, not the leading marker byte). If the
 * x-coordinate is NULL, the function will obtain it based on the
 * ParamInfo and 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 oldPoint The point to be copied.
 * @param newPoint The struct into which the copy will be placed.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
int VOLT_CALLING_CONV VoltBFCopyPoint VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VoltMpIntCtx *mpCtx,
   VtBFType1IBEParamInfo *paramInfo,
   VtBFType1IBEPoint *oldPoint,
   VtBFType1IBEPoint *newPoint
));

/* For BB.
 * <p>The caller passes in an existing ParamInfo, this function will
 * copy the old point to the new point. The old point is actually one
 * of the points in the ParamInfo struct, but it's isolated so we can
 * call this function with any of the points.
 * <p>If the oldPoint is infinity, error.
 * <p>If the y-coordinate is not NULL, this function checks to make
 * sure it is valid. If valid, it allocates a new buffer in the data
 * field of the newPoint and copies the data. If the y-coordinate is
 * NULL, the function will use the ParamInfo and the x-coordinate to
 * compute the y-coordinate (the x-coordinate is supposed to be a
 * leading marker byte with the actual x-coordinate following).
 * <p>The function then checks the x-coordinate. If not NULL, it copies
 * the data (if the y-coordinate had been missing, the function copies
 * only the actual data, not the leading marker byte). If the
 * x-coordinate is NULL, the function will obtain it based on the
 * ParamInfo and 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 oldPoint The point to be copied.
 * @param newPoint The struct into which the copy will be placed.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
int VOLT_CALLING_CONV VoltBBCopyPoint VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VoltMpIntCtx *mpCtx,
   VtBBType1IBEParamInfo *paramInfo,
   VtBBType1IBEPoint *oldPoint,
   VtBBType1IBEPoint *newPoint
));

/* For BB
 * <p>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 VoltBBGetYCoordFromX VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VoltMpIntCtx *mpCtx,
   VtBBType1IBEParamInfo *paramInfo,
   unsigned char *xCoord,
   unsigned int xCoordLen,
   unsigned char *yCoord,
   unsigned int bufferSize,
   unsigned int *yCoordLen
));

/* For BB
 * <p>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 VoltBBGetXCoordFromY VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VoltMpIntCtx *mpCtx,
   VtBBType1IBEParamInfo *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 VCtxDestroy.
 */
void VOLT_CALLING_CONV BBType1IBEClassCtxDestroy 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 VGetOutputSize.
 */
int VOLT_CALLING_CONV BBType1IBEGetOutputSize 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 VEncryptInit.
 */
int VOLT_CALLING_CONV BBType1IBEPubEncryptInit 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 VEncryptUpdate.
 */
int VOLT_CALLING_CONV BBType1IBEPubEncryptUpdate 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 VDecryptInit.
 */
int VOLT_CALLING_CONV BBType1IBEPriDecryptInit 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
));

/* Implements VDecryptUpdate.
 */
int VOLT_CALLING_CONV BBType1IBEPriDecryptUpdate 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.
 */
#define VALID_SECURITY_SIZES {1024,2048,3072}
#define VALID_PRIME_SIZES {512,1024,1536}
#define VALID_BF_SUBPRIME_SIZES {160,0,0}
#define VALID_BB_SUBPRIME_SIZES {160,224,256}
#define VALID_SECURITY_SIZES_COUNT 3

#ifdef __cplusplus
}
#endif

#endif /* _IBE_H */

⌨️ 快捷键说明

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