📄 p1pad.h
字号:
/* Copyright 2005-2006, Voltage Security, all rights reserved.
*/
#include "vibecrypto.h"
#include "environment.h"
#include "base.h"
#include "libctx.h"
#include "algobj.h"
#include "pad.h"
#ifndef _P1_PAD_H
#define _P1_PAD_H
#ifdef __cplusplus
extern "C" {
#endif
/* P1 Type 1 padding needs to know how long the digest is supposed to
* be, along with the digestInfo.
* The digestInfo is the DER of the following
* SEQUENCE {
* digestAlg AlgorithmIdentifier,
* digest OCTET_STRING }
* The digestInfo holds the SEQ and digestAlg.
*/
typedef struct
{
unsigned char *digestInfo;
unsigned int digestInfoLen;
unsigned int digestLen;
} VoltP1T1PadCtx;
#define VOLT_MD5_DIGEST_INFO_LEN 18
#define VOLT_MD5_DIGEST_INFO \
0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, \
0x48, 0x86, 0xf7, 0x0d, 0x02, 0x05, 0x05, 0x00, \
0x04, 0x10
#define VOLT_SHA1_DIGEST_INFO_LEN 15
#define VOLT_SHA1_DIGEST_INFO \
0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, \
0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14
#define VOLT_SHA224_DIGEST_INFO_LEN 19
#define VOLT_SHA224_DIGEST_INFO \
0x30, 0x2d, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, \
0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04, 0x05, \
0x00, 0x04, 0x1c
#define VOLT_SHA256_DIGEST_INFO_LEN 19
#define VOLT_SHA256_DIGEST_INFO \
0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, \
0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, \
0x00, 0x04, 0x20
#define VOLT_SHA384_DIGEST_INFO_LEN 19
#define VOLT_SHA384_DIGEST_INFO \
0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, \
0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, \
0x00, 0x04, 0x30
#define VOLT_SHA512_DIGEST_INFO_LEN 19
#define VOLT_SHA512_DIGEST_INFO \
0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, \
0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, \
0x00, 0x04, 0x40
/* Implements VPad.
*/
int VOLT_CALLING_CONV P1T1Pad VOLT_PROTO_LIST ((
VoltAlgorithmObject *obj,
VtRandomObject random,
Pointer padCtx,
unsigned char *block,
unsigned int inputLen,
unsigned int blockSize
));
/* Implements VUnpad.
*/
int VOLT_CALLING_CONV P1T1Unpad VOLT_PROTO_LIST ((
VoltAlgorithmObject *obj,
Pointer padCtx,
unsigned char *block,
unsigned int blockSize,
unsigned int *outputLen
));
/* Implements VPad.
*/
int VOLT_CALLING_CONV P1T2Pad VOLT_PROTO_LIST ((
VoltAlgorithmObject *obj,
VtRandomObject random,
Pointer padCtx,
unsigned char *block,
unsigned int inputLen,
unsigned int blockSize
));
/* Implements VUnpad.
*/
int VOLT_CALLING_CONV P1T2Unpad VOLT_PROTO_LIST ((
VoltAlgorithmObject *obj,
Pointer padCtx,
unsigned char *block,
unsigned int blockSize,
unsigned int *outputLen
));
/* This is the local pad ctx for the OAEP padding Impl.
*/
typedef struct
{
VtAlgorithmObject digester;
unsigned char *digestOfLabel;
unsigned int digestLen;
} VoltP1OaepCtx;
/* Implements VPad.
*/
int VOLT_CALLING_CONV P1OAEPad VOLT_PROTO_LIST ((
VoltAlgorithmObject *obj,
VtRandomObject random,
Pointer padCtx,
unsigned char *block,
unsigned int inputLen,
unsigned int blockSize
));
/* Implements VUnpad.
*/
int VOLT_CALLING_CONV P1OAEPUnpad VOLT_PROTO_LIST ((
VoltAlgorithmObject *obj,
Pointer padCtx,
unsigned char *block,
unsigned int blockSize,
unsigned int *outputLen
));
/* Implements VCtxDestroy.
*/
void VOLT_CALLING_CONV P1OAEPCtxDestroy VOLT_PROTO_LIST ((
Pointer object,
Pointer context
));
#ifdef __cplusplus
}
#endif
#endif /* _P1_PAD_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -