📄 aesalgid.c
字号:
/* Copyright 2003-2006, Voltage Security, all rights reserved.
*/
#include "vibe.h"
#include "environment.h"
#include "base.h"
#include "libctx.h"
#include "algobj.h"
#include "cipher.h"
#include "block.h"
#include "oidlist.h"
#include "algid.h"
#include "errorctx.h"
int VtDerCoderAES128ECB (
VtDerCoderInfo *coderInfo,
Pointer object,
unsigned int flag
)
{
int status;
VoltBlockCipherAlgIdData algIdData;
unsigned char aes128ECBOid[VoltAES128ECBOidBytesLen] =
{ VoltAES128ECBOidBytes };
VOLT_DECLARE_FNCT_LINE (fnctLine)
/* Set the algIdData to what we're expecting the object to represent.
*/
algIdData.oid = aes128ECBOid;
algIdData.oidLen = VoltAES128ECBOidBytesLen;
algIdData.algorithm = VT_ALG_ID_AES_128_ECB;
algIdData.subAlg1 = VOLT_SUB_ALG_AES;
algIdData.subAlg2 = VOLT_SUB_ALG_NO_PAD | VOLT_SUB_ALG_ECB;
algIdData.algImpl = VtAlgorithmImplAES;
algIdData.KeyParam = VtKeyParamAES;
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltDerCoderBlockCipher (flag, object, coderInfo, &algIdData);
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, object, status, 0, 0,
(char *)0, "VtDerCoderAES128ECB", fnctLine, (char *)0)
return (status);
}
int VtDerCoderAES192ECB (
VtDerCoderInfo *coderInfo,
Pointer object,
unsigned int flag
)
{
int status;
VoltBlockCipherAlgIdData algIdData;
unsigned char aes192ECBOid[VoltAES192ECBOidBytesLen] =
{ VoltAES192ECBOidBytes };
VOLT_DECLARE_FNCT_LINE (fnctLine)
/* Set the algIdData to what we're expecting the object to represent.
*/
algIdData.oid = aes192ECBOid;
algIdData.oidLen = VoltAES192ECBOidBytesLen;
algIdData.algorithm = VT_ALG_ID_AES_192_ECB;
algIdData.subAlg1 = VOLT_SUB_ALG_AES;
algIdData.subAlg2 = VOLT_SUB_ALG_NO_PAD | VOLT_SUB_ALG_ECB;
algIdData.algImpl = VtAlgorithmImplAES;
algIdData.KeyParam = VtKeyParamAES;
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltDerCoderBlockCipher (flag, object, coderInfo, &algIdData);
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, object, status, 0, 0,
(char *)0, "VtDerCoderAES192ECB", fnctLine, (char *)0)
return (status);
}
int VtDerCoderAES256ECB (
VtDerCoderInfo *coderInfo,
Pointer object,
unsigned int flag
)
{
int status;
VoltBlockCipherAlgIdData algIdData;
unsigned char aes256ECBOid[VoltAES256ECBOidBytesLen] =
{ VoltAES256ECBOidBytes };
VOLT_DECLARE_FNCT_LINE (fnctLine)
/* Set the algIdData to what we're expecting the object to represent.
*/
algIdData.oid = aes256ECBOid;
algIdData.oidLen = VoltAES256ECBOidBytesLen;
algIdData.algorithm = VT_ALG_ID_AES_256_ECB;
algIdData.subAlg1 = VOLT_SUB_ALG_AES;
algIdData.subAlg2 = VOLT_SUB_ALG_NO_PAD | VOLT_SUB_ALG_ECB;
algIdData.algImpl = VtAlgorithmImplAES;
algIdData.KeyParam = VtKeyParamAES;
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltDerCoderBlockCipher (flag, object, coderInfo, &algIdData);
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, object, status, 0, 0,
(char *)0, "VtDerCoderAES256ECB", fnctLine, (char *)0)
return (status);
}
int VtDerCoderAES128CBC (
VtDerCoderInfo *coderInfo,
Pointer object,
unsigned int flag
)
{
int status;
VoltBlockCipherAlgIdData algIdData;
unsigned char aes128CbcOid[VoltAES128CBCOidBytesLen] =
{ VoltAES128CBCOidBytes };
VOLT_DECLARE_FNCT_LINE (fnctLine)
/* Set the algIdData to what we're expecting the object to represent.
*/
algIdData.oid = aes128CbcOid;
algIdData.oidLen = VoltAES128CBCOidBytesLen;
algIdData.algorithm = VT_ALG_ID_AES_128_CBC;
algIdData.subAlg1 = VOLT_SUB_ALG_AES;
algIdData.subAlg2 = VOLT_SUB_ALG_NO_PAD | VOLT_SUB_ALG_CBC;
algIdData.algImpl = VtAlgorithmImplAES;
algIdData.KeyParam = VtKeyParamAES;
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltDerCoderBlockCipher (flag, object, coderInfo, &algIdData);
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, object, status, 0, 0,
(char *)0, "VtDerCoderAES128CBC", fnctLine, (char *)0)
return (status);
}
int VtDerCoderPkcs7AES128CBC (
VtDerCoderInfo *coderInfo,
Pointer object,
unsigned int flag
)
{
int status;
VoltBlockCipherAlgIdData algIdData;
unsigned char aes128CbcOid[VoltAES128CBCOidBytesLen] =
{ VoltAES128CBCOidBytes };
VOLT_DECLARE_FNCT_LINE (fnctLine)
/* Set the algIdData to what we're expecting the object to represent.
* This is PKCS #7 version of a block cipher in CBC mode, it pads.
*/
algIdData.oid = aes128CbcOid;
algIdData.oidLen = VoltAES128CBCOidBytesLen;
algIdData.algorithm = VT_ALG_ID_AES_128_CBC;
algIdData.subAlg1 = VOLT_SUB_ALG_AES;
algIdData.subAlg2 = VOLT_SUB_ALG_P5_PAD | VOLT_SUB_ALG_CBC;
algIdData.algImpl = VtAlgorithmImplAES;
algIdData.KeyParam = VtKeyParamAES;
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltDerCoderBlockCipher (flag, object, coderInfo, &algIdData);
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, object, status, 0, 0,
(char *)0, "", fnctLine, (char *)0)
return (status);
}
int VtDerCoderAES192CBC (
VtDerCoderInfo *coderInfo,
Pointer object,
unsigned int flag
)
{
int status;
VoltBlockCipherAlgIdData algIdData;
unsigned char aes192CbcOid[VoltAES192CBCOidBytesLen] =
{ VoltAES192CBCOidBytes };
VOLT_DECLARE_FNCT_LINE (fnctLine)
/* Set the algIdData to what we're expecting the object to represent.
*/
algIdData.oid = aes192CbcOid;
algIdData.oidLen = VoltAES192CBCOidBytesLen;
algIdData.algorithm = VT_ALG_ID_AES_192_CBC;
algIdData.subAlg1 = VOLT_SUB_ALG_AES;
algIdData.subAlg2 = VOLT_SUB_ALG_NO_PAD | VOLT_SUB_ALG_CBC;
algIdData.algImpl = VtAlgorithmImplAES;
algIdData.KeyParam = VtKeyParamAES;
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltDerCoderBlockCipher (flag, object, coderInfo, &algIdData);
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, object, status, 0, 0,
(char *)0, "VtDerCoderAES192CBC", fnctLine, (char *)0)
return (status);
}
int VtDerCoderPkcs7AES192CBC (
VtDerCoderInfo *coderInfo,
Pointer object,
unsigned int flag
)
{
int status;
VoltBlockCipherAlgIdData algIdData;
unsigned char aes192CbcOid[VoltAES192CBCOidBytesLen] =
{ VoltAES192CBCOidBytes };
VOLT_DECLARE_FNCT_LINE (fnctLine)
/* Set the algIdData to what we're expecting the object to represent.
* This is PKCS #7 version of a block cipher in CBC mode, it pads.
*/
algIdData.oid = aes192CbcOid;
algIdData.oidLen = VoltAES192CBCOidBytesLen;
algIdData.algorithm = VT_ALG_ID_AES_192_CBC;
algIdData.subAlg1 = VOLT_SUB_ALG_AES;
algIdData.subAlg2 = VOLT_SUB_ALG_P5_PAD | VOLT_SUB_ALG_CBC;
algIdData.algImpl = VtAlgorithmImplAES;
algIdData.KeyParam = VtKeyParamAES;
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltDerCoderBlockCipher (flag, object, coderInfo, &algIdData);
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, object, status, 0, 0,
(char *)0, "", fnctLine, (char *)0)
return (status);
}
int VtDerCoderAES256CBC (
VtDerCoderInfo *coderInfo,
Pointer object,
unsigned int flag
)
{
int status;
VoltBlockCipherAlgIdData algIdData;
unsigned char aes256CbcOid[VoltAES256CBCOidBytesLen] =
{ VoltAES256CBCOidBytes };
VOLT_DECLARE_FNCT_LINE (fnctLine)
/* Set the algIdData to what we're expecting the object to represent.
*/
algIdData.oid = aes256CbcOid;
algIdData.oidLen = VoltAES256CBCOidBytesLen;
algIdData.algorithm = VT_ALG_ID_AES_256_CBC;
algIdData.subAlg1 = VOLT_SUB_ALG_AES;
algIdData.subAlg2 = VOLT_SUB_ALG_NO_PAD | VOLT_SUB_ALG_CBC;
algIdData.algImpl = VtAlgorithmImplAES;
algIdData.KeyParam = VtKeyParamAES;
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltDerCoderBlockCipher (flag, object, coderInfo, &algIdData);
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, object, status, 0, 0,
(char *)0, "VtDerCoderAES256CBC", fnctLine, (char *)0)
return (status);
}
int VtDerCoderPkcs7AES256CBC (
VtDerCoderInfo *coderInfo,
Pointer object,
unsigned int flag
)
{
int status;
VoltBlockCipherAlgIdData algIdData;
unsigned char aes256CbcOid[VoltAES256CBCOidBytesLen] =
{ VoltAES256CBCOidBytes };
VOLT_DECLARE_FNCT_LINE (fnctLine)
/* Set the algIdData to what we're expecting the object to represent.
* This is PKCS #7 version of a block cipher in CBC mode, it pads.
*/
algIdData.oid = aes256CbcOid;
algIdData.oidLen = VoltAES256CBCOidBytesLen;
algIdData.algorithm = VT_ALG_ID_AES_256_CBC;
algIdData.subAlg1 = VOLT_SUB_ALG_AES;
algIdData.subAlg2 = VOLT_SUB_ALG_P5_PAD | VOLT_SUB_ALG_CBC;
algIdData.algImpl = VtAlgorithmImplAES;
algIdData.KeyParam = VtKeyParamAES;
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltDerCoderBlockCipher (flag, object, coderInfo, &algIdData);
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, object, status, 0, 0,
(char *)0, "", fnctLine, (char *)0)
return (status);
}
int VtDerCoderAES128OFB (
VtDerCoderInfo *coderInfo,
Pointer object,
unsigned int flag
)
{
int status;
VoltBlockCipherAlgIdData algIdData;
unsigned char aes128OFBOid[VoltAES128OFBOidBytesLen] =
{ VoltAES128OFBOidBytes };
VOLT_DECLARE_FNCT_LINE (fnctLine)
/* Set the algIdData to what we're expecting the object to represent.
*/
algIdData.oid = aes128OFBOid;
algIdData.oidLen = VoltAES128OFBOidBytesLen;
algIdData.algorithm = VT_ALG_ID_AES_128_OFB;
algIdData.subAlg1 = VOLT_SUB_ALG_AES;
algIdData.subAlg2 = VOLT_SUB_ALG_OFB | VOLT_SUB_ALG_NO_PAD;
algIdData.algImpl = VtAlgorithmImplAES;
algIdData.KeyParam = VtKeyParamAES;
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltDerCoderBlockCipher (flag, object, coderInfo, &algIdData);
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, object, status, 0, 0,
(char *)0, "VtDerCoderAES128OFB", fnctLine, (char *)0)
return (status);
}
int VtDerCoderAES192OFB (
VtDerCoderInfo *coderInfo,
Pointer object,
unsigned int flag
)
{
int status;
VoltBlockCipherAlgIdData algIdData;
unsigned char aes192OFBOid[VoltAES192OFBOidBytesLen] =
{ VoltAES192OFBOidBytes };
VOLT_DECLARE_FNCT_LINE (fnctLine)
/* Set the algIdData to what we're expecting the object to represent.
*/
algIdData.oid = aes192OFBOid;
algIdData.oidLen = VoltAES192OFBOidBytesLen;
algIdData.algorithm = VT_ALG_ID_AES_192_OFB;
algIdData.subAlg1 = VOLT_SUB_ALG_AES;
algIdData.subAlg2 = VOLT_SUB_ALG_OFB | VOLT_SUB_ALG_NO_PAD;
algIdData.algImpl = VtAlgorithmImplAES;
algIdData.KeyParam = VtKeyParamAES;
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltDerCoderBlockCipher (flag, object, coderInfo, &algIdData);
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, object, status, 0, 0,
(char *)0, "VtDerCoderAES192OFB", fnctLine, (char *)0)
return (status);
}
int VtDerCoderAES256OFB (
VtDerCoderInfo *coderInfo,
Pointer object,
unsigned int flag
)
{
int status;
VoltBlockCipherAlgIdData algIdData;
unsigned char aes256OFBOid[VoltAES256OFBOidBytesLen] =
{ VoltAES256OFBOidBytes };
VOLT_DECLARE_FNCT_LINE (fnctLine)
/* Set the algIdData to what we're expecting the object to represent.
*/
algIdData.oid = aes256OFBOid;
algIdData.oidLen = VoltAES256OFBOidBytesLen;
algIdData.algorithm = VT_ALG_ID_AES_256_OFB;
algIdData.subAlg1 = VOLT_SUB_ALG_AES;
algIdData.subAlg2 = VOLT_SUB_ALG_OFB | VOLT_SUB_ALG_NO_PAD;
algIdData.algImpl = VtAlgorithmImplAES;
algIdData.KeyParam = VtKeyParamAES;
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltDerCoderBlockCipher (flag, object, coderInfo, &algIdData);
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, object, status, 0, 0,
(char *)0, "VtDerCoderAES256OFB", fnctLine, (char *)0)
return (status);
}
int VtDerCoderAES128CFB (
VtDerCoderInfo *coderInfo,
Pointer object,
unsigned int flag
)
{
int status;
VoltBlockCipherAlgIdData algIdData;
unsigned char aes128CFBOid[VoltAES128CFBOidBytesLen] =
{ VoltAES128CFBOidBytes };
VOLT_DECLARE_FNCT_LINE (fnctLine)
/* Set the algIdData to what we're expecting the object to represent.
*/
algIdData.oid = aes128CFBOid;
algIdData.oidLen = VoltAES128CFBOidBytesLen;
algIdData.algorithm = VT_ALG_ID_AES_128_CFB;
algIdData.subAlg1 = VOLT_SUB_ALG_AES;
algIdData.subAlg2 = VOLT_SUB_ALG_CFB | VOLT_SUB_ALG_NO_PAD;
algIdData.algImpl = VtAlgorithmImplAES;
algIdData.KeyParam = VtKeyParamAES;
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltDerCoderBlockCipher (flag, object, coderInfo, &algIdData);
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, object, status, 0, 0,
(char *)0, "VtDerCoderAES128CFB", fnctLine, (char *)0)
return (status);
}
int VtDerCoderAES192CFB (
VtDerCoderInfo *coderInfo,
Pointer object,
unsigned int flag
)
{
int status;
VoltBlockCipherAlgIdData algIdData;
unsigned char aes192CFBOid[VoltAES192CFBOidBytesLen] =
{ VoltAES192CFBOidBytes };
VOLT_DECLARE_FNCT_LINE (fnctLine)
/* Set the algIdData to what we're expecting the object to represent.
*/
algIdData.oid = aes192CFBOid;
algIdData.oidLen = VoltAES192CFBOidBytesLen;
algIdData.algorithm = VT_ALG_ID_AES_192_CFB;
algIdData.subAlg1 = VOLT_SUB_ALG_AES;
algIdData.subAlg2 = VOLT_SUB_ALG_CFB | VOLT_SUB_ALG_NO_PAD;
algIdData.algImpl = VtAlgorithmImplAES;
algIdData.KeyParam = VtKeyParamAES;
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltDerCoderBlockCipher (flag, object, coderInfo, &algIdData);
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, object, status, 0, 0,
(char *)0, "VtDerCoderAES192CFB", fnctLine, (char *)0)
return (status);
}
int VtDerCoderAES256CFB (
VtDerCoderInfo *coderInfo,
Pointer object,
unsigned int flag
)
{
int status;
VoltBlockCipherAlgIdData algIdData;
unsigned char aes256CFBOid[VoltAES256CFBOidBytesLen] =
{ VoltAES256CFBOidBytes };
VOLT_DECLARE_FNCT_LINE (fnctLine)
/* Set the algIdData to what we're expecting the object to represent.
*/
algIdData.oid = aes256CFBOid;
algIdData.oidLen = VoltAES256CFBOidBytesLen;
algIdData.algorithm = VT_ALG_ID_AES_256_CFB;
algIdData.subAlg1 = VOLT_SUB_ALG_AES;
algIdData.subAlg2 = VOLT_SUB_ALG_CFB | VOLT_SUB_ALG_NO_PAD;
algIdData.algImpl = VtAlgorithmImplAES;
algIdData.KeyParam = VtKeyParamAES;
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltDerCoderBlockCipher (flag, object, coderInfo, &algIdData);
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, object, status, 0, 0,
(char *)0, "VtDerCoderAES256CFB", fnctLine, (char *)0)
return (status);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -