A method for detecting malicious logic in IP soft core based on graph texture analysis

Through the graph texture analysis method, a hardware Trojan map texture library is constructed and the texture feature points of IP soft cores are extracted, which solves the problem of low detection accuracy of IP soft cores in the existing technology, and realizes efficient and accurate maliciousness of RTL-level IP soft cores Logical detection improves the credibility and fine-grainedness of detection.

CN118094543BActive Publication Date: 2024-11-12NAT UNIV OF DEFENSE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410233247.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-01
Publication Date
2024-11-12
Estimated Expiration
2044-03-01

AI Technical Summary

Technical Problem

The existing IP soft-core hardware Trojan detection methods have noise influence, low keyword detection accuracy and difficult to detect encrypted IP soft-core malicious logic, resulting in the RTL-level IP soft-core security being threatened.

Method used

Using a method based on graph texture analysis, a standardized hardware Trojan map texture library is constructed, grayscale maps of IP soft cores are extracted, image enhancement processing and texture feature point extraction are performed, and malicious logic is detected using SIFT feature matching.

Benefits of technology

It realizes efficient and accurate detection of RTL-level IP soft cores, overcomes the problems of noise influence and low keyword detection accuracy, and improves the credibility and fine-grainedness of the detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118094543B_ABST
    Figure CN118094543B_ABST
Patent Text Reader

Abstract

The present invention provides an IP soft core malicious logic detection method based on atlas texture analysis, comprising the following steps: step S1: constructing a standardized hardware Trojan atlas texture library; step S2: extracting the IP soft core grayscale atlas, and performing image enhancement processing on the grayscale atlas; step S3: extracting texture feature points of the IP soft core grayscale atlas; step S4: matching the texture feature points with the standardized hardware Trojan atlas texture library, when the matching rate is greater than a set threshold, the IP soft core has malicious logic. Converting text features into atlas texture features can effectively overcome the problems of noise influence, low keyword detection accuracy, IP soft core encryption, etc., and has the characteristics of comprehensive evaluation features, high credibility of recognition results, and the ability to achieve fine-grained detection. The detection process and calculation difficulty are more complex and efficient, and the results are more credible and accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of chip security detection, and in particular to a method for detecting malicious logic of an IP soft core based on atlas texture analysis. Background Art

[0002] In recent years, information security incidents have occurred from time to time, and the security of integrated circuits is receiving widespread attention. Ensuring that chips are "autonomous and controllable" and "autonomous and trustworthy" has become an urgent need for various information systems under the current situation. In the uncontrollable links in the life cycle of integrated circuits, it is easy for malicious logic (hardware Trojans) to be inserted by third parties with ulterior motives, posing a huge security threat. Hardware malicious logic is a new type of attack method against integrated circuit chips that has emerged in recent years. They are attackers who purposefully tamper with the target circuit in the entire IC design and manufacturing process by using the redundant state of the circuit or the redundant area in the layout. As a bomb hidden in the chip, it cannot be eliminated like a software virus, which brings major challenges to IC security. With the continuous development of IC design technology, in order to accelerate the production and manufacturing of products, a large number of key modules that constitute the system-level chip are implemented using reusable IP soft cores. However, due to factors such as the complexity, stability and process of the IP soft core, a large number of IP soft cores used in the design are designed and manufactured by third parties, resulting in the IP soft core being easily maliciously implanted with hardware Trojans, which poses serious security risks.

[0003] At present, the domestic methods for detecting hardware Trojans in IP soft cores mainly include:

[0004] 1. The reverse analysis after post-tapeout destructive hardware Trojan detection is not only very time-consuming but also expensive. At the same time, these detection methods cannot solve the problem of chips with increasing integration and increasingly complex structures. The DFTT-assisted detection method currently only supports Verilog HDL code and does not support code in other hardware description languages. The method based on bypass signal analysis is easily affected by process variables and various noises, and the detection accuracy of tiny hardware Trojan malicious logic is not high. The test vector structure of the logic detection method is complex, and it is easy to make mistakes when detecting complex hardware Trojan malicious logic.

[0005] 2. Conduct pseudo-exhaustive functional testing, and perform coverage and flip rate analysis during the test, or perform keyword matching analysis at the semantic level. The former is often not very ideal due to the existence of process noise, and the latter is flexible in writing hardware description languages, and there are many ways to implement circuits. For example, when completing state machine code, you can use two-segment writing or three-segment writing. At the same time, in ultra-large-scale design, the code is often written by multiple designers, and each person's coding style is different, which makes it difficult for the detection method to integrate codes of different styles, and to perform feature analysis on the functions described by the code through text search and keyword matching, and the detection accuracy and reliability are not high. In general, there is no reliable detection model and detection algorithm for RTL-level IP soft core hardware Trojan detection, which poses a huge threat to the security of IP soft cores. Summary of the invention

[0006] The present invention proposes a method for detecting malicious logic of IP soft core based on atlas texture analysis to solve the technical problems of noise influence, low keyword detection accuracy and difficulty in detecting encrypted IP soft core.

[0007] In order to solve the above technical problems, the present invention provides an IP soft core malicious logic detection method based on atlas texture analysis, comprising the following steps:

[0008] Step S1: construct a standardized hardware Trojan atlas texture library;

[0009] Step S2: extracting the IP soft core grayscale map, and performing image enhancement processing on the grayscale map;

[0010] Step S3: extracting texture feature points of the IP soft core grayscale map;

[0011] Step S4: Match the texture feature points with the standardized hardware Trojan atlas texture library. When the matching rate is greater than a set threshold, the IP soft core contains malicious logic.

[0012] Preferably, the method for extracting the grayscale map of the IP soft core in step S2 includes: reading a program file; splitting the input data into two bits; converting it into decimal and then into binary; concatenating the binary data into an unsigned eight-bit binary string; representing and storing each element of the grayscale map with an eight-bit binary string.

[0013] Preferably, the method for performing image enhancement processing in step S2 includes: rapidly expanding the contrast by using a contrast stretching function.

[0014] Preferably, the contrast stretching function adopts a three-stage contrast stretching transformation, and the expression of the three-stage contrast stretching transformation is:

[0015]

[0016] In the formula, f(x,y) represents the gray value of the original image, (x,y) represents the coordinates of the matrix, g(x,y) represents the gray value of the image after linear gray transformation, [0,a] and [b,F max ] represents the set grayscale interval, c represents the pixel value after the change corresponding to a, d represents the pixel value after the change corresponding to b, G max Indicates F max The corresponding pixel value after the change.

[0017] Preferably, step S3 extracts texture feature points by sequentially performing scale space extremum detection, key point positioning, key point direction determination and key point description.

[0018] Preferably, the method for detecting extreme values ​​in scale space comprises: constructing a Gaussian difference pyramid, wherein the Gaussian difference pyramid is obtained by subtracting images of two adjacent Gaussian scale spaces, wherein the images of two adjacent scale spaces are calculated by a constant multiplication factor k, and the scale relationship of the same layer of two adjacent groups is twice, and the expression is:

[0019] D(x,y,kσ)=(G(x,y,kσ)-G(x,y,σ))*I(x,y)=L(x,y,kσ)-L(x,y,σ);

[0020] In the formula, G represents the Gaussian function, * represents the convolution calculation, σ represents the scale parameter, I(x, y) represents the original spectrum, and L(x, y, σ) represents the scale space of the spectrum;

[0021] Find the extreme points of the Gaussian difference pyramid: each pixel is compared with all its neighboring points, which include 8 neighboring points of the same scale and 9×2 points corresponding to the upper and lower adjacent scales, a total of 26 points.

[0022] Preferably, the key point positioning method includes:

[0023] Using Taylor expansion in scale space:

[0024]

[0025] X=(x,y,σ) T ;

[0026] After taking the derivative of the above formula and setting it to zero, we can get the offset of the extreme point:

[0027]

[0028] Combining the above equations, we get the value of the corresponding extreme point equation:

[0029]

[0030] In the formula, Indicates the offset relative to the interpolation center;

[0031] Use the Hessian matrix to remove unstable edge response points:

[0032]

[0033] Tr(H)=D xx +D yy =α+β;

[0034] Det(H)=D xx D yy -(D yy ) 2 =α·β;

[0035] α=λ max ;

[0036] β=λ min ;

[0037] Where D xx It means that the image of a certain scale in the Gaussian difference pyramid is differentiated twice in the x direction, and the eigenvalue of the Hessian matrix is ​​proportional to the principal curvature of D, λ max represents the maximum eigenvalue of the Hessian matrix, λ min represents the minimum eigenvalue of the Hessian matrix, T r (H) represents the trace of the Hessian matrix, and Det(H) represents the determinant of the Hessian matrix;

[0038] Calculate the following ratio:

[0039]

[0040] when When the key points are retained, otherwise they are proposed.

[0041] Preferably, the method for determining the direction of the key point includes: collecting the gradient and direction distribution characteristics of the pixels in the 3σ neighborhood window of the Gaussian difference pyramid image where the key point is located, and calculating the image gradient direction angle θ and amplitude m:

[0042]

[0043] θ(x,y)=tan -1 ((L(x+1,y)-L(x-1,y)) / (L(x,y+1)-L(x,y-1)));

[0044] Construct a histogram and divide the 360-degree range into 36 columns, each column has 10 degrees, and the main direction of the feature point is the direction of the maximum value of the histogram.

[0045] Preferably, the method of describing key points includes:

[0046] Divide the area around the key point into d×d sub-areas, each with mσ(d+1) pixels; rotate the feature point by an angle θ, and the new coordinates of the sampling points in the area after rotation are:

[0047]

[0048] After rotating, the area to be described is divided into d×d sub-areas, and the gradient histograms in 8 directions are obtained in each sub-area. The accumulated values ​​of each gradient direction form a seed point, that is, each sub-area histogram is divided into 8 intervals from 0° to 360°, each interval has a 45° interval, forming a SIFT feature vector of dxdx9 data.

[0049] Preferably, the matching method in step S4 includes: traversing the grayscale map of the IP soft core to be detected and the SIFT feature vector of the standardized hardware Trojan map texture library, calculating the Euclidean distance of the key points, selecting the two points with the smallest Euclidean distance, if the nearest distance divided by the second nearest distance is less than the ratio threshold Threshold, then the texture feature point is matched successfully, and the number of feature point matches at different deflection angles is counted. When the number of texture feature point matches at a certain deflection angle exceeds the set threshold, a Trojan exists in the IP soft core to be detected.

[0050] The beneficial effects of the present invention include at least:

[0051] Compared with the current traditional IP soft core hardware Trojan detection scheme based on code coverage review, flip rate check, etc., the present invention maps grayscale texture atlas for IP soft core RTL level code, and proposes a RTL level IP soft core hardware Trojan malicious logic detection model and algorithm based on atlas texture analysis. Compared with the current semantic-level keyword matching analysis, pseudo-exhaustive functional testing and other methods, the RTL level IP soft core hardware Trojan malicious logic detection based on atlas texture analysis is based on the RTL level IP soft core hardware Trojan atlas texture. The hardware Trojan atlas texture library is constructed by extracting and enhancing atlas texture features of multiple types of hardware Trojan data sets, and then the atlas texture of the sample to be tested is extracted and matched and classified using the atlas texture based on SIFT scale-invariant features. Converting text features into atlas texture features can effectively overcome the influence of noise, low keyword detection accuracy, IP soft core encryption and other problems. It has the characteristics of comprehensive evaluation features, high credibility of recognition results, and the ability to achieve fine-grained detection. The detection process and calculation difficulty are more complex and efficient, and the credibility and accuracy of the results are higher. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1 A schematic diagram of a method flow chart of an embodiment of the present invention;

[0053] Figure 2 A schematic diagram of a piecewise linear transformation of a grayscale range according to an embodiment of the present invention;

[0054] Figure 3 A schematic diagram of generating a Gaussian difference pyramid according to an embodiment of the present invention;

[0055] Figure 4 The B19 hardware Trojan texture feature library extracted by the embodiment of the present invention;

[0056] Figure 5 A schematic diagram of extracting texture feature points of a graph according to an embodiment of the present invention;

[0057] Figure 6 A schematic diagram of matching detection of atlas texture features according to an embodiment of the present invention;

[0058] Figure 7 A statistical diagram of the number of texture feature point matches according to an embodiment of the present invention. DETAILED DESCRIPTION

[0059] The following is a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the protection scope of the present invention.

[0060] like Figure 1 As shown, an embodiment of the present invention provides an IP soft core malicious logic detection method based on atlas texture analysis, comprising the following steps:

[0061] Step S1: Construct a standardized hardware Trojan atlas texture library.

[0062] Specifically, the hardware Trojan atlas texture library is built based on the standard hardware Trojan circuit in the Trust-Hub library. The Trust-Hub library can quickly establish and timely update and expand new standard hardware Trojan circuits to ensure the accuracy of IP soft core detection, including the following steps:

[0063] Step 1: Save the standard hardware Trojan circuit program in the Trust-Hub library to the local computer;

[0064] Step 2: Use Winhex software to convert the data format and obtain the hexadecimal data stream;

[0065] Step 3: Complete the grayscale map mapping and save the data through the matrix;

[0066] Step 4: Determine the size of the atlas according to the amount of data contained in the grayscale image matrix, obtain the grayscale image through the output of the relevant function, realize data visualization and generate a hardware Trojan atlas texture library.

[0067] Step S2: extracting the IP soft core grayscale map, and performing image enhancement processing on the grayscale map.

[0068] Specifically, firstly, the RTL level of the hardware Trojan is analyzed. The hardware Trojan is stored in the IP soft core in the Verilog HDL hardware language description. The Winhex software is used to convert the Verilog HDL language into computer language data, and the converted data is mapped to a grayscale map, including the following steps:

[0069] Step 1: Extract the program code of the RTL-level hardware description language in the IP soft core through technical means

[0070] Step 2: Use Winhex software to convert the extracted RTL-level program code from VHDL language to computer language to obtain the hexadecimal data stream of the IP soft core RTL-level program.

[0071] Step 3: Map the converted data stream to the graph through the grayscale graph algorithm.

[0072] After that, the image enhancement processing of the hardware Trojan atlas texture library is performed. The image presented by each pixel in the grayscale image is determined by the grayscale value of this pixel. However, due to the small difference in the reflection of the grayscale value in color, the real features in the extracted texture features are omitted and pseudo features are extracted, thereby reducing the accuracy of texture feature extraction. Therefore, before feature extraction, image enhancement is often required to highlight its texture and improve detection efficiency and accuracy.

[0073] In the embodiment of the present invention, it is assumed that the gray value of each point in the original image is f(x, y), (x, y) is the coordinate of the matrix, and the gray value of the image after gray transformation is g(x, y). The gray enhancement model can be expressed by the following formula:

[0074] g(x,y)=T[f(x,y)];

[0075] After the transformation, the grayscale value of the image g(x,y) is still within the maximum grayscale value range of the image. The mapping relationship of the grayscale transformation is represented by the function T(f), which describes the transformation relationship between the grayscale values ​​of the input pixel and the output pixel. Grayscale transformation can generally be divided into grayscale linear transformation and grayscale nonlinear transformation.

[0076] The present invention adopts the piecewise linear transformation method in the grayscale nonlinear transformation, and uses the contrast stretching function to quickly expand the contrast and realize low-contrast image enhancement. The three-segment contrast stretching transformation adopted in the embodiment of the present invention is as follows: Figure 2 As shown in the figure, the mathematical expression of the transformation is as follows: f(x, y) is the gray value of the original image, g(x, y) is the gray value of the image after linear gray transformation, a, b, c, d, G max 、F max is the pixel value at the boundary of the grayscale interval:

[0077]

[0078] After the grayscale range of the hardware Trojan map is determined, a and b are obtained. Figure 2 The grayscale interval [a,b] is linearly stretched to the interval [c,d], and the grayscale intervals [0,a] and [b,F max ] is compressed to [0,c] and [d,G max ]. Through the above calculations, it can be concluded that to achieve the expansion or compression of a grayscale interval, it can be achieved by adjusting the starting position of the interval and controlling the slope of the piecewise straight line. Piecewise linear transformation is suitable for situations where noise interference exists, especially near black or white. In an embodiment of the present invention, the contrast in the grayscale atlas is significantly enhanced by processing the standardized hardware Trojan atlas texture through the above-mentioned piecewise linear direct grayscale transformation method, thereby obtaining a hardware Trojan atlas texture library with explicit texture features, which is beneficial to the subsequent extraction and detection of atlas texture features.

[0079] Step S3: extracting texture feature points of the IP soft core grayscale map.

[0080] Texture refers to some inherent characteristics of the image surface, such as grayscale statistics, spatial distribution information, image structure, information, etc. Texture features refer to the regular, organized, and repetitive structure formed by the grayscale, color, shape, etc. between pixels in a certain area of ​​the image. Texture features are very important in image processing. They can effectively extract the characteristic information of the image and play an important role in recognition, classification, segmentation, etc.

[0081] In the first step of the embodiment of the present invention, a Gaussian difference pyramid is applied to identify potential points of interest with scale and direction invariance. In the second step, at each candidate position, the position and scale are determined by a finely fitted model, and the key points are selected based on their stability. Based on the local gradient direction of the image, one or more directions are assigned to each key point position. In the third step, all subsequent operations on the image data are transformed relative to the direction, scale and position of the key point, thereby providing invariance to these transformations. Finally, in the neighborhood around each key point, the local gradient of the image is measured at a selected scale, and these gradients are transformed into a representation that allows relatively large local shape deformations and illumination changes.

[0082] Images of different scales are obtained by selecting parameters in the Gaussian function; the parameter σ is the scale space factor, and the different scales determined by different σ determine the finite discrete layer of the scale space. (x, y) represents the position of the image pixel. The Gaussian calculation formula of the template element is as follows, where the size of the two-dimensional template is a*b.

[0083]

[0084] Define a scale space L(x,y,σ) of the graph: the original graph is represented by I(x,y), which is convolved with a Gaussian function G(x,y,σ) representing the scale change:

[0085] L(x,y,σ)=G(x,y,σ)*I(x,y)(2)

[0086] The * represents the convolution calculation. The larger the σ scale parameter is, the clearer the overall overview is and the more blurred the details are. The overall map tends to become gradually blurred.

[0087] The texture feature points of the atlas are selected and expressed mainly through the following four stages:

[0088] 1) Scale space extreme value detection:

[0089] Since the Gaussian pyramid is relatively complex and has the disadvantages of long processing time and low efficiency, the embodiment of the present invention proposes a Gaussian difference pyramid, which is obtained by subtracting images of two adjacent Gaussian scale spaces, which greatly improves the work efficiency. In order to make the scale appear continuous, two adjacent scale images are calculated by a constant multiplication factor k, and the scale relationship of the same layer of two adjacent groups is double, which is expressed as formula (3). D is obtained by subtracting images of two adjacent Gaussian scale spaces:

[0090] D(x,y,kσ)=(G(x,y,kσ)-G(x,y,σ))*I(x,y)=L(x,y,kσ)-L(x,y,σ)(3)

[0091] The Gaussian difference image DoG (Difference of Gaussian) is obtained by subtracting the upper and lower, adjacent layers of the Gaussian pyramid in each group, such as Figure 3 shown.

[0092] In order to create images of different scales, there are corresponding feature points; each subtracted group is called: sub-octave (octave), the scale of the first octave is the original unprocessed image, and the subsequent octaves are generated by sampling the previous octave at alternate points.

[0093] The feature points are composed of local extreme points in the DOG space. In order to find the extreme points of the DOG function, each pixel point is compared with all its neighboring points to see whether it is larger or smaller than its neighboring points in the image domain and scale domain. The middle detection point is compared with its 8 neighboring points of the same scale and 9×2 points corresponding to the upper and lower adjacent scales, a total of 26 points, to ensure that the extreme points are detected in both the scale space and the two-dimensional image space.

[0094] 2) Key point positioning:

[0095] The extreme points detected by the above method are the extreme points of the discrete space. The following method accurately determines the position and scale of the key points by fitting a three-dimensional quadratic function, and removes low-contrast key points and unstable edge response points (because the DOG operator will produce a strong edge response) to enhance matching stability and improve noise resistance.

[0096] In order to improve the stability of key points, it is necessary to perform curve fitting on the scale space Gaussian difference function to find the extreme points. This fitting is performed using the Taylor expansion of the scale space:

[0097]

[0098] X=(x,y,σ) T

[0099] Taking the derivative of the above formula and setting it to 0, we can get the offset of the extreme point as:

[0100]

[0101] Among the detected feature points, remove the low-contrast feature points and unstable edge response points. Remove low-contrast points: Substitute formula (5) into formula (4), and the value of the corresponding extreme point equation is:

[0102]

[0103] in, Represents the offset relative to the interpolation center. When its offset in any dimension (x or y or σ) is greater than 0.5, it means that the interpolation center has shifted to its neighboring point, so the position of the current key point must be changed. At the same time, interpolation is repeated at the new position until convergence; it is also possible to exceed the set number of iterations or exceed the range of the image boundary, in which case such points should be deleted.

[0104] Use the Hessian matrix to remove unstable edge response points:

[0105]

[0106] D xx It means that the image of a certain scale in the DOG pyramid is differentiated twice in the x direction. The eigenvalue of H is proportional to the principal curvature of D, and the ratio of the eigenvalue is expressed by H. Let α = λ max is the largest eigenvalue, β=λ min is the smallest eigenvalue, then T r (H) represents the trace of the matrix H and Det(H) represents the determinant of H can be expressed as:

[0107] Tr(H)=D xx +D yy =α+β (8)

[0108] Det(H)=D xx D yy -(D yy ) 2 =α·β (9)

[0109]

[0110] The ratio is minimum when the two eigenvalues ​​are equal, that is, When , the key points are retained, otherwise they are removed. T represents the set threshold, which is set to 1.2 in the embodiment of the present invention.

[0111] 3) Determination of key point direction:

[0112] Gradient amplitude: The direction of the gradient is the basis for maintaining invariance in subsequent image operations. In order to achieve rotation invariance, a reference direction must be assigned to each key point. For the key points detected in the DOG pyramid, the gradient and direction distribution characteristics of the pixels in the 3σ neighborhood window of the Gaussian pyramid image are collected. Calculate the image gradient direction angle θ and amplitude m:

[0113]

[0114] θ(x,y)=tan -1((L(x+1,y)-L(x-1,y)) / (L(x,y+1)-L(x,y-1))) (12)

[0115] Gradient histogram: The gradient histogram is used to count the gradient and direction of each feature point in the neighborhood. The 360-degree range is divided into 36 bins, each with 10 degrees. The main direction of the feature point is determined by the direction of the maximum value of the histogram. When the gradient is converted into a specific representation, it achieves invariance to local shape deformation and illumination changes.

[0116] 4) Key point description: Through the above steps, for each key point, we have three pieces of information: position, scale and direction. By using a set of vectors to describe this key point in detail, it not only describes the key point itself, but also includes nearby points that affect the key point.

[0117] Describing the sub-sampling area: The specific description of the feature descriptor requires the scale of the key point, and the calculation of the gradient is also performed on the Gaussian image corresponding to the feature point. In the specific implementation, the area near the key point is divided into d×d (Lowe's article recommends d=4) sub-areas, and the size of each sub-area is mσ pixels. In actual calculations, bilinear interpolation is used, so the calculation area is mσ(d+1);

[0118] Rotation of regional coordinate axes: In order to ensure rotation invariance, the feature point is rotated at an angle of θ. The new coordinates of the sampling points in the region after rotation are:

[0119]

[0120] Calculate the gradient histogram of the sampling area: After rotating the area to be described, it is divided into d×d sub-areas, and the gradient histograms of 8 directions are obtained in each sub-area. Then the accumulated values ​​of each gradient direction form a seed point. Different from the main direction, at this time, each sub-area histogram divides 0°~360° into 8 intervals, and each interval has a 45° interval. Since there are d×d, that is, 4×4 sub-areas, there are 4×4×8=128 data in the end, forming a 128-dimensional SIFT feature vector, which constitutes the description of the key point.

[0121] Step S4: Match the texture feature points with the standardized hardware Trojan atlas texture library. When the matching rate is greater than a set threshold, the IP soft core contains malicious logic.

[0122] Specifically, the embodiment of the present invention performs the same standardization and image enhancement processing as the hardware Trojan atlas texture library on the sample to be tested after preprocessing, and extracts a set of key point descriptors. The identification of the sample to be tested is completed by comparing the key point descriptors in the two point sets. The similarity measurement of the key point descriptors with 128 dimensions adopts the Euclidean distance.

[0123] Atlas texture key point descriptor in the hardware Trojan library: R i =(r i1 ,r i2 ,···,r i128 );

[0124] The key point descriptor of the atlas texture in the sample to be tested: S i =(s i1 ,s i2 ,···,s i128 );

[0125] The embodiment of the present invention uses Euclidean distance to describe the similarity measurement of any two descriptors:

[0126]

[0127] For the two images, calculate their SIFT feature vectors respectively, traverse the key points in one image, and calculate the Euclidean distance d (R i ,S i ), select the two points with the smallest Euclidean distance, if the closest distance divided by the next closest distance is less than the ratio threshold Threshold, it is a match. Since the embodiment of the present invention matches two pictures with a large number of arbitrary scales, rotations and brightness changes, the results show that the best value is between 0.4 and 0.6, so the embodiment of the present invention sets Threshold to 0.5.

[0128] The B19 hardware Trojan was selected for experimental verification below.

[0129] Experimental process:

[0130] (1) First, the RTL code of the B19 hardware Trojan is converted into computer language data through Winhex software. The converted data is split according to size and stored in an array D. Then, the split data segment D[i] is mapped to the grayscale spectrum to obtain the standard size spectrum R[i]. At this time, R is the spectrum texture library, which contains the spectrum texture features of the B19 Trojan. However, there is still a lot of noise in the spectrum, which may affect the feature extraction. Therefore, each texture feature in R, that is, all pixels of a spectrum, are traversed to perform calculations:

[0131]

[0132] By using this image enhancement algorithm to further visualize the texture, we finally get the B19 texture feature library GOLDEN. Figure 4 As shown, 16 atlases represent the texture features in the B19 hardware Trojan.

[0133] (2) Then the sample to be tested is subjected to the same operation as above to obtain a map containing the texture features of the sample to be tested. The map of the sample to be tested and the B19 hardware Trojan is matched by a scale-invariant feature transformation matching algorithm to extract texture feature points, such as Figure 5 As shown, Figure 5 The left side shows the texture feature points of the sample map to be tested. Figure 5 On the right are the texture feature points of the B19 hardware Trojan map.

[0134] Then, feature point matching is performed. For the two images, the SIFT feature vectors are calculated respectively. The key points in one image are traversed, and the Euclidean distance between the key points in the second image and the key points in the second image is calculated. The two points with the smallest Euclidean distance are selected. If the closest distance divided by the second closest distance is less than the ratio threshold Threshold, the texture feature point is successfully matched. The embodiment of the present invention also adopts a two-way matching mechanism: based on the above-mentioned first matching result, the matching points in the first feature set of the matched key points in the second feature set are sought in turn, that is, the distance ratio between the nearest neighbor and the second nearest neighbor of the matched key points in the first feature set is less than the Threshold, and the final match is considered to be successful.

[0135] The results of the spectrum matching are as follows Figure 6 As shown, the final texture feature point matching set match is obtained, and the number of feature point matches at different deflection angles is counted. If a peak appears, that is, the number of texture feature point matches at a certain deflection angle exceeds three times the average number, it means that the texture features of the two images are matched successfully, indicating that the sample to be tested contains a Trojan.

[0136] The matching detection result statistics of the embodiment of the present invention are as follows: Figure 7 As shown in the experimental results in the figure above, it can be seen that there are obvious peaks in the image. The number of texture feature point matches at a zero-degree deflection angle far exceeds that at other angles, indicating that the sample to be tested is very likely to be a hardware Trojan maliciously implanted into B19.

[0137] According to the above method, combined with Winhex and MATLAB, the malicious logic detection of the third-party IP soft core can be performed at the RTL level. The embodiment of the present invention has carried out experimental verification based on the real IP soft core program, and verified the feasibility and effectiveness of the detection model based on atlas texture analysis and its algorithm. The experimental analysis results show that the RTL-level IP soft core hardware Trojan malicious logic detection method based on atlas texture analysis can effectively perform non-destructive detection on "uncontrollable" IP soft cores, with short detection time and high detection efficiency, which can improve the efficiency and accuracy of detection.

[0138] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. Only the preferred embodiments of the present invention are expressed. The description is more specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. As long as there is no contradiction in the combination of these technical features, they should be considered as the scope recorded in this specification.

[0139] It should be noted that, for those skilled in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these modifications and improvements all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

Claims

1. A method for detecting malicious logic in IP soft cores based on graph texture analysis. Features: The following steps are involved: Step S1: construct a standardized hardware Trojan atlas texture library; Step S2: extracting the IP soft core grayscale map, and performing image enhancement processing on the grayscale map; Step S3: extracting texture feature points of the IP soft core grayscale map; Step S4: Matching the texture feature points with the standardized hardware Trojan atlas texture library, when the matching rate is greater than a set threshold, the IP soft core has malicious logic; The method for performing image enhancement processing in step S2 includes: rapidly expanding the contrast by using a contrast stretching function; The contrast stretching function adopts a three-stage contrast stretching transformation, and the expression of the three-stage contrast stretching transformation is: In the formula, f(x,y) represents the gray value of the original image, (x,y) represents the coordinates of the matrix, g(x,y) represents the gray value of the image after linear gray transformation, [0,a] and [b,F max ] represents the set grayscale interval, c represents the pixel value after the change corresponding to a, d represents the pixel value after the change corresponding to b, G max Indicates F max The corresponding pixel value after the change; Step S3 extracts texture feature points by sequentially performing scale space extreme value detection, key point positioning, key point direction determination and key point description; The method for detecting extreme values ​​in scale space includes: constructing a Gaussian difference pyramid, wherein the Gaussian difference pyramid is obtained by subtracting images of two adjacent Gaussian scale spaces, wherein the images of two adjacent scale spaces are calculated by a constant multiplication factor k, and the scale relationship of the same layer of two adjacent groups is two times, and the expression is: D(x,y,kσ)=(G(x,y,kσ)-G(x,y,σ))*I(x,y)=L(x,y,kσ)-L(x,y,σ); In the formula, G represents the Gaussian function, * represents the convolution calculation, σ represents the scale parameter, I(x, y) represents the original spectrum, and L(x, y, σ) represents the scale space of the spectrum; Find the extreme points of the Gaussian difference pyramid: compare each pixel point with all its neighboring points, where the neighboring points include 8 neighboring points of the same scale and 9×2 points corresponding to the upper and lower adjacent scales, a total of 26 points; The method for key point positioning includes: Using Taylor expansion in scale space: X=(x,y,σ) T ; After taking the derivative of the above formula and setting it to zero, we can get the offset of the extreme point: Combining the above equations, we get the value of the corresponding extreme point equation: In the formula, Indicates the offset relative to the interpolation center; Use the Hessian matrix to remove unstable edge response points: Tr(H)=D xx +D yy =α+β; It(H)=D xx D yy -(D yy ) 2 =α·β; a=l max ; β=λ min ; Where D xx It means that the image of a certain scale in the Gaussian difference pyramid is differentiated twice in the x direction, and the eigenvalue of the Hessian matrix is ​​proportional to the principal curvature of D, λ max represents the maximum eigenvalue of the Hessian matrix, λ min represents the minimum eigenvalue of the Hessian matrix, T r (H) represents the trace of the Hessian matrix, and Det(H) represents the determinant of the Hessian matrix; Calculate the following ratio: when When the key points are retained, otherwise they are removed; The method for determining the direction of the key point includes: collecting the gradient and direction distribution characteristics of the pixels in the 3σ neighborhood window of the Gaussian difference pyramid image where the key point is located, and calculating the image gradient direction angle θ and amplitude m: θ(x,y)=tan -1 ((L(x+1,y)-L(x-1,y)) / (L(x,y+1)-L(x,y-1))); Construct a histogram, divide the 360-degree range into 36 columns, each column has 10 degrees, and the main direction of the feature point is the direction of the maximum value of the histogram; The method of describing the key points includes: Divide the area around the key point into d×d sub-areas, each with mσ(d+1) pixels; rotate the feature point by an angle θ, and the new coordinates of the sampling points in the area after rotation are: The region to be described is divided into d×d sub-regions after rotation. The gradient histograms in 8 directions are obtained in each sub-region. The accumulated values ​​of each gradient direction form a seed point, that is, each sub-region histogram is divided into 8 intervals from 0° to 360°, each interval has a 45° interval, forming a SIFT feature vector of d×d×9 data; The matching method in step S4 includes: traversing the grayscale map of the IP soft core to be detected and the SIFT feature vector of the standardized hardware Trojan map texture library, calculating the Euclidean distance of the key points, selecting the two points with the smallest Euclidean distance, if the closest distance divided by the second closest distance is less than the ratio threshold Threshold, then the texture feature point is matched successfully, and the number of feature point matches at different deflection angles is counted. When the number of texture feature point matches at a certain deflection angle exceeds the set threshold, a Trojan exists in the IP soft core to be detected.

2. According to claim 1, a method for detecting malicious logic of IP soft core based on graph texture analysis, Features: The method for extracting the grayscale map of the IP soft core in step S2 includes: reading a program file; splitting the input data into two bits; converting it into decimal and then into binary; concatenating the binary data into an unsigned eight-bit binary string; representing and storing each element of the grayscale map with an eight-bit binary string.