Implement all the features of the IPSec protocol to improve VPN network security with Altera SoC

1 IPSec protocol

The IPSec protocol is an IP security standard specifically developed for the Internet Engineering Task Group (IETF) for the serious defects of the TCP / IP protocol, which is used to implement access control, no connection integrity, data source authentication, anti-playback, Data encryption and limited traffic confidentiality and other secure services. This standard consists of a series of protocols, and the relationship between the protocols is shown in Figure 1.

Fund Project: During the Tenth Five-Year Plan, the National Password Development Fund Password Theory “Classification SOC Chip Architecture and Security Research”.

The interpretation of the agreement is as follows:

1AH (AuthenCaon Heer) is a security protocol header that provides data integrity, data source authentication, some optional and limited anti-broadcast services in transmission mode.

2ESP (Encapsulang Security PayLoad) is a protocol head inserted into the IP datagram, providing secure services such as IP layer flow data, data source identity, anti-broadcast, and data integrity.

3 The authentication and encryption algorithm are the core of IPsec to implement security data transmission, where encryption algorithm is used for ESP, which can be used by DES, IDEA and other password algorithms; the authentication algorithm is used for AH, and 3DES, RC5 and other algorithms can be employed.

4ike (Internet Key Exchange) is a key exchange protocol for establishing shared security parameters and validated keys in both IPSec communication to establish a security association.

5DOI (Domain of Interpretaon) is a separate document that stores parameters for IKE negotiation.

6SA (Security Association) is a security association protocol, a host, router, two-way logical connections between IPS EC entities. SA has a security policy library (SPDB) and security association library (SADB), which stores specific details of security policies, including protection, protected, protective communication data, and other strategies.2 SOC technology

Currently, the SOC platform is mainly used for chip development in CSOC, SOPC, EPGA. Among them, CSOC is called a configurable system-level chip, typically includes 1 processor core, programmable logical array, and other universal components; SOPC is a programmable single-chip system, such as N kernel module; EPGA is the SOC for the main body chip. Using these SOC development platforms, you can make full use of the characteristics of the system-level chip integration and superior performance, flexible design and development of various dedicated SOC chips.

(1) Selection of development platform

The SO platform includes: a variety of tools and resource software, which can be reconstructed for hardware structural verification platforms and instruction manuals. Its available software resources include: multi-core, hardware module design language, compiler, simulation, integrated, and layout, tools, etc .; design language includes HDL, C / C ++, etc. The choice of development platform depends on the source of the device: When elects the commercial device, you can select Altera’s SOPC Development Environment II; when selecting SOCs to develop SOCs, the relevant special development platform should be used.

(2) Selection of LP library

The selection of the IP library should select a universal IP core for the device type. Algorithm modules with high security requirements should take technical measures such as access control, anti-anatomy analysis; for variable logic modules, FPGA should be used to ensure programmable features.(3) Choice of chip structure

The body part of the SOC is consisting of CPU and composition. During the design, the choice of chip structure should be applied from the system application planning, protocol processing speed requirements, easy to implement, Vetilog HDL programming, and several perspectives such as the actual structure of the logical module used.

The SOC chip of Altera is shown in Figure 2.

(4) Software and hardware system design

The basic structure of the SOC has a plurality of microprocessors, as well as programmable hardware logic, so in SOC design must be a collaborative design of software and hardware. Software and hardware collaborative design is very technical, it has both SOC design flexibility, and there is also a complexity of SOC design, full of variables, will involve the planning of hardware resources and the implementation of the entire system performance.

(5) System integration design

The key technologies of system integration design are mainly a seamless connection system design and related technical, including tight, transmission characteristics, integrated and test interfaces.

(6) Low-power management design

Low-power design is a design technology for devices with relevant requirements, and is mainly implemented in some system status, bridge control, etc.

3 IPSec implementation technology based on SOC

3.1 Basic Structure

The multi-protocol module that implements IPsec with SOC includes: 1IPSec protocol input, output engine, is resolved by protocol, determines the processing of data flow; 2 security association, key exchange, password algorithm, etc., where security association modules provide directly Required parameters, the key exchange module is used for IKE automatically managed SAD, the algorithm module is the basic module that implements IP data plus decryption and authentication; 3 Interface module, is an interface interface of IPSec and IPv4 / IPv6 protocol. The CPU core in the SOC, implement system management, policy management, and key management. SOC-based IPSec protocol structure is shown in Figure 3.The main part of IPSec is a hardware module processed by multi-protocol. During the SOC design, you should be optimized to meet the functionality and performance requirements of IPsec; use the on-chip operating system to meet the flexibility of the design, the inheritance and reusability of IP characteristics; combined with the structure, performance of the CPU And instruction systems, software-hardware system designs to achieve communication between various modules>, transmission, and control.

The SOC-based IPSec chip structure is shown in Figure 4.

The IKE key exchange, policy management, and SAD manual injection of the IPSec protocol in Figure 4 are handled by the real-time operating system, and the IPSec inputs the protocol resolution, the security policy library (SAD, SPD), key quick lookup (CAM), The addendal algorithm, the GMAC communication interface, and the like are constructed by the hardware module. Communication interface realizes the reception, transmission, check and other functions of link frames. The chip should also be designed to prevent system cracklers; in addition, design tracking modules for system software and hardware debugging.In summary, in the SOC chip that implements the IPSec protocol, the main protocol stack processing is implemented by the hardware module, and the CPU is responsible for managing scheduling and key configuration.

3.2 functional implementation

(1) Output and input engine processing of the LPSec protocol

For output packets, the IPSec Protocol Output Engine initiates a policy management module to query SPD, and determine the security policy that the data package should be used. According to the instructions of the policy management module, the protocol engine makes the data package three possible processing:

1 If there is a valid SA, the corresponding parameters are removed, encapsulate data packets (including encryption, verification, add IPsec headers and IP heads, and then send.

2 If the SA has not been established, the policy management module starts or triggers IKE negotiation. After the negotiation is successful, press the steps in the step; unsuccessful, the packet should be discarded and the error message will be recorded.

3 If there is SA but invalid, the policy management module will report this information to the IKE, request the negotiation of the new SA, and then processes the steps in 1 after success, and the packet should be discarded.For entering packets, the IPSec protocol engine first calls the policy management module to query SAD. If a valid SA is obtained, the packet is decoupled (restore), then the SPD is queried, verify that the security protection provided by the packet is consistent with the policy configuration. If you match, the restored packet is paid to the TCP layer or forward. If you do not match, or require application IPsec but not established SA, or if SA is invalid, the packet is discarded and the error message is recorded.

(2) SPDB and SADB implementation technology

The IPSec protocol processes the data packets to verify the legitimacy of the data and the removal of the data report by constantly querying the legitimacy and the removal key for the data report. Therefore, how to save the SADB and SPDB for IPSec processing performance. The data structure is critical. In addition, since SA and SPs are dynamically changed, the appropriate storage structure must be selected. If the software method is designed to store a reasonable data structure, the query speed of SA and SPs can be accepted in the system’s SADB and SPDB scale, but with the expansion of SADB and SPDB, the system’s query capabilities must fall. Because the best situation in the query is a hit, most cases will not be a hit, the efficiency of the query is inevitably declining, which affects the processing of the IPSec protocol. To fundamentally solve the problem of query efficiency, you must analyze SADB and SPDB design requirements to find solutions.

The design of SPDB and SADB is based on a SPD corresponding to each SA. SA and SPD have the same address in each medium. With pointer to each other, as long as one of the databases finds the matching field, the address pointer of the two databases can be obtained at the same time. Therefore, the design of SPDB and SADB should meet the following requirements:

1 For this data structure, the data structure can be effectively queried, to obtain the exact or selective matching result, including the source address, destination address, protocol, and S.

2 can save a wild, range or exact value for the selector.

3 hide the pointer to SADB and SPDB to ensure synchronization between the two structures.

4 Sort the SA / SP entry so that matching is always completed quickly.

Hardware design technology is usually a good way to improve protocol processing speed. Among them, CAM (CONNT_ADDRESSABLE MEMORY) is composed of control and matching two parts by a content addressing memory. By the control section, you can use the data that needs to be written into the CAM to write into the CAM via the SPDB and SADB management modules, which is used when it is found. You can enter the data in the matching port to find the address where the matching data is located and returns. In actual design, the SADB or SPDB database content is continuously stored in space. Write a matching input item, which requires the lookup, the matching output is 32 bits as the address of the query SADB and SPDB in the RAM, which checks only a few clock cycles at a time. When the SADB and SPDB are very large, the system’s query speed will not be lowered. At present, the matching speed of CAM is very fast, the search speed can reach 100 million / s, and the number of continuous biopsy in a 1000MB / s network port is 1000 ¡Á 1024 ¡Á 1024 / (8 ¡Á 96) = 1 365 330, fully meet the needs of system search. Matching successfully can find the starting address in the corresponding database, which greatly saves the time of the surfacket, and improve the efficiency of IPSec processing. (3) Implementation of password algorithm

A series of password operations involved in the IPSec implementation, including encryption algorithms and authentication algorithms that implement AH and ESP, and implement the key exchange algorithm required for IKE and key generation algorithm. In order to achieve higher cryptographic operation efficiency, it is possible to design a special password computing processor for pipeline technology design; design hardware random number generator, generate a message key for the cryptographic device; design the key security controller to protect the key security.(4) Realization of the rest of the function

IKE key exchange, policy management, SAD manual injection and hardware initialization (such as SPD and SAD management) are implemented by real-time operating systems.


This article introduces SOC-based IPSec protocol implementation technology, which is suitable for high-end applications such as Gigabit VPN devices. As for low-end applications with high speed requirements, protocol processing can be implemented by the CPU, and the password algorithm is implemented by hardware to reduce hardware scale and design costs, enabling the device to obtain a higher cost performance. In summary, the SOC construction safety platform is an effective way to improve safety products, reliability, and timeliness.

R & D is based on independent intellectual property rights. Based on SOC-based security products, it can make full use of high CPU efficiency, strong hardware programmability, and characteristics of large-scale, fast speed, and greatly improve the performance of safety products. This technology not only has important practical value for information security products, but also has important academic significance for cryptographic engineering technology.