<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 利用STM32F唯一96bit序列號實現(xiàn)反拷貝加密的源代碼公開

          利用STM32F唯一96bit序列號實現(xiàn)反拷貝加密的源代碼公開

          作者: 時間:2016-11-26 來源:網(wǎng)絡(luò) 收藏
          //---------------------------------------------------------------------------
          #include
          #pragma argsused
          BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fwdreason, LPVOID lpvReserved)
          {
          return 1;
          }
          //---------------------------------------------------------------------------
          //本示例代碼用BCB5編寫,很容易移植到VC++等編譯環(huán)境
          //導(dǎo)出函數(shù)mcuisp_AntiCopy,mcuisp.exe將調(diào)用mcuisp_AntiCopy函數(shù)來實現(xiàn)反拷貝功能
          extern "C" __declspec(dllexport) int __stdcall mcuisp_AntiCopy(
          unsigned char *buf,//FLASH內(nèi)容存儲緩沖
          DWORD buflen,//FLASH代碼長度(字節(jié))
          DWORD startaddress,//FLASH的地址偏移,STM32F一般為0x08000000
          unsigned char const *inbuf, //前12字節(jié)為96bit的芯片序列號
          DWORD inputbuflen//序列號信息的長度
          );
          //--
          int __stdcall mcuisp_AntiCopy(
          unsigned char *buf,//FLASH內(nèi)容存儲緩沖
          DWORD buflen,//FLASH代碼長度(字節(jié))
          DWORD startaddress,//FLASH的地址偏移,STM32F一般為0x08000000
          unsigned char const *inbuf, //前12字節(jié)為96bit的芯片序列號
          DWORD inputbuflen//序列號信息的長度
          )
          {
          //mcuisp_AntiCopy根據(jù)FLASH內(nèi)容和芯片序列號,經(jīng)過運算后,修改FLASH內(nèi)容
          //本例中,簡單的把序列號拷貝到0x08010000的位置
          //可以在STM32的代碼中比對0x08010000和0x1ffff7e8的內(nèi)容,相符才正常運行
          //實際應(yīng)用中,可以采取比較復(fù)雜的算法
          memcpy(buf+0x10000,inbuf,12);
          return 0;
          };

          上述DLL與mcuisp配合,即可實現(xiàn)STM32F AntiCopy功能。
          由于算法由用戶自己把握,自由發(fā)揮,可最大限度保護用戶的代碼


          關(guān)鍵詞: STM32F序列號反拷貝加

          評論


          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();