Software implementation of KEELOQ technology

Publisher:闪耀之星Latest update time:2006-05-07 Source: 电子技术应用 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

    Abstract: KEELOQ technology is an important secure encryption and decryption technology, which has the characteristics of multiple changes and resistance to interception. Significant parts of the technology are secret and in the hands of only a few foreign companies. A practical and reliable KEELOQ algorithm is proposed, and the software process for implementing the algorithm is given.

    Keywords: KEELOQ technology encryption and decryption synchronization

As a confidential high-tech technology, KEELOQ technology is relatively unfamiliar to many people, but it is widely used in various anti-theft alarm systems (especially vehicle anti-theft alarm systems), remote control electronic locks and other complete control fields. It is a multi-variable, interception-resistant, safe and reliable code-hopping encryption and decryption technology. At present, this advanced technology is only in the hands of a few foreign companies. They use the advantages of integrated circuit design to package this technology in chips and sell it to users. Engineers often find it inconvenient to do some development based on the hardware they provide. KEELOQ technology is actually a complex protocol. As long as you understand its principles, you can choose appropriate parameters in this protocol according to actual needs. This article conducts special research on KEELOQ technology, proposes a software implementation method, and applies this method to car anti-theft alarm systems.

1 General characteristics of KEELOQ technology

As a safe and practical encryption and decryption technology, KEELOQ technology has the following characteristics:

(2) Applying KEELOQ technology to communications has very good security. For the same command, the codeword obtained after KEELOQ encoding is different each time (in a very long period), and this change is irregular.

(2) The code sent by the sender can only be effectively received by a specific object. The receiver can only effectively decrypt the received data after obtaining (through learning) the sender's encryption key in advance.

(3) A specific object can only be used after learning the information of a certain sender.

(4) This technology can prevent the harm caused by the transmission code being intercepted and then forwarded.

(5) The receiving party can clear the learning information it has saved at any time, so that the original sender cannot control itself, which can effectively prevent illegal use by third parties.

It is these characteristics that make KEELOQ technology more and more important and widely used.

2 Hardware implementation of KEELOQ technology

Special chips based on KEELOQ technology are divided into two types: one for encryption and one for decryption, which are usually used together. The chip that implements the encryption function has 4 button interfaces, and can be used in combination to achieve 15 functions. Every time a key is pressed, the KEELOQ encryption password is automatically generated. The composition of the KEELOQ encryption code is generally as follows:

Description serial number Key signal Check Digit sync counter

Once the chip is fabricated, the length of the above items is determined. If the length of the serial number is designed to be 28 bits, the capacity of the entire system will not exceed 268435455 (2 28-1), which is very inconvenient if you want to expand the system capacity. This chip must be preset with some initial values ​​(serial number, encryption key, synchronization counter) before use. Before the sender and receiver can work together, the receiver must first learn to obtain and store the sender's serial number, encryption key, and current synchronization counter value. Learning is an important aspect of KEELOQ technology.

The encryption process of hardware implementation of KEELOQ technology is shown in Figure 1.

The serial number is used to identify different objects; the encryption key is used to encrypt the sent data, making it more difficult to decipher, and it is not sent directly; the synchronization counter is used to resist interception. Every time a key is pressed, the synchronization counter The value is updated, encrypted and transformed before being sent.

The hardware implementation of KEELOQ technology decryption process is shown in Figure 2.

After confirming that the sequence numbers match, the receiver decrypts the received data, then checks whether the synchronization counter matches, and then processes the received key signaling after confirming that it matches.

After use, it was discovered that there are the following shortcomings in implementing KEELOQ technology in hardware:

(1) The hardware cost is high. When using the KEELOQ chip, a microcontroller (MCU) is needed to control it. This is more prominent during mass production.

(2) Key signaling must be combined (more than 1 key is pressed at the same time), otherwise there are only 4 functions, and a maximum of 15 functions through combination. This makes pressing buttons inconvenient and making function expansion almost impossible.

(3) The length of the sequence and synchronous counter of a specific type of chip is fixed. After the system is built, if developers want to expand the capacity of the system or improve the performance of the system only through software upgrades, it is basically impossible to implement KEELOQ technology in hardware.

(4) KEELOQ technology only codes the key signaling at the error detection level and does not code at the error correction level.

(5) Limited by hardware design, flexibility is poor; without core technology, it is easy to be controlled by others.

It is these shortcomings that prompt us to study the use of software to implement KEELOQ technology.

3 Software implementation of KEELOQ technology

The core of KEELOQ technology is the KEELOQ algorithm. As an important part of KEELOQ technology, the KEELOQ algorithm is confidential. After a long period of exploration, research, and verification, this article proposed a reliable KEELOQ algorithm and successfully applied it to the car anti-theft alarm system, achieving very good results.

The serial number encryption key uses a 32-bit m sequence. For a user, the encryption key and the serial number are different. Theoretically, the longer the synchronization counter is, the better, but if it is longer, the overhead in other aspects will be greater. Here, a 16-bit m sequence is selected. The car alarm consists of two parts: the part installed on the car body is called the landline phone; the handheld control part is called the mobile phone. In order to save hardware expenses, the mobile phone is designed with only three buttons and no combination buttons. There are a total of 12 button functions. Each key has four states: one click, two clicks, three clicks, and long press. These 12 types of keys are divided into two categories: one is the command control key to control the operation of the landline (including the learning start key), and the other is the operation key of the mobile phone itself. Each time the command control key is pressed, the KEELOQ encryption process is performed. The software implementation KEELOQ encryption operation process is shown in Figure 3.

It is necessary to perform error correction coding on key signaling: Assume that a certain key signaling is 0110. After transmission through the channel, the codeword decrypted by the receiver becomes 0101, and 0101 also represents a valid command. Obviously, the consequences of this misoperation are serious. Encoded with the Walsh code, after encoding, 3 or less errors can be discovered and corrected at the same time; at the same time, according to the characteristics of the encoding, the encryption key is used to transform the encoded key signaling. Experiments show that these measures greatly improve the reliability of the system.

The relevant part of the KEELOQ algorithm is the synchronized counter. As mentioned before, the mobile phone must be preset with a valid serial number, synchronization counter value, and encryption key before being used for the first time. The landline can learn any mobile phone through control. If the learning is successful, the serial number, synchronization counter value and encryption key of the mobile phone will be saved. Each time the command control key is pressed, the value of the mobile phone's synchronization counter increases by 1 (only one bit changes). After passing through the m sequence generator, from a statistical point of view, half of the bits change. After the receiver confirms that the sequence number of the received data matches, it decrypts the received data and then determines whether the synchronization counter matches. Only after the synchronization counter confirms the match, the received key signaling is processed. Figure 4 illustrates the matching process of confirming the synchronization counter.

    KEELOQ technology is implemented through a complex synchronization technology. Although the anti-theft system developed is a two-way communication, for convenience, the landline phone is called the receiver and the mobile phone is called the sender. The receiver determines whether the value of the decrypted synchronization counter is within the range of a single operation. If it is, replace the original synchronization counter value with the received synchronization counter value and execute the received command; otherwise, check whether it is within the double operation range. If it is, temporarily store the value of the counter and wait to receive the next valid data. In this case, if data is received, when confirming the synchronization count, it is judged whether the value of the received synchronization counter is within the single operation range of the last temporarily stored synchronization counter value. If it is, replace the original synchronization counter value with the currently received synchronization counter value, and execute the command; if the value of the sender's synchronization counter is not within the receiver's double operation range, the command will not be executed, and the synchronization counter The value is not saved. The sender must be learned by the receiver before it can effectively control the receiver. Since the receiver updates the value of its own synchronization counter each time it receives a valid command, the previously used synchronization counter value becomes a disable code and is no longer valid. In this way, the harm caused by the transmitted code being intercepted and then forwarded can be avoided.

    It should be noted that the above-mentioned single operation range, double operation range, and the length of the synchronous counter can be selected according to actual needs. Since the synchronization counter is very important, the algorithm performs error detection coding on it during processing. The software implementation of KEELOQ decryption operation process is shown in Figure 5.

In KEELOQ technology, learning function is an important part. Learning includes clearing the original stored information and learning new information. It is divided into two types: general learning and safe learning. This article adopts a safe learning method. Clear the information of the original mobile phone by long pressing the learning clear key on the landline (this key has two functions: long pressing is the clearing function, and clicking is entering the learning mode) (the original mobile phone cannot control the landline, and must be learned after To control), click the learning clear button on the base phone. If the original information of the base phone has been cleared, the learning mode will be entered; otherwise, the click is invalid and the learning mode will not be entered. At this time, if the mobile phone sends a learning start command to the landline, the landline in the learning state will immediately send a learning request signal to the mobile phone after receiving the command. After receiving the request signal, the mobile phone will immediately send the transformed encryption key and synchronization counter to the mobile phone. The landline phone will exit the learning state after sending it and save the new encryption key and synchronization counter value; after the landline phone confirms that the data is valid, it will save the encryption key and synchronization counter value and exit the learning mode, and needs to continue learning. The encryption key and synchronization counter sent from the mobile phone to the landline are different each time you learn (change irregularly), which is the main feature of safe learning. For greater security, the landline phone can only learn information from one mobile phone at most. The safe learning operation process is shown in Figure 6.

    It can be seen that implementing KEELOQ technology in software is not complicated, and an ordinary microcontroller is enough. The mobile phone part uses WINBOND 4-bit microcontroller, and the landline phone part uses Philips (PHILIPS) 8-bit microcontroller. Using software to implement KEELOQ technology is very flexible: the mobile phone buttons can be designed as needed (imitation mobile phone button design); the serial number, encryption key, and synchronization counter length can be selected as needed, making it easier to upgrade or change in the future; send via mobile phone The key signaling is error-corrected and encoded, and some complex transformation processing can be performed in a focused manner when encoding the sent data with the encryption key. Some manufacturers claim that they can send the same key signaling approximately 4.29 (2 32-1) billion times without duplication. In fact, this can be achieved by increasing the length of the encryption key and synchronization counter, or even more times than this. No duplicate sending. These can be modified in software according to changes in customer system requirements without changing the hardware design. In short, using software to implement KEELOQ technology can save hardware costs, system design can be less dependent on hardware, and system performance can be theoretically superior and reliable.
Reference address:Software implementation of KEELOQ technology

Previous article:PIC Design of Controllable Digital Speech Delay
Next article:Software optimization design of real-time MPEG-4 encoding based on DSP

Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号