如何應用AndesCoreTM EDM安全訪(fǎng)問(wèn)機制
圖表8 AHB bus如何使用hdebug_access和驗證邏輯來(lái)防止惡意的debug存取
本文引用地址:http://dyxdggzs.com/article/201609/303699.htm如下verilog code說(shuō)明了如何使用hdebug_access信號:
//--- Use hdebug_access to prevent malicious debug access in AHB Bus Controller
//* assume zero-wait-state AHB access
…
parameter IRRELEVANT_DATA = 32’hcafe0001;
parameter AUTH_CODE = 32’h01020304;
…
always @(posedge hclk or negedge hreset_n) begin
if (!hreset_n) begin
dbg_acc_d1 《= 1’b0;
end
else begin // data phase indication of debug access
dbg_acc_d1 《= hdebug_access;
end
end
。..
always @(posedge hclk or negedge hreset_n) begin
if (!hreset_n) begin
passcode_reg 《= 32‘d0;
end
else if (passcode_wen) begin //debugger enters passcode through debug access
passcode_reg 《= hwdata[31:0];
end
end
…
//validate passcode to check authentication
assign auth_check_fail = (passcode_reg != AUTH_CODE);
//return irrelevant data if the authentication check of debug access fails
assign hrdata_out = {32{data_read_en}}
((dbg_acc_d1 auth_check_fail) IRRELEVANT_DATA : normal_data_out);
4. 實(shí)際的應用
用戶(hù)經(jīng)由上面的介紹完成了權限管理邏輯后,并且掛在AndesCoreTMAHB bus上,再經(jīng)由仿真器(Cadence)仿真此權限管理邏輯的行為,如下面幾張圖所示:
edm_restrict_access信號控制
下圖說(shuō)明由sw code把edm_restrict_access signal disable

圖表9 由sw code把edm_restrict_access signal disable
trusted_debug_exit信號控制

圖表10 經(jīng)由debug access把trusted_debug_exit signal設定成high
debug_access信號
下圖說(shuō)明經(jīng)由debug host來(lái)做存取時(shí),debug_access signal會(huì )從low變成high

圖表11 經(jīng)由debug host來(lái)做存取時(shí),debug_access signal會(huì )從low變成high
下圖說(shuō)明經(jīng)由執行IRTE instruction時(shí),debug_access signal會(huì )從high變成low

圖表12 經(jīng)由執行IRTE instruction時(shí),debug_access signal會(huì )從high變成low
5. 結語(yǔ)
EDM安全存取是AndesCoreTM保護周邊裝置內容不被竊取的功能,也因為越來(lái)越多客戶(hù)使用到此功能,所以撰寫(xiě)此技術(shù)文章讓客戶(hù)更能進(jìn)一步了解到此功能的用途,讓客戶(hù)能夠很快速的上手,并且使用晶心開(kāi)發(fā)的EDM安全存取是一件愉快與簡(jiǎn)單的工作。
評論