KR101240243B1 - Encryption apparatus and method according to CTR mode of AES(advanced encryption standard) - Google Patents

Encryption apparatus and method according to CTR mode of AES(advanced encryption standard) Download PDF

Info

Publication number
KR101240243B1
KR101240243B1 KR1020110050122A KR20110050122A KR101240243B1 KR 101240243 B1 KR101240243 B1 KR 101240243B1 KR 1020110050122 A KR1020110050122 A KR 1020110050122A KR 20110050122 A KR20110050122 A KR 20110050122A KR 101240243 B1 KR101240243 B1 KR 101240243B1
Authority
KR
South Korea
Prior art keywords
round
bytes
result
cache
aes
Prior art date
Application number
KR1020110050122A
Other languages
Korean (ko)
Other versions
KR20120131738A (en
Inventor
이동훈
박진형
백정하
Original Assignee
고려대학교 산학협력단
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 고려대학교 산학협력단 filed Critical 고려대학교 산학협력단
Priority to KR1020110050122A priority Critical patent/KR101240243B1/en
Publication of KR20120131738A publication Critical patent/KR20120131738A/en
Application granted granted Critical
Publication of KR101240243B1 publication Critical patent/KR101240243B1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0618Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation
    • H04L9/0631Substitution permutation network [SPN], i.e. cipher composed of a number of stages or rounds each involving linear and nonlinear transformations, e.g. AES algorithms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/24Key scheduling, i.e. generating round keys or sub-keys for block encryption

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Storage Device Security (AREA)

Abstract

본 발명은 AES의 CTR 모드에 따른 암호화 장치 및 방법에 관한 것으로, 본 발명에 따른 암호화 방법은 평문을 입력받아 128 비트의 크기를 갖는 대상 데이터 블록으로 분할하고, 각 라운드마다 128 비트의 데이터 블록을 입력받아 초기화 벡터로 설정하고, 초기화 벡터를 4 개의 4 바이트 스테이트로 분할하고, 분할된 대상 데이터 블록 중 제 1 블록과 초기화 벡터를 이용하여 암호화된 결과를 XOR하여 제 1 암호문을 생성하고, 분할된 4 개의 스테이트 중 각 라운드의 연산 과정에서 값이 변경되지 않는 스테이트들을 캐시에 저장하고, 제 1 블록에 연속하는 복수 개의 블록들에 대해 각각의 블록들과 캐시를 참조하여 획득한 연산 결과를 XOR함으로써 복수 개의 암호문을 생성하며, 생성된 제 1 암호문과 복수 개의 암호문을 암호화 결과로 출력한다.The present invention relates to an encryption apparatus and method according to the CTR mode of AES, and the encryption method according to the present invention receives a plain text and divides it into a target data block having a size of 128 bits, and each 128-bit data block is divided. Take the input, set it as an initialization vector, divide the initialization vector into four 4-byte states, generate a first ciphertext by XORing the result of encryption using the first block and the initialization vector of the divided target data block, By storing the states whose value does not change during the operation of each round among the four states in the cache, and XOR the operation result obtained by referring to the respective blocks and the cache for a plurality of blocks consecutive to the first block A plurality of ciphertexts are generated, and the generated first ciphertext and the plurality of ciphertexts are output as encryption results.

Description

AES의 CTR 모드에 따른 암호화 장치 및 방법{Encryption apparatus and method according to CTR mode of AES(advanced encryption standard)}Encryption apparatus and method according to ARS (CTR mode) {C encryption mode of AES (advanced encryption standard)}

본 발명은 AES 규격에 따른 암호화 장치 및 방법에 관한 것으로, 특히 평문 데이터의 양이 암호화를 위한 데이터의 크기보다 큰 경우 사용하는 블록 암호화 방법의 다양한 모드들 중, 인터넷 스트리밍 서비스 등에서 안전한 정보의 전송을 위해 사용되는 AES의 CTR 모드를 이용한 암호화 장치, 방법 및 그 방법을 기록한 기록매체에 관한 것이다.The present invention relates to an encryption apparatus and method according to the AES standard, and in particular among the various modes of the block encryption method used when the amount of plain text data is larger than the size of the data for encryption, the transmission of secure information in the Internet streaming service, etc. The present invention relates to an encryption device using the CTR mode of AES, and a recording medium recording the method.

최근 네트워크 기술의 급속한 발전과 함께 인터넷 사용자 수가 급속히 증가하였다. 이에 따라 이러한 네트워크를 이용한 콘텐츠 전송 및 인터넷 전화(VoIP)등 과 같은 인터넷 서비스들이 증가하고 있다. 이러한 인터넷 서비스들이 유·무선망을 통해 유료 서비스 및 개인 통화 정보 등을 전송할 경우, 그 내용이 제 3자에게 쉽게 노출되지 않도록 전송되는 정보의 기밀성을 유지하고 실시간 처리를 지원할 수 있는 정보 보호 기술이 적용되어야 한다.With the recent rapid development of network technology, the number of Internet users has increased rapidly. Accordingly, Internet services such as content delivery and Internet telephony (VoIP) using such networks are increasing. When these Internet services transmit paid services and personal call information through wired / wireless networks, information protection technology is provided to maintain the confidentiality of the transmitted information and to support real-time processing so that its contents are not easily exposed to third parties. Should be applied.

이러한 정보 보호 기술과 관련하여 20년이 넘게 오랫동안 사용되어 온 암호화 알고리즘은 DES(Data Encryption Standard)는 1972년에 미국 상무성 산하 NIST (National Institute of Standards and Technology)의 전신인 NBS(National Bureau of Standards)에서 컴퓨터 데이터를 보호할 목적으로 표준 알고리즘을 공모하여 IBM사가 개발한 암호 알고리즘이다. DES는 연방 표준으로 제정된 후에 5년마다 안정성을 인정받으면서 표준으로 존속되어 왔으나, 1997년 이후 안정성에 대한 논란이 대두되자 NIST가 DES를 대체할 차세대 표준 암호 알고리즘 제정을 위한 프로젝트를 추진하였다.The encryption algorithm that has been in use for more than 20 years in connection with this information protection technology is the DES (Data Encryption Standard) in 1972, the National Bureau of Standards (NBS), the forerunner of the National Institute of Standards and Technology (NIST). Is a cryptographic algorithm developed by IBM to collaborate on a standard algorithm to protect computer data. DES has been the standard of stability every five years since its establishment as a federal standard.However, after the debate about stability since 1997, NIST pursued a project to develop a next-generation standard cryptographic algorithm to replace DES.

그 프로젝트 결과 새로운 차세대 표준 암호화 알고리즘으로서 제시된 것이 바로 AES(Advanced Encryption Standard)이다. AES는 로열티 없이도 사용할 수 있는 국제 표준 대칭키 암호화 알고리즘으로서, 알고리즘에서 사용하는 블록 크기는 128 비트(bit)이며, 128, 192, 256 비트의 키(key)를 사용할 수 있다. 이러한 키의 크기에 따라 AES-128, AES-192, AES-256으로 구별되며, 각각 10, 12, 14 라운드(round)로 동작한다. 이러한 각각의 라운드 일련의 연산들로 구성되는데, 그러한 일련의 연산은 때로는 복잡하고 수행에 시간이 많이 소요되므로, 인터넷 스트리밍 데이터를 처리해야 하는 기술 분야에 있어서는, 암호화 과정의 신속한 처리가 매우 중요하다.As a result of the project, the new next-generation standard encryption algorithm is AES (Advanced Encryption Standard). AES is an international standard symmetric key encryption algorithm that can be used without royalties. The block size used in the algorithm is 128 bits, and keys of 128, 192, and 256 bits can be used. These keys are divided into AES-128, AES-192, and AES-256 and operate in 10, 12, and 14 rounds, respectively. Each of these rounds consists of a series of operations, which are sometimes complex and time consuming to perform, and therefore, in the technical field where Internet streaming data must be processed, rapid processing of the encryption process is very important.

한편, OMA(Open Mobile Alliance)의 DRM(Digital Right Management) V2.0 은 모바일 기기에서의 콘텐츠 보호를 위해 음악이나 동영상과 같은 연속적인 미디어를 위한 PDCF 포맷에 암호화를 위한 AES-CTR 모드(mode)를 포함하고 있다. 또한 서비스의 특성상 고속의 암/복호화와 높은 안전성이 요구되는 IPTV 및 VoIP 서비스에는 실시간으로 전송되는 정보를 안전하게 보호하기 위해 Secure RTP(Real time Transport protocol) 기술이 적용되고 있다. Secure RTP는 보안이 고려되지 않은 기존의 RTP에서 정보전송의 안전성을 향상시킨 것으로 AES CTR Mode를 사용한다. 이와 같이 AES CTR Mode는 OMA DRM, IPTV 그리고 VoIP 등의 스트리밍 서비스에 사용되며 정보의 기밀성 확보와 효율적인 암/복호화 처리를 지원한다. 하지만 IPTV의 셋탑 박스나 DRM 서비스 혹은 VoIP 서비스 등을 이용하는 모바일 디바이스들은 제한된 자원을 가지고 있으므로, 이러한 환경에 사용되는 암호화 알고리즘은 효율성을 고려하여 구현되어야 한다.On the other hand, Digital Right Management (DRM) V2.0 of the Open Mobile Alliance (OMA) provides AES-CTR mode for encryption in PDCF format for continuous media such as music or video for content protection on mobile devices. It includes. In addition, Secure RTP (Real Time Transport Protocol) technology is applied to IPTV and VoIP services that require high-speed encryption / decryption and high security due to the characteristics of the service. Secure RTP uses AES CTR Mode to improve the safety of information transmission in existing RTP without security consideration. As such, AES CTR Mode is used for streaming services such as OMA DRM, IPTV, and VoIP, and secures confidentiality of information and supports efficient encryption / decryption processing. However, mobile devices using IPTV set-top boxes, DRM services, or VoIP services have limited resources. Therefore, the encryption algorithm used in these environments should be implemented with consideration of efficiency.

본 발명이 해결하고자 하는 기술적 과제는 인터넷 스트리밍 데이터를 암호화/복호화하는 과정에서 AES 알고리즘의 일련의 연산으로 인해 실시간 처리가 지연되는 한계를 극복하고, 제한된 자원을 갖는 환경에서 이들 연산을 처리하기 위해 많은 컴퓨팅 자원이 소모되는 문제점을 해결하고자 한다.The technical problem to be solved by the present invention is to overcome the limitation that the real-time processing is delayed due to a series of operations of the AES algorithm in the process of encrypting / decrypting internet streaming data, and to handle these operations in an environment with limited resources. To solve the problem that the computing resources are consumed.

상기 기술적 과제를 해결하기 위하여, 본 발명에 따른 AES(Advanced Encryption Standard)의 CTR 모드(counter mode)에 따른 암호화 방법은, 평문을 입력받아 128 비트(bit)의 크기를 갖는 대상 데이터 블록으로 분할하고, 각 라운드(round)마다 128 비트의 데이터 블록을 입력받아 초기화 벡터(initialization vector)로 설정하며, 상기 설정된 초기화 벡터를 4 개의 4 바이트(byte) 스테이트(state)로 분할하는 단계; 상기 분할된 대상 데이터 블록 중 제 1 블록과 상기 설정된 초기화 벡터를 이용하여 암호화된 결과를 XOR하여 제 1 암호문을 생성하는 단계; 상기 분할된 4 개의 스테이트 중 상기 각 라운드의 연산 과정에서 값이 변경되지 않는 3 개의 스테이트를 캐시(cache)에 저장하는 단계; 상기 제 1 블록에 연속하는 N 개(N은 양의 정수)의 블록들에 대해 각각의 블록들과 상기 캐시를 참조하여 획득한 연산 결과를 XOR함으로써 N 개의 암호문을 생성하는 단계; 및 상기 생성된 제 1 암호문과 상기 생성된 N 개의 암호문을 암호화 결과로 출력하는 단계를 포함한다.In order to solve the above technical problem, the encryption method according to the CTR mode (counter mode) of the AES (Advanced Encryption Standard) according to the present invention, receives the plain text is divided into a target data block having a size of 128 bits (bit) Receiving a 128-bit data block for each round and setting it as an initialization vector, and dividing the set initialization vector into four 4-byte states; Generating a first cipher text by XORing an encrypted result using a first block among the divided target data blocks and the set initialization vector; Storing three states of the divided four states whose values do not change during the operation of each round in a cache; Generating N ciphertexts by XORing the results of operations obtained by referring to the respective blocks and the cache with respect to N blocks (N is a positive integer) consecutive to the first block; And outputting the generated first cipher text and the generated N cipher texts as an encryption result.

상기된 암호화 방법에서 상기 라운드가 AES 초기화 라운드(initial round)인 경우, 상기 3 개의 스테이트를 캐시에 저장하는 단계는, 상기 초기화 라운드의 연산 결과인 16 바이트 중, 마지막 4 바이트를 제외한 12 바이트를 상기 캐시에 저장한다.In the above encryption method, when the round is an AES initialization round, the storing of the three states in the cache may include: 12 bytes excluding the last 4 bytes of the 16 bytes that are the result of the initialization round; Store in cache

상기된 암호화 방법에서 상기 라운드가 AES 라운드 1(round 1)인 경우, 상기 3 개의 스테이트를 캐시에 저장하는 단계는, 상기 라운드 1의 연산 결과인 16 바이트 중, 처음 4 바이트를 제외한 12 바이트를 상기 캐시에 저장한다.In the above encryption method, when the round is AES round 1, the storing of the three states in the cache may include 12 bytes excluding the first 4 bytes of the 16 bytes that are the result of the round 1 operation. Store in cache

또한, 상기 라운드가 AES 라운드 1(round 1)인 경우의 암호화 방법은 상기 캐시에 저장되지 않는 처음 4 바이트에 대하여 상기 AES 라운드 1에 선행하는 AES 암호 초기화 라운드에서 소정 연산에 대한 결과를 미리 산출하여 치환 테이블에 저장하는 단계를 더 포함하고, 상기 AES 라운드 1에서는 상기 저장된 4 바이트의 치환 테이블을 독출하여 상기 카운터 값을 산출하는 것이 바람직하다.In addition, the encryption method when the round is AES round 1 (the round 1) by calculating in advance the result of a predetermined operation in the AES encryption initialization round preceding the AES round 1 for the first 4 bytes not stored in the cache The method may further include storing in the substitution table, and in the AES round 1, it is preferable to calculate the counter value by reading the stored 4-byte substitution table.

상기된 암호화 방법에서 상기 라운드가 AES 라운드 2(round 2)인 경우, 상기 3 개의 스테이트를 캐시에 저장하는 단계는, 상기 라운드 2의 연산 중, 대상 블록의 컬럼이 소정 다항식에 의해 치환되는 MixColumns() 연산 과정에서 인접한 블록 간에 값이 변경되지 않는 12 바이트의 XOR 결과를 상기 캐시에 저장한다.In the above encryption method, when the round is AES round 2, the storing of the three states in the cache may include MixColumns (where the column of the target block is replaced by a predetermined polynomial during the operation of the round 2). In the above operation, a 12-byte XOR result whose value does not change between adjacent blocks is stored in the cache.

나아가, 또한, 이하에서는 상기 기재된 AES의 CTR 모드에 따른 암호화 방법을 컴퓨터에서 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록매체를 제공한다.Furthermore, the following provides a computer readable recording medium having recorded thereon a program for executing the encryption method according to the CTR mode of AES described above on a computer.

본 발명은 각 라운드의 연산 과정에서 값이 변경되지 않는 3 개의 스테이트를 캐시에 저장하여 참조함으로써 인터넷 스트리밍 데이터를 암호화/복호화하는 과정에서 AES 알고리즘의 일련의 연산을 단축하여 실시간 처리 속도를 향상시키고, 제한된 자원을 갖는 환경에서 이들 연산을 처리하기 위해 소모되는 컴퓨팅 자원을 절약함으로써 암호화 효율을 높일 수 있다.The present invention improves real-time processing speed by shortening a series of operations of the AES algorithm in the process of encrypting / decrypting internet streaming data by storing and referencing three states whose values do not change during each round of operation in a cache. In an environment with limited resources, encryption efficiency can be improved by saving the computing resources consumed to process these operations.

도 1은 AES의 대상 데이터 블록을 4 개의 스테이트로 분할하는 과정을 설명하기 위한 도면이다.
도 2는 AES의 CTR 모드의 암호화 과정을 설명하기 위한 도면이다.
도 3은 본 발명의 일 실시예에 따른 AES의 CTR 모드에 따른 암호화 방법을 도시한 흐름도이다.
도 4는 본 발명의 일 실시예에 따른 AES의 CTR 모드에 따른 암호화 방법에서 캐시를 이용하여 AES 초기화 라운드의 연산 과정을 단축하는 과정을 설명하기 위한 도면이다.
도 5는 본 발명의 다른 실시예에 따른 AES의 CTR 모드에 따른 암호화 방법에서 캐시를 이용하여 AES 라운드 1의 연산 과정을 단축하는 과정을 설명하기 위한 도면이다.
도 6은 본 발명의 또 다른 실시예에 따른 AES의 CTR 모드에 따른 암호화 방법에서 치환 테이블을 이용하여 AES 라운드 1의 연산 과정을 단축하는 과정을 설명하기 위한 도면이다.
도 7은 본 발명의 또 다른 실시예에 따른 AES의 CTR 모드에 따른 암호화 방법에서 캐시를 이용하여 AES 라운드 2의 연산 과정을 단축하는 과정을 설명하기 위한 도면이다.
1 is a diagram illustrating a process of dividing a target data block of an AES into four states.
2 is a view for explaining the encryption process of the CTR mode of the AES.
3 is a flowchart illustrating an encryption method according to a CTR mode of AES according to an embodiment of the present invention.
4 is a diagram illustrating a process of shortening an AES initialization round operation process using a cache in an encryption method according to a CTR mode of AES according to an embodiment of the present invention.
FIG. 5 is a diagram illustrating a process of shortening an AES round 1 calculation process using a cache in an encryption method according to a CTR mode of AES according to another embodiment of the present invention.
FIG. 6 is a diagram for describing a process of shortening an AES round 1 calculation process using a substitution table in an encryption method according to a CTR mode of AES according to another embodiment of the present invention.
FIG. 7 is a diagram illustrating a process of shortening an AES round 2 operation process using a cache in an encryption method based on a CTR mode of AES according to another embodiment of the present invention.

본 발명의 실시예들을 설명하기에 앞서 실시예들이 활용되는 AES 암호화 분야, 특히 CTR 모드에 대해 개괄적으로 소개하고, 실시예들이 공통적으로 채용하고 있는 기본 아이디어를 제시하고자 한다.Before describing the embodiments of the present invention, an overview of the field of AES encryption, in particular the CTR mode, in which the embodiments are utilized, is presented, and the basic idea that the embodiments are commonly employed is presented.

통상적으로 암호화하고자 하는 대상 데이터의 양이 암호화를 위해 설정된 데이터의 크기보다 큰 경우 대상 데이터를 일정한 크기의 집합, 즉 블록으로 분할하여 암호화 처리를 하게 된다. AES 알고리즘은 이러한 블록 암호화 기법을 활용하고 있으며, 특히 인터넷 스트리밍 데이터와 같이 그 크기가 매우 큰 대상 데이터의 경우 이러한 블록 암호화 방식이 유용하게 활용될 수 있다.In general, when the amount of target data to be encrypted is larger than the size of data set for encryption, the target data is divided into a set of a predetermined size, that is, a block, and the encryption process is performed. The AES algorithm utilizes this block ciphering technique, and this block ciphering scheme can be usefully used especially for a very large target data such as internet streaming data.

AES 알고리즘의 라운드는 4 가지 변환, SubBytes(), ShiftRows(), MixColumns(), AddRoundKey()을 선택적으로 포함하며, 라운드를 반복할수록 안전성이 증가하는 특징을 갖는다. 이상의 4 가지 변환은 스테이트(state)라고 불리는 4×4 행렬로 구성된 16 바이트(byte) 블록을 사용하여 동작하며, 각 라운드에 사용되는 라운드 키(round key)는 S-box와 XOR, Rotation으로 구성된 일련의 프로세스(키 스케줄링을 의미한다.)에 의해 비밀키로부터 생성된다.The round of the AES algorithm optionally includes four transformations, SubBytes (), ShiftRows (), MixColumns (), and AddRoundKey (), and it is characterized that safety is increased as the round is repeated. The above four transformations operate using a 16 byte block composed of 4 × 4 matrices called states, and the round key used for each round consists of S-box, XOR, and Rotation. Generated from a secret key by a series of processes (meaning key scheduling).

도 1은 AES의 대상 데이터 블록을 4 개의 스테이트로 분할하는 과정을 설명하기 위한 도면으로서, 16 바이트의 크기를 갖는 블록(110)을 다시 4 바이트 단위의 4 개의 스테이트(120)로 분할하여 처리하는 변환 과정을 도시하고 있다. 보다 구체적으로, AES의 데이터 블록은 128 비트로 구성되며 16 바이트를 원소로 하는 1×16 행렬(110)로 표현할 수 있다. AES는 여러 횟수의 라운드를 사용하며, 각 라운드는 이상에서 소개한 4 가지 변환들로 구성된다. 데이터 블록은 각 단계에서 다른 단계로 이동함에 따라 데이터가 변형되는데, 각 단계 전후에 있는 데이터 블록을 스테이트(state)라고 정의한다. 데이터 블록과 마찬가지로 스테이트는 전체 16 바이트로 구성되며, 바이트를 성분으로 하는 4×4 행렬(120)로 나타낸다.FIG. 1 is a diagram illustrating a process of dividing an AES target data block into four states. The block 110 having a size of 16 bytes is further divided into four states 120 of 4 byte units. The conversion process is shown. More specifically, the AES data block may be represented by a 1 × 16 matrix 110 composed of 128 bits and having 16 bytes as an element. AES uses multiple rounds, each round consisting of the four transformations introduced above. As data blocks move from one stage to another, data is transformed. Data blocks before and after each stage are defined as states. Like the data block, the state is composed of 16 bytes in total and is represented by a 4x4 matrix 120 having bytes as components.

알고리즘의 시작 부분에서 데이터 블록의 바이트들은 도 1과 같이 하나의 스테이트에 열 단위로 삽입되고, 각 열에 대해서는 위에서 아래로 삽입된다. 스테이트(120)는 4 열로 구성되어 있는데, 왼쪽에서부터 열 단위로 State[0], State[1], State[2], State[3]으로 표현된다. 이하에서 소개될 본 발명의 실시예들은 이렇게 분리된 각각의 스테이트들을 단위로 연산 과정 중, 일부 데이터를 캐시에 저장하여 처리한다.At the beginning of the algorithm, the bytes of the data block are inserted in a state in units of columns as shown in FIG. 1, and are inserted from top to bottom for each column. State 120 is composed of four columns, which are expressed as State [0], State [1], State [2], and State [3] in units of columns from the left. Embodiments of the present invention, which will be described below, store and process some data in a cache during the operation of each of these separated states.

도 2는 AES의 CTR 모드의 암호화 과정을 설명하기 위한 도면으로서, 본 발명의 실시예들이 공통적으로 채택하고 있는 암호화 처리 방법의 일례를 제시하고 있다. 앞서 간단히 설명한 바와 같이 평문의 데이터 크기가 큰 경우 활용될 수 있는 블록 단위의 반복 암호화 기법에는 그 구체적인 방법에 따라 다양한 모드(mode)가 제시되어 있는데, 본 발명의 실시예들은 공통적으로 CTR 모드에 따라 암호화를 수행한다.2 is a view for explaining the encryption process of the CTR mode of the AES, showing an example of an encryption processing method commonly adopted by the embodiments of the present invention. As described briefly above, various modes are proposed according to a specific method for a block-based repetitive encryption scheme that can be utilized when the data size of the plain text is large. Embodiments of the present invention are common according to the CTR mode. Perform encryption.

CTR 모드는 암호화/복호화가 동일한 구조이며, 카운터(Counter)를 사용함으로써 키 스트림(Key Stream)이 의사난수성을 갖는다. 도 2에 나타난 것처럼 카운터라고 불리는 입력 값이 암호 알고리즘에 의해 암호화된 결과가 평문과 XOR되어 암호문을 생성한다. n-bit의 카운터는 미리 정해진 값(초기화 벡터(IV, initialization vector)를 의미한다.)으로 초기화되고, 미리 정해진 규칙에 따라 값을 증가시킨다. 일련의 카운터 값들은 암호 알고리즘의 입력으로 동일한 값이 사용되면 안 되며, 각각의 블록에 모두 다른 값이 사용되어야 한다. 동일한 키로 암호화되는 모든 메시지에 대해서 카운터 값은 반드시 서로 구별되어야 한다.In the CTR mode, the encryption / decryption structure is the same, and the key stream is pseudorandom by using a counter. As shown in Fig. 2, an input value called a counter is encrypted by a cryptographic algorithm, and the result is XORed with the plain text to generate a cipher text. The n-bit counter is initialized to a predetermined value (meaning an initialization vector (IV)) and incremented according to a predetermined rule. The sequence of counter values should not use the same value as the input to the encryption algorithm, and different values should be used for each block. For all messages encrypted with the same key, the counter values must be distinct from each other.

AES-CTR 모드는 최초 블록(210)에 입력된 IV(211)를 기점으로 매 블록마다 LSB를 1씩 증가시켜 다음 블록의 입력으로 사용한다. 최초의 블록(210)에 대해 입력된 IV(211)를 이용하여 AES 암호화 키 스트림(212)을 생성하고, 이를 128 비트의 평문(213)과 XOR(exclusive or, 배타적 논리합)함으로써 128 비트의 암호문(214)를 생성한다. 최초의 블록(210)과 마찬가지로 이에 연속하는 다음 블록들(220, 230)에 대해서도 동일한 연산을 수행한다.In the AES-CTR mode, the LSB is increased by 1 for each block starting from the IV 211 inputted to the first block 210 and used as the input of the next block. A 128-bit ciphertext is generated by generating an AES encryption key stream 212 using the IV 211 inputted for the first block 210 and by XOR (exclusive or exclusive OR) with the 128-bit plaintext 213. Generate 214. Like the first block 210, the same operation is performed on subsequent blocks 220 and 230 subsequent to the same.

이 과정에서, AES 알고리즘의 첫 번째 연산은 AddRoundKey()로서 입력된 데이터 블록을 그대로 키와 XOR 연산에 적용한다. 단일 블록의 길이가 16 바이트인 AES 알고리즘이기 때문에 LSB로부터 1씩 증가한 카운터가 나머지 전체 블록에 영향을 주기 위해서는 상당한 양의 데이터 프로세싱을 거쳐야 한다. 따라서, 이하에서 소개될 본 발명의 다양한 실시예들은 알고리즘 내부적으로 매번 같은 입력 값을 AddRoundKey()를 비롯한 다양한 연산에 직접적으로 적용하지 않고, 이전의 블록에서 이미 계산된 결과를 재사용하여 그 연산의 효율을 향상시키고자 하는 노력에서 안출된 것이다. 또한, 이하의 실시예들을 통해 AddRoundKey() 뿐만 아니라, 첫 번째 라운드에 적용되는 SubBytes(), ShiftRows(), MixColumns()의 특성을 잘 활용한다면 추가적인 연산결과의 재사용이 가능하다는 점을 제시하고자 한다.In this process, the first operation of the AES algorithm applies the data block entered as AddRoundKey () to the key and XOR operation. Because this is an AES algorithm with a single block of 16 bytes in length, a counter incremented by one from the LSB requires a significant amount of data processing to affect the rest of the entire block. Accordingly, various embodiments of the present invention, which will be introduced below, do not directly apply the same input value to various operations including AddRoundKey () each time inside the algorithm, and reuse the result already calculated in the previous block to improve the efficiency of the operation. The effort was made to improve the situation. In addition, through the following examples, it is suggested that additional calculation results can be reused by utilizing not only AddRoundKey () but also SubBytes (), ShiftRows (), and MixColumns () applied to the first round. .

도 3은 본 발명의 일 실시예에 따른 AES의 CTR 모드에 따른 암호화 방법을 도시한 흐름도로서, 다음과 같은 단계들을 포함한다.3 is a flowchart illustrating an encryption method according to a CTR mode of AES according to an embodiment of the present invention, and includes the following steps.

310 단계에서 평문을 입력받아 128 비트(bit)의 크기를 갖는 대상 데이터 블록으로 분할하고, 각 라운드(round)마다 128 비트의 데이터 블록을 입력받아 초기화 벡터(initialization vector)로 설정하며, 상기 설정된 초기화 벡터를 4 개의 4 바이트(byte) 스테이트(state)로 분할한다. 이 과정은 CTR 모드를 위한 대상 데이터 및 연산을 위한 기초 데이터를 가공하는 단계에 해당한다.In step 310, the plain text is received and divided into a target data block having a size of 128 bits, and the data block of 128 bits is received in each round and set as an initialization vector, and the set initialization is performed. Divides the vector into four four byte states. This process corresponds to processing the target data for the CTR mode and the basic data for the calculation.

이 과정은 데이터 처리(초기화 벡터 설정 및 스테이트 분할이 될 수 있다.)를 위해 적어도 하나 이상의 프로세서(processor)가 활용될 수 있으며, 처리된 데이터를 저장하는 적어도 하나 이상의 저장공간(memory)을 통해 구현될 수 있을 것이다.This process can be utilized by at least one processor for data processing (which can be initialization vector setup and state partitioning), and is implemented through at least one memory to store the processed data. Could be.

320 단계에서는 310 단계를 통해 분할된 대상 데이터 블록 중 제 1 블록과 310 단계를 통해 설정된 초기화 벡터를 이용하여 암호화된 결과를 XOR하여 제 1 암호문을 생성한다. 즉, 이 과정은 앞서 소개한 도 2의 최초의 블록을 암호화하는 과정에 대응한다. 이 과정 역시 암호화 과정에서 사용되는 4 개의 연산을 처리하기 위해 적어도 하나 이상의 프로세서와 저장공간을 통해 구현될 수 있다. 이상과 같이 최초의 블록을 암호화하는 과정은 통상적인 AES-CTR과 대부분 동일하나, 일단 최초의 블록에 대한 암호화 과정이 수행되고 나면, 최초의 블록에 연속하는 여타의 블록들을 암호화 과정은 통상적인 AES-CTR과 상이하다. 이를 위해 최초의 블록에 대한 암호화 과정에서 산출된 연산 결과를 저장하여 두었다가, 이후 재활용하는 과정이 수반된다.In operation 320, a first ciphertext is generated by XORing an encrypted result using the first block among the target data blocks divided in operation 310 and the initialization vector set in operation 310. That is, this process corresponds to the process of encrypting the first block of FIG. This process may also be implemented through at least one processor and storage space to process the four operations used in the encryption process. As described above, the process of encrypting the first block is mostly the same as the normal AES-CTR. However, once the encryption process for the first block is performed, the encryption process is performed for the other blocks consecutive to the first block. Different from -CTR. For this purpose, the operation result calculated during the encryption process for the first block is stored and then recycled.

330 단계에서는 310 단계를 통해 상기 분할된 4 개의 스테이트 중 상기 각 라운드의 연산 과정에서 값이 변경되지 않는 3 개의 스테이트를 캐시(cache)에 저장한다. 이러한 구성은 대상 데이터 블록의 4 개의 스테이트 중 3 개의 스테이트가 AES-CTR 모드의 연산 과정에서 값이 변경되지 않으며, 나머지 1 개의 스테이트 중 일부 데이터의 값이 변경되는 것을 발견한데 따라 안출된 것이다. 즉, 캐시에 저장된 3 개의 스테이트는 이후 다음 대상 데이터 블록에 대한 연산 과정에서 재활용된다.In step 330, caches are stored in the cache, in which three values are not changed in the operation of each round among the divided four states. This configuration was devised as three of the four states of the target data block found that the value did not change during the operation of the AES-CTR mode, and that the value of some of the remaining one state changed. That is, the three states stored in the cache are then recycled during the operation on the next target data block.

비록 각 변환(연산)에 따라 실질적으로 그 값이 변경되는 바이트는 1 개의 스테이트의 바이트(4 바이트)보다 적어질 수 있으므로, 3 개의 스테이트 이상의 정보를 캐시에 저장하여 재활용하는 것이 가능하나, 이 경우 캐시의 지속적인 활용 가능성이 낮아지는 문제점이 발생하므로 본 발명의 실시예들은 캐시의 활용도를 높이기 위해 3 개의 스테이트만을 캐시에 저장하는 방법을 채택하였다. 캐시에 저장되는 데이터는 각 변환에 따라 달라질 수 있으며, 이후 도 4 내지 도 7을 통해 구체적으로 설명한다. 이상의 과정은 적어도 하나의 프로세서와 하나의 캐시를 통해 구현 가능하다.Although the byte whose value is substantially changed by each conversion (operation) may be smaller than the byte of one state (4 bytes), it is possible to store and reuse information of three or more states in the cache. Since there is a problem of low availability of the cache, embodiments of the present invention adopt a method of storing only three states in the cache in order to increase the utilization of the cache. Data stored in the cache may vary according to each conversion, and will be described in detail later with reference to FIGS. 4 to 7. The above process can be implemented through at least one processor and one cache.

340 단계에서는 제 1 블록에 연속하는 N 개(N은 양의 정수)의 블록들에 대해 각각의 블록들과 상기 캐시를 참조하여 획득한 연산 결과를 XOR함으로써 N 개의 암호문을 생성한다. 이제, 최초의 블록(제 1 블록을 의미한다.)에 연속하는 복수 개의 블록들에 대해서도 일련의 변환을 수행하는데, 이러한 변환 과정에 앞서 저장한 캐시 데이터를 활용한다. 즉, 제 1 블록과 동일한 변환을 나머지 N 개의 블록들에 대해 동일하게 수행하는 것이 아니라, 이미 산출되어 캐시에 저장된 3 개의 스테이트를 활용하여 변환에 필요한 연산의 수를 줄일 수 있다. 이상의 과정은 적어도 하나의 프로세서와 하나의 캐시를 통해 구현 가능하다.In step 340, N ciphertexts are generated by XORing the operation results obtained by referring to the respective blocks and the cache for N blocks (N is a positive integer) consecutive to the first block. Now, a series of transformations are also performed on a plurality of blocks that are continuous to the first block (which means the first block). The cache data stored before the conversion process is utilized. In other words, instead of performing the same conversion as the first block on the remaining N blocks, the number of operations required for the conversion can be reduced by utilizing three states already calculated and stored in the cache. The above process can be implemented through at least one processor and one cache.

마지막으로 350 단계에서는 320 단계를 통해 생성된 제 1 암호문과 340 단계를 통해 생성된 N 개의 암호문을 암호화 결과로 출력한다. 이렇게 생성된 암호화 결과는 실시간으로 수신자에게 전달될 수 있을 것이다.Finally, in step 350, the first cipher text generated in step 320 and the N cipher texts generated in step 340 are output as an encryption result. The generated encryption result may be delivered to the receiver in real time.

한편, 이상의 암호화 과정에 대응하여 암호문을 평문으로 복원하는 복호화 과정이 구현 가능하다. 그러나, 중복되는 설명을 피하기 위해 여기서는 암호화 과정만을 소개하도록 한다. 복호화 과정은 이상의 AES-CTR 암호화 과정의 역에 해당하는 것으로 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자는 이상의 실시예가 채택하고 있는 핵심적인 아이디어(캐시를 이용하여 각 라운드의 변환 연산의 연산 결과값을 재활용하는 구성)를 이미 알려진 AES-CTR 복호화 과정에 적용할 수 있다.Meanwhile, a decryption process for restoring the cipher text to the plain text may be implemented in response to the encryption process. However, in order to avoid overlapping descriptions, only the encryption process is introduced here. The decryption process corresponds to the inverse of the above-described AES-CTR encryption process. Those skilled in the art to which the present invention belongs should adopt the core idea (the result of the operation of each round of conversion operation using the cache). The configuration of recycling values) can be applied to the known AES-CTR decoding process.

이하에서는 도 3에서 제시한 캐시를 활용한 AES-CTR 암호화 방법에 대한 본 발명의 다양한 실시예들을 각각의 라운드마다 차별적으로 나타나는 특징을 중심으로 제시하도록 한다.Hereinafter, various embodiments of the present invention for the AES-CTR encryption method using the cache shown in FIG. 3 will be presented based on the features appearing differently in each round.

도 4는 본 발명의 일 실시예에 따른 AES의 CTR 모드에 따른 암호화 방법에서 캐시를 이용하여 AES 초기화 라운드의 연산 과정을 단축하는 과정을 설명하기 위한 도면으로, 특히 AES 초기화 라운드에서 AddRoundKey() 연산의 결과를 캐시에 저장하고 재사용하는 방법에 대해 제시하고 있다.FIG. 4 is a diagram illustrating a process of shortening an AES initialization round operation process using a cache in an encryption method according to a CTR mode of AES according to an embodiment of the present invention. In particular, an AddRoundKey () operation is performed in an AES initialization round. It shows how to store and reuse the results in a cache.

보다 구체적으로, AES-CTR 모드 알고리즘은 초기 라운드에서 암호 알고리즘의 입력 값과 라운드 키(Round Key, Cipher key)를 XOR한다. 첫 블록의 입력 값을 초기화 벡터(IV, Initialization Vector)로 설정하고, 미리 정해진 규칙에 따라 초기화 벡터의 값을 증가시켜 다음 블록의 입력 값으로 사용한다. 초기화 벡터의 증가에 따라 캐리(Carry)가 발생하지 않는다면, 첫 블록의 입력 값인 초기화 벡터와 바로 다음 블록의 입력 값인 카운터 값은 증가한 값에 영향을 받는 마지막 1 바이트만 값만이 다르며 나머지 값들은 동일하다.More specifically, the AES-CTR mode algorithm XORs an input value of a cryptographic algorithm and a round key (cipher key) in an initial round. The input value of the first block is set as an initialization vector (IV), and the value of the initialization vector is increased according to a predetermined rule and used as the input value of the next block. If Carry does not occur as the initialization vector increases, only the last 1 byte affected by the increment is different from the initialization vector, which is the input value of the first block, and the input value of the next block, and the other values are the same. .

예를 들어, 값을 1씩 증가시키는 카운터를 사용하며, IV0(최초 블록의 입력값을 의미한다.)값을 1로 설정했다고 가정하면, IV0값과 카운터에 의해 증가된 값 IV1(다음 블록의 입력값을 의미한다.)은 다음과 같이 마지막 1 바이트만 다른 값을 갖는다.For example, suppose you use a counter that increments the value by 1, and you set the IV 0 (meaning the input value of the first block) to 1, the IV 0 value and the value incremented by the counter IV 1 ( Means the input value of the next block), and only the last 1 byte has a different value as follows.

- IV0 : 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01-IV 0 : 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01

- IV1 : 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x02-IV 1 : 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x02

이러한 차이는 도 4의 첫 번째 블록의 스테이트(411)와 이에 연속하는 두 번째 블록의 스테이트(412)의 연산 결과를 비교하면 명확히 알 수 있다. 결국 입력 값과 첫 번째 라운드 키가 XOR되는 초기 라운드에서 각각의 데이터 블록들은 같은 라운드 키 값과 XOR되기 때문에 그 결과도 IV0, IV1과 마찬가지로 마지막 1 바이트만 다른 값을 갖는다.This difference can be clearly seen by comparing the operation result of the state 411 of the first block of FIG. 4 and the state 412 of the second block subsequent to it. As a result, in the initial round in which the input value and the first round key are XORed, since each data block is XORed with the same round key value, the result is different only in the last 1 byte as in IV0 and IV1.

이러한 특성에 기초하여 본 실시예는 초기 라운드의 결과 16 바이트 중 마지막 4 바이트를 제외한 나머지 12 바이트를 저장함으로써 232-1 블록을 연산하는 동안 재사용할 수 있는 방법을 제안한다. 즉, 초기화 벡터 IV를 { State[0], State[1], State[2], State[3] }이라 할 때, 초기 라운드의 결과로 저장된 스테이트에서 값이 변하지 않는 부분인 State[0], State[1], State[2] 부분을 캐시(420)에 저장하여 다음 블록의 연산 시에 재사용한다. 도 4에는 초기 라운드 과정과 결과 스테이트의 캐시 가능한 부분(즉, 변환 연산에 의해 값이 변경되지 않는 부분을 의미한다.)을 빗금을 쳐서 표시하고 있다.Based on this characteristic, the present embodiment proposes a method that can be reused while calculating 2 32 -1 blocks by storing 12 bytes except the last 4 bytes of the result 16 rounds of the initial round. That is, when the initialization vector IV is {State [0], State [1], State [2], State [3]}, State [0], which is a part of the state which is not changed in the state stored as a result of the initial round, The state [1] and state [2] parts are stored in the cache 420 and reused in the operation of the next block. In Fig. 4, the initial rounding process and the cacheable part of the result state (that is, the part whose value is not changed by the conversion operation) are shown by hatching.

본 실시예에 따르면, 카운터 값의 증가에 따라 카운터 값(대상 데이터 블록)의 12번째 바이트 값이 변경되면서 캐리를 발생시켜 11번째 바이트에 영향을 미칠 때까지 캐시된 정보를 사용할 수 있다. 예를 들어, 카운터 증가 값이 1 이고, 초기화 벡터의 값이 0 인 경우 카운터 값의 11번째 바이트에서 캐리가 발생하는 블록은 4,294,967,297번째 블록이 된다. 따라서 이 경우 4,294,967,295개의 블록을 계산하는 동안은 초기 라운드에서 스테이트의 일부분에 대해 입력 값과 라운드 키의 XOR 연산을 수행하는 대신 저장된 정보를 사용할 수 있다. AES 알고리즘의 한 블록은 16 바이트이므로, 위와 같은 경우 약 65.5 GBytes 마다 한 번씩만 캐시된 내부 데이터를 갱신해주면 된다.According to the present exemplary embodiment, the cached information may be used until the 12th byte value of the counter value (target data block) is changed as the counter value is increased to affect the 11th byte. For example, when the counter increment value is 1 and the value of the initialization vector is 0, the block in which the carry occurs at the 11th byte of the counter value becomes the 4,294,967,297th block. Therefore, in this case, while calculating 4,294,967,295 blocks, the stored information can be used instead of performing the XOR operation of the input value and the round key on a part of the state in the initial round. Since one block of the AES algorithm is 16 bytes, in this case, the cached internal data needs to be updated only once every 65.5 GBytes.

요약하건대, AES-CTR 모드에서 라운드가 AES 초기화 라운드(initial round)인 경우, 값이 변경되지 않는 3 개의 스테이트를 캐시에 저장하는 단계는, 초기화 라운드의 연산 결과인 16 바이트 중, 마지막 4 바이트를 제외한 12 바이트를 캐시에 저장하는 것이 바람직하다.In summary, if the round is an AES initialization round in AES-CTR mode, storing three states in the cache whose values do not change is the last four bytes of the 16 bytes that are the result of the initialization round operation. It is desirable to store 12 bytes except cache.

또한, 최초의 블록(제 1 블록을 의미한다.)에 연속하는 N 개의 블록에 대해 N 개의 암호문을 생성하는 단계는, 제 1 블록에 연속하는 232-1 개의 블록들에 대해 상기 캐시에 저장된 12 바이트를 독출하고, 232-1 개의 블록들에 대해 각각의 카운터 값의 변화 규칙을 고려하여 XOR 연산 결과의 4 바이트를 산출하고, 독출된 12 바이트와 산출된 4 바이트를 결합하여 해당 데이터 블록에 대한 연산 결과를 생성하며, 생성된 연산 결과에 기초하여 232-1 개의 암호문을 생성한다. 여기서, 232-1 개는 캐시에 저장된 3 개의 스테이트를 재활용할 수 있는 한계값을 의미하며, 232-1 개 이후의 암호화 대상 데이터 블록에 대해서는 캐리로 인해 캐시된 값을 갱신해 주어야 한다.Also, generating N cipher texts for N blocks consecutive to the first block (meaning the first block) may be stored in the cache for 2 32 -1 blocks consecutive to the first block. Reads 12 bytes, calculates 4 bytes of the result of the XOR operation for each of the 2 32 -1 blocks, taking into account the change rules of each counter value, and combines the read 12 bytes and the calculated 4 bytes to correspond to the corresponding data block. Generates the result of the operation and generates 2 32 -1 ciphertexts based on the generated operation result. Here, 2 32 -1 means a limit value for reusing three states stored in the cache, and the cached value due to carry must be updated for 2 32 -1 or more encrypted data blocks.

도 5는 본 발명의 다른 실시예에 따른 AES의 CTR 모드에 따른 암호화 방법에서 캐시를 이용하여 AES 라운드 1의 연산 과정을 단축하는 과정을 설명하기 위한 도면으로서, AES 라운드 1에서 SubBytes(), ShiftRows(), MixColumns(), AddRoundKey()의 연산 결과 중 12 바이트 정보를 캐시하여 재사용하는 방법을 도시하고 있다.FIG. 5 is a diagram illustrating a process of shortening an AES round 1 operation process using a cache in an encryption method according to a CTR mode of AES according to another embodiment of the present invention. In the AES round 1, SubBytes () and ShiftRows It shows how to cache and reuse 12-byte information among the results of operations of (), MixColumns (), and AddRoundKey ().

보다 구체적으로, 초기화 라운드를 거친 이후에 처리되는 데이터는 첫 번째 라운드(라운드 1을 의미한다.)에 입력으로 활용된다. 이 때, 첫 번째 라운드에서도 역시 데이터를 저장하여 다음 블록에 활용할 수 있다. 다만 초기화 라운드보다 캐시된 데이터의 갱신이 자주 일어난다. 도 5에 도시된 바와 같이 라운드 1의 입력이 되는 초기 라운드의 스테이트는 첫 번째 블록과 두 번째 블록이 마지막 1 바이트만 서로 다른 값을 갖는다. 비록 라운드 1 과정을 통해 스테이트의 서로 다른 값을 갖는 마지막 1 바이트는 ShiftRows()와 MixColumns()의 단계에서 이동되고 확산되지만, 그 영향은 하나의 스테이트에 국한된다. 따라서 도 5와 같이 라운드 1의 결과로 출력된 스테이트들(511, 512)을 비교하여 보면, State[0]을 제외한 나머지 스테이트들을 캐시(520)에 저장하여 사용할 수 있다.More specifically, data processed after the initialization round is used as an input in the first round (meaning round 1). At this time, the first round can also store data for use in the next block. However, the update of cached data occurs more frequently than the initialization round. As shown in FIG. 5, the state of the initial round that is input of round 1 has a value different only in the last 1 byte of the first block and the second block. Although the last 1 byte with different values of state through the round 1 process is shifted and spread in the steps of ShiftRows () and MixColumns (), the effect is limited to one state. Accordingly, when comparing the states 511 and 512 output as a result of the round 1 as shown in FIG. 5, the remaining states except State [0] may be stored and used in the cache 520.

이 때, 카운터 값의 증가에 따라 카운터 값의 15번째 바이트에서 캐리가 발생하여 초기 라운드 스테이트의 14 번째 바이트 값이 바뀌면, 캐시 해두었던 스테이트 값들을 갱신해 주어야 한다. 한편, 캐리로 인해 초기 라운드의 결과 스테이트에서 14 번째 바이트 값이 함께 바뀐 경우에도 라운드 1 과정 후의 스테이트 결과 값 중 State[2]와 State[3]은 여전히 같은 값이 유지된다. 이러한 경우를 고려하여 14번째 바이트 값이 바뀐 경우 State[2], State[3]을 연산하지 않고 캐시된 데이터를 불러오도록 구현할 수도 있다. 하지만, 이 경우 연산의 횟수를 줄여서 얻을 수 있는 이득보다 캐리 검사(Carry Check)로 인한 오버헤드가 더 크기 때문에 전체 알고리즘의 수행 속도는 앞의 방법보다 느리다.At this time, if the carry occurs in the 15th byte of the counter value as the counter value increases, and the 14th byte value of the initial round state changes, the cached state values should be updated. On the other hand, even if the 14th byte value is changed in the result state of the initial round due to carry, State [2] and State [3] of the state result values after Round 1 are still the same. In consideration of such a case, when the 14th byte value is changed, the cached data may be loaded without calculating State [2] or State [3]. However, in this case, the overhead of the carry check is larger than the gain obtained by reducing the number of operations, so the overall algorithm is slower than the previous method.

결국 효율성을 고려하였을 때 초기화 라운드에서 캐시된 스테이트 정보가 사용될 수 있는 최대 블록 수는 232-1 이며, 라운드 1에서 캐시된 스테이트 정보가 사용될 수 있는 최대 블록 수는 28-1 이다.After all, in consideration of efficiency, the maximum number of blocks that can be used for cached state information in an initialization round is 2 32 -1, and the maximum number of blocks that can be used for cached state information in round 1 is 2 8 -1.

요약하건대, AES-CTR 모드의 라운드가 AES 라운드 1(round 1)인 경우, 연산 과정에서 값이 변경되지 않는 3 개의 스테이트를 캐시에 저장하는 단계는, 라운드 1의 연산 결과인 16 바이트 중, 처음 4 바이트를 제외한 12 바이트를 캐시에 저장하는 것이 바람직하다.In summary, when the round in AES-CTR mode is AES round 1, storing three states in the cache whose values do not change during the operation is the first of 16 bytes that are the result of the round 1 operation. It is desirable to store 12 bytes in the cache except 4 bytes.

또한, 최초의 블록(제 1 블록을 의미한다.)에 연속하는 N 개의 블록에 대해 N 개의 암호문을 생성하는 단계는, 제 1 블록에 연속하는 28-1 개의 블록들에 대해 캐시에 저장된 12 바이트를 독출하고, 라운드 1의 연산 과정을 고려하여 연산 결과의 4 바이트를 산출하고, 독출된 12 바이트와 산출된 4 바이트를 결합하여 해당 데이터 블록에 대한 연산 결과를 생성하며, 생성된 연산 결과에 기초하여 28-1 개의 암호문을 생성한다. 여기서, 28-1 개는 캐시에 저장된 3 개의 스테이트를 재활용할 수 있는 한계값을 의미한다.Also, generating N cipher texts for N blocks consecutive to the first block (meaning the first block) may be performed by storing 12 caches for 2 8 -1 blocks consecutive to the first block. Read 4 bytes, calculate 4 bytes of operation result by considering round 1 operation process, combine the 12 bytes read and 4 bytes calculated to generate the operation result for the corresponding data block. Generate 2 8 -1 ciphertexts based on that. Here, 2 8 -1 means a limit value for reusing three states stored in the cache.

나아가, 본 발명의 또 다른 실시예는 도 5를 통해 제시된 본 발명의 실시예에서 전체 16 바이트의 카운터 값에서 캐시되지 않은 4 바이트 정보를 미리 획득하는 방법을 제공한다. 이하에서 도 6을 참조하여 설명한다.Furthermore, another embodiment of the present invention provides a method for pre-acquiring 4 bytes of uncached information from a counter value of 16 bytes in the embodiment of the present invention shown in FIG. 5. A description with reference to FIG. 6 is as follows.

도 6은 본 발명의 또 다른 실시예에 따른 AES의 CTR 모드에 따른 암호화 방법에서 치환 테이블을 이용하여 AES 라운드 1의 연산 과정을 단축하는 과정을 설명하기 위한 도면이다. 앞서 도 5를 통해 소개된 실시예는 AES 라운드 1에서 12 바이트의 정보를 미리 저장된 캐시로부터 독출하여 사용하고, 나머지 4 바이트 정보는 매 블록마다 새로 계산한다. 도 6의 실시예에서는 암호 인스턴스 초기화 단계에서 매번 계산되는 4 바이트 정보에 대해 미리 산출된 테이블(Pre-Computation Table)을 생성하여 효율성을 극대화하는 기법을 제안한다.FIG. 6 is a diagram for describing a process of shortening an AES round 1 calculation process using a substitution table in an encryption method according to a CTR mode of AES according to another embodiment of the present invention. In the embodiment introduced through FIG. 5, 12 bytes of information is read from a pre-stored cache in AES round 1, and the remaining 4 bytes of information are newly calculated for each block. The embodiment of FIG. 6 proposes a technique for maximizing efficiency by generating a pre-computed table for 4 byte information calculated every time in the encryption instance initialization step.

일반적으로 암호 모듈이 구현될 경우 두 단계로 나뉘어 구성된다. 첫 번째 단계는 초기화 단계이다. 암호 초기화 단계에서는 사용하려는 암호 알고리즘의 인스턴스가 사용하게 될 암호화 키와 초기화 벡터가 결정된다. 이 단계에서 키는 정해진 AES 키 길이에 따라 라운드 키로 확장되며, CTR 모드에서는 초기화 벡터가 해당 암호 인스턴스의 카운터로 사용된다. 두 번째 단계는 암/복호화 단계로서 정해진 라운드 키와 초기화 벡터를 사용하여 입력되는 입력 데이터를 암/복호화 하는 과정이 진행된다. 특히, 이 단계는 제공되는 암호 함수의 성격에 따라 입력을 불연속적으로 처리할 수 있도록 여러 과정을 거쳐 나뉘어서 진행되기도 하므로, 같은 키와 초기화 벡터라도 여러 번 반복적으로 호출될 수도 있다.In general, when a cryptographic module is implemented, it is divided into two stages. The first step is the initialization step. The encryption initialization phase determines the encryption key and initialization vector that the instance of the encryption algorithm to use will use. At this stage, the key is expanded to a round key according to the defined AES key length. In CTR mode, the initialization vector is used as a counter for the cipher instance. The second step is an encryption / decryption step. The process of encrypting / decoding input data using a predetermined round key and an initialization vector is performed. In particular, this step may be divided into several processes to discontinuously process the input depending on the nature of the cryptographic function provided. Therefore, the same key and initialization vector may be repeatedly called.

도 6의 실시예는 초기 1 회만 호출되어 인스턴스를 유지하는 초기화 단계에서 AES-CTR 모드의 라운드 1에서 빈번하게 사용되는 정보를 미리 계산하여, 최대 4 바이트 정보가 변경되기 전까지 재사용 가능한 기법을 도시하고 있다. 도 6은 AES-CTR 모드가 동작하는 동안 라운드 1에서의 데이터들 위치 변화와 상관관계가 미치는 영향을 나타낸다. AES 알고리즘의 입력은 다음과 같이 표현될 수 있다.The embodiment of FIG. 6 illustrates a scheme that can be reused until a maximum of 4 bytes of information is changed by precomputing information frequently used in round 1 of AES-CTR mode in an initialization step of calling an initial one and maintaining an instance. have. 6 shows the effect of correlation with changes in the position of the data in round 1 while the AES-CTR mode is in operation. The input of the AES algorithm can be expressed as follows.

Figure 112011039565510-pat00001
Figure 112011039565510-pat00001

암호의 입력 16 바이트의 데이터가 0부터 15까지 순서를 가진다고 했을 때, AES-CTR 모드는 15 번째 바이트부터 1씩 증가하여 입력을 매 블록마다 달리한다. 이 때, 두 번째 블록에서 b15는 첫 번째 블록과 다르기 때문에 MixColumns() 연산에서 b15는 b0, b5, b10에 영향을 미치게 된다. b0, b5, b10가 이전 블록과 비교했을 때 값의 변경이 없다는 점을 상기해보면, b15의 변화가 캐리를 수반하지 않는다고 가정하면, b15가 라운드 1의 MixColumns() 연산에서 b0, b5, b10를 결정한다. 이는 도 6에서 (a) MixColumns() 연산과 (b) AddRoundKey() 연산이 매 라운드마다 반복되는 것을 의미하고, 따라서 미리 산출해 놓은 (a)와 (b)의 결과 값을 재사용하는 방법을 적용하면 연산 효율성을 향상시킬 수 있다. 도 6에는 이들 (a)와 (b)의 연산에 의해 변경되는 값과 변경되지 않는 값을 카운터 값(610, 620)을 통해 표시하고 있다.Assuming the 16-byte data in the cipher has a sequence from 0 to 15, the AES-CTR mode increments the input by 1 from the 15th byte, changing the input every block. In this case, b 15 is different from the first block in the second block, so b 15 affects b 0 , b 5 , and b 10 in the MixColumns () operation. b 0, b 5, b 10 the haebomyeon said that there is no change in value compared to the previous block, b when a 15 change in the home does not involve a carry, b 15 a b from the MixColumns () operation of the round 1 Determine 0 , b 5 , b 10 . This means that (a) the MixColumns () operation and (b) the AddRoundKey () operation are repeated every round in FIG. 6, and accordingly, a method of reusing the result values of (a) and (b) previously calculated is applied. This can improve computational efficiency. In FIG. 6, the values that are changed by the operations of (a) and (b) and the values that are not changed are displayed through counter values 610 and 620.

주어진 b15에 대한 State[0]를 결정하는 테이블을 구성한다고 할 때, b15는 0x00부터 0xFF까지 변화하고, State[0]는 4 바이트이기 때문에 총 4 × 256 = 1 KBytes의 메모리가 필요하다. 이 테이블은 또한 모든 암호 인스턴스마다 같지는 않지만, 오직 입력된 키와 초기화 벡터에 의존하기 때문에 초기화 단계에서 미리 계산하고 결정할 수 있다. 초기화 단계는 매 암호 인스턴스에서 단 한 번만 수행되기 때문에 실제 암/복호화 연산 단계에서 효율성을 확보할 수 있다.Assuming that constructs a table for determining the State [0] for a given b 15, b 15 are changing from 0x00 to 0xFF, State [0] is a total of 4 × 256 = 1 KBytes of memory is required because it is 4 bytes . This table is also not the same for every cryptographic instance, but only depends on the key and initialization vector entered so that it can be precomputed and determined at initialization. Since the initialization phase is performed only once in each crypto instance, efficiency can be achieved in the actual encryption / decryption operation phase.

생성된 치환 테이블을 사용할 수 있는 것은 b15 증가의 영향이 b10에 영향을 미칠 때, 즉 [b11 - b15]가 [0xFFFFFFFFFF]가 되어 b10에 캐리가 발생할 경우이다. 이 때, 미리 계산된 치환 테이블에 업데이트 과정이 필요한데, 한번 업데이트가 이루어진 이후에는 240 × 16 바이트의 입력은 추가적인 테이블 업데이트 과정 없이 치환 테이블을 사용할 수 있다. 즉, 16 TeraBytes의 데이터를 처리하는 동안에는 추가 연산 과정이 필요하지 않기 때문에 연산의 효율성을 높일 수 있다.The generated substitution table can be used when the effect of increasing b 15 affects b 10 , that is, when [b 11 -b 15 ] becomes [0xFFFFFFFFFF] and a carry occurs at b 10 . In this case, an update process is required for the pre-calculated substitution table. After the update is performed once, the input of 2 40 × 16 bytes may use the substitution table without an additional table update process. In other words, while processing 16 TeraBytes of data, no additional computation is required, which increases the efficiency of computation.

요약하건대, AES-CTR 모드에 따른 암호화 방법에서 캐시에 저장되지 않는 처음 4 바이트에 대하여 AES 라운드 1에 선행하는 AES 초기화 라운드에서 특정 연산에 대한 결과를 미리 산출하여 치환 테이블에 저장하는 단계를 더 포함하고, AES 라운드 1에서는 저장된 4 바이트의 치환 테이블을 독출하여 카운터 값을 산출하는 것이 바람직하다.In summary, in the encryption method according to the AES-CTR mode, the method further includes pre-calculating the result of a specific operation in the AES initialization round preceding AES round 1 and storing the result in a substitution table for the first 4 bytes not stored in the cache. In the AES round 1, it is preferable to calculate the counter value by reading the stored 4-byte substitution table.

이 때, 이상의 특정 연산은 대상 블록의 컬럼(column)이 다항식에 의해 치환되는 MixColumns() 연산 및 MixColumns() 연산의 출력과 라운드 키(round key)의 XOR 값을 산출하는 AddRoundKey() 연산을 의미한다. 각각의 연산 방법에 관한 구체적인 설명은 본 실시예의 본질을 흐리게 하므로 여기서는 생략한다.In this case, the above specific operation refers to the MixColumns () operation in which the column of the target block is replaced by the polynomial, and the AddRoundKey () operation for calculating the output of the MixColumns () operation and the XOR value of the round key. do. A detailed description of each calculation method is omitted here because it obscures the essence of this embodiment.

또한, 카운터 값에서 캐리(carry)가 발생하는 경우 새롭게 산출된 연산 결과에 따라 저장된 치환 테이블을 갱신하고, 갱신된 치환 테이블은 갱신 이후, 연속하는 240×16 바이트의 입력 데이터에 대해 상기 치환 테이블로부터 독출된 4 바이트의 값을 이용하여 상기된 특정 연산 없이 카운터 값을 산출하는 것이 가능하다.In addition, when a carry occurs in a counter value, the stored substitution table is updated according to a newly calculated operation result, and the updated substitution table is replaced with the substitution table for input data of 2 40 x 16 bytes after the update. It is possible to calculate the counter value without the specific operation described above using the value of 4 bytes read from.

도 7은 본 발명의 또 다른 실시예에 따른 AES의 CTR 모드에 따른 암호화 방법에서 캐시를 이용하여 AES 라운드 2의 연산 과정을 단축하는 과정을 설명하기 위한 도면으로, AES 라운드 2에서 MixColumns()연산 과정 중 매 블록마다 12 바이트 정보가 반복되는 점을 이용하여 해당 데이터를 캐시하고 재사용하는 방법을 도시하고 있다.FIG. 7 is a diagram illustrating a process of shortening an AES round 2 operation process by using a cache in an encryption method according to a CTR mode of AES according to another embodiment of the present invention. In the AES round 2, a MixColumns () operation is performed. A method of caching and reusing the corresponding data is illustrated by using 12-byte information repeated every block during the process.

첫 번째 라운드를 거친 스테이트는 두 번째 라운드의 입력으로 사용된다. 도 7은 첫 번째 블록과 두 번째 블록의 라운드 2 과정을 나타낸 것으로, 특히 MixColumns()에 State[0]의 변환 과정이 나타나 있다. 도 7과 같이 첫 번째 블록과 두 번째 블록의 Round 1의 결과로 출력된 스테이트는 State[0]만 다른 값을 갖는다. 스테이트의 각 바이트를 S[i] (i = 0, 1, 2, ... , 15) 라 표현하면, 라운드 2 과정에서 ShiftRows() 변환을 거친 후의 State[0]는 S[0], S[5], S[10], S[15] 바이트들로 구성된다. 이 State[0] 는 MixColumns()에서 아래와 같은 변환이 일어난다.The state following the first round is used as the input for the second round. 7 shows a round 2 process of the first block and the second block. In particular, the process of converting State [0] to MixColumns () is illustrated. As shown in FIG. 7, the state output as a result of Round 1 of the first block and the second block has a different value only for State [0]. If each byte of the state is expressed as S [i] (i = 0, 1, 2, ..., 15), State [0] after the ShiftRows () conversion in round 2 is S [0], S [5], S [10], S [15] bytes. This State [0] is converted in MixColumns () as follows.

Figure 112011039565510-pat00002
Figure 112011039565510-pat00002

첫 번째 블록과 두 번째 블록에서 이 변환을 살펴보면, 두 블록의 각 State[0]에서 서로 다른 바이트는 S[0] 하나뿐이다. 따라서 위 연산에서 S[0]를 제외한 나머지 연산, 즉 rlt[0]의 3·S[5]

Figure 112011039565510-pat00003
1·S[10]
Figure 112011039565510-pat00004
1·S[15] 과 rlt[1]의 2·S[5]
Figure 112011039565510-pat00005
3·S[10]
Figure 112011039565510-pat00006
1·S[15], rlt[2]의 1·S[5]
Figure 112011039565510-pat00007
2·S[10]
Figure 112011039565510-pat00008
3·S[15], 그리고 rlt[3]의 1·S[5]
Figure 112011039565510-pat00009
1·S[10]
Figure 112011039565510-pat00010
2·S[15] 부분의 연산 결과(710)를 캐시(720)에 저장하여 활용할 수 있다. 이 부분의 연산 결과를 캐시하여 사용함으로써 3번의 XOR연산을 1번으로 줄일 수 있다. State[1], State[2], State[3] 에서도 역시 마찬가지로 각각 S[3], S[2], S[1]을 제외한 나머지 부분의 연산 결과를 캐시하여 사용할 수 있다.Looking at this transformation in the first and second blocks, there is only one different byte in each State [0] of S [0]. Therefore, in the above operation except for S [0], that is, 3 · S [5] of rlt [0].
Figure 112011039565510-pat00003
1 · S [10]
Figure 112011039565510-pat00004
2S [5] of 1S [15] and rlt [1]
Figure 112011039565510-pat00005
3 · S [10]
Figure 112011039565510-pat00006
1 · S [5] of 1 · S [15], rlt [2]
Figure 112011039565510-pat00007
2 · S [10]
Figure 112011039565510-pat00008
3 · S [15] and 1 · S [5] of rlt [3]
Figure 112011039565510-pat00009
1 · S [10]
Figure 112011039565510-pat00010
The operation result 710 of the 2 · S [15] portion may be stored and utilized in the cache 720. By caching and using the result of this part, three XOR operations can be reduced to one. State [1], State [2], and State [3] can also be used by caching the results of the calculations except for S [3], S [2], and S [1].

앞서 설명한 도 5의 실시예와 마찬가지로 라운드 2의 입력 스테이트의 State[1], State[2], State[3]의 값이 유지되는 동안에만 캐시된 정보가 사용될 수 있기 때문에 캐시된 정보가 사용될 수 있는 최대 블록의 수는 도 5의 라운드 1의 경우와 마찬가지로 28-1 이다.Similar to the embodiment of FIG. 5 described above, the cached information can be used because the cached information can be used only while the values of State [1], State [2], and State [3] of the input state of Round 2 are maintained. The maximum number of blocks present is 2 8-1 as in the case of round 1 of FIG. 5.

요약하건대, AES-CTR 모드의 라운드가 AES 라운드 2(round 2)인 경우, 연산 과정에서 값이 변경되지 않는 3 개의 스테이트를 캐시에 저장하는 단계는, 라운드 2의 연산 중, 대상 블록의 컬럼이 특정 다항식에 의해 치환되는 MixColumns() 연산 과정에서 인접한 블록 간에 값이 변경되지 않는 12 바이트의 XOR 결과를 캐시에 저장하는 것이 바람직하다.In summary, if the round of the AES-CTR mode is AES round 2, storing three states in the cache whose values do not change during the operation is performed. In the MixColumns () operation, which is replaced by a specific polynomial, it is desirable to store a 12-byte XOR result in a cache that does not change value between adjacent blocks.

또한, 최초의 블록(제 1 블록을 의미한다.)에 연속하는 N 개의 블록에 대해 N 개의 암호문을 생성하는 단계는, 제 1 블록에 연속하는 28-1 개의 블록들에 대해 캐시에 저장된 12 바이트를 독출하고, 라운드 1의 연산 과정을 고려하여 MixColumns() 연산 과정에서 인접한 블록 간에 값이 변경되는 4 바이트의 XOR 결과를 산출하고, 독출된 12 바이트와 산출된 4 바이트를 결합하여 MixColumns() 연산의 결과값으로 설정하고, 설정된 결과값에 기초하여 해당 데이터 블록에 대한 연산 결과를 생성하며, 생성된 연산 결과에 기초하여 28-1 개의 암호문을 생성한다.Also, generating N cipher texts for N blocks consecutive to the first block (meaning the first block) may be performed by storing 12 caches for 2 8 -1 blocks consecutive to the first block. Reads the byte, takes into account the round 1 operation, and calculates the 4-byte XOR result whose value is changed between adjacent blocks in the MixColumns () operation, and combines the read 12 bytes and the calculated 4 bytes to mixColumns () The result of the calculation is set, an operation result for the corresponding data block is generated based on the set result value, and 2 8 -1 cipher texts are generated based on the generated operation result.

상기된 본 발명의 다양한 실시예들에 따르면, 각 라운드의 연산 과정에서 값이 변경되지 않는 스테이트들을 캐시에 저장하여 참조함으로써 인터넷 스트리밍 데이터를 암호화/복호화하는 과정에서 AES 알고리즘의 일련의 연산을 단축하여 실시간 처리 속도를 향상시키고, 제한된 자원을 갖는 환경에서 이들 연산을 처리하기 위해 소모되는 컴퓨팅 자원을 절약함으로써 암호화 효율을 높일 수 있다.According to various embodiments of the present invention described above, by shortening a series of operations of the AES algorithm in the process of encrypting / decrypting Internet streaming data by storing and referring to states in which a value does not change during a round operation. Encryption efficiency can be improved by improving the real-time processing speed and saving the computing resources consumed to process these operations in an environment with limited resources.

AES-CTR 모드는 병렬처리가 가능하다는 특성으로 인해 고속 처리를 필요로 하는 다양한 스트리밍 서비스 등의 암/복호화 연산에 사용되고 있다. IPTV, VoIP등의 서비스를 사용하는 모바일 환경은 자원이 제한되어 있기 때문에 이러한 환경에서 사용되는 암호화 알고리즘은 효율성을 고려하여 구현되어야 한다. 플랫폼에 특화된 알고리즘 성능 개선은 확장성이 많이 부족하지만, AES 알고리즘 자체의 구현 로직 개선은 알고리즘이 동작하는 아키텍쳐에 제한되지 않고 적용 가능하다.AES-CTR mode is used for encryption / decoding operations such as various streaming services that require high-speed processing because of the parallel processing. Since the mobile environment using services such as IPTV and VoIP has limited resources, the encryption algorithm used in such environment should be implemented in consideration of efficiency. Platform-specific algorithm performance improvements lack much scalability, but the implementation logic improvements of the AES algorithm itself can be applied without being limited to the architecture in which the algorithm operates.

나아가, 본 발명은 컴퓨터로 읽을 수 있는 기록 매체에 컴퓨터가 읽을 수 있는 코드로 구현하는 것이 가능하다. 컴퓨터가 읽을 수 있는 기록 매체는 컴퓨터 시스템에 의하여 읽혀질 수 있는 데이터가 저장되는 모든 종류의 기록 장치를 포함한다.Furthermore, the present invention can be embodied as computer readable codes on a computer readable recording medium. A computer-readable recording medium includes all kinds of recording apparatuses in which data that can be read by a computer system is stored.

컴퓨터가 읽을 수 있는 기록 매체의 예로는 ROM, RAM, CD-ROM, 자기 테이프, 플로피디스크, 광 데이터 저장장치 등이 있으며, 또한 캐리어 웨이브(예를 들어 인터넷을 통한 전송)의 형태로 구현하는 것을 포함한다. 또한, 컴퓨터가 읽을 수 있는 기록 매체는 네트워크로 연결된 컴퓨터 시스템에 분산되어, 분산 방식으로 컴퓨터가 읽을 수 있는 코드가 저장되고 실행될 수 있다. 그리고 본 발명을 구현하기 위한 기능적인(functional) 프로그램, 코드 및 코드 세그먼트들은 본 발명이 속하는 기술 분야의 프로그래머들에 의하여 용이하게 추론될 수 있다.Examples of the computer-readable recording medium include a ROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device and the like, and also a carrier wave (for example, transmission via the Internet) . In addition, the computer-readable recording medium may be distributed over network-connected computer systems so that computer readable codes can be stored and executed in a distributed manner. In addition, functional programs, codes, and code segments for implementing the present invention can be easily deduced by programmers skilled in the art to which the present invention belongs.

이상에서 본 발명에 대하여 그 다양한 실시예들을 중심으로 살펴보았다. 본 발명에 속하는 기술 분야에서 통상의 지식을 가진 자는 본 발명이 본 발명의 본질적인 특성에서 벗어나지 않는 범위에서 변형된 형태로 구현될 수 있음을 이해할 수 있을 것이다. 그러므로 개시된 실시예들은 한정적인 관점이 아니라 설명적인 관점에서 고려되어야 한다. 본 발명의 범위는 전술한 설명이 아니라 특허청구범위에 나타나 있으며, 그와 동등한 범위 내에 있는 모든 차이점은 본 발명에 포함된 것으로 해석되어야 할 것이다.The present invention has been described above with reference to various embodiments. It will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims. Therefore, the disclosed embodiments should be considered in an illustrative rather than a restrictive sense. The scope of the present invention is defined by the appended claims rather than by the foregoing description, and all differences within the scope of equivalents thereof should be construed as being included in the present invention.

110 : 대상 데이터 블록 120 : 4×4 스테이트 행렬
210, 220, 230 : 데이터 블록 211 : 초기화 벡터(카운터)
212 : AES 암호화 방법에 따른 암호화 값
213 : 128 비트 평문 214 : 128 비트 암호문
411, 412 : 초기화 라운드에서의 블록 스테이트
511, 512 : 라운드 1에서의 연산 결과에 따른 블록 스테이트
610, 620 : 라운드 1에서의 각 연산 결과에 따른 블록 스테이트 일부
710 : 라운드 2에서의 연산 결과에 따른 블록 스테이트 일부
420, 520, 720 : 캐시
110: target data block 120: 4x4 state matrix
210, 220, 230: Data block 211: Initialization vector (counter)
212: Encryption value according to the AES encryption method
213: 128-bit plain text 214: 128-bit ciphertext
411, 412: Block State in Initialization Round
511, 512: Block state according to the operation result in round 1
610, 620: part of block state according to the result of each operation in round 1
710: Part of block state resulting from operation in round 2
420, 520, 720: cache

Claims (11)

AES(Advanced Encryption Standard)의 CTR 모드(counter mode)에 따른 암호화 방법에 있어서,
평문을 입력받아 128 비트(bit)의 크기를 갖는 대상 데이터 블록으로 분할하고, 각 라운드(round)마다 128 비트의 데이터 블록을 입력받아 초기화 벡터(initialization vector)로 설정하며, 상기 설정된 초기화 벡터를 4 개의 4 바이트(byte) 스테이트(state)로 분할하는 단계;
상기 분할된 대상 데이터 블록 중 제 1 블록과 상기 설정된 초기화 벡터를 이용하여 암호화된 결과를 XOR하여 제 1 암호문을 생성하는 단계;
상기 분할된 4 개의 스테이트 중 상기 각 라운드의 연산 과정에서 값이 변경되지 않는 3 개의 스테이트를 캐시(cache)에 저장하는 단계;
상기 제 1 블록에 연속하는 N 개(N은 양의 정수)의 블록들에 대해 각각의 블록들과 상기 캐시를 참조하여 획득한 연산 결과를 XOR함으로써 N 개의 암호문을 생성하는 단계; 및
상기 생성된 제 1 암호문과 상기 생성된 N 개의 암호문을 암호화 결과로 출력하는 단계를 포함하는 방법.
In the encryption method according to the CTR mode (counter mode) of the Advanced Encryption Standard (AES),
Receives a plain text and divides it into a target data block having a size of 128 bits, receives a 128-bit data block for each round, sets it as an initialization vector, and sets the set initialization vector to 4 Dividing into four 4 byte states;
Generating a first cipher text by XORing an encrypted result using a first block among the divided target data blocks and the set initialization vector;
Storing three states of the divided four states whose values do not change during the operation of each round in a cache;
Generating N ciphertexts by XORing the results of operations obtained by referring to the respective blocks and the cache with respect to N blocks (N is a positive integer) consecutive to the first block; And
And outputting the generated first cipher text and the generated N cipher texts as an encryption result.
제 1 항에 있어서,
상기 라운드가 AES 초기화 라운드(initial round)인 경우,
상기 3 개의 스테이트를 캐시에 저장하는 단계는, 상기 초기화 라운드의 연산 결과인 16 바이트 중, 마지막 4 바이트를 제외한 12 바이트를 상기 캐시에 저장하는 것을 특징으로 하는 방법.
The method of claim 1,
If the round is an AES initial round,
The storing of the three states in the cache may include storing, in the cache, 12 bytes out of the last 4 bytes of the 16 bytes that are the result of the initialization round operation.
제 2 항에 있어서,
상기 N 개의 암호문을 생성하는 단계는,
상기 제 1 블록에 연속하는 232-1 개의 블록들에 대해 상기 캐시에 저장된 12 바이트를 독출하는 단계;
232-1 개의 블록들에 대해 각각의 카운터 값의 변화 규칙을 고려하여 XOR 연산 결과의 4 바이트를 산출하는 단계;
상기 독출된 12 바이트와 상기 산출된 4 바이트를 결합하여 해당 데이터 블록에 대한 연산 결과를 생성하는 단계; 및
상기 생성된 연산 결과에 기초하여 232-1 개의 암호문을 생성하는 단계를 포함하는 방법.
The method of claim 2,
Generating the N number of cipher texts,
Reading 12 bytes stored in the cache for 2 32 -1 blocks consecutive to the first block;
Calculating 4 bytes of an XOR operation result in consideration of a change rule of each counter value for 2 32 -1 blocks;
Combining the read 12 bytes with the calculated 4 bytes to generate an operation result for the corresponding data block; And
Generating 2 32 -1 cipher texts based on the generated operation result.
제 1 항에 있어서,
상기 라운드가 AES 라운드 1(round 1)인 경우,
상기 3 개의 스테이트를 캐시에 저장하는 단계는, 상기 라운드 1의 연산 결과인 16 바이트 중, 처음 4 바이트를 제외한 12 바이트를 상기 캐시에 저장하는 것을 특징으로 하는 방법.
The method of claim 1,
If the round is AES round 1,
The storing of the three states in the cache may include storing, in the cache, 12 bytes except the first 4 bytes of the 16 bytes that are the result of the round 1 operation.
제 4 항에 있어서,
상기 N 개의 암호문을 생성하는 단계는,
상기 제 1 블록에 연속하는 28-1 개의 블록들에 대해 상기 캐시에 저장된 12 바이트를 독출하는 단계;
상기 라운드 1의 연산 과정을 고려하여 연산 결과의 4 바이트를 산출하는 단계;
상기 독출된 12 바이트와 상기 산출된 4 바이트를 결합하여 해당 데이터 블록에 대한 연산 결과를 생성하는 단계; 및
상기 생성된 연산 결과에 기초하여 28-1 개의 암호문을 생성하는 단계를 포함하는 방법.
The method of claim 4, wherein
Generating the N number of cipher texts,
Reading 12 bytes stored in the cache for 2 8 -1 blocks consecutive to the first block;
Calculating 4 bytes of the operation result in consideration of the operation of the round 1;
Combining the read 12 bytes with the calculated 4 bytes to generate an operation result for the corresponding data block; And
Generating 2 8 -1 cipher texts based on the generated operation result.
제 4 항에 있어서,
상기 캐시에 저장되지 않는 처음 4 바이트에 대하여 상기 AES 라운드 1에 선행하는 AES 초기화 라운드에서 소정 연산에 대한 결과를 미리 산출하여 치환 테이블에 저장하는 단계를 더 포함하고,
상기 AES 라운드 1에서는 상기 저장된 4 바이트의 치환 테이블을 독출하여 카운터 값을 산출하는 것을 특징으로 하는 방법.
The method of claim 4, wherein
Calculating a result of a predetermined operation in the AES initialization round preceding the AES round 1 with respect to the first 4 bytes not stored in the cache, and storing the result in a substitution table in advance;
In the AES round 1, a counter value is calculated by reading the stored 4-byte substitution table.
제 6 항에 있어서,
상기 소정 연산은 대상 블록의 컬럼(column)이 소정 다항식에 의해 치환되는 MixColumns() 연산 및 상기 MixColumns() 연산의 출력과 라운드 키(round key)의 XOR 값을 산출하는 AddRoundKey() 연산인 것을 특징으로 하는 방법.
The method according to claim 6,
The predetermined operation is a MixColumns () operation in which a column of a target block is replaced by a predetermined polynomial, and an AddRoundKey () operation for calculating an output of the MixColumns () operation and an XOR value of a round key. How to.
제 6 항에 있어서,
상기 카운터 값에서 캐리(carry)가 발생하는 경우 새롭게 산출된 연산 결과에 따라 상기 저장된 치환 테이블을 갱신하고,
상기 갱신된 치환 테이블은 갱신 이후, 연속하는 240×16 바이트의 입력 데이터에 대해 상기 치환 테이블로부터 독출된 4 바이트의 값을 이용하여 상기 소정 연산 없이 상기 카운터 값을 산출하는 것을 특징으로 하는 방법.
The method according to claim 6,
When a carry occurs in the counter value, the stored substitution table is updated according to a newly calculated operation result.
And the updated substitution table calculates the counter value without the predetermined operation by using a value of 4 bytes read from the substitution table for successive 2 40 x 16 bytes of input data after the update.
제 1 항에 있어서,
상기 라운드가 AES 라운드 2(round 2)인 경우,
상기 3 개의 스테이트를 캐시에 저장하는 단계는, 상기 라운드 2의 연산 중, 대상 블록의 컬럼이 소정 다항식에 의해 치환되는 MixColumns() 연산 과정에서 인접한 블록 간에 값이 변경되지 않는 12 바이트의 XOR 결과를 상기 캐시에 저장하는 것을 특징으로 하는 방법.
The method of claim 1,
If the round is AES round 2,
The storing of the three states in the cache may include a 12-byte XOR result in which a value does not change between adjacent blocks during a MixColumns () operation in which a column of a target block is replaced by a predetermined polynomial during the round 2 operation. Storing in the cache.
제 9 항에 있어서,
상기 N 개의 암호문을 생성하는 단계는,
상기 제 1 블록에 연속하는 28-1 개의 블록들에 대해 상기 캐시에 저장된 12 바이트를 독출하는 단계;
상기 라운드 1의 연산 과정을 고려하여 상기 MixColumns() 연산 과정에서 인접한 블록 간에 값이 변경되는 4 바이트의 XOR 결과를 산출하는 단계;
상기 독출된 12 바이트와 상기 산출된 4 바이트를 결합하여 상기 MixColumns() 연산의 결과값으로 설정하는 단계;
상기 설정된 결과값에 기초하여 해당 데이터 블록에 대한 연산 결과를 생성하는 단계; 및
상기 생성된 연산 결과에 기초하여 28-1 개의 암호문을 생성하는 단계를 포함하는 방법.
The method of claim 9,
Generating the N number of cipher texts,
Reading 12 bytes stored in the cache for 2 8 -1 blocks consecutive to the first block;
Calculating a 4-byte XOR result whose value is changed between adjacent blocks in the MixColumns () operation in consideration of the operation of the round 1;
Combining the read 12 bytes with the calculated 4 bytes and setting the result values of the MixColumns () operation;
Generating an operation result for the corresponding data block based on the set result value; And
Generating 2 8 -1 cipher texts based on the generated operation result.
제 1 항 내지 제 9 항 중에 어느 한 항의 방법을 컴퓨터에서 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록매체.A computer-readable recording medium storing a program for causing a computer to execute the method according to any one of claims 1 to 9.
KR1020110050122A 2011-05-26 2011-05-26 Encryption apparatus and method according to CTR mode of AES(advanced encryption standard) KR101240243B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020110050122A KR101240243B1 (en) 2011-05-26 2011-05-26 Encryption apparatus and method according to CTR mode of AES(advanced encryption standard)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020110050122A KR101240243B1 (en) 2011-05-26 2011-05-26 Encryption apparatus and method according to CTR mode of AES(advanced encryption standard)

Publications (2)

Publication Number Publication Date
KR20120131738A KR20120131738A (en) 2012-12-05
KR101240243B1 true KR101240243B1 (en) 2013-03-11

Family

ID=47515505

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020110050122A KR101240243B1 (en) 2011-05-26 2011-05-26 Encryption apparatus and method according to CTR mode of AES(advanced encryption standard)

Country Status (1)

Country Link
KR (1) KR101240243B1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20190028066A (en) 2017-09-08 2019-03-18 국민대학교산학협력단 A method of generating random number based on block cipher with whitebox encryption and apparatus thereof

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102543267B1 (en) * 2016-07-13 2023-06-13 삼성에스디에스 주식회사 Method and apparatus for white box cryptography
KR102387169B1 (en) * 2020-11-05 2022-04-15 서울과학기술대학교 산학협력단 Digital forensic data decoding device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030046563A1 (en) 2001-08-16 2003-03-06 Dallas Semiconductor Encryption-based security protection for processors
KR20090094704A (en) * 2008-03-03 2009-09-08 동국대학교 산학협력단 Encryption apparatus and the method based on AES Counter mode

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030046563A1 (en) 2001-08-16 2003-03-06 Dallas Semiconductor Encryption-based security protection for processors
KR20090094704A (en) * 2008-03-03 2009-09-08 동국대학교 산학협력단 Encryption apparatus and the method based on AES Counter mode

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
논문1(2008) *
논문2(2009.01) *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20190028066A (en) 2017-09-08 2019-03-18 국민대학교산학협력단 A method of generating random number based on block cipher with whitebox encryption and apparatus thereof

Also Published As

Publication number Publication date
KR20120131738A (en) 2012-12-05

Similar Documents

Publication Publication Date Title
JP7007384B2 (en) Increased ambiguity
Bogdanov et al. ALE: AES-based lightweight authenticated encryption
CN101753292B (en) Methods and devices for a chained encryption mode
US9600421B2 (en) Systems and methods for low-latency encrypted storage
Saraf et al. Text and image encryption decryption using advanced encryption standard
US8577023B2 (en) Encryption processing method, apparatus, and computer program utilizing different types of S-boxes
US20120189119A1 (en) Method and Apparatus for Increasing the Speed of Cryptographic Processing
KR101737299B1 (en) Encoder, decoder and methods
US20060023875A1 (en) Enhanced stream cipher combining function
WO2021129470A1 (en) Polynomial-based system and method for fully homomorphic encryption of binary data
Gouvêa et al. High speed implementation of authenticated encryption for the MSP430X microcontroller
CN111800255A (en) Dynamic white-box library generation and use method suitable for block cipher white-box
KR20190020988A (en) Computer-executable lightweight white-box cryptographic method and apparatus thereof
KR101240243B1 (en) Encryption apparatus and method according to CTR mode of AES(advanced encryption standard)
US20170041133A1 (en) Encryption method, program, and system
KR20080072345A (en) Apparatus for encryption and method using the same
CN116796345A (en) Encryption and decryption method, device, equipment and storage medium
CN113541942B (en) Digital content encryption and decryption method based on ARX white-box block cipher
KR101583285B1 (en) Block cipher method using expansion key and apparatus thereof
Xiao et al. Data transmission scheme based on AES and polar codes
US9286474B2 (en) Encoding apparatus and method
KR102097702B1 (en) Key generation method for low delay block cipher operating mode
KR102626974B1 (en) Method and system for protecting secret key of white box cryptography
Ajlouni et al. A New Approach in Key Generation and Expansion in Rijndael Algorithm.
Rohilla Blowfish Algorithm: Security and Performance Enhancement

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E701 Decision to grant or registration of patent right
GRNT Written decision to grant
FPAY Annual fee payment

Payment date: 20170109

Year of fee payment: 5

FPAY Annual fee payment

Payment date: 20180108

Year of fee payment: 6

FPAY Annual fee payment

Payment date: 20190211

Year of fee payment: 7

FPAY Annual fee payment

Payment date: 20200128

Year of fee payment: 8