首页 > 编程语言 > 详细

生成UDS安全算法DLL文件

时间:2021-05-31 11:38:43      阅读:24      评论:0      收藏:0      [点我收藏+]

使用Visual Studio打开工工程模板,模板在C:\Users\Public\Documents\Vector\CANoe\10.0 (x64)\CANoe Sample Configurations\CAN\Diagnostics\UDSSystem\SecurityAccess\Sources\KeyGenDll_GenerateKeyEx下,

打开工程GenerateKeyExImpl.vcproj,提示工程转换点确定

技术分享图片

 

 

修改算法

KEYGENALGO_API VKeyGenResultEx GenerateKeyEx(
const unsigned char* iSeedArray, /* Array for the seed [in] */
unsigned int iSeedArraySize, /* Length of the array for the seed [in] */
const unsigned int iSecurityLevel, /* Security level [in] */
const char* iVariant, /* Name of the active variant [in] */
unsigned char* ioKeyArray, /* Array for the key [in, out] */
unsigned int iKeyArraySize, /* Maximum length of the array for the key [in] */
unsigned int& oSize /* Length of the key [out] */
)
{
unsigned int key = 0U;
unsigned int seed = 0U;
unsigned int i = 0;
if (iSeedArraySize>iKeyArraySize)
return KGRE_BufferToSmall;
// for (unsigned int i=0;i<iSeedArraySize;i++)
// ioKeyArray[i]=~iSeedArray[i];
seed = iSeedArray[1];
seed |= (iSeedArray[0]<<8);

key = seed + 1;

ioKeyArray[1] = key & 0xff;
ioKeyArray[0] = (key>>8)& 0xff;
oSize=iSeedArraySize;

return KGRE_Ok;
}

 

在工程属性下 选择生成DLL文件

技术分享图片

 

 

点击生成文件,DLL文件在debug文件夹下。

 

生成UDS安全算法DLL文件

原文:https://www.cnblogs.com/hkj8808/p/14829999.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!