WO2015144305A1 - Memory efficient side-channel-protected masking - Google Patents

Memory efficient side-channel-protected masking Download PDF

Info

Publication number
WO2015144305A1
WO2015144305A1 PCT/EP2015/000625 EP2015000625W WO2015144305A1 WO 2015144305 A1 WO2015144305 A1 WO 2015144305A1 EP 2015000625 W EP2015000625 W EP 2015000625W WO 2015144305 A1 WO2015144305 A1 WO 2015144305A1
Authority
WO
WIPO (PCT)
Prior art keywords
masked
folded
xor
calculation
masking
Prior art date
Application number
PCT/EP2015/000625
Other languages
German (de)
French (fr)
Inventor
Jürgen PULKUS
Original Assignee
Giesecke & Devrient Gmbh
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 Giesecke & Devrient Gmbh filed Critical Giesecke & Devrient Gmbh
Priority to EP15713647.4A priority Critical patent/EP3123461A1/en
Publication of WO2015144305A1 publication Critical patent/WO2015144305A1/en

Links

Classifications

    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09CCIPHERING OR DECIPHERING APPARATUS FOR CRYPTOGRAPHIC OR OTHER PURPOSES INVOLVING THE NEED FOR SECRECY
    • G09C1/00Apparatus or methods whereby a given sequence of signs, e.g. an intelligible text, is transformed into an unintelligible sequence of signs by transposing the signs or groups of signs or by replacing them by others according to a predetermined system
    • 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/002Countermeasures against attacks on cryptographic mechanisms
    • H04L9/003Countermeasures against attacks on cryptographic mechanisms for power analysis, e.g. differential power analysis [DPA] or simple power analysis [SPA]
    • 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/04Masking or blinding
    • H04L2209/043Masking or blinding of tables, e.g. lookup, substitution or mapping
    • 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/12Details relating to cryptographic hardware or logic circuitry
    • H04L2209/122Hardware reduction or efficient architectures

Definitions

  • the correlation curves for false key bytes consist of a more or less uniform noise, similar to the correlation curve shown in FIG. 1b.
  • the correlation curve for the correct key byte with which the calculation was performed has a rash at a previously unknown time, similar to the correlation curve shown in FIG. This procedure is performed with each key byte k of the key K until the key K is reconstructed byte by byte.
  • Secondary masking is applied to the folded masked intermediate value so that randomization is performed on either the folded masked intermediate value or the one's complement associated with the folded masked intermediate value.
  • a value is therefore first basemasked that The masked intermediate value or the one's complement associated with the masked intermediate value is further calculated, if necessary, using a correction element which is entered by the convolution distance. Random access to either the intermediate value or the one's complement of the intermediate value is then performed on intermediate values generated with base masking and the additional step of folding.
  • FIG. 1b the table is masked with the secondary masking according to the invention, in addition to the base XOR masking.
  • Memory-efficient secondary masking is accomplished by first convolving the XOR masked table underlying FIG. 1a and expanding it to a simply extended table containing the convolved XOR-masked table (first the XOR masked table , then it has been folded) and the complementary table to the folded XOR-masked table includes.
  • the table access is applied to the extended folded XOR-masked table. In this case, either the folded XOR-masked table or the complementary table is randomly accessed within the extended folded XOR-masked table.
  • FIG. 3 shows computational rules for base masking of an intermediate value to a masked intermediate value with XOR masking and additive masking.
  • the calculation rule to mask x with an additive base masking to x add is
  • the complementary table S' is formed by that in the base masked table 5 "of FIG. 10, the table input x and the table output y are complemented.
  • Fig. 14 shows a table T ', simply extended, starting from the folded table of Fig. 12, with selection bits at the lowest binary bit position, according to a preferred embodiment of the invention.
  • Table 14 is obtained from Table 13 by alternately selecting one entry from the upper and lower half of Table 13 (line by line). Therefore, the first circled value 22 of the second half of Table 13 immediately appears as a second value in the table 14, and accordingly, the last circled value 11 of the upper half of Table 13 is the penultimate value of FIG Table Fig. 14.

Landscapes

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

Abstract

The invention creates a method in a processor for performing a cryptographic calculation. The performance of the calculation involves the application of a basic masking, by means of which intermediate values are used in the calculation as masked intermediate values. The performance of the calculation additionally involves the application of a folding and a secondary masking. The folding involves the calculation of the masked intermediate value using the unmasked intermediate value and at least one secondary intermediate value. The secondary masking involves the calculation, for each intermediate value masked by means of the basic masking, under random control, being performed either with the masked intermediate value or with the one's complement of the masked intermediate value.

Description

Speichereffiziente seitenkanalgeschützte Maskierung  Memory Efficient Side Channel Protected Masking
Die Erfindung betrifft ein Verfahren zum Durchführen einer kryptographi- schen Berechnung unter Verwendung eines kryptographischen Schlüssels, das gegen Ausspähen des Schlüssels über Seitenkanalangriffe geschützt ist. The invention relates to a method for performing a cryptographic calculation using a cryptographic key that is protected against spying the key via page channel attacks.
Kryptographische Berechnungen werden z.B. von allgemeinen Prozessoren (CPUs) durchgeführt, alternativ häufig von Krypto-Coprozessoren, die den allgemeinen Prozessoren zugeordnete spezielle Prozessoren sind. Insbeson- dere Chipkarten für Zahlungsverkehr- oder Mobilfunkanwendungen haben häufig Prozessoren (CPUs) mit Krypto-Coprozessoren. Viele Chip karten für Zahlungsverkehr- oder Mobilfunkanwendungen haben speziell für DES o- der AES ausgelegte Krypto-Coprozessoren (siehe nächster Absatz). Durch eine kryptographische Berechnung werden Eingangsdaten unterCryptographic calculations are e.g. often performed by general purpose processors (CPUs), alternatively often by crypto-coprocessors, which are dedicated processors to general processors. In particular, smart cards for payment or mobile applications often have processors (CPUs) with crypto coprocessors. Many chip cards for payments or mobile applications have crypto coprocessors specially designed for DES or AES (see next paragraph). Through a cryptographic calculation, input data is under
Verwendung eines geheimen Schlüssels zu Ausgangsdaten verarbeitet, z.B. Klartextdaten (Eingangsdaten) mit einem Schlüssel zu Chiffredaten (Ausgangsdaten) verschlüsselt oder umgekehrt Chiffredaten (Eingangsdaten) mit einem Schlüssel zu Klartextdaten (Ausgangsdaten) entschlüsselt. Beispiele für symmetrische (Verschlüsselungs-Schlüssel = Entschlüsselungs-Schlüssel) kryptographische Berechnungen sind die Algorithmen DES (Data Encrypti- on Standard) und AES (Advanced Encryption Standard). Use of a secret key processed to output data, e.g. Clear text data (input data) encrypted with a key to cipher data (output data) or vice versa Cipher data (input data) decrypted with a key to plain text data (output data). Examples of symmetric (encryption key = decryption key) cryptographic computations are the algorithms DES (Data Encryption Standard) and AES (Advanced Encryption Standard).
Beim AES, der in mehrere Runden (z.B. 10, 12 oder 14) unterteilt ist, werden die Eingangsdaten und der Schlüssel in Blöcke unterteilt und blockweise verarbeitet. Innerhalb jeder Runde werden die Daten byteweise verarbeitet, so dass im Detail jeweils ein Eingangsdatenbyte (Klartextbyte bei Verschlüsselung bzw. Chiffretextbyte bei Entschlüsselung) mit einem Schlüsselbyte verarbeitet wird. So wird z.B. bei einer AES Verschlüsselung, die in Fig. 2 auszugsweise schematisch gezeigt ist, ein Klartext P mit einem Schlüssel K zu einem Chiffretext C verschlüsselt. Der Klartext P = pp...ppp besteht aus einer Folge von Klartextbytes p, der Schlüssel K = kk...kkk aus einer Folge von Schlüsselbytes k. Am Eingang jeder Runde (in Fig. 2 auszugsweise gezeigt sind die ersten beiden Runden R=l und R=2) wird eine Teilberechnung durchgeführt, anhand der später beispielhaft ein DPA Angriff beschrieben wird. Bei der Teilberechnung wird ein Klartextbyte p mit einem Schlüsselbyte k verxort ( p Θ k ), das Ergebnis der Verxorung in eine (Substitutions-) Tabelle S (S-Box) eingesetzt und hierdurch durch einen Tabellenzugriff auf die Tabelle S ein Zwischenwert x = S[p Θ k] berechnet. Der Zwischenwert x wird innerhalb der Runde weiteren Rechenschritten wie ShiftRow, MixColumn zugeführt, die in Fig. 2 nicht gezeigt sind. Schlüsselexpansionen und Auswahl von Schlüsselbits, die bei AES durchgeführt werden, sind in Fig. 2 ebenfalls nicht gezeigt. Tabellenzugriffe sind besonders gefährdet durch DPA Angriffe. In AES, which is divided into several rounds (eg 10, 12 or 14), the input data and the key are divided into blocks and processed in blocks. Within each round, the data is processed byte by byte, so that in each case an input data byte (plaintext byte for encryption or cipher text byte for decryption) is processed with a key byte. Thus, for example, in the case of an AES encryption, which is shown schematically in excerpts in FIG. 2, a plaintext P is encrypted with a key K to form a ciphertext C. The plaintext P = pp ... ppp consists of a sequence of plaintext bytes p, the key K = kk ... kkk from a sequence of key bytes k. At the entrance of each round (shown in FIG. 2 in excerpts are the first two rounds R = 1 and R = 2), a partial computation is carried out on the basis of which a DPA attack will be described later by way of example. In the sub-calculation, a plaintext byte p with a key byte k is used (p Θ k), the result of the forgery in a (substitution) table S (S-box) is inserted and thereby an intermediate value x = S through a table access to the table S [p Θ k] is calculated. The intermediate value x is fed within the round to further computing steps such as ShiftRow, MixColumn, which are not shown in FIG. Key expansions and selection of key bits that are performed at AES are also not shown in FIG. Table accesses are particularly vulnerable to DPA attacks.
Da der Stromverbrauch eines Prozessors (z.B. in einer Chipkarte) von den verarbeiteten Daten abhängt, sind auf Prozessoren implementierte krypto- graphische Berechnungen anfällig gegenüber Seitenkanalangriffen, bei denen der zeitaufgelöste Stromverbrauch des Prozessors während der Durchführung der Berechnung gemessen wird. Meistens ist der Stromverbrauch genauer vom Hamminggewicht der Daten abhängig, d.h. von der Anzahl Einsen in den Daten in der Binärdarstellung. Der Stromverbrauch des Prozessors während der Durcriführung der Berechnung, aufgezeichnet gegenüber der während der Berechnung verstrichenen Zeit, wird als Stromkurve bezeichnet. Stromkurven eines Prozessors für eine Berechnung werden beispielsweise mittels eines Oszilloskops aufgezeichnet. Bei einem DPA (Differential Power Analysis) Angriff, teilweise auch Correla- tion Power Attack (CPA) genannt, wird eine Mehrzahl von Stromkurven (z.B. ungefähr 1000) für strukturell gleiche, mit zufällig variierenden Eingangsdaten durchgeführte Berechnung aufgezeichnet und synchronisiert. Bei der Berechnung werden mit bekannten Eingangsdaten und einem geheimen Schlüssel Ausgangsdaten berechnet. Für jeden möglichen Wert des Schlüssels wird eine zeitaufgelöste Korrelationskurve zwischen den synchronisierten Stromkurven und dem Hamminggewicht HW der mit dem jeweiligen Schlüssel erzielten Ausgangsdaten berechnet. Die Korrelations- kurven für falsche Schlüssel bestehen aus einem mehr oder weniger gleichmäßigen Rauschen, ähnlich wie die in Fig. lb gezeigte Korrelationskurve. Die Korrelationskurve für den Schlüssel, mit dem die Berechnung durchgeführt wurde, hat an einem zuvor unbekannten Zeitpunkt eine statistische Auffälligkeit in Form eines Ausschlags („Peaks"), ähnlich wie die in Fig. la gezeigte Korrelationskurve. Because the power consumption of a processor (eg, in a smart card) depends on the data being processed, processor-implemented cryptographic computations are prone to side-channel attacks in which the processor's time-resolved power consumption is measured while performing the computation. In most cases, the power consumption is more closely dependent on the data's hamming weight, that is, the number of ones in the data in the binary representation. The power consumption of the processor during the duration of the calculation, recorded versus the time elapsed during the calculation, is called the current curve. Current curves of a processor for a calculation are recorded, for example, by means of an oscilloscope. In a DPA (Differential Power Analysis) attack, sometimes referred to as Correlation Power Attack (CPA), a plurality of current curves (eg, about 1000) are recorded and synchronized for structurally equal computation performed with randomly varying input data. In the calculation, output data is calculated using known input data and a secret key. For each possible value of the key, a time-resolved correlation curve between the synchronized current curves and the Hamming weight HW of the output data obtained with each key is calculated. The correlation curves for false keys consist of a more or less uniform noise, similar to the correlation curve shown in FIG. The correlation curve for the key with which the calculation was performed has a statistical conspicuousness in the form of a peak at a previously unknown time, similar to the correlation curve shown in FIG.
Bei einem DPA Angriff höherer (zweiter, dritter, vierter, ...) Ordnung werden Stromkurven an mehreren (zwei, drei, vier, ...) Zeitpunkten im zeitlichen Ablauf der Berechnung aufgenommen. [PRB10] beschreibt eine DPA Angriff zweiter Ordnung. In a DPA attack of higher (second, third, fourth, ...) order, current curves are recorded at several (two, three, four, ...) times in the time course of the calculation. [PRB10] describes a second-order DPA attack.
Bei einem DPA Angriff auf die Teilberechnung des AES aus Fig. 2 wird ein Klartextbyte p des bekannten Schlüssels K mit einem Schlüsselbyte k des geheimen Schlüssels K verxort ( p @ k ), das Ergebnis der Verxorung in die 256-Byte Substitutionstabelle S (S-Box) eingesetzt und hierdurch durch Tabellenzugriff der Zwischenwert x = S[p Θ k] berechnet. Der Angreifer zeichnet ungefähr 1000 Stromkurven der Teilberechnung auf (p variiert dabei, k bleibt gleich), synchronisiert sie und berechnet für jeden möglichen Wert 0,...,255 des Schlüsselbytes k die Korrelationskurve zwischen den synchroni- sierten gemessenen Stromkurven und dem Harnminggewicht HW(x) des mit dem jeweiligen Schlüsselbyte k berechneten Zwischenwerts x . Die Korrelationskurven für falsche Schlüsselbytes bestehen aus einem mehr oder weniger gleichmäßigen Rauschen, ähnlich wie die in Fig. lb gezeigte Korre- lationskurve. Die Korrelationskurve für das richtige Schlüsselbyte, mit dem die Berechnung durchgeführt wurde, hat an einem zuvor unbekannten Zeitpunkt einen Ausschlag, ähnlich wie die in Fig. la gezeigte Korrelationskurve. Dieses Verfahren wird mit jedem Schlüsselbyte k des Schlüssels K durchgeführt, bis der Schlüssel K Byte für Byte rekonstruiert ist. In a DPA attack on the partial calculation of the AES of FIG. 2, a plaintext byte p of the known key K is verxort with a key byte k of the secret key K (p @ k), the result of Verxorung in the 256-byte substitution table S (S). Box) and calculated by table access the intermediate value x = S [p Θ k]. The attacker records about 1000 current curves of the sub-computation (p varies, k remains the same), synchronizes them and calculates for each possible value 0, ..., 255 of the key byte k the correlation curve between the synchronous Siert measured current curves and the urinary weight HW (x) of the calculated with the respective key byte k intermediate value x. The correlation curves for false key bytes consist of a more or less uniform noise, similar to the correlation curve shown in FIG. 1b. The correlation curve for the correct key byte with which the calculation was performed has a rash at a previously unknown time, similar to the correlation curve shown in FIG. This procedure is performed with each key byte k of the key K until the key K is reconstructed byte by byte.
Gemäß einem firmeninternen unveröffentlichten Stand der Technik wird als Gegenmaßnahme gegen DPA Angriffe die„OO/FF-Maskierung" vorgesehen. Hierbei wird ein Zwischenergebnis einer Teilberechnung in der Berechnung zufallsgesteuert entweder direkt berechnet, so dass das Zwischenergebnis erzeugt wird, oder komplementiert berechnet, so dass das Einerkomplement des Zwischenergebnisses berechnet wird. Bedarfsweise müssen dabei die Eingangsdaten (Klartext oder Chiffretext) und der Schlüssel unabhängig voneinander zufallsgesteuert komplementiert werden und am Ausgang der Berechnung die Ausgangsdaten (Chiffretext bzw. Klartext) komplementiert werden. Beispielsweise wird also zufallsgesteuert die Berechnung so durchgeführt, dass eine Teilberechnung x = S[p Θ k] durchgeführt wird, oder eine komplementierende Teilberechnung x = S' p®k] durchgeführt wird, mit einer einerkomplementierten S-Box S'[x] = S[5c] und einer komplementierten Klartextbytes und Schlüsselbytes. Werden für einen Angriff ungefähr 1000 Durchführungen der kryptographischen Berechnung durchgeführt, wird statistisch in je der Hälfte mit dem Zwischenwert x und dem Einerkomplement 3c gerechnet. Für das Harnminggewicht HW x) der komplementierenden Teilberechnung x = S'\p®k] gilt die Formel HWix) = 8— HW(x), in der das Hamminggewicht HW(x) der nicht-komplementierten Berechnung mit negativem Vorzeichen vorkommt. Hierdurch heben sich bei Zufallssteuerung im Mittel Korrelationen zwischen den Stromkurven und dem mit dem Schlüssel erzielten Rechenergebnis auf. Somit ergibt sich für zufallsgesteuer- tes Rechnen mit dem Zwischenwert x - S[p Θ k] oder dem komplementierten Zwischenwert x = S' p&k] auch beim Rechnen mit dem richtigen Schlüsselbyte eine Korrelationskurve wie die in Fig. lb gezeigte, wie sie ohne Abwehrmaßnahmen nur für ein falsch geratenes Schlüsselbit entsteht. Die Durchführung der Berechnung zufallsgesteuert mit dem Zwischenwert x = S[p Θ k] oder dem komplementierten Zwischenwert x = S' [p®/c] ist somit resistent gegen den oben beschriebenen DPA-Seitenkanalangriff mit Korrelationsberechnung. Zudem ist die OO/FF-Maskierung speichersparend. According to an in-house unpublished state of the art, "OO / FF masking" is provided as a countermeasure against DPA attacks, whereby an intermediate result of a partial calculation in the calculation is randomly calculated either directly, so that the intermediate result is generated or computed complementarily, so that If necessary, the input data (plaintext or ciphertext) and the key must be complemented independently of one another randomly and the output data (ciphertext or plaintext) are complemented at the output of the calculation. that a partial calculation x = S [p Θ k] is performed, or a complementary partial calculation x = S 'p®k] is performed, with a complemented S-box S' [x] = S [5c] and a complemented plaintext byte and Key Bytes. Will be for one Attack carried out approximately 1000 executions of the cryptographic calculation is statistically calculated in half each with the intermediate value x and the one's complement 3c. For the urinary weight HW x) of the complementing partial computation x = S '\ p®k] the formula HWix) = 8- HW (x), in the hamming weight HW (x) of the non-complemented calculation with a negative sign occurs. As a result, correlations between the current curves and the calculated result obtained with the key cancel each other out at random control on average. Thus, for random-controlled arithmetic with the intermediate value x - S [p Θ k] or the complemented intermediate value x = S 'p & k], a correlation curve such as that shown in FIG. 1b also results when calculating with the correct key byte, as it does without defensive measures only for a wrong guess key bit. Performing the calculation randomly with the intermediate value x = S [p Θ k] or the complemented intermediate value x = S '[p® / c] is thus resistant to the above-described DPA side channel attack with correlation calculation. In addition, the OO / FF masking saves memory.
Die Berechnung des ler-Komplements eines Werts wird wahlweise durch Verxoren des Werts mit hexadezimal FF (andere Schreibweise: Oxff) durchgeführt, die Bereitstellung des Werts selbst wird in diesem Fall wahlweise durch Verxoren mit 0 an derselben Stelle im Berechnungsablauf, an der beim ler-Komplement mit FF verxort wird, durchgeführt. Durch Verxoren mit FF wird ein Wert komplementiert. Durch Verxoren mit Null bleibt der Wert unverändert. Durch die Durchführung einer Verxorung in beiden Fällen wird verschleiert, wann der Wert und wann das ler-Komplement des Werts verwendet wird. Aus dieser Art der Durdiführung der Zufallssteuerung resultiert der Name„OO/FF-Maskierung". Bei einem variierten DPA Angriff wird statt der Korrelation eine andere Statistik berechnet, beispielsweise die Varianz oder eine eindimensionale Kol- mogorov-Smirnov Statistik. Hierdurch mittein sich die statistischen Auffälligkeiten bei Verwendung des richtigen Schlüsselbytes auch dann nicht heraus, wenn zufallsgesteuert mit dem Zwischenwert x = S[p Θ k] oder dem komplementierten Zwischenwert x - S'[p ® k] gerechnet wird. Somit ist dennoch erkennbar, wann mit dem richtigen Schlüssel gerechnet wird. The calculation of the ler complement of a value is performed optionally by forcing the value with hexadecimal FF (other notation: Oxff), the provision of the value itself in this case optionally by verifying with 0 at the same place in the calculation process, at which Complement with FF is being carried out. Verxoring with FF complements a value. By zeroing the value remains unchanged. Performing a forgery in both cases disguises when the value and when the ler complement of the value is used. This type of random control results in the name "OO / FF masking." In a varied DPA attack, instead of the correlation, another statistic is computed, such as the variance or one-dimensional Kologorov-Smirnov statistic Even if the correct key byte is used, it is not noticeable if randomized with the intermediate value x = S [p Θ k] or complemented intermediate value x - S '[p ® k] is calculated. Thus, it is still recognizable when the right key is expected.
Eine weitere Gegenmaßnahme gegen DPA Angriffe besteht in der XOR- Maskierimg, die beispielsweise in DE 198 22 217 AI beschrieben ist, und wobei statt Eingangsdaten E mit einer Zufallszahl r verxorte Eingangsdaten E'= E ® r verarbeitet werden. A further countermeasure against DPA attacks consists in the XOR mask, which is described for example in DE 198 22 217 A1, and in which, instead of input data E, a random number r is used to process inputted data E '= E® r.
Bei der XOR-Maskierung ist es wichtig, dass stets alle Zwischenwerte mas- kiert sind. Wird unvorsichtig maskiert, ist dies nicht der Fall. Wird beim AES in einer Teilberechnung, z.B. derjenigen aus Fig. 2, eine Verschlüsselung eines maskierten Klartextbytes p'= p ® r mit einem maskierten Schlüsselbyte k'= k ® r durchgeführt, ergibt sich (p ® r) ® (k ® r) - p ® k = x , also ein un- maskiertes Verschlüsselungsergebnis bzw. Zwischenergebnis x. Dass alle Zwischenergebnisse maskiert sind, und niemals unmaskierte Zwischenergebnisse auftreten, wird beispielsweise durch unterschiedliche Maskierung von Eingangsdaten und Schlüssel erreicht. Beispielsweise werden die Eingangsdaten (Klartext oder Chiffretext) mit zwei Zufallszahlen r, s maskiert, der Schlüssel mit nur einer Zufallszahl r maskiert und eine Kompensations- maskierung durchgeführt. Beispielsweise wird die Maskierung durchgeführt gemäß (((p ® r) ® s) ® (k ® r)) ® (r ® s) = p ® k ® r = x ® r = xXOR . Das Klartextbyte p wird also mit r und s maskiert, das Schlüsselbyte wird nur mit s maskiert, und zudem die Kompensationsmaskierung mit beiden Zufallszahlen r, s durchgeführt. Hierdurch taucht statt des Zwischenergebnisses x ein mit r maskiertes Zwischenergebnis xXOR = x ® r auf, vgl. Fig. 3. Eine Berechnung mit sorgfältiger XOR-Maskierung ist resistent gegen den oben beschriebenen DPA Angriff, unabhängig von der verwendeten Statistik (z.B. Korrelation, Varianz, eindimensionale Kolmogorov-Smirnov Statistik). Das Zwischenergebnis der TeÜberechnung aus Fig. 2 wird berechnet gemäß For XOR masking, it is important that all intermediate values are always masked. If carelessly masked, this is not the case. If an encryption of a masked plaintext byte p '= p® r with a masked key byte k' = k® r is carried out in the AES in a partial calculation, for example that of FIG. 2, (p® r )® (k® r) results - p ® k = x, ie an unmasked encryption result or intermediate result x. That all intermediate results are masked, and never unmasked intermediate results occur, for example, achieved by different masking of input data and keys. For example, the input data (plaintext or ciphertext) is masked with two random numbers r, s, the key with only a random number r is masked and a compensation masking is performed. For example, the masking is carried out in accordance with (((p ® r) ® s) ® (k ® r)) ® (r ® s) = p ® k ® r = x ® r = x XOR . The plaintext byte p is thus masked with r and s, the key byte is masked only with s, and in addition the compensation masking with both random numbers r, s is performed. As a result, instead of the intermediate result x, an intermediate result x XOR = x.rar. Masked with r appears, cf. Fig. 3. A calculation with careful XOR masking is resistant to the DPA attack described above, regardless of the statistics used (eg correlation, variance, one-dimensional Kolmogorov-Smirnov statistic). The Interim result of the calculation of FIG. 2 is calculated in accordance with
S'[x] = S[x Θ rl] Θ rl, mit rl, r2 unabhängigen Zufallszahlen. Hieraus ist ersichtlich, dass für alle Werte der Zufallszahlen rl und r2 eine eigene Substitutionstabelle (S-Box) S' benötigt wird. Wahlweise wird für jeden möglichen Wert der Zufallszahl r (= rl bzw. r2) eine mit r maskierte Substitutionstabelle (S-Box) S' abgespeichert (z.B. in der Chipkarte bzw. dem Prozessor), also bei einer 256 Byte großen Substitutionstabelle (S-Box) z.B. 256 verschiedene 256- Byte-Tabellen. Alternativ wird die Substitutionstabelle (S-Box) erst nach der Festlegung der Zufallszahl r berechnet, vorzugsweise in einem dem Prozes- sor zugeordneten Arbeitsspeicher RAM. Dies kostet allerdings Rechenzeit und ggf . Speicherplatz im Arbeitsspeicher RAM. Im Verlauf der Durchführung des Algorithmus, z.B. des AES, und sobald die Zufallszahl festgelegt ist, wird dagegen stets dieselbe Substitutionstabelle verwendet. Beim Beispiel aus Fig. 2 wird also für alle Klartextbytes p des lartexts P und Schlüs- selbytes k des Schlüssels K dieselbe Substitutionstabelle verwendet. Hierdurch sind bei der Teilberechnung aus Fig. 2, durchgeführt für unterschiedliche Klartextbytes p, p' und Schlüsselbytes k, k', d.h. an unterschiedlichen Zeitpunkt t, t' im AES, der berechnete Zwischenwert xXOR = S[p ® k] @ r bzw. x'XOR = S[p'®k'] Θ r durch dieselbe Zugriffszahl r maskiert, was einen Schwachpunkt darstellt. S '[x] = S [x Θ rl] Θ rl, with rl, r2 independent random numbers. From this it can be seen that a separate substitution table (S-box) S 'is required for all values of the random numbers rl and r2. Optionally, for each possible value of the random number r (= rl or r2), a substitution table (S-box) S 'masked with r is stored (eg in the chip card or the processor), ie in a 256-byte substitution table (S). Box) eg 256 different 256 byte tables. Alternatively, the substitution table (S-box) is calculated only after the determination of the random number r, preferably in a random access memory RAM assigned to the processor. However, this costs computing time and possibly. Memory in RAM RAM. In the course of the implementation of the algorithm, eg the AES, and as soon as the random number is fixed, the same substitution table is always used. In the example from FIG. 2, therefore, the same substitution table is used for all plaintext bytes p of the text P and key bytes k of the key K. 2, carried out for different plaintext bytes p, p 'and key bytes k, k', ie at different times t, t 'in the AES, the calculated intermediate value x XOR = S [p ® k] @ r or x ' XOR = S [p''k'] Θ r is masked by the same access number r, which is a weak point.
Die Tatsache, dass bei der XOR-Maskierung bei allen Tabellenaufrufen dieselbe Tabelle (z.B. AES S-Box) verwendet wird, kann für einen DPA Angriff höherer Ordnung genutzt werden, wie er für AES z.B. in [PRB10] beschrie- ben ist. Beim DPA Angriff zweiter Ordnung aus [PRB10] wird der Stromverbrauch j( ), J(t') an zwei Zeitpunkten t, t' gemessen und normiert zu The fact that the same table (e.g., AES S-Box) is used in XOR masking on all table calls can be used for a higher order DPA attack, such as those used for AES e.g. in [PRB10]. In the second order DPA attack from [PRB10], the current consumption j (), J (t ') is measured and normalized at two points in time t, t'
j' t), j f) . Die Korrelation zwischen dem Produkt j(t) (t') und dem Ham- minggewicht des Werts x ® x'= S[p Θ k] Θ S[p'<®k'] wird für jedes mögliche Schlüsselpaar k, k' und jede Paar von Zeitpunkten /, /' dazu berechnet. Für den richtigen Schlüssel ergibt sich eine Korrelationskurve wie die in Fig. la gezeigte, mit dem signifikanten Ausschlag an einem Zeitpunkt. Der Rechenaufwand für den Angriff zweiter Ordnung aus [PRB10] steigt mit der Anzahl zu berücksichtigender Zeitpunkte und Schlüssel quadratisch an und ist somit erheblich. j ' t), jf). The correlation between the product j (t) (t ') and the Hamming weight of the value x ® x' = S [p Θ k] Θ S [p '<®k'] will be for each possible Key pair k, k 'and each pair of times /, /' calculated. For the correct key, a correlation curve such as that shown in FIG. 1a results, with the significant rash at one time. The computational effort for the second-order attack from [PRB10] increases quadratically with the number of times and keys to be taken into account and is therefore significant.
In der deutschen Patentanmeldung DE 102012018924.9 der Anmelderin der vorliegenden Anmeldung ist ein intern„erweitere Maskierung" genanntes Verfahren zum Durchführen einer kryptographischen Berechnung unter Verwendung eines kryptographischen Schlüssels angegeben, das gegen Ausspähen des Schlüssels über Seitenkanalangriffe, insbesondere DPA Angriffe höherer Ordnung, geschützt ist, so dass die Schlüsselausspähung verhindert ist oder zumindest stark erschwert ist, und das zugleich effizient ist. Applicant's German patent application DE 102012018924.9 discloses an internally "extended masking" method for performing a cryptographic computation using a cryptographic key protected against spying the key via side channel attacks, in particular DPA higher order attacks that key spying is prevented, or at least severely hampered, and at the same time efficient.
Das in 102012018924.9 angegebene Verfahren hat vom Grundsatz her die Struktur einer Kombination einer Basismaskierung - z.B. XOR-Maskierung- und einer 00/ FF-Maskierung, angewandt auf eine kryptographische Berechnung, um geheime Daten der Berechnung vor Ausspähung zu schützen. Die erfindungsgemäße Maskierung wird intern bei der Anmelderin auch erweiterte Maskierung genannt. The method given in 102012018924.9 has in principle the structure of a combination of a base masking - e.g. XOR masking and 00 / FF masking applied to cryptographic computation to guard against secret data from spying. The mask according to the invention is also called internal masking by the applicant.
Das Verfahren aus 102012018924.9 ist zur Ausführung in einem Prozessor (z.B. Mikroprozessor, CPU, Krypto-Coprozessor, Krypto-Beschleuniger) ein- gerichtet, der zum Durchfuhren einer kryptographischen Berechnung eingerichtet ist, bei der aus Eingangsdaten unter Verwendung eines kryptographischen Schlüssels und über die Erzeugung von Zwischenwerten Ausgangsdaten erzeugt werden. Ein Beispiel einer solchen kryptographischen Berechnung ist der AES. Bei der Durchführung der Berechnung wird eine Basis- maskierung angewandt, durch welche zumindest manche, vorzugsweise alle, Zwischenwerte als maskierte Zwischenwerte in die Berechnung einfließen. Das Verfahren zeichnet sich dadurch aus, dass bei der Durchführung der Berechnung zusätzlich eine Sekundärmaskierung angewandt wird, wo- bei für jeden mittels der Basismaskierung maskierten Zwischenwert das Einerkomplement des maskierten Zwischenwerts gebildet wird, der maskierte Zwischenwert oder das Einerkomplement des maskierten Zwischenwerts bereitgestellt werden und zufallsgesteuert die Berechnung entweder mit dem maskierten Zwischenwert oder mit dem Einerkomplement des maskier- ten Zwischenwerts durchgeführt wird. The method of 102012018924.9 is adapted for implementation in a processor (eg, microprocessor, CPU, crypto co-processor, crypto-accelerator) adapted to perform a cryptographic computation, in which input data is generated using a cryptographic key and generated of intermediate values output data are generated. An example of such a cryptographic calculation is the AES. When carrying out the calculation, a base masking applied by which at least some, preferably all, intermediate values as masked intermediate values are included in the calculation. The method is characterized in that, in carrying out the calculation, a secondary masking is additionally applied, wherein for each intermediate masked by the base masking the one's complement of the masked intermediate value is formed, the masked intermediate value or the one's complement of the masked intermediate value is provided and random controlled the calculation is performed either with the masked intermediate value or with the one's complement of the masked intermediate value.
Wie eingangs beschrieben, z.B. mit Verweis auf [PRB10], ist ein Ausspähen des geheimen Schlüssels einer XOR-maskierten kryptographischen Berechnung möglich mit einem DPA Angriff zweiter Ordnung, bei dem der Strom- verbrauch j(t), j(t') an zwei Zeitpunkten t, t', d.h. bei zwei unterschiedlichen Rechenschritten innerhalb der Berechnung, gemessen und ausgewertet wird. Bei [PRB10] sind die betrachteten Rechenschritte innerhalb der Berechnung durch Tabellenzugriffe verwirklicht. Der Schwachpunkt, der bei dem Angriff ausgenutzt wird ist, dass an den beiden Zeitpunkten dieselbe Tabelle verwendet wird. Gemäß der Erfindung wird zusätzlich zur Basismaskierung (z.B. XOR) die Sekundärmaskierung angewandt, gemäß der zufallsgesteuert entweder mit dem Zwischenwert oder dem Einerkomplement des Zwischenwerts gerechnet wird. Hierdurch werden Rechenschritte an unterschiedlichen Zeitpunkten im Ablauf der Berechnung, die bei einer reinen XOR-Maskierung gleichartig wären, zufallsgesteuert unterschiedlich gemacht. Für eine als Tabellenzugriff verwirklichte Teilberechnung (Rechenschritt) bedeutet dies, dass für die unterschiedlichen Teilberechnungen - o- der gleichbedeutend unterschiedlichen Zeitpunkte - innerhalb der Berechnung zufallsgesteuert unterschiedliche Tabellen verwendet werden. Eine statistische Auswertung des Stromverbrauchs j(t), '(f ) an zwei (oder mehr) Zeitpunkten t, t' liefert somit, wie die Anmelderin experimentell bestätigen konnte, keine Information über den bei der Berechnung verwendeten geheimen Schlüssel. Insbesondere liefern Korrelationskurven wie die in Fig. 1 gezeigten auch bei Verwendung des richtigen Schlüssels das mehr oder weniger gleichmäßige Rauschen (vgl. Fig. lb), das bei Verwendung eines falschen Schlüssels entsteht, nicht aber den prominenten Aüsschlag (Fig. la), der z.B. bei XOR-Maskierung und dem richtigen Schlüssel zu sehen ist. Im Vergleich zu dem denkbaren Verfahren, bei XOR-Maskierung für jeden Tabellenaufruf eine neue XOR-Tabelle mit einer neuen XOR-Maske zu berechnen, muss bei der erfindungsgemäßen erweiterten Maskierung nur zu Beginn der Berechnung die Tabelle für den Tabellenzugriff um ein oder mehrere Komplementär-Tabellen erweitert werden (daher der Begriff erwei- terte Maskierung). Bei nachfolgenden Tabellenaufrufen kann auf die vorausberechnete erweiterte Tabelle zurückgegriffen werden, ohne Neuberechnung für jeden Tabellenzugriff. Für andere Teilberechnungen (Rechenschritte) als Tabellenzugriffe, z.B. Berechnungen gemäß einer Rechenvorschrift (Operation), bei AES z.B. die Verschiebeoperationen„Shift Row" oder„Mix Co- lumn", verhält es sich analog. Zu Beginn der Berechnung wird die Operation (Rechenvorschrift) mit der Basismaskierung maskiert und zumindest eine komplementärmaskierte Operation gebildet. Bei den Teilberechnungen innerhalb der Berechnung wird mit den vorab berechneten maskierten und komplementärmaskierten Operationen gerechnet. Somit ist die erweiterte Maskierung sicher und zugleich effizient. As described in the introduction, eg with reference to [PRB10], spying on the secret key of an XOR-masked cryptographic calculation is possible with a second-order DPA attack, in which the power consumption j (t), j (t ') at two Times t, t ', ie at two different calculation steps within the calculation, is measured and evaluated. In [PRB10], the considered calculation steps within the calculation are realized by table accesses. The weak point exploited in the attack is that the same table is used at both times. According to the invention, in addition to the basic masking (eg XOR), the secondary masking is used, according to which the intermediate value or the one's complement of the intermediate value is randomly calculated. As a result, calculation steps at different points in time in the course of the calculation, which would be similar in the case of pure XOR masking, are made randomly differentiated. For a partial calculation (computation step) realized as a table access, this means that different tables are used randomly for the different partial computations-or the equivalently different points in time-within the calculation. A statistical evaluation of the power consumption j (t), ' (f) at two (or more) times t, t' thus provides, as the Applicant could confirm experimentally, no information about the secret key used in the calculation. In particular, correlation curves such as those shown in Fig. 1, even using the correct key, provide the more or less uniform noise (see Fig. 1b) that results when using a wrong key, but not the prominent strike (Fig la) eg with XOR masking and the correct key can be seen. In contrast to the conceivable method of calculating a new XOR table with a new XOR mask for each table call in the case of XOR masking, in the case of the extended masking according to the invention only at the beginning of the calculation the table for table access must be extended by one or more complementary XOR tables. Tables (hence the term extended masking). For subsequent table calls, the pre-calculated extended table can be used without recalculation for each table access. For other partial calculations (calculation steps) than table accesses, eg calculations according to a calculation rule (operation), in AES eg the shift operations "shift row" or "mix column", it is analogous. At the beginning of the calculation, the operation (calculation rule) is masked with the base masking and at least one complementary masked operation is formed. The partial calculations within the calculation are calculated using the previously calculated masked and complementary masked operations. Thus, the extended masking is safe and at the same time efficient.
Daher ist gemäß 102012018924.9 ein Verfahren zum Durchführen einer kryp- tographischen Berechnung unter Verwendung eines kryptographischen Schlüssels geschaffen, das gegen Ausspähen des Schlüssels über Seitenka- nalangriff e, insbesondere DPA Angriffe höherer Ordnung, geschützt ist, so dass die Schlüsselausspähung verhindert ist oder zumindest stark erschwert ist, und das zugleich effizient ist. Nachteilig an dem Verfahren gemäß 102012018924.9 ist, dass der Speicherbedarf gegenüber einen nur einfachen Maskierung erhöht ist. Vor allem bei einem Tabellenzugriff, der in der Praxis regelmäßig im (flüchtigen) Arbeitsspeicher z.B. RAM erfolgt, ist der Speicherbedarf im (flüchtigen) Arbeitsspeicher z.B. RAM erhöht. Der vorliegenden Erfindung liegt die Aufgabe zu Grunde, das Verfahren aus 102012018924.9 speichereffizienter zu gestalten, bevorzugt mit Ersparnis beim (flüchtigen) Arbeitsspeicher z.B. RAM. Therefore, according to 102012018924.9, there is provided a method of performing a cryptographic calculation using a cryptographic key that is useful against spying the key over page cams. nalangriff e, in particular DPA attacks of higher order, is protected, so that the key spying is prevented or at least severely hampered, and which is also efficient. A disadvantage of the method according to 102012018924.9 is that the memory requirement is increased compared to only a simple masking. Especially in the case of table access, which in practice takes place regularly in the (volatile) main memory, for example RAM, the memory requirement in the (volatile) main memory, eg RAM, is increased. The present invention is based on the object to make the method of 102012018924.9 memory more efficient, preferably with savings in (volatile) memory, for example RAM.
Das Dokument DE 10 2004 032893 AI beschreibt ein Verfahren zum ausspä- hungsgeschützten Berechnen eines maskierten Ergebniswertes aus einem maskierten Eingangswert gemäß einer vorgegebenen Abbildung, die inDocument DE 10 2004 032893 A1 describes a method for spurious-protected calculation of a masked result value from a masked input value according to a predetermined mapping, which is described in US Pat
Form einer Tabelle vorgesehen ist. Bei dem Verfahren wird zuerst in einem ersten Schritt eine maskierte Tabelle mit einer Mehrzahl von Einträgen berechnet, wobei zur Berechnung zumindest mancher Einträge der maskierten Tabelle die vorgegebene Abbildung an mindestens zwei Stellen ausgewertet wird und die dabei ermittelten Ergebniswerte, z.B. T(ql) und T(q2), in die Berechnung des Eintrags der maskierten Tabelle eingehen. Anschließend wird in einem zweiten Schritt der maskierte Ergebniswert unter Verwendung der maskierten Tabelle und der vorgegebenen Abbildung berechnet. Indem im ersten Schritt die Abbildung an mindestens zwei Stellen ausge- wertet wird, um einen einzigen Tabelleneintrag zu berechnen, wird die Tabelle gefaltet (hiermit ist nicht die auch„Faltung" genannte mathematische Operation gemeint) und lässt sich hierdurch speichersparend speichern. Der Erfindung in der vorliegenden Anmeldung liegt die Aufgabe zu Grunde, das in 102012018924.9 angegebene Verfahren dahingehend zu modifizieren, dass der Speicherbedarf gegenüber der Lösung in 102012018924.9 verringert ist. Vorzugsweise soll die Lösung so modifiziert werden, dass bei der verbesserten Maskierung gemäß 102012018924.9 der Speicherbedarf gegenüber einer herkömmlichen Maskierung wie z.B. XOR-Maskierung nicht erhöht ist. Form of a table is provided. In the method, a masked table with a plurality of entries is first calculated in a first step, wherein for calculating at least some entries of the masked table, the predetermined mapping is evaluated at at least two locations and the resulting result values, eg T (ql) and T (q2), enter into the calculation of the entry of the masked table. Subsequently, in a second step, the masked result value is calculated using the masked table and the predetermined mapping. By evaluating the mapping in at least two places to calculate a single table entry in the first step, the table is folded (this does not mean the mathematical operation also called "convolution") and can thus be stored saving memory. The object of the invention in the present application is to modify the method specified in 102012018924.9 in such a way that the memory requirement compared to the solution in 102012018924.9 is reduced. Preferably, the solution should be modified so that in the improved masking according to 102012018924.9 the memory requirement compared to a conventional masking such as XOR masking is not increased.
Das erfindungsgemäße Verfahren gemäß Anspruch 1 geht im Oberbegriff von einer sogenannten„erweiterten Maskierung" gemäß 102012018924.9 AI aus. Gemäß der erweiterten Maskierung wird zum einen eine Basismaskierung, z.B. XOR, angewandt, und zum anderen zusätzlich eine Sekundärmaskierung angewandt. Durch die Sekundärmaskierung wird bewirkt, dass für jeden mittels der Basismaskierung (z.B. XOR) maskierten Zwischen wert zu- fallsgesteuert (z.B. durch Zufallsbit b) die Berechnung (z.B. AES) entweder mit dem maskierten Zwischenwert oder mit dem Einerkomplement des maskierten Zwischenwerts durchgeführt wird. Das erfindungsgemäße Verfahren zeichnet sich dadurch aus, dass an der Berechnung weiter ein Schritt des Faltens durchgeführt wird, durch welchen bewirkt wird, dass zumindest manche mit der Basismaskierung maskierte Zwischenwerte als gefaltet maskierte Zwischenwerte vorgesehen sind, wobei der gefaltet maskierte Zwischenwert unter Verwendung des basismaskierten Zwischenwerts und mindestens eines weiteren Zweit-Zwischenwerts berechnet wird, wobei der Zweit-Zwischenwert aus dem basismaskierten Zwischenwert unter Ver- wendung einer Faltungsdistanz abgeleitet wird. Auf den gefaltet maskierten Zwischenwert wird die Sekundärmaskierung angewandt, sodass zufallsgesteuert die Berechnung entweder mit dem gefaltet maskierten Zwischenwert oder mit dem zum gefaltet maskierten Zwischenwert gehörigen Einerkomplement durchgeführt wird. Ein Wert wird also zuerst basismaskiert, dass durch Falten bearbeitet und schließlich sekundärmaskiert Der maskierte Zwischenwert oder das zum maskierten Zwischenwert gehörige Einerkomplement wird weiter, falls erforderlich unter Verwendung eines Korrekturelements berechnet, in das die Faltungsdistanz eingeht. Das zufallsgesteuer- te Zugreifen auf entweder den Zwischenwert oder das Einerkomplement des Zwischenwerts wird dann an Zwischenwerten durchgeführt, die mit Basismaskierung und dem zusätzlichen Schritt des Faltens erzeugt worden sind. The method according to claim 1 is based in the preamble on a so-called "extended masking" according to 102012018924.9 AI According to the extended masking, on the one hand a base masking, eg XOR, is used and on the other hand a secondary masking is applied. that for each intermediate value masked by means of the basic masking (eg XOR) the calculation (eg AES) is carried out either with the masked intermediate value or with the one's complement of the masked intermediate value (eg by random bit b) in that the calculation further performs a folding step of causing at least some intermediate masked intermediate masking values to be provided as folded masked intermediate values, the folded masked intermediate value using the basic masked intermediate value and min at least one further intermediate intermediate value is calculated, wherein the second intermediate value is derived from the base-masked intermediate value using a convolution distance. Secondary masking is applied to the folded masked intermediate value so that randomization is performed on either the folded masked intermediate value or the one's complement associated with the folded masked intermediate value. A value is therefore first basemasked that The masked intermediate value or the one's complement associated with the masked intermediate value is further calculated, if necessary, using a correction element which is entered by the convolution distance. Random access to either the intermediate value or the one's complement of the intermediate value is then performed on intermediate values generated with base masking and the additional step of folding.
Mit anderen Worten, werden, um einen einzigen mit Falten und mit der Ba- sismaskierung maskierten Zwischenwert zu erzeugen, basismaskierte Zwischenwerte an zwei oder mehr Stellen ausgewertet. Dies entspricht einem Falten der durchgeführten Berechnung, so dass mindestens zwei Zwischenwerte an derselben Stelle zu Hegen kommen. Dadurch lassen sich an einem einzigen Speicherplatz zwei (bei einfachem Falten) oder mehr (bei mehrfa- chem Falten) Zwischenwerte speichern. Der erforderliche Speicherplatz ist daher verringert. Die aufeinandergefalteten und basismaskierten Zwischenwerte werden zudem analog wie in 102012018924.9 angegeben erweitert maskiert. Das Korrekturelemeht ist gegebenenfalls erforderlich, z.B. nur falls mit dem Einerkomplement gerechnet wird, um den Einfluss des Faltens auf das Rechenergebnis zu kompensieren. In other words, to generate a single intermediate value masked with wrinkles and with base masking, basemasked intermediate values at two or more locations are evaluated. This corresponds to a folding of the calculation carried out so that at least two intermediate values occur at the same place. This allows you to store two (single fold) or more (multiple fold) intermediate values in a single memory location. The required storage space is therefore reduced. The interfolded and base-masked intermediate values are also expanded masked analogously as indicated in 102012018924.9. The correction item may be required, e.g. only if the one's complement is calculated in order to compensate for the influence of the folding on the calculation result.
Somit ist gemäß Anspruch 1 eine speichersparende Modifizierung des in 102012018924.9 angegebenen Verfahrens geschaffen. Wahlweise wird nur entweder der gefaltet maskierte Zwischenwert oder das Einerkomplement des gefaltet maskierten Zwischenwerts unter Verwendung eines Korrekrurterms berechnet, da nur entweder beim Zwischenwert oder beim Einerkomplement ein Korrekturterm erforderlich ist, z.B. nur beim Einerkomplement. Als Berechnung ist wahlweise eine Verschlüsselung, Entschlüsselung, Signaturerzeugung oder Signatuxprüfung vorgesehen, wahlweise gemäß einem vorbestimmten Algorithmus wie z.B. AES. Thus, according to claim 1, a memory-saving modification of the method specified in 102012018924.9 is provided. Optionally, only one of the folded masked intermediate value and the one's complement of the convolved masked intermediate value is computed using a correction term, since only at the intermediate value or the one's complement is a correction term required, eg only at the one's complement. The calculation optionally includes encryption, decryption, signature generation or signatux checking, optionally according to a predetermined algorithm such as AES.
Wahlweise ist als Basismaskierung eine einfache oder mehrfache XOR- Maskierung, oder eine Zerlegungsmaskierung, oder eine Hintereinanderschaltung zweier oder mehrerer der vorgenannten Basismaskierungen vorgesehen. Optionally, a simple or multiple XOR masking, or a disassembly masking, or a series connection of two or more of the aforementioned base masks is provided as basic masking.
Wahlweise, gemäß Anspruch 3, umfasst die Berechnung eine Teilberechnung, durch die aus einem Eingangswert unter Durchführung eines Tabellenzugriffs auf eine Tabelle, die eine Mehrzahl von Tabelleneinträgen aufweist, ein Zwischenwert erzeugbar ist. Gemäß Anspruch 3 wird zur Durch- führung der Berechnung oder zumindest der Teilberechnung die Tabelle mit der Basismaskierung maskiert wird zu einer maskierten Tabelle. Die Teilberechnung wird durchgeführt, indem ein Tabellenzugriff durchgeführt wird. Bei dem Tabellenzugriff wird, wie in DE 102012018924.9, eine Sekundärmaskierung angewandt, wobei durch die Sekundärmaskierung einer Tabelle bewirkt wird, dass ein Tabellenzugriff auf die Tabelle zufallsgesteuert auf entweder die Tabelle selbst oder die bzw. eine Komplementär-Tabelle zur Tabelle durchgeführt wird. Bis hierhin entspricht der Tabellenzugriff dem auf eine erweitert maskierte Tabelle. Das Verfahren nach Anspruch 3 ist weiter dadurch gekennzeichnet, dass ein Schritt des Faltens durchgeführt wird, wobei die bereits mit der Basisimaskierung maskierte Tabelle gefaltet wird zu einer gefalteten maskierten Tabelle, wobei, für zumindest manche Tabelleneinträge der gefalteten maskierten Tabelle, der Tabelleneintrag unter Verwendung eines basismaskierten Eingangswerts der Tabelle und mindestens eines weiteren basismaskierten Zweit-Eingangswerts der Tabelle be rechnet wird, wobei der Zweit-Eingangswert aus dem unmaskierten Eingangswert unter Verwendung einer Faltungsdistanz abgeleitet wird. Die gefaltete maskierte Tabelle wird schließlich mit der (ohne Falten in DE Optionally, according to claim 3, the computation comprises a partial computation, by which an intermediate value can be generated from an input value by performing a table access to a table which has a plurality of table entries. In accordance with claim 3, in order to carry out the calculation or at least the partial calculation, the table with the basic masking is masked to form a masked table. The sub-calculation is performed by performing a table access. In the table access, as in DE 102012018924.9, a secondary masking is applied, whereby the secondary masking of a table causes a table access to the table to be performed randomly on either the table itself or the or a complementary table to the table. So far, the table access corresponds to an expanded masked table. The method of claim 3 further characterized in that a step of folding is performed, wherein the table already masked with the base mask is convoluted into a folded masked table, wherein, for at least some table entries of the folded masked table, the table entry using a base-masked input value of the table and at least one further base-masked second input value of the table be with the second input value being derived from the unmasked input value using a convolution distance. The folded masked table is finally filled with the (without folding in DE
102012018924.9 beschriebenen) Sekundärmaskierung maskiert, so dass der Tabellenzugriff zufallsgesteuert entweder auf die gefaltete maskierte Tabelle selbst oder auf die bzw. eine Komplementär-Tabelle zur gefalteten maskierten Tabelle durchgeführt wird. Bedarfsweise wird der gefaltet maskierte Tabelleneintrag oder das zum gefaltet maskierten Tabelleneintrag gehörige Einerkomplement weiter unter Verwendung eines Korrekturterms und/ oder einer Korrekturtabelle berechnet, wobei in den Korrekturterm und in die Korrekturtabelle die Faltungsdistanz eingeht.  102012018924.9) so that table access is randomized to either the folded masked table itself or to the complemented table to the folded masked table. If necessary, the one-masked table entry or the one-complement associated with the folded masked table entry is further computed using a correction term and / or a correction table, wherein the convolution distance and the correction table are entered.
Somit werden in der gefaltet basismaskierten Tabelle zumindest manche Tabelleneinträge, vorzugsweise und sofern nichts dagegenspricht, alle Tabel- leneinträge mit einem Schritt des Faltens erzeugt, wobei die Tabelle ein- oder mehrfach gefaltet wird, so dass zwei oder mehr Erngangswerte aufeinander gespeichert werden. Sind beispielsweise alle Tabelleneinträge durch Aufei- nander-Falten zweier Eingangswerte erzeugt, benötigt die Tabelle nur halb so viel Speicherplatz wie ohne Faltung. Andererseits benötigt eine erweitert maskierte Tabelle, die eine einzige Originaltabelle und eine einzige dazu komplementäre Komplementärtabelle umf asst doppelt so viel Speicherplatz wie eine nur basismaskierte entsprechende Tabelle. In dieser Konstellation - einfaches Falten der Tabelle, so dass immer zwei Eingangswerte in jeden Tabelleneintrag einfließen, und erweiterte Maskierung mit einer einzigen Komplementärtabelle - wird somit durch die Faltung die durch die erweiterte Maskierung erzeugte Erhöhung des Speicherbedarfs exakt wieder kompensiert. Der Speicherbedarf ist somit genau derjenige einer lediglich basismaskierten Tabelle (z.B. maskiert mit einer XOR-Maske). Die erfindungsgemäße gefaltete und erweiterte Maskierung ist besonders für Teilberechnungen vorteilhaft, die durch Tabellenaufrufe gebildet werden. Gerade bei einem Tabellenaufruf würde eine Neuberechnung der Tabelle für jeden Tabellenaufruf einen erheblichen zusätzlichen Rechenaufwand bedeu- ten. Im AES ist die relativ aufwändige nichtlineare S-Box-Operation als Tabellenaufruf verwirklicht. Auf Grund der erweiterten Maskierung ist, je nach Ausführungsform, doppelt bis viermal so viel Tabellen-Speicher erforderlich wie bei einer lediglich basismaskierten - z.B. XOR-maskierten - Tabelle. Durch die Faltung der Tabelle wird der Mehrbedarf an Speicher im vorteil- haften Fall ganz oder zumindest teilweise wieder aufgehoben (vgl. vorstehender Absatz). Andere, vergleichsweise einfache Teilberechnungen wie z.B. Shif t Row oder Mix Column sind durch direkt implementierte Operationen gebildet. Für diese direkt implementierten einfachen Operationen kann es vom Rechenaufwand her vertretbar sein, jede Teilberechnung neu zu mas- kieren. Folglich ist die Erfindung wahlweise derart umgesetzt, dass Tabellenaufrufe mit der erfindungsgemäßen gefaltete erweiterten Maskierung maskiert sind und direkt implementierte Operationen mit einer anderen, z.B. stärkeren aber aufwändigeren, Maskierung maskiert sind. Wahlweise sind aufwändige Teilberechnungen - wie z.B. S-Box-Operationen beim AES - mit der gefalteten erweiterten Maskierung maskiert, und sind vergleichsweise einfache Teilberechnungen - z.B. Shift Row oder Mix Column - durch eine andere, z.B. stärkere aber dafür aufwändigere Maskierung maskiert, z.B. Neumaskierung bei jeder Teilberechnung (Rechenschritt). Alternativ kann auch die gesamte Berechnung gefaltet und erweitert maskiert sein. Teilbe- rechnungen zwischen Tabellenaufrufen sollten zumindest nicht schwächer maskiert sein als TabeUenaufrufe. Thus, in the folded base-masked table, at least some of the table entries, preferably and unless contradicted, generate all table entries with a step of folding, folding the table one or more times so that two or more values of the food are stored one upon the other. For example, if all the table entries are generated by folding two input values together, the table requires only half as much space as without folding. On the other hand, an extended-masked table, the single original table, and a single complementary table that is complementary to it require twice as much space as a base-masked corresponding table. In this constellation-simple folding of the table, so that two input values are always included in each table entry, and extended masking with a single complementary table-the folding thus compensates exactly for the increase in memory requirement produced by the extended masking. The memory requirement is thus exactly that of a basic-only masked table (eg masked with an XOR mask). The folded and extended masking according to the invention is particularly advantageous for sub-calculations formed by table calls. Especially for a table call, a recalculation of the table for each table call would require considerable additional computation effort. In AES, the relatively complex nonlinear S-box operation is implemented as a table call. Due to the extended masking, depending on the embodiment, twice to four times as much table memory is required as with a base-masked only - eg XOR-masked - table. By folding the table, the additional requirement for storage is advantageously completely or at least partially canceled in the advantageous case (see above paragraph). Other, relatively simple sub-calculations, such as shift row or mix column, are formed by directly implemented operations. For these directly implemented simple operations, it can be justifiable from the computational effort to remap each sub-computation. Consequently, the invention is optionally implemented in such a way that table calls are masked with the folded extended masking according to the invention and directly implemented operations are masked with a different, eg stronger but more elaborate, masking. Optionally, complex sub-calculations - such as S-box operations at the AES - masked with the folded extended masking, and comparatively simple sub-calculations - eg Shift Row or Mix Column - masked by another, eg stronger but more complex masking, eg re-masking at each partial calculation (calculation step). Alternatively, the entire calculation can also be folded and expanded masked. Partial calculations between table calls should at least not be less masked than table calls.
Wahlweise ist die Korrekturtabelle mit einer Sekundärmaskierung maskiert, d.h. um (eine) Komplementärtabelle/ (n) erweitert. Das zufallsgesteuerte Zugreifen auf entweder die gefaltet maskierte Tabelle oder die bzw. eine gefaltet maskierte Komplementär-Tabelle wird wahlweise dadurch durchgeführt, dass der Eingangswert zur Erzeugung des Zwischenwerts um einen Tabellenauswahl- Abschnitt erweitert wird, durch den die Tabelle festgelegt ist, auf die zugegriffen wird. Die Länge des Tabellenauswahl-Abschnitts ist passend zur Festlegung der ein oder mehreren Komplementär-Tabellen gewählt. Wird eine einzige Komplementär-Tabelle berechnet, ist der Tabellenauswahl- Abschnitt vorzugsweise ein Bit („Auswahlbit") lang. Werden drei Komplementär-Tabellen berechnet, ist der Tabellen- auswahl- Abschnitt vorzugsweise zwei Bit lang. Die Bits können wahlweise entweder aufeinanderfolgend sein (z.B. aa) oder zwischen die Bits des Tabelleneingangs eingestreut sein (z.B. xax; axax; etc.; vgl. Figuren). Optionally, the correction table is masked with a secondary mask, ie extended by (a) complement table / (n). The random accessing of either the folded masked table or the folded masked complementary table is optionally performed by expanding the input value to produce the intermediate value by a table selection section that defines the table to be accessed , The length of the table selection section is chosen to match the one or more complementary tables. If a single complementary table is computed, the table select section is preferably one bit ("select bit") long. If three complementary tables are computed, the table select section is preferably two bits long. eg aa) or interspersed between the bits of the table input (eg xax; axax; etc; see figures).
Wahlweise weist (auch) die Korrekturtabelle einen Tabellenauswahlab- schnitt auf, durch den die Korrekturtabelle festgelegt ist, auf die zugegriffen wird. Der TabeUenauswahlabschnitt der eigentlichen Tabelle und der Tabel- lenauswahlabschnitt der Korrekturtabelle sind ggf. vorzugsweise unabhängig voneinander. Beispielsweise wird also für Tabelle und Korrekturtabelle je ein Zufallsbit festgelegt. Optionally, the correction table also has a table selection section that defines the correction table that is accessed. If necessary, the tabular selection section of the actual table and the table selection section of the correction table are preferably independent of one another. For example, a random bit is thus defined for the table and the correction table.
Die Tabelle weist wahlweise einen Tabelleneingang und einen Tabellenausgang auf, und wobei genau eine maskierte Komplementär-Tabelle berechnet wird, bei welcher sowohl der Tabelleneingang als auch der Tabellenausgang komplementiert sind, indem die Positionen der Tabelleneinträge in der Ta- belle komplementiert sind (Komplementierung des Eingangs) und die Werte der Tabelleneinträge in der Tabelle komplementiert sind (Komplementierung des Ausgangs). Wahlweise, alternativ, weist die Tabelle einen Tabelleneingang und einen Tabellenausgang auf, und wobei drei maskierte Komplementär-Tabellen berechnet werden, wobei The table optionally has a table input and a table output, and exactly computes a masked complementary table in which both the table input and the table output are complemented by the positions of the table entries in the table are complemented (complementing the input ) and the values of the table entries in the table are complemented (complementation of the output). Alternatively, alternatively, the table has a table input and a table output, and where three masked complementary tables are calculated, where
- bei einer ersten gefaltet maskierten Komplementär-Tabelle nur der Tabel- leneingang komplementiert ist, indem die Positionen der Tabelleneinträge in der gefaltet maskierten Tabelle komplementiert sind,  in the case of a first folded-masked complementary table, only the table input is complemented by the positions of the table entries in the folded-masked table being complemented,
- bei einer zweiten gefaltet maskierten Komplementär-Tabelle nur der Tabellenausgang komplementiert ist, indem die Werte der Tabelleneinträge in der gefaltet maskierten Tabelle komplementiert sind, und  in a second folded masked complementary table, only the table output is complemented by the values of the table entries in the folded masked table being complemented, and
- bei einer dritten gefaltet maskierten Komplementär-Tabelle sowohl der Tabelleneingang als auch der Tabellenausgang komplementiert sind, indem sowohl die Positionen als auch die Werte der Tabelleneinträge in der gefaltet basismaskierten Tabelle komplementiert sind. Wahlweise werden die gefaltet maskierte Tabelle und die mindestens eine (z.B. eine oder alternativ drei) Komplementär-Tabelle(n) in eine einzige erweiterte Tabelle eingetragen, die die Tabelleneinträge der gefaltet maskierten Tabelle und der mindestens einen Komplementär-Tabelle in einer vorbestimmten Anordnung enthält. Die Anordnung der Tabelleneinträge kann z.B. hintereinander sein (vgl. z.B. Fig. 11), oder alternativ schachbrettartig abwechselnd (ausgehend von den Tabellen aus Fig. 11 schachbrettartige Verwürfelung der Tabelleneinträge, ggf. mit entsprechender Gestaltung der Tabellen- Auswahl- Abschnitte) . Wahlweise sind dem Prozessor ein Permanentspeicher (z.B. ROM, EEPROM, ...) und ein flüchtiger Arbeitsspeicher (z.B. RAM) zugeordnet, wobei die Tabelle im Permanentspeicher abgespeichert ist, und wobei die gefaltet maskierte Tabelle und die mindestens eine gefaltet maskierte Komplementär- Tabelle im flüchtigen Arbeitsspeicher berechnet werden. Beispielsweise sind bei AES die originären, unmaskierten S-Boxen im nichtflüchtigen Speicher abgespeichert. Die gefaltet maskierte Tabelle und ihre Komplementär- Tabelle^) werden im flüchtigen Speicher berechnet und abgelegt. Insbesondere werden vorzugsweise zu Beginn der Berechnung (z.B. AES) die Tabel- len (z.B. S-Boxen) aus dem nichtflüchtigen Speicher in den flüchtigen Speicher geladen, im flüchtigen Speicher die gefaltet maskierte Tabelle (z.B. Fig. 12) und ihre Komplementär-Tabelle(n) berechnet (dies führt z.B. zu Fig. 13, 14 oder 15) und im weiteren Verlauf der Berechnung (z.B. AES) stets ein und dieselben zu Beginn der Berechnung (AES) berechneten RAM-Tabellen (maskierte Tabelle und ihre Komplementär-Tabelle (n)) verwendet. Für einen neuen Durchlauf der Berechnung (z.B. AES), z.B. eine neue Verschlüsselung, Entschlüsselung, Signaturberechnung, Signaturverifizierung, werden neue RAM-Tabellen (die gefaltet maskierte Tabelle und ihre Komplementär- Tabelle^)) berechnet. in the case of a third folded masked complementary table, both the table input and the table output are complemented by complementing both the positions and the values of the table entries in the folded base-masked table. Optionally, the folded masked table and the at least one (eg, one or alternatively three) complementary table (s) are entered into a single extended table containing the table entries of the folded masked table and the at least one complementary table in a predetermined arrangement. The arrangement of the table entries can be, for example, consecutively (cf., for example, FIG. 11), or alternatively alternating like a checkerboard (starting from the tables from FIG. 11, checkerboard-like scrambling of the table entries, if appropriate with corresponding design of the table selection sections). Optionally, the processor is a non-volatile memory (eg ROM, EEPROM, ...) and a volatile memory (eg RAM) associated with the table is stored in non-volatile memory, and wherein the folded masked table and the at least one folded masked complementary table in volatile memory. For example At AES, the original, unmasked S-boxes are stored in non-volatile memory. The folded masked table and its complementary table ^) are calculated and stored in the volatile memory. In particular, preferably at the beginning of the calculation (eg AES) the tables (eg S-boxes) are loaded from the nonvolatile memory into the volatile memory, in the volatile memory the folded masked table (eg FIG. 12) and its complementary table ( n) (this leads eg to FIG. 13, 14 or 15) and in the further course of the calculation (eg AES) always one and the same at the beginning of the calculation (AES) calculated RAM tables (masked table and its complementary table ( n)). For a new pass of the calculation (eg AES), eg a new encryption, decryption, signature calculation, signature verification, new RAM tables (the folded masked table and its complementary table ^)) are calculated.
Das Falten wird hierbei an Tabellen durchgeführt, die im meist eher knapp bemessenen (flüchtigen) Arbeitsspeicher (z.B. RAM) erzeugt werden. Somit wird der knappe Arbeitsspeicher (z.B. RAM) sparsam verwendet. Dass zusätzlich eine Korrekturtabelle vorgehalten werden muss, beeinträchtigt die Ersparnis beim Arbeitsspeicher bevorzugt nicht, da die Korrekturtabelle bevorzugt im Permanentspeicher (z.B. ROM) gespeichert ist. The folding is done here on tables that are generated in the usually rather limited (volatile) memory (for example RAM). Thus, the scarce main memory (e.g., RAM) is used sparingly. The fact that the correction table has to be kept in addition does not affect the saving in the working memory, since the correction table is preferably stored in non-volatile memory (for example ROM).
Gemäß einer Ausführungsform wird ein Verfahren angegeben, wobeiAccording to one embodiment, a method is given, wherein
- die gefaltet maskierte Tabelle und mindestens eine Komplementär-Tabelle für eine Mehrzahl von Tabellenzugriffen auf die Tabelle verwendet werden, wahlweise für zumindest eine gesamte Durchführung der kryptographi- schen Berechnung (z.B. ein Durchlauf des AES), und the folded masked table and at least one complementary table are used for a plurality of table accesses to the table, optionally for at least one complete execution of the cryptographic calculation (e.g., one pass of the AES), and
- innerhalb der Mehrzahl von Tabellenzugriffen zumindest einmal, vorzugsweise für jeden Tabellenzugriff, neu zufallsgesteuert festgelegt wird, dass die Berechnung bzw. Teilberechnung entweder mit dem gefaltet maskierten Zwischenwert oder mit dem Einerkomplement des gefaltet maskierten Zwischenwerts durchgeführt wird, und die Berechnung bzw. Teilberechnung entsprechend dem Festlegen durchgeführt wird. within the majority of table accesses at least once, preferably randomly for each table access, the calculation or partial calculation is carried out either with the folded masked intermediate value or with the one's complement of the folded masked intermediate value, and the calculation or partial calculation is carried out in accordance with the specification.
Insbesondere wird wahlweise zu Beginn der Berechnung (z.B. AES) eine gefaltet maskierte Tabelle (z.B. S-Box) und ausgehend von der gefaltet maskierten Tabelle mindestens eine (z.B. genau eine oder genau drei) Komplementär-Tabelle^) berechnet, z.B. im RAM. Im restlichen Verlauf der Berechnung (z.B. AES) werden die vorausberechneten Tabellen und Komplementär- Tabelle^) verwendet (z.B. aus dem RAM). Zuvor wird ggf. die unmaskierte Tabelle aus dem nichtflüchtigen Speicher (z.B. ROM) geladen. Evtl., abhängig vom Einzelfall, wird eine so erzeugte RAM-Tabelle auch für mehrere AES-Durchläufe verwendet. Ansonsten wird vor jedem AES-Durchlauf die RAM-Tabelle neu berechnet wird. In particular, optionally at the beginning of the calculation (e.g., AES), a convolved masked table (e.g., S-box) and from the convoluted-masked table at least one (e.g., exactly one or exactly three) complementary table ^) are calculated, e.g. in the RAM. In the remainder of the calculation (e.g., AES), the predicted tables and Complementary Table ^) are used (e.g., from the RAM). Previously, if necessary, the unmasked table is loaded from the nonvolatile memory (e.g., ROM). Depending on the individual case, a RAM table generated in this way may also be used for several AES passes. Otherwise, the RAM table is recalculated before each AES pass.
Wahlweise weist die Tabelle einen Tabelleneingang und einen Tabellenausgang auf, und wobei die maskierte Tabelle Optionally, the table has a table input and a table output, and where the masked table
- entweder einen maskierten Tabelleneingang hat,  - either has a masked table input,
- oder einen maskierten Tabellenausgang hat, - or has a masked table output,
- oder einen maskierten Tabelleneingang und einen maskierten Tabellenausgang hat, wobei weiter der Tabelleneingang und der Tabellenausgang entweder mit der gleichen Basismaskierung maskiert sind oder mit unterschiedlichen Basismaskierungen maskiert sind.  - or has a masked table input and a masked table output, further wherein the table input and the table output are either masked with the same base masking or are masked with different base masks.
Die hier angegebene getrennte Maskierung von Tabelleneingang und Tabellenausgang stellt eine Hintereinanderschaltung der zwei Maskierungen von Tabelleneingang und Tabellenausgang dar. Im Folgenden wird die Erfindung an Hand von Ausfuhrungsbeispielen und unter Bezugnahme auf die Zeichnung näher erläutert, in der zeigen: The separate masking of table input and table output specified here represents a series connection of the two mappings of table input and table output. In the following the invention will be explained in more detail with reference to exemplary embodiments and with reference to the drawing, in which:
Fig. 1 Korrelationskurven für DPA 2. Ordnung a) bei XOR-Maskierung b) bei erweiterter Maskierung gemäß der Erfindung; Figure 1 Correlation curves for DPA 2nd order a) with XOR masking b) with extended masking according to the invention;
Fig. 2 eine Teilberechnung bei AES, umfassend einen Tabellenzugriff, der für die erfindungsgemäße erweiterte und gefaltete Maskierung geeignet ist;  FIG. 2 shows a partial calculation in AES, comprising a table access, which is suitable for the extended and folded masking according to the invention; FIG.
Fig. 3 Rechenvorschriften zur Basis-Maskierung eines Zwischenwerts zu einem maskierten Zwischenwert gemäß XOR-Maskierung und additiver Maskierung;  FIG. 3 shows computation instructions for basic masking of an intermediate value to a masked intermediate value according to XOR masking and additive masking; FIG.
Fig. 4 eine Tabelle in unmaskierter Form (Original-Tabelle);  4 shows a table in unmasked form (original table);
Fig. 5 eine komplementierte Tabelle zur Tabelle aus Fig. 4, wobei nur der Tabelleneingang komplementiert (invertiert) ist;  FIG. 5 is a complemented table to the table of FIG. 4 with only the table input complemented (inverted); FIG.
Fig. 6 eine komplementierte Tabelle zur Tabelle aus Fig. 4, wobei nur der Tabellenausgang komplementiert ist; FIG. 6 is a complemented table to the table of FIG. 4 with only the table output complemented; FIG.
Fig. 7 eine komplementierte Tabelle zur Tabelle aus Fig. 4, wobei der Tabelleneingang und der Tabellenausgang komplementiert sind;  FIG. 7 is a complemented table to the table of FIG. 4 with the table input and the table output complemented; FIG.
Fig. 8 eine, ausgehend von der Tabelle aus Fig. 4, XOR-randomisierte Tabel- le, mit Eingangsmaske 31 und Ausgangsmaske 00;  8 shows, starting from the table of FIG. 4, XOR-randomized table with input mask 31 and output mask 00;
Fig. 9 eine, ausgehend von der Tabelle aus Fig. 4, XOR-randomisierte Tabelle, mit Eingangsmaske 00 und Ausgangsmaske 02;  FIG. 9 shows an XOR-randomized table based on the table of FIG. 4, with input mask 00 and output mask 02; FIG.
Fig. 10 eine, ausgehend von der Tabelle aus Fig. 4, XOR-randomisierte Tabelle, mit Eingangsmaske 31 und Ausgangsmaske 02;  10 shows, starting from the table of FIG. 4, XOR-randomized table, with input mask 31 and output mask 02;
Fig. 11 eine, ausgehend von der XOR-randomisierten Tabelle aus Fig. 10, einfach erweiterte Tabelle, mit einer einzelnen Komplementär-Tabelle;FIG. 11 is a table simply expanded, starting from the XOR randomized table of FIG. 10, with a single complementary table; FIG.
Fig. 12 eine, ausgehend von der Tabelle aus Fig. 10, gefaltete Tabelle mit Faltungsdistanz 12; Fig. 13 eine, ausgehend von der gefalteten Tabelle aus Fig. 12, einfach erweiterte Tabelle, mit Auswahlbit an der obersten binären Bitstelle, gemäß einer Ausführungsform der Erfindung; FIG. 12 shows a folding distance table 12 folded from the table of FIG. 10; FIG. Fig. 13 is a table simply expanded from the folded table of Fig. 12, with selection bit at the top binary bit position, according to an embodiment of the invention;
Fig. 14eine, ausgehend von der gefalteten Tabelle aus Fig. 12, einfach erwei- terte Tabelle, mit Auswahlbit an der untersten binären Bitstelle, gemäß einer weiteren Ausführungsform der Erfindung;  FIG. 14 is a table, simply expanded, starting from the folded table of FIG. 12, with selection bits at the lowest binary bit position, according to a further embodiment of the invention; FIG.
Fig. 15eine, ausgehend von der gefalteten Tabelle aus Fig. 12, zweifach erweiterte Tabelle, mit Auswahlbit an den beiden obersten binären Bitstellen, gemäß einer weiteren Ausführungsform der Erfindung.  FIG. 15 shows, starting from the folded table from FIG. 12, a table twice expanded, with selection bits at the two uppermost binary bit positions, according to a further embodiment of the invention.
Fig. 1 zeigt Korrelationskurven für einen DPA- Angriff zweiter Ordnung auf einen Tabellenzugriff beim AES a) bei XOR-Maskierung und b) bei erweiterter Maskierung gemäß Ausführungsformen der Erfindung. Als Tabelle ist eine AES S-Box vorgesehen. Die Korrelationskurve aus Fig. la wurde mit einem DPA- Angriff zweiter Ordnung auf einen Tabellenzugriff im AES bei Durchführung des Tabellenzugriffs mit dem richtigen Schlüssel ermittelt. Die Tabelle ist XOR-maskiert. Der signifikante Peak zeigt an, dass der richtige Schlüssel k verwendet wurde. Wurde der Tabellenzugriff mit einem falschen Schlüssel k durchgeführt, fehlt der Peak, ähnlich wie in Fig. Ib. Fig. lb zeigt eine Korrelationskurve, die aus einem DPA- Angriff zweiter Ordnung auf denselben Tabellenzugriff im Ablauf des AES gewonnen wurde wie die Kurve aus Fig. la. Im Unterschied zu Fig. la ist bei Fig. lb die Tabelle, zusätzlich zur Basis-XOR-Maskierung, mit der erfindungsgemäßen Sekundärmaskierung maskiert. Die speichereffiziente Sekundärmaskierung ist ver- wirklicht, indem die XOR-maskierte Tabelle, die Fig. la zu Grunde liegt, zunächst gefaltet wird und zu einer einfach erweiterten Tabelle erweitert ist, welche die gefaltete XOR-maskierte Tabelle (erst wurde die Tabelle XOR- maskiert, dann wurde sie gefaltet) und die Komplementär-Tabelle zur gefalteten XOR-maskierten Tabelle umf asst. Der Tabellenzugriff wird auf die er- weiterte gefaltete XOR-maskierte Tabelle durchgeführt. Dabei wird innerhalb der erweiterten gefalteten XOR-maskierten Tabelle zufallsgesteuert entweder auf die gefaltete XOR-maskierte Tabelle oder auf die Komplementär-Tabelle zugegriffen. Bei Durchführung des Tabellenzugriffs auf die erweiterte Tabelle mit dem richtigen Schlüssel fehlt in der Korrelation aus Fig. lb im Vergleich zur Korrelation der nur basismaskierten Tabelle nach Fig. la der prominente Peak, der das Vorliegen des richtigen Schlüssels anzeigt. Somit sind mit der einfach erweiterten Tabelle statt einer lediglich XOR- maskierten Tabelle Tabellenzugriffe mit dem richtigen Schlüssel ununter- scheidbar von Tabellenzugriffen mit falschen Schlüsseln. Fig. 1 shows correlation curves for a second order DPA attack on a table access in AES a) in XOR masking and b) in extended masking according to embodiments of the invention. The table is an AES S-Box. The correlation curve of Fig. 1a was determined with a second order DPA attack on a table access in the AES when performing table access with the correct key. The table is XOR masked. The significant peak indicates that the correct key k was used. If the table access was performed with a wrong key k, the peak is absent, similar to FIG. 1b. FIG. 1b shows a correlation curve obtained from a second-order DPA attack on the same table access in the course of the AES as the curve from FIG. 1a. In contrast to FIG. 1a, in FIG. 1b the table is masked with the secondary masking according to the invention, in addition to the base XOR masking. Memory-efficient secondary masking is accomplished by first convolving the XOR masked table underlying FIG. 1a and expanding it to a simply extended table containing the convolved XOR-masked table (first the XOR masked table , then it has been folded) and the complementary table to the folded XOR-masked table includes. The table access is applied to the extended folded XOR-masked table. In this case, either the folded XOR-masked table or the complementary table is randomly accessed within the extended folded XOR-masked table. In performing the table access to the extended table with the correct key, the prominent peak that indicates the presence of the correct key is missing in the correlation of FIG. 1b compared to the correlation of the base-masked table of FIG. Thus, with the simple extended table, table accesses with the correct key are not indistinguishable from table accesses with wrong keys, instead of a merely XOR- masked table.
Tabellenzugriffe auf eine zweifach erweiterte Tabelle, welche die Basismaskierte Tabelle und drei Komplementär-Tabellen umfasst, liefern ähnliche Korrelationskurven wie die in Fig. lb gezeigte. Auch bei zweifach erweiterter Tabelle sind also Tabellenzugriffe mit dem richtigen Schlüssel k ununter- scheidbar von Tabellenzugriffen mit einem falschen Schlüssel. Bei den drei Komplementärtabellen sind ausgehend von der gefalteten basismaskierten Tabelle nur der Tabelleneingang komplementiert, nur der Tabellenausgang komplementiert, bzw. der Tabelleneingang und der Tabellenausgang komplementiert. Table accesses to a two-times extended table comprising the base-masked table and three complementary tables provide similar correlation curves to those shown in Fig. 1b. Even with a table that has been expanded twice, table accesses with the correct key k are therefore indistinguishable from table accesses with a wrong key. In the case of the three complementary tables, only the table input is complemented from the folded base-masked table; only the table output is complemented, or the table input and the table output are complemented.
Fig. 2 zeigt eine Teilberechnung aus einer AES- Verschlüsselung, bei der ein Tabellenzugriff auf eine Tabelle S (S-Box, AES Substitutionstabelle) durchgeführt wird. Der Tabellenzugriff aus Fig. 2 ist dafür geeignet, mit dem erfindungsgemäßen Verfahren maskiert zu werden. In Fig. 2 sind zwei Tabellen S im AES dargestellt, die an unterschiedlichen Stellen im Algorithmus AES, hier genauer in unterschiedlichen Runden des AES, angewendet werden. Die beiden Tabellen S sind in Fig. 2 mit denselben Symbolen p, k, x, y für Klartext p, Schlüssel k, Eingangswert x der Tabelle S und Ausgangswert y der Tabelle S dargestellt, um anzudeuten, dass der Rechenvorgang auf Grund der Tabelle S für die beiden Tabellen S der gleiche ist. Die Werte von Klartext p, Schlüssel k, Eingangswert x und Ausgangswert y sind in der Regel für jede Tabelle S unterschiedlich. FIG. 2 shows a partial calculation from AES encryption in which a table access to a table S (S-box, AES substitution table) is carried out. The table access of FIG. 2 is suitable for being masked by the method according to the invention. FIG. 2 shows two tables S in the AES, which are applied at different locations in the algorithm AES, more precisely in different rounds of the AES. The two tables S are shown in FIG. 2 with the same symbols p, k, x, y for plaintext p, key k, input value x of the table S and output value y of FIG Table S to indicate that the arithmetic operation due to the table S is the same for the two tables S. The values of plaintext p, key k, input value x and output value y are usually different for each table S.
Fig. 3 zeigt Rechenvorschriften zur Basis-Maskierung eines Zwischenwerts zu einem maskierten Zwischenwert mit XOR-Maskierung und additiver Maskierung. Die Rechenvorschrift, um x mit einer XOR-Basismaskierung zu xXOR zu maskieren, lautet x— > xXOR = x Θ r . Die Rechenvorschrift, um x mit einer additiven Basismaskierung zu xadd zu maskieren, lautet FIG. 3 shows computational rules for base masking of an intermediate value to a masked intermediate value with XOR masking and additive masking. The calculation rule for masking x with an XOR base mask to x XOR is x-> x XOR = x Θ r. The calculation rule to mask x with an additive base masking to x add is
x— > xadd = x + r mod 2" . Die Rechenvorschrift, um x mit einer affinen Basismaskierung zu xa zu maskieren, lautet x -> xa = a - x ® r , wird hier nicht weiter betrachtet. Im Zusammenhang mit dem erfindungsgemäßen Maskieren mit Falten und Erweitern ist die affine Maskierung von untergeordneter Bedeutung, da Faltung bei affin maskierten Tabellen sehr ineffizient ist. x-> x add = x + r mod 2 "The arithmetic rule for masking x with an affine base masking to x a is x -> x a = a - x ® r, is not considered here In the masking according to the invention with folding and widening, the affine masking is of secondary importance, since folding is very inefficient in affine-masked tables.
Die Beispielrechnungen aus Fig. 4-11 zeigen Tabellen S, deren Tabelleneinträge ohne Faltung von Eingangswerten erzeugt sind, und falls dabei erweitert maskiert ist (Fig. 11), also gemäß der Lösung aus 102012018924.9. Fig. 12 und Fig. 13 zeigen gefaltete Tabellen. Die nur mit Falten - und ohne Erweiterungsmaskierung (Sekundärmaskierung) - erzeugte Tabelle aus Fig. 12 entspricht vom Grundsatz her der Lösung aus DE 10 2004 032893 AI. Tabellen ohne Faltung sind vom Grundsatz her mit dem Symbol S bezeichnet, ggf. mit Zusätzen wie„ ' " oder„ -" etc. um den Grad der Maskierung anzuge- ben. Eine gefaltete und erweitert maskierte Tabelle wird im Allgemeinen mit T bezeichnet. Dabei wird vom Grundsatz her zwar von einer Tabelle S = T ausgegangen wie in Fig. 2 angegeben. Insbesondere ist durch die Tabelle T dieselbe Funktion implementiert wir durch die Tabelle S, beispielsweise eine S-Box gemäß Fig. 2. Um Verwechslungen mit zwischen Tabellen S ohne Faltung und Tabellen T mit Faltung zu vermeiden, werden Tabellen, bei denen Eingangswerte gefaltet sind, um einen Tabelleneintrag zu erzeugen, im Allgemeinen mit T bezeichnet, Tabellen ohne Faltung oder Tabellen im Allge- meinen hingegen mit S. The example calculations from FIGS. 4-11 show tables S whose table entries are generated without convolution of input values, and if it is expanded masked (FIG. 11), ie according to the solution from 102012018924.9. Figs. 12 and 13 show folded tables. The table of FIG. 12 produced only with wrinkles and without extension masking (secondary masking) corresponds in principle to the solution from DE 10 2004 032893 A1. Tables without convolution are designated by the principle with the symbol S, if necessary with additions such as "'" or "-" etc. to indicate the degree of masking. A folded and expanded masked table is generally designated T. In principle, a table S = T is assumed, as indicated in FIG. 2. In particular, the same function is implemented by the table T through the table S, for example one In order to avoid confusion with between non-convoluted and non-convoluted tables T, tables with input values convolved to produce a table entry are generally denoted by T, tables without convolution, or tables in general, however, with S.
Fig. 4 zeigt eine Tabelle S in unmaskierter Form (Original-Tabelle), z.B. eine AES-S-Box. Die Tabelle ist im Vierersystem mit Basis 4 dargestellt. Folglich kann jedes Bit die vier Werte 0, 1, 2, 3 annehmen. Bei einem Tabellenzugriff beim AES gemäß Fig. 2, mit einer Tabelle gemäß Fig. 4, wird durch die Konkatenation von Spaltenindex und Zeüenindex der Tabelleneingang x=xx gebildet. Der an der durch Spaltenindex und Zeilenindex festgelegten Stelle in der Tabelle stehende Wert ist der Tabellenausgang y=yy. In Fig. 4 ist ein Beispiel eines Tabellenzugriffs mit Tabelleneingang xx = 12 und Tabellenaus- gang yy = 11 eingezeichnet (Schnittbereich der beiden Ellipsen). Fig. 4 shows a table S in unmasked form (original table), e.g. an AES-S box. The table is shown in the quad system with base 4. Thus, each bit can take the four values 0, 1, 2, 3. In the case of a table access in the AES according to FIG. 2, with a table according to FIG. 4, the concatenation of the column index and the index index forms the table input x = xx. The value in the table at the location specified by column index and row index is the table output y = yy. FIG. 4 shows an example of a table access with table input xx = 12 and table output yy = 11 (sectional area of the two ellipses).
Fig. 5 zeigt eine komplementierte Tabelle S zur Tabelle S aus Fig. 4, wobei nur der Tabelleneingang x komplementiert ist. Der Tabelleneingang x ist dadurch komplementiert, dass die Positionen der Tabelleneinträge komple- mentiert sind. Beispielsweise ist der Eintrag zum Index x = xx = 00 aus Fig. 4 in Fig. 5 an den Index x = 33 verschoben, der Eintrag zum Index x = 12 an den Index x = 21, etc. . Das Beispiel aus Fig. 4 wird mit der Maskierung aus Fig. 5 zu einem Tabellenzugriff mit Tabelleneingang xx = 21 und Tabellenausgang yy = 11 (Schnittbereich der beiden Ellipsen). Fig. 5 shows a complemented table S to the table S of Fig. 4, wherein only the table input x is complemented. The table input x is complemented by the positions of the table entries being supplemented. For example, the entry to the index x = xx = 00 of FIG. 4 in FIG. 5 is shifted to the index x = 33, the entry to the index x = 12 to the index x = 21, etc. The example of FIG. 4, with the mask of FIG. 5, becomes a table access with table input xx = 21 and table output yy = 11 (intersection of the two ellipses).
Fig. 6 zeigt eine komplementierte Tabelle S zur Tabelle S aus Fig. 4, wobei nur der Tabellenausgang y = yy komplementiert ist zu y . Der Tabellenausgang y ist dadurch komplementiert, dass der Wert des Tabelleneintrags komplementiert ist. Beispielsweise ist der Tabellen-Ausgangs- Wert y = 11 am Index x = 12 aus Fig. 4 in Fig. 6 zu einem Tabellen- Ausgangs-Wert y = 22 komplementiert, und verbleibt dabei an der gleichen Stelle. Der beispielhafte Tabellenzugriff ergibt mit der Maskierung aus Fig. 6 Tabelleneingang x = 12 und Tabellenausgang y = 22 (Kreis). Fig. 6 shows a complemented table S to the table S of Fig. 4, wherein only the table output y = yy is complemented to y. The table output y is complemented by the fact that the value of the table entry is complemented. For example, the table output value is y = 11 at index x = 12 of Fig. 4 in Fig. 6 to a table output value y = 22, while remaining in the same place. The exemplary table access results with the mask of FIG. 6 table input x = 12 and table output y = 22 (circle).
Fig. 7 zeigt eine komplementierte Tabelle S zur Tabelle S aus Fig. 4, wobei der Tabelleneingang x und der Tabellenausgang y komplementiert sind. Ausgehend von Fig. 5 ist z.B. der Tabelleneintrag, der in Fig. 5 vom Eingangswert x = 21 zum Ausgangswert y = 11 führt, zu einem Ausgangswert y = 22 komplementiert. Ausgehend von Fig. 6 ist der Ausgangswert y = 22 von Fig. 6 vom Index x = 12 zum Index Je = 21 verschoben, d.h. zusätzlich ist der Eingangswert x komplementiert zu x . Der Tabellenzugriff aus Fig. 4 wird in der Maskierung von Fig. 7 somit zum Tabellenzugriff mit Tabelleneingang Je = 21 und Tabellenausgang y = 22 (Kreis). Fig. 7 shows a complemented table S to the table S of Fig. 4, wherein the table input x and the table output y are complemented. Starting from Fig. 5, e.g. the table entry, which in FIG. 5 leads from the input value x = 21 to the output value y = 11, is complemented to an output value y = 22. Starting from Fig. 6, the output value y = 22 of Fig. 6 is shifted from the index x = 12 to the index Je = 21, i. In addition, the input value x is complemented by x. The table access of FIG. 4 in the mask of FIG. 7 thus becomes table access with table input Je = 21 and table output y = 22 (circle).
Fig. 8-12 zeigen ausgehend von der Tabelle aus Fig. 4 randomisierte (= maskierte) Tabellen mit einer XOR-Maskierung als Basismaskierung. Jeder Eingangswert x der Tabellen in Fig. 8-12 ist somit gemäß der Rechenvorschrift x— » xXOR = x ® r maskiert zu xXOR . 8-12 show, starting from the table of FIG. 4, randomized (= masked) tables with XOR masking as base masking. Each input value x of the tables in FIGS. 8-12 is thus masked to x XOR in accordance with the computation rule x- x XOR = xR .
Fig. 8 zeigt eine XOR-randomisierte Tabelle S' , mit Eingangsmaske 31 und Ausgangsmaske 00, d.h. nur der Tabelleneingang x ist maskiert, nämlich mit XOR-Maske 31, und der Tabellenausgang y ist unmaskiert (XOR-Maske 00, was äquivalent ist zu keiner Maskierung). Ausgehend von der Tabelle S aus Fig. 4 ergibt dies Eingang 23 und Ausgang 11 (Kreis). Fig. 8 shows an XOR randomized table S ', with input mask 31 and output mask 00, i. only the table input x is masked, namely with XOR mask 31, and the table output y is unmasked (XOR mask 00, which is equivalent to no masking). Starting from the table S of FIG. 4 this results in input 23 and output 11 (circle).
Fig. 9 zeigt eine XOR-randomisierte Tabelle S' , mit Eingangsmaske 00 und Ausgangsmaske 02, d.h. nur der Tabellenausgang ist maskiert, nämlich mit XOR-Maske 02, und der Tabelleneingang ist unmaskiert (XOR-Maske 00). Ausgehend von der Tabelle aus Fig. 4 gibt dies Eingang 12 und Ausgang 13. 9 shows an XOR-randomized table S ', with input mask 00 and output mask 02, ie only the table output is masked, namely with XOR mask 02, and the table input is unmasked (XOR mask 00). Starting from the table of FIG. 4, this gives input 12 and output 13.
Fig. 10 zeigt eine XOR-randomisierte Tabelle S' , mit Eingangsmaske 31 und Ausgangsmaske 02. Fig. 10 zeigt eine mit XOR-Maskierung als Basismaskierung maskierte Tabelle, die als Grundlage zur Erzeugung einfach und zweifach (doppelt) erweitert maskierter Tabellen (Fig. 11, 12) dient Ausgehend von der Tabelle aus Fig. 4 ergibt dies einen Tabellenzugriff mit Eingangswert XXOR ~ 23 und Ausgangswert yX0R = 13. 10 shows an XOR randomized table S ', with input mask 31 and output mask 02. FIG. 10 shows a mask masked with XOR masking as a base masking, which is used as the basis for generating single and double (twice) extended masked tables (FIG. 11, 12). Starting from the table of FIG. 4, this results in a table access with input value XXOR ~ 23 and output value y X0R = 13.
Fig. 11 zeigt eine einfach erweiterte XOR-randomisierte (= XOR-maskierte) Tabelle S" (einfach: Erweiterung nur in eine Richtung der Tabelle, hier nach rechts), mit Eingangsmaske 31 und Ausgangsmaske 02. In der erweiterten Tabelle sind die unkomplementierte XOR-Basis-maskierte Tabelle S' (= Ta- belle aus Fig. 10) und eine Komplementär-Tabelle S' zur XOR-Basis- maskierten Tabelle enthalten. Die Komplementär-Tabelle S' ist dadurch gebildet, dass bei der Basis-maskierten Tabelle 5" aus Fig. 10 der Tabelleneingang x und der Tabellenausgang y komplementiert sind. Das zweite Bit (Spaltenindex) des Tabelleneingangs x ist um ein vorangestelltes Auswahlbit a (= Tabellen- Auswahlabschnitt) erweitert. Tabelleneingänge x haben somit in der Tabelle aus Fig. 11 die Form axx, Tabellenausgänge y unverändert die Form yy. Die Form axx ist beispielhaft angeführt und kann alternativ ebensogut xax oder xxa sein. Die Einträge zu den Zeilenindizes 00, 01, 02, 03 (oben), bei denen das Auswahlbit a im Tabelleneingangswert axx den Wert Null (0) hat, gehören zur unkomplementierten, nur mit der Basismaskierung maskierten Tabelle (Tabelle aus Fig. 10). Die Einträge zu den Zeilenindizes 10, 11, 12, 13 (oben,), bei denen das Auswahlbit a im Tabelleneingangswert axx den Wert Eins (1) hat, gehören zur Komplementär-Tabelle. Der beispielhafte Tabellenzugriff aus Fig. 4 wird in der erweiterten Maskierung S" aus Fig. 11 zu einem Tabellenzugriff mit Tabelleneingang axx = 023 und Tabellenausgang yy = 13 oder Tabelleneingang axx = 123 und Tabellenausgang yy = 31. Ob der Tabellenzugriff mit entweder Tabelleneingang xXOR = axx = 023 und Tabellenausgang yy = 13 (obere Tabellenhälfte, Auswahlbit im Tabel- leneingang 023 hat den Wert 0) oder Tabelleneingang xXOR = axx = 123 und11 shows a simply extended XOR-randomized (= XOR-masked) table S "(simple: extension only in one direction of the table, here to the right), with input mask 31 and output mask 02. In the extended table, the uncomplemented XOR 10) and a complementary table S 'to the XOR base masked table The complementary table S' is formed by that in the base masked table 5 "of FIG. 10, the table input x and the table output y are complemented. The second bit (column index) of the table input x is extended by a preceding selection bit a (= table selection section). Table inputs x thus have the form axx in the table from FIG. 11, and table outputs y have the form yy unchanged. The form axx is given as an example and may alternatively also be xax or xxa. The entries for the row indexes 00, 01, 02, 03 (top) in which the selection bit a in the table input value axx has the value zero (0) belong to the uncomplemented table masked only with the basic masking (table from FIG. 10). The entries for the row indexes 10, 11, 12, 13 (above), in which the selection bit a in the table input value axx has the value one (1) belong to the complementary table. The exemplary table access of FIG. 4 is displayed in the extended mask S " 11 shows a table access with table input axx = 023 and table output yy = 13 or table input axx = 123 and table output yy = 31. Whether the table access with either table input x XOR = axx = 023 and table output yy = 13 (upper table half, selection bit im Table input 023 has the value 0) or table input x XOR = axx = 123 and
Tabellenausgang yy = 31 (untere Tabellenhälfte, Auswahlbit im Tabelleneingang 123 hat den Wert 1) durchgeführt wird, ist dabei zufallsgesteuert. Table output yy = 31 (lower half of the table, selection bit in table input 123 has the value 1) is random.
Der Einsatz einer einfach erweiterten Tabelle wird nachfolgend anhand von Fig. 2 und 11 erläutert. In einem AES-Krypto-Coprozssor wird eine AES- Berechnung (wahlweise Verschlüsselung, Entschlüsselung, Signaturerzeugung oder Signaturprüfung) gestartet, in Fig. 2 beispielhaft eine Verschlüsselung. AES umfasst mehrere Runden R = 1,2,... . In jeder Runde R wird eine Teilberechnung durchgeführt, in der ein Klartextbyte p mit einem Schlüs- selby te k verxort (p ® k ) wird, das Ergebnis der Verxorung in eine (Substitu- tions-) Tabelle S (S-Box) eingesetzt wird und hierdurch durch einen Tabellenzugriff auf die Tabelle S ein Zwischenwert x = S[p Θ k] berechnet wird. The use of a simply expanded table will be explained below with reference to FIGS. 2 and 11. In an AES cryptographic coprocessor, an AES calculation (optionally encryption, decryption, signature generation or signature verification) is started, in FIG. 2 an example of encryption. AES comprises several rounds R = 1,2, .... In each round R, a partial computation is performed in which a plaintext byte p with a key byte x (p k) is used, and the result of the corruption is inserted in a (substitution) table S (S-box) and thereby an intermediate value x = S [p Θ k] is calculated by a table access to the table S.
Gemäß einer Ausfuhrungsform der erweiterten Maskierung wird als Tabelle S in Fig. 2 eine gemäß Fig. 11 einfach erweiterte Tabelle 5"' verwendet. Der Eingangswert x wird um ein Bit als Tabellenauswahl- Abschnitt a erweitert. Der Eingangswert x lautet somit x = αχ χ0 , in Fig. 11 beispielsweise x = 023 , falls auf die nicht-komplementierte Tabelle iS" zugegriffen wird, mit Ausgangswert y = 13 (wie in Fig. 10), und x = 1 10 , falls auf die komplementierte Tabelle 5" in S" zugegriffen wird, mit Ausgangswert y = 22. According to one embodiment of the extended masking, a table 5 "'which is simply extended according to Figure 11 is used as table S in Figure 2. The input value x is extended by one bit as table selection section a 0 , in FIG. 11, for example, x = 023 if the non-complemented table iS "is accessed, with output y = 13 (as in FIG. 10), and x = 1 10 if the complemented table 5" in FIG S "is accessed, with output value y = 22.
Fig. 12 zeigt eine, ausgehend von der Tabelle S' aus Fig. 10, gefaltete XOR- randomisierte Tabelle T, mit Eingangsmaske i = 31, Ausgangsmaske o = 02 und Faltungsdistanz d = 12. Eingekreist ist derjenige Tabelleneintrag dargestellt, auf den der Tabellenzugriff erfolgt. Basis ist 4. Ausgehend von der Tabelle aus Fig. 10 wird der Tabelleneintrag an der Stelle (= am Eingangswert) 23 mit dem Tabelleneintrag an der Stelle 23 xor 12 = 31 zusammengelegt. D.h. die Tabelle S' wird so zur Tabelle T gefaltet, dass die Tabelleneinträge an den Stellen 23 und 31 aufeinander zu liegen kommen. Die Faltungsdistanz (bei Basis 4) d = 12 (dezimal 6) hat die Binärdarstellung 0110. Isolieren wir in der (binär dargestellten) Faltungsdistanz d das unterste Bit, das gleich 1 ist, erhalten wir 0010. Wie gesagt werden die Einträge an den Stellen 23 (= binär Olli) und 31 (= binär 1101) zusammengelegt. Dabei müssen wir für die gefaltete Tabelle T denjenigen Eingangswert auswählen, der an der Stelle 0010 gleich 0 ist, also den Eingangswert 31 (= binär 1101). Für die gefaltete Tabelle T müssen wir die 0 an der Stelle 0010 streichen, haben also als Eingangswert binär 111 (= 13 im Vier er System). Deshalb erfolgt der Tabellenzu- griff in der Tabelle T aus Fig. 12 auf den Tabellen-Ausgangswert 11 zum Ta- bellen-Eingangswert 13 (eingekreist). FIG. 12 shows an XOR-randomized table T folded, starting from the table S 'from FIG. 10, with input mask i = 31, output mask o = 02 and convolution distance d = 12. Circled is the table entry on which the table access occurs. The basis is 4. Starting from the table from FIG. 10, the table entry at the position (= at the input value) 23 is merged with the table entry at the position 23 xor 12 = 31. That is, the table S 'is folded to the table T so that the table entries at the positions 23 and 31 come to lie on each other. The convolution distance (at base 4) d = 12 (decimal 6) has the binary representation 0110. If we isolate in the (binary) convolution distance d the lowest bit, which is equal to 1, we get 0010. As said, the entries are at the positions 23 (= binary Olli) and 31 (= binary 1101) combined. For the folded table T we have to select the input value which is 0 at the position 0010, ie the input value 31 (= binary 1101). For the folded table T, we have to delete the 0 at the position 0010, so we have as input value binary 111 (= 13 in the four system). For this reason, the table access in the table T from FIG. 12 is made to the table output value 11 for the table input value 13 (circled).
Nun können wir noch den dort stehenden Wert 11 überprüfen. Die lediglich randomisierte Tabelle S' aus Fig. 10 hat an den Stellen 23 und 31 die Werte 13 und 00 stehen, was verxort 13 xor 00 = 13 ergibt. Da sich durch das Verxoren die Ausgangsmaske o = 02 wieder heraushebt, müssen wir sie noch einmal draufverxoren und erhalten somit 13 xor 02 = 11. Now we can check the value 11 there. The merely randomized table S 'from FIG. 10 has the values 13 and 00 at the positions 23 and 31, which results in xx = 13 = 13. Since the original mask o = 02 is lifted out again by the Verxoren, we have to rewrite it once again and thus get 13 xor 02 = 11.
Fig. 13 zeigt eine, ausgehend von der gefalteten Tabelle T aus Fig. 12, einfach erweiterte Tabelle T', mit Auswahlbit an der obersten binären Bitstelle, gemäß einer Ausführungsform der Erfindung. Insgesamt ist die Tabelle T' aus Fig. 13 somit XOR- randomisiert, mit Eingangsmaske i = 31 und Ausgangsmaske o = 02, gefaltet mit Faltungsdistanz d = 12 und einfach erweitert, mit Auswahlbit an der obersten binären Bitstelle (erste Spalte, erste Stelle). Die untere Hälfte der Tabelle V aus Fig. 13 hat invertierte Ausgangswerte in umgekehrter Reihenfolge. Der markierte Eingangswert 13 aus Tabelle T Fig. 12 wird zur Erzeugung der Tabelle T' aus Fig. 13 invertiert zum Eingangswert 20. An der Stelle 20 der Tabelle T' Fig. 13 steht gerade der im Vergleich zur Stelle 13 von Fig. 12 invertierte Wert 22. Fig. 13 shows a table T ', simply extended, starting from the folded table T of Fig. 12, with selection bit at the highest binary bit position, according to an embodiment of the invention. Overall, the table T 'of FIG. 13 is thus XOR-randomized, with input mask i = 31 and output mask o = 02, convoluted with convolution distance d = 12 and simply extended, with selection bit at the uppermost binary bit position (first column, first digit). , The The lower half of Table V of Fig. 13 has inverted output values in reverse order. The marked input value 13 from the table T FIG. 12 is inverted to the input value 20 for generating the table T 'from FIG. 13. At the position 20 of the table T' FIG. 13 is just the one inverted compared to the position 13 of FIG Value 22.
Fig. 14 zeigt eine, ausgehend von der gefalteten Tabelle aus Fig. 12, einfach erweiterte Tabelle T', mit Auswahlbit an der untersten binären Bitstelle, gemäß einer bevorzugten Ausführungsform der Erfindung. Die Tabelle Fig. 14 erhält man aus Tabelle Fig. 13, indem man abwechselnd einen Eintrag von der oberen und von der unteren Hälfte der Tabelle Fig. 13 wählt (Zeile für Zeile). Daher taucht der erste, eingekreiste, Wert 22 der zweiten Hälfte von Tabelle Fig. 13 gleich als zweiter Wert in der Tabelle Fig. 14 auf, und entsprechend der letzte, eingekreiste, Wert 11 der oberen Hälfte von Tabelle Fig. 13 als vorletzter Wert der Tabelle Fig. 14. Fig. 14 shows a table T ', simply extended, starting from the folded table of Fig. 12, with selection bits at the lowest binary bit position, according to a preferred embodiment of the invention. Table 14 is obtained from Table 13 by alternately selecting one entry from the upper and lower half of Table 13 (line by line). Therefore, the first circled value 22 of the second half of Table 13 immediately appears as a second value in the table 14, and accordingly, the last circled value 11 of the upper half of Table 13 is the penultimate value of FIG Table Fig. 14.
Fig. 15 zeigt eine, ausgehend von der gefalteten Tabelle aus Fig. 12, zweifach erweiterte Tabelle, mit zwei Auswahlbits, nämlich einem an der obersten binären Bitstelle (wie in Fig. 13), sowie einem an der zweitobersten Bitstelle. Das Auswahlbit an der obersten Binärstelle (wie in Figur 13) entscheidet, ob der Tabellen- Ausgang invertiert ist oder nicht. Das Auswahlbit an der zweitobersten Binärstelle entscheidet, ob der Tabellen-Eingang invertiert ist oder nicht. Im Folgenden wird eine bevorzugte Ausführungsform dargelegt, um eine gefaltete und erweitert maskierte Tabelle T und eine Korrekturtabelle T zu erzeugen und einen Tabellenzugriff auf einen Tabelleneintrag in der Tabelle T' durchzuführen, umfassend Korrektur des Tabelleneintrags mittels derFig. 15 shows a table twice extended starting from the folded table of Fig. 12, with two selection bits, one at the uppermost binary bit position (as in Fig. 13), and one at the second uppermost bit position. The select bit at the top bin (as in Figure 13) decides whether the table output is inverted or not. The selection bit at the second highest binary location decides whether the table input is inverted or not. In the following, a preferred embodiment is set forth to generate a folded and expanded masked table T and a correction table T and to perform a table access to a table entry in the table T 'comprising correction of the table entry by means of the
Korrekturtabelle f . Als T' kann z.B. die eine Tabelle wie die aus Fig. 13 oder 14 vorgesehen sein. Dabei wird vom Grundsatz her von einer Tabelle S ausgegangen wie in Fig. 2 und 4-12 angegeben. Insbesondere ist durch die un- maskierte Tabelle S wahlweise dieselbe Funktion implementiert wie durch die Tabelle S. Beispielsweise ist S eine S-Box im AES gemäß Fig. 2. Jede der Tabellen T' und T hat die Struktur einer erweiterten Tabelle, d.h. es gilt Correction table f. As T ', for example, the one table as shown in FIG. 13 or 14 may be provided. This is based on the principle of a table S as indicated in Fig. 2 and 4-12. In particular, the same function is implemented by the unmasked table S as by the table S. For example, S is an S-box in the AES according to FIG. 2. Each of the tables T 'and T has the structure of an extended table, ie
T'[x] =
Figure imgf000033_0001
und f'[x] = f'[x] .
T '[x] =
Figure imgf000033_0001
and f '[x] = f' [x].
Im Permanentspeicher (vorzugsweise) ROM wird die folgende Korrekturta- belle f abgelegt, wobei x » i für ein Rechtsschieben von x um i Stellen in Binärdarstellung steht, und ein Überstrich für Einerkomplement-Bildung. ßir x geradeIn the non-volatile memory (preferably) ROM, the following correction table f is stored, where x »i is for a right shift of x by i digits in binary representation, and an overline for one's complement formation. straight x
Figure imgf000033_0002
ßir x ungerade Im Arbeitsspeicher RAM wird eine gefaltete und erweitert maskierte Tabelle T' erzeugt. Als Basismaskierung wird eine XOR-Maskierung verwendet, mit einer Tabelleneingangsmaske i und einer Tabellenausgangsmaske o. Anlässlich jeder Berechnung einer Tabelle T' im Arbeitsspeicher RAM wird zufällig eine Faltungsdistanz d 0 festgesetzt. Als unmaskierter Eingangswert für einen Tabellenaufruf auf Tabelle T' wird x verwendet, z.B. x = p ® k gemäß Fig. 2. Für die Maskierung des Tabelleneingangs mit der Maske i wird ein erstes Zufallsbit b festgelegt, das, ebenso wie die Zufallsdistanz d, für jede Berechnung einer Tabelle T' im Arbeitsspeicher RAM neu zufällig festgesetzt wird. Der erweitert XOR-maskierte Tabellen-Eingangswert x' ist gleich
Figure imgf000033_0002
ßir x odd In the random access memory RAM, a folded and expanded masked table T 'is generated. XOR masking is used as base masking, with a table input mask i and a table output mask o. On the occasion of each calculation of a table T 'in the main memory RAM, a convolution distance d 0 is set at random. As an unmasked input value for a table call on table T ', x is used, eg x = p®k according to FIG. 2. For the masking of the table input with the mask i, a first random bit b is defined, which, like the random distance d, for each calculation of a table T 'in random access memory RAM is newly randomized. The extended XOR-masked table input value x 'is the same
\x Θ i falls b = 0 \ x Θ i if b = 0
[x Θ i falls b = 1 Die ausgehend vom maskierten Tabelleneingangswert x' gebildete RAM- Tabelle T' ist definiert als, mit der Faltungsfunktion fd, [x Θ i if b = 1 The RAM table T 'formed from the masked table input value x' is defined as, with the convolution function f d ,
(Τ[χ] Θ T[x®d] φ o falls b = 0 (Τ [χ] Θ T [x®d] φ o if b = 0
rlttW << 1) + tl r-KW « i] falls = r lttW << 1) + tl r-KW «i] if =
Die Faltungsfunktion fd (nicht gemeint ist hiermit die mathematische Operation der Faltung) wird in den folgenden zwei Schritten gebildet. Dabei ist mit „&" das bitweise UND bezeichnet. Die Zufallsdistanz d in Binär darstellung ist dargestellt durch eine Folge von 1-Bits und O-Bits. Die Bitlänge der Faltungsdistanz d ist in der Regel gleich der Bitlänge des Eingangswerts x. Für einen konkreten Wert der Zufallsdistanz d taucht an irgend einer bestimmten Bit-Stelle in d das niedrigste 1-Bit z von d auf, d.h. das niedrigste Bit, das Eins ist, und alle noch niedrigeren Bits sind Null. Das niedrigste 1-Bit ist gleich z = d8i(—cT). An der Bitstelle des niedrigsten 1-Bits der Zufallsdistanz d hat nur entweder der basismaskierte Eingangswert x' oder der Faltungs- Partner zum basismaskierte Eingangswert x'®d ein 1-Bit, d.h. nur entweder in x' oder in x'®d ist das niedrigste 1-Bit z von d (auf den Wert 1) gesetzt. The convolution function f d (not meant hereby the mathematical operation of convolution) is formed in the following two steps. The "random" distance d in binary representation is represented by a sequence of 1-bits and 0-bits The bit length of the convolution distance d is generally equal to the bit length of the input value x Value of the random distance d emerges at any given bit position in d the lowest 1-bit z of d, ie the lowest bit which is one and all even lower bits are 0. The lowest 1-bit is equal to z = d8i (-cT) At the bit position of the lowest 1-bit of the random distance d, only one of the base-masked input value x 'and the convolutional partner to the base-masked input value x'd has a 1-bit, ie only in either x' or in x'd is the lowest 1-bit z of d (set to the value 1).
Im ersten Schritt des Bildens der Faltungsfunktion fd wird derjenige Wert aus x' und x'®d ausgewählt, der an der Bitstelle des niedrigsten 1-Bits der Zufallsdistanz d eine Null stehen hat und als x" definiert. falls x'&z = 0 In the first step of forming the convolution function f d , the value of x 'and x'd that has a zero at the bit position of the lowest 1-bit of the random distance d is defined as x "if x'& z = 0
x'h-»x'h- "
Figure imgf000034_0001
falls x'&z = z
Figure imgf000034_0001
if x '& z = z
Im zweiten Schritt wird die Null, die an der Bitstelle des niedrigsten 1-Bits der Zufallsdistanz d steht, aus dem basismaskierten Eingangswert x' gestri- chen (der Eingangswert x' ist nach wie vor in Binärdarstellung). Durch die Streichung der Null wird x" übergeführt in den Wert der Faltungsfunktion fd (x') an der Stelle x' : fd(x') := (*" + 0"&m)) » 1 , wobei m = -(x'&z) In the second step, the zero, which is at the bit position of the lowest 1-bit of the random distance d, is extracted from the base-masked input value x '. (the input value x 'is still in binary representation). By removing the zero, x "is converted into the value of the convolution function f d (x ') at the point x': f d (x ') : = (*" + 0 "& m))» 1, where m = - (x '& z)
Für alle d 0 verkürzt die Faltungsfunktion d ( ') ihr Argument x' um ein Bit und ist surjektiv. Daher ist die Tabelle T' woWdefiniert. Da statt fd(x) = fd(x) nur /d( ) = /d(x)0/d(z) gilt, muss im Fall b=l der Term f (z zur Korrektur des Eingangswerts x' der RAM Tabelle verwendet werden. For all d 0, the convolution function d (') shortens its argument x' by one bit and is surjective. Therefore, the table T 'is wherewefined. Since instead of f d (x) = f d (x) only / d () = / d (x) 0 / d (z) holds, in the case b = 1 the term f (z for correcting the input value x 'of the RAM table can be used.
Insgesamt besteht beim vorliegenden Ausfuhrungsbeispiel ein erweitert maskierter TabeUenaufruf mit gefalteter Tabelle aus folgenden Schritten. Overall, in the present exemplary embodiment, an expanded masked TabeUenaufruf with folded table of the following steps.
Berechne den Index u = x'®d für die ROM Korrekturtabelle f Compute the index u = x'®d for the ROM correction table f
Für ein Zufallsbit b' (b', b unabhängig) maskiere den Index u um zu  For a random bit b '(b', b independent), mask the index u to
u für b' = 0  u for b '= 0
u' = ue(-b' = {  u '= ue (-b' = {
für b' = 1  for b '= 1
3. Berechne den Index v = fd(x') für die RAM Tabelle T 3. Compute the index v = f d (x ') for the RAM table T
4. Berechne die Korrektur  4. Calculate the correction
0 für b = 0  0 for b = 0
= (dez)&(^ö) = /d(z)&(-0) = [ = (dec) & (^ ö) = / d (z) & (- 0) = [
fd (z für b = l f d (z for b = l
5. Korrigiere den Index v zu v' = v®c  5. Correct the index v to v '= v®c
6. Werte die ROM Korrekturtabelle T aus mittels  6. Read out the ROM correction table T using
y0 = f [(u' « 1) + (b®b')] y 0 = f [(u''1) + (b'b ')]
7. Werte die RAM Tabelle T' (d.h. z.B. die AES S-Box) aus mittels  7. Evaluate the RAM table T '(i.e., e.g., the AES S box) by means of
yi = T'[ v' « l) + b] 8. Kombiniere die ausgelesenen Tabellenwerte yQ der Korrekturtabelle und yx der Tabelle (z.B. AES S-Box) zum Ergebnis des Tabellenzugriffs (= Tabellen- Ausgangswert) y'— y0 yi Per Konstruktion ist das Ergebnis y' des Tabellenzugriffs auf die Tabelle T' der mit der XOR-Maske o und erweitertem Maskenbit ' erweitert maskierte Wert zum unmaskierten Wert y = T[x] : y i = T '[v' «l) + b] 8. Combine the read table values y Q of the correction table and y x of the table (eg AES S-Box) to the result of the table access (= table output value) y'-y 0 yi By construction, the result y 'of the table access to the table T 'the value masked with the XOR mask o and extended mask bit' to the unmasked value y = T [x]:
T[u'] für b = b' T [u '] for b = b'
y0 = T[u' « 1) + (b®b')] = y 0 = T [u '«1) + (b'b')] =
T[u'] für b*b'  T [u '] for b * b'
Figure imgf000036_0001
Figure imgf000036_0001
Tfred] /ür = b'  Tfred] / ür = b '
T[x®d] für b*b'  T [xd] for b * b '
(T'[v«l] fürb = 0(T '[v «l] forb = 0
* = r'[((,ec) « i) + *] = ^ φ fM) < ^ + 1}fürb = 1 * = r '[((, ec) «i) + *] = ^ φ fM) < ^ + 1 } forb = 1
_ CT'[v « 1] = r[d( ) « 1] fürb = 0_ CT '[v «1] = r [ d ()« 1] forb = 0
= { T'[v © /dO) « lj = T'[fd(x' ®fd(z) « lj fürb = l = {T '[v © / d O) «lj = T' [f d (x '®f d (z)« lj forb = l
_ [r\fd{x') « 1] = T'\fd(x © Q « 1] fürb = 0 _ [r \ f d {x ') «1] = T' \ f d (x © Q« 1) for b = 0
\T'[fd(x~') « 1] = T'[fd(x © 0 « 1] fürb = l \ T '[f d (x ~ ') «1] = T '[f d (x © 0« 1] forb = l
_ ( T[x] θ Γ[χ © d] © o für b = 0  _ (T [x] θ Γ [χ © d] © o for b = 0
~ { T[x] ® T[x © d] © o /ürb = l Μ © o /ür ö' = 0  ~ {T [x] ® T [x © d] © o / tur = l Μ © o / ür ö = 0
T[x] © o /ür £»' = 1  T [x] © o / ür £ »'= 1
Die Rechnung zeigt, dass der angegebene Algorithmus funktional korrekt ist. Die Sicherheit gegen DPA 2. Ordnung kann durch sorgfältige Analyse der einzelnen Schritte verifiziert werden und wurde durch eine Implementierung auf einer Chipkarte praktisch überprüft. The calculation shows that the specified algorithm is functionally correct. The security against DPA 2nd order may be due to careful analysis of the individual steps and was virtually verified by an implementation on a smart card.
Beim obigen Ausführungsbeispiel wurde durch einen Tabellenauswahlab- schnitt, konkret mittels eines zusätzlich an der untersten Stelle ergänzten Bits, signalisiert, ob eine zusätzliche Komplementierung des (basis-) maskierten Werts gegeben ist (Bit = 1) oder nicht (Bit = 0). Dieses Bitmuss nicht an unterster Stelle stehen, sondern kann auch an anderer Stelle stehen. Wird das Bit des Tabellenauswahlabschnitts an einer anderen Stelle eingefügt, ändern sich die Formeln für die Tabellen und die Berechnung der Indices (u, v) entsprechend. Zudem kann die Kodierung auch umgekehrt erfolgen, d.h. Bit = 1 ist ohne zusätzliche Komplementierung und Bit = 0 ist mit zusätzlicher Komplementierung. In der Regel wird die Information für den Tabellenaus- wahlabschnitt getrennt von den maskierten Daten gehalten und nur die die Durchführung eines Tabellenaufrufs eingefügt. Wahlweise wird statt der im Ausführungsbeispiel vorgesehenen einfachen Erweiterung (entsprechend Fig. 13, 14) eine doppelte Erweiterung vorgesehen (entsprechend Fig. 15). In the above embodiment, it was signaled by a table selection section, specifically by means of a bit additionally supplemented at the lowest point, whether an additional complementation of the (base) masked value is given (bit = 1) or not (bit = 0). This bit need not be at the bottom, but may be elsewhere. If the bit of the table selection section is inserted elsewhere, the formulas for the tables and the calculation of the indices (u, v) change accordingly. In addition, the coding can also be reversed, ie bit = 1 is without additional complementation and bit = 0 is with additional complementation. As a rule, the information for the table selection section is kept separate from the masked data and only the entry for a table call is inserted. Optionally, instead of the simple extension provided in the exemplary embodiment (corresponding to FIGS. 13, 14), a double extension is provided (corresponding to FIG. 15).
Zitierter Stand der Technik: Cited prior art:
1) DE 198 22 217 AI; 1) DE 198 22 217 AI;
2) EP 2 302 552 AI;  2) EP 2 302 552 AI;
3) DE 102012018924.9  3) DE 102012018924.9
4) DE 10 2004 032893 AI  4) DE 10 2004 032893 Al
5) [PRBIO] E. Prouff, M. Rivain, R. Bevan: Statistical Analysis ofSecond Order Differential Poiuer Analysis, http:/ / eprint.iacr.org/ 2010/ 646.pdf, ffiEE Transactions on Computers 58, S. 799.811, 2009;  5) [PRBIO] E. Prouff, M. Rivain, R. Bevan: Statistical Analysis of Second Order Differential Poiure Analysis, http://eprint.iacr.org/ 2010/646.pdf, ffiEE Transactions on Computers 58, p. 799,811 , 2009;

Claims

P a t e n t a n s p r ü c h e Patent claims
1. Verfahren, in einem Prozessor, zum Durchrühren einer kryptographischen Berechnung (AES), bei der aus Eingangsdaten (P) unter Verwendung eines kryptographischen Schlüssels (K) und über die Erzeugung von Zwischenwerten (x, y) Ausgangsdaten (C) erzeugt werden, A method, in a processor, for carrying out a cryptographic calculation (AES), in which output data (C) are generated from input data (P) using a cryptographic key (K) and via the generation of intermediate values (x, y),
wobei bei der Durchführung der Berechnung (AES) eine Basismaskierung (XOR) angewandt wird, durch welche zumindest manche, vorzugsweise alle, Zwischenwerte (x, y, ...) als maskierte Zwischenwerte ( xXOR yWR ,— ) in die Berechnung einfließen, und wherein in the execution of the calculation (AES) a basic masking (XOR) is applied, by which at least some, preferably all, intermediate values (x, y, ...) are included as masked intermediate values (x XOR y WR , -) in the calculation , and
wobei bei der Durchführung der Berechnung (AES) zusätzlich eine Sekundärmaskierung (00/ FF) angewandt wird, die so eingerichtet ist, dass für jeden mit der Sekundärmaskierung maskierten Zwischenwert ( xWR ) bewirkt wird, dass zufallsgesteuert (Zufallsbit b) die Berechnung (AES) entweder mit dem Zwischenwert ( xXOR ) oder mit dem Einerkomplement ( xXOR ) des Zwischenwerts ( xXOR ) durchgeführt wird, wherein during the execution of the calculation (AES) additionally a secondary masking (00 / FF) is applied which is set up such that for each intermediate value (x WR ) masked with the secondary masking it is effected that randomly (random bit b) the calculation (AES ) with either the intermediate value (x XOR) or (with the one's complement x XOR) of the intermediate value (x XOR) is performed,
dadurch gekennzeichnet, dass, characterized in that
- an der Berechnung (AES) ein Schritt des Faltens durchgeführt wird, durch welchen bewirkt wird, dass zumindest manche mit der Basismaskierung maskierte Zwischenwerte als gefaltet maskierte Zwischenwerte vorgesehen sind ( xXOR ), wobei der gefaltet maskierte Zwischenwert ( xXOR ) unter Verwendung des basismaskierten Zwischenwerts (x) und mindestens eines weiteren basismaskierten Zweit-Zwischenwerts ( x Θ d ) berechnet wird, wobei der Zweit-Zwischenwert (x ® d) aus dem Zwischenwert (x) unter Verwen- dung einer Faltungsdistanz (d) abgeleitet wird, a folding step is performed on the calculation (AES), causing at least some intermediate masked intermediate masking values to be provided as folded masked intermediate values (x XOR ), the folded masked intermediate value (x XOR ) using the base-masked intermediate value (x) and at least one further base-masked second intermediate value (x Θ d) is calculated, wherein the second intermediate value (x ® d) is derived from the intermediate value (x) using a convolution distance (d),
- auf den gefaltet maskierten Zwischenwert ( xXOR ) die Sekundärmaskierung angewandt wird, sodass zufallsgesteuert die Berechnung entweder mit dem gefaltet maskierten Zwischenwert (xXOR ) oder mit dem zum gefaltet maskierten Zwischenwert ( xX0R ) gehörigen Einerkomplement ( xXOR ) durchgeführt wird, und - bedarfsweise der gefaltet maskierte Zwischenwert ( xXOR ) oder das zum gefaltet maskierten Zwischenwert ( xXOR ) gehörige Einerkomplement (xX0R ) weiter unter Verwendung eines Korrekturelements ( ; f, c) berechnet wird, in das die Faltungsdistanz (d) eingeht. - the folded masked intermediate value (x XOR) the secondary masking is applied, so that randomly calculating either the folded masked intermediate value (x XOR) or associated with the folded masked intermediate value (x X0R) one's complement is performed (x XOR), and if necessary, the folded masked intermediate value (x XOR ) or the one-complement (x X0R ) associated with the folded masked intermediate value (x XOR ) is further calculated using a correction element (; f, c) into which the convolution distance (d) is received.
2. Verfahren nach Anspruch 1, wobei als Basismaskierung eine einfache oder mehrfache XOR-Maskierung, oder eine Zerlegungsmaskierung, oder eine Hintereinanderschaltung zweier oder mehrerer der vorgenannten Basismaskierungen vorgesehen ist. 2. The method of claim 1, wherein as basic masking a single or multiple XOR masking, or a Zerlegungsmaskierung, or a series connection of two or more of the aforementioned base masks is provided.
3. Verfahren nach Anspruch 1 oder 2, wobei die Berechnung (AES) eine Teilberechnung umfasst, durch die aus einem Eingangswert ( x - p Φ k ) unter Durchführung eines Tabellenzugriffs auf eine Tabelle ( S ), die eine Mehrzahl von Tabelleneinträgen ( y ) aufweist, ein Zwischenwert (y = S[x] ) erzeugbar ist, Method according to claim 1 or 2, wherein the calculation (AES) comprises a partial calculation by which an input value (x-p φ k) is performed by performing a table access to a table (S) containing a plurality of table entries (y). has an intermediate value (y = S [x]) can be generated,
- wobei zur Durchführung der Berechnung oder zumindest der Teilberechnung die Tabelle ( S ) mit der Basismaskierung (XOR) maskiert wird zu einer maskierten Tabelle (S'),  in which, in order to carry out the calculation or at least the partial calculation, the table (S) with the basic masking (XOR) is masked to form a masked table (S '),
- wobei die maskierte Tabelle ( S' ) komplementierbar ist, wodurch mindes- tens eine maskierte Komplementär-Tabelle ( 5" ) erzeugbar ist,  - wherein the masked table (S ') is complementable, whereby at least one masked complementary table (5 ") can be generated,
- wobei die Teilberechnung durchgeführt wird, indem ein Tabellenzugriff durchgeführt wird, wobei bei dem Tabellenzugriff  - wherein the sub-calculation is performed by performing a table access, wherein in the table access
- eine Sekundärmaskierung (00/ FF) angewandt wird, wobei durch die Sekundärmaskierung einer maskierten Tabelle ( S' ) bewirkt wird, dass ein Ta- bellenzugriff auf die maskierte Tabelle ( <S" ) zufallsgesteuert auf entweder die maskierte Tabelle (S' ) selbst oder die bzw. eine maskierte Komplementär- Tabelle ( S' ) zur maskierten Tabelle ( -S" ) durchgeführt wird, weiter dadurch gekennzeichnet, dass die maskierte Tabelle ( S' ) gefaltet wird zu einer gefalteten maskierten Tabelle ( T ), wobei für zumindest manche Tabelleneinträge (y') der gefalteten maskierten Tabelle ( T' ), a secondary masking (00 / FF) is applied, whereby the secondary masking of a masked table (S ') causes a table access to the masked table (<S ") to be randomized to either the masked table (S') itself or the masked complementary table (S ') to the masked table (-S ") is performed, further characterized in that the masked table (S ') is convoluted into a folded masked table (T), wherein for at least some table entries (y') of the folded masked table (T '),
- der Tabelleneintrag (y') unter Verwendung eines basismaskierten Ein- gangswerts (x = p Θ k ) der Tabelle (S ) und mindestens eines weiteren basismaskierten Zweit-Eingangswerts ( x Θ d ) der Tabelle ( S ) berechnet wird, wobei der Zweit-Eingangswert ( x Θ d ) aus dem Eingangswert ( x = p Θ k ) unter Verwendung einer Faltungsdistanz (d) abgeleitet wird,  the table entry (y ') is calculated using a base-masked input value (x = p Θ k) of the table (S) and at least one further base-masked second input value (x Θ d) of the table (S), the second Input value (x Θ d) is derived from the input value (x = p Θ k) using a convolution distance (d),
- die gefaltete maskierte Tabelle ( ') mit der Sekundärmaskierung maskiert wird, so dass der Tabellenzugriff zufallsgesteuert entweder auf die gefaltete maskierte Tabelle (Τ') selbst oder auf die bzw. eine Komplementär-Tabelle ( V ) zur gefalteten maskierten Tabelle ( ) durchgeführt wird und  - the folded masked table (') is masked with the secondary masking so that the table access is randomized to either the folded masked table (Τ') itself or to the complemented table (V) to the folded masked table () and
- bedarfsweise der gefaltet maskierte Tabelleneintrag (y') oder das zum gefaltet maskierten Tabelleneintrag (y') gehörige Einerkomplement (y' ) weiter unter Verwendung eines Korrekturterm (c) und einer Korrekturtabelle (f ) berechnet wird, wobei in den Korrekturterm (c) und in die Korrekturtabelle ( T ) die Faltungsdistanz (d) eingeht.  if necessary, the folded masked table entry (y ') or the one's complement (y') associated with the folded masked table entry (y ') is further calculated using a correction term (c) and a correction table (f), wherein the correction term (c) and the folding distance (d) is entered in the correction table (T).
4. Verfahren nach Anspruch 3, wobei die Korrekturtabelle ( f ), analog zur Tabelle (S), ebenfalls mit einer Basismaskierung (XOR) und einer Sekundärmaskierung (Zufallsbit b') maskiert ist. 4. The method of claim 3, wherein the correction table (f), analogous to the table (S), also with a base masking (XOR) and a secondary masking (random bit b ') is masked.
5. Verfahren nach Anspruch 3 oder 4, wobei das zufallsgesteuerte Zugreifen auf entweder die maskierte Tabelle (Τ' ) oder die bzw. eine maskierte Kom- plementär-Tabelle (Γ') dadurch durchgeführt wird, dass der Eingangswert ( x ) zur Erzeugung des Zwischenwerts ( y = S[x] ) um einen Tabellenauswahl- Abschnitt (a; ax ...aQ) erweitert wird, durch den die Tabelle festgelegt ist, auf die zugegriffen wird. 5. A method according to claim 3 or 4, wherein the random accessing of either the masked table (Τ ') or the masked complementary table (Γ') is performed by using the input value (x) to generate the Intermediate value (y = S [x]) is extended by a table selection section (a; a x ... a Q ) which defines the table being accessed.
6. Verfahren nach einem der Ansprüche 3 bis 5, wobei die Tabelle ( S ) einen Tabelleneingang (x) aufweist und einen Tabellenausgang (y) aufweist, und wobei genau eine maskierte Komplementär-Tabelle ( S' ) berechnet wird, bei welcher sowohl der Tabelleneingäng (x) als auch der Tabellenausgang (y) komplementiert sind, indem die Positionen der Tabelleneinträge in der Tabelle ( S ) komplementiert sind und die Werte der Tabelleneinträge in der Tabelle ( S ) komplementiert sind. 6. The method according to any one of claims 3 to 5, wherein the table (S) has a table input (x) and a table output (y), and wherein exactly one masked complementary table (S ') is calculated, in which both the Table entry (x) and the table output (y) are complemented by the positions of the table entries in the table (S) are complemented and the values of the table entries in the table (S) are complemented.
7. Verfahren nach einem der Ansprüche 3 bis 5, wobei die Tabelle ( S ) einen Tabelleneingäng (x) aufweist und einen Tabellenausgang (y) aufweist, und wobei drei gefaltete maskierte Komplementär-Tabellen ( ) berechnet werden, wobei The method of any of claims 3 to 5, wherein the table (S) has a table entry (x) and a table exit (y), and wherein three folded masked complementary tables () are calculated, wherein
- bei einer ersten gefalteten maskierten Komplementär-Tabelle ( T ) nur der Tabelleneingang (x) komplementiert ist, indem die Positionen der Tabelleneinträge in der gefalteten maskierten Tabelle (Τ') komplementiert sind, in the case of a first folded masked complementary table (T), only the table input (x) is complemented by the positions of the table entries in the folded masked table (Τ ') being complemented,
- bei einer zweiten gefalteten maskierten Komplementär-Tabelle ( ) nur der Tabellenausgang (y) komplementiert ist, indem die Werte der Tabelleneinträge in der maskierten Tabelle ( ) komplementiert sind, und in a second folded masked complementary table (16), only the table output (y) is complemented by the values of the table entries in the masked table (16) being complemented, and
- bei einer dritten gefalteten maskierten Komplementär-Tabelle ( V ) sowohl der Tabelleneingang (x) als auch der Tabellenausgang (y) komplementiert sind, indem die Positionen der Tabelleneinträge in der gefalteten maskierten Tabelle ( T) komplementiert sind und die Werte der Tabelleneinträge in der gefalteten maskierten Tabelle ( T ) komplementiert sind.  in the case of a third folded masked complementary table (V), both the table input (x) and the table output (y) are complemented by the positions of the table entries in the folded masked table (T) being complemented and the values of the table entries in the folded masked table (T) are complemented.
8. Verfahren nach einem der Ansprüche 3 bis 7, wobei die gefaltete maskierte Tabelle ( T ) und die mindestens eine Komplementär-Tabelle ( T ) zur gefaltete maskierten Tabelle (Τ' ) in eine einzige erweiterte Tabelle ( T") eingetragen werden, die die Tabelleneinträge der gefalteten maskierten Tabelle ( ) und der mindestens einen Komplementär-Tabelle ( V ) in einer vorbestimmten Anordnung (hintereinander; schachbrettartig abwechselnd; ...) enthält. 8. The method according to any one of claims 3 to 7, wherein the folded masked table (T) and the at least one complementary table (T) to the folded masked table (Τ ') entered in a single extended table (T ") containing the table entries of the folded masked table (12) and the at least one complementary table (V) in a predetermined order (one after the other, in a checkered pattern;
9. Verfahren nach einem der Ansprüche 3 bis 8, wobei dem Prozessor ein Permanentspeicher (ROM) und ein flüchtiger Arbeitsspeicher (RAM) zugeordnet sind, und wobei die Tabelle ( S ) und die Korrekturtabelle ( f ) im Permanentspeicher (ROM) abgespeichert sind, und wobei die gefaltete maskierte Tabelle ( ) und die mindestens eine gefaltete maskierte Komplemen- tär-Tabelle ( T ) im flüchtigen Arbeitsspeicher (RAM) berechnet werden. 9. The method according to any one of claims 3 to 8, wherein the processor, a non-volatile memory (ROM) and a volatile random access memory (RAM) are assigned, and wherein the table (S) and the correction table (f) are stored in non-volatile memory (ROM), and wherein the folded masked table (12) and the at least one folded masked complement table (T) are calculated in volatile random access memory (RAM).
10. Verfahren nach einem der Ansprüche 3 bis 9, wobei 10. The method according to any one of claims 3 to 9, wherein
- die gefaltete maskierte Tabelle (Γ') und mindestens eine Komplementär- Tabelle ( ') für eine Mehrzahl von Tabellenzugriffen auf die Tabelle (S ) verwendet werden, wahlweise für zumindest eine gesamte Durchführung der kryptographischen Berechnung (AES), und  the folded masked table (Γ ') and at least one complementary table (') are used for a plurality of table accesses to the table (S), optionally for at least one entire execution of the cryptographic calculation (AES), and
- innerhalb der Mehrzahl von Tabellenzugriffen zumindest einmal, vorzugsweise für jeden Tabellenzugriff, neu zufallsgesteuert festgelegt wird, dass die Berechnung (AES) entweder mit dem maskierten Zwischenwert ( *XOR ) oder mit dem Einerkomplement ( xXOR ) des maskierten Zwischenwerts ( XXOR ) durchgeführt wird, und die Berechnung entsprechend dem Festlegen durchgeführt wird. - Within the plurality of table accesses, at least once, preferably for each table access, it is newly randomized that the calculation (AES) is performed either with the masked intermediate value (* XOR) or with the one's complement (x XOR ) of the masked intermediate value ( X XOR) and the calculation is performed according to the setting.
11. Verfahren nach einem der Ansprüche 3 bis 10, wobei die Tabelle ( S ) ei- nen Tabelleneingang (x) aufweist und einen Tabellenausgang (y) aufweist, und wobei die maskierte Tabelle ( ) 11. Method according to one of claims 3 to 10, wherein the table (S) has a table input (x) and a table output (y), and wherein the masked table ()
- entweder einen maskierten Tabelleneingang (x) hat,  either has a masked table input (x),
- oder einen maskierten Tabellenausgang (y) hat, - oder einen maskierten Tabelleneingang (x) und einen maskierten Tabellenausgang (y) hat, wobei weiter der Tabelleneingang (x) und der Tabellenausgang (y) entweder mit der gleichen Basismaskierung (XOR) maskiert sind oder mit unterschiedlichen Basismaskierungen (XOR) maskiert sind. - or has a masked table output (y), or a masked table input (x) and a masked table output (y), further wherein the table input (x) and the table output (y) are either masked with the same basic mask (XOR) or masked with different base masks (XOR).
12. Verfahren nach einem der Ansprüche 3 bis 11, wobei mittels der Korrekturtabelle zumindest der Tabelleneingang (x) der maskierten Tabelle (Τ') korrigiert wird. 12. The method according to any one of claims 3 to 11, wherein at least the table input (x) of the masked table (Τ ') is corrected by means of the correction table.
PCT/EP2015/000625 2014-03-26 2015-03-23 Memory efficient side-channel-protected masking WO2015144305A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
EP15713647.4A EP3123461A1 (en) 2014-03-26 2015-03-23 Memory efficient side-channel-protected masking

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
DE102014004378.9 2014-03-26
DE102014004378.9A DE102014004378A1 (en) 2014-03-26 2014-03-26 Memory Efficient Side Channel Protected Masking

Publications (1)

Publication Number Publication Date
WO2015144305A1 true WO2015144305A1 (en) 2015-10-01

Family

ID=52785032

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/EP2015/000625 WO2015144305A1 (en) 2014-03-26 2015-03-23 Memory efficient side-channel-protected masking

Country Status (3)

Country Link
EP (1) EP3123461A1 (en)
DE (1) DE102014004378A1 (en)
WO (1) WO2015144305A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112787800A (en) * 2021-01-19 2021-05-11 清华大学 Encryption and decryption method and device based on second-order mask, electronic equipment and storage medium

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102015015953B3 (en) * 2015-12-08 2017-04-27 Giesecke & Devrient Gmbh Crypto algorithm with key-dependent masked calculation step (SBOX call)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102004032893A1 (en) * 2004-07-07 2006-02-02 Giesecke & Devrient Gmbh Masked result value calculating procedure, involves evaluating specific illustration at two positions for calculation of some entries and incorporating determined result values of illustration into calculation of entries of masked table
US20080292100A1 (en) * 2007-05-24 2008-11-27 Kabushiki Kaisha Toshiba Non-linear data converter, encoder and decoder

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5398284A (en) * 1993-11-05 1995-03-14 United Technologies Automotive, Inc. Cryptographic encoding process
DE19822217B4 (en) 1998-05-18 2018-01-25 Giesecke+Devrient Mobile Security Gmbh Access-protected disk
FR2820576B1 (en) * 2001-02-08 2003-06-20 St Microelectronics Sa ENCRYPTION METHOD PROTECTED AGAINST ENERGY CONSUMPTION ANALYSIS, AND COMPONENT USING SUCH AN ENCRYPTION METHOD
KR100594265B1 (en) * 2004-03-16 2006-06-30 삼성전자주식회사 A cipher processing unit, an advanced encryption standard cipher system and an advanced encryption standard cipher method with masking method
DE602005002349T2 (en) * 2005-05-10 2008-01-17 Research In Motion Ltd., Waterloo Key masking for cryptographic processes
FR2950721B1 (en) 2009-09-29 2011-09-30 Thales Sa METHOD FOR EXECUTING A PROTECTIVE ALGORITHM OF AN AFFIN-MASKING ELECTRONIC DEVICE AND ASSOCIATED DEVICE
DE102012018924A1 (en) 2012-09-25 2014-03-27 Giesecke & Devrient Gmbh Side channel protected masking

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102004032893A1 (en) * 2004-07-07 2006-02-02 Giesecke & Devrient Gmbh Masked result value calculating procedure, involves evaluating specific illustration at two positions for calculation of some entries and incorporating determined result values of illustration into calculation of entries of masked table
US20080292100A1 (en) * 2007-05-24 2008-11-27 Kabushiki Kaisha Toshiba Non-linear data converter, encoder and decoder

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112787800A (en) * 2021-01-19 2021-05-11 清华大学 Encryption and decryption method and device based on second-order mask, electronic equipment and storage medium

Also Published As

Publication number Publication date
EP3123461A1 (en) 2017-02-01
DE102014004378A1 (en) 2015-10-01

Similar Documents

Publication Publication Date Title
EP2901611B1 (en) Side-channel-protected masking
EP3593483B1 (en) Transition from a boolean masking to an arithmetic masking
WO2016074782A1 (en) Method for testing and hardening software applications
DE60223337T3 (en) METHOD FOR SECURE ENCRYPTION AND COMPONENT FOR CARRYING OUT SUCH A COATING METHOD
DE60207818T2 (en) Secure cryptographic calculation method with secret key and component applying such a method
DE69932740T2 (en) METHOD AND DEVICE FOR CRYPTOGRAPHIC DATA PROCESSING
EP1664979B1 (en) Transition between masked representations of a value during cryptographic calculations
EP3123461A1 (en) Memory efficient side-channel-protected masking
DE60022840T2 (en) METHOD FOR SECURING ONE OR MORE ELECTRONIC ASSEMBLIES, ASSISTING A PRIVATE KEY CYPRUS ALGORITHM, AND ELECTRONIC ASSEMBLY
EP3387636B1 (en) Cryptographic algorithm having a key-dependent masked computing step (sbox call)
EP4101118A1 (en) Key generation and pace with protection against side channel attacks
EP1615098B1 (en) Calculation of a masked value protected against spy out
EP3804209B1 (en) Method having safe-error defensive measure
DE60213327T2 (en) A method based on a round-robin block encryption algorithm and apparatus for carrying out the method
EP4360247A1 (en) Method for calculating a transition from a boolean masking to an arithmetic masking
EP1506473B1 (en) Modular inversion that is protected against espionage
DE102012015158A1 (en) Protected against spying protected cryptographic calculation
EP1573955A1 (en) Encoding method
DE102004032893B4 (en) Spying-protected calculation of a masked result value
DE10303723B4 (en) Apparatus and method for calculating encrypted data from unencrypted data or unencrypted data from encrypted data
DE10149191A1 (en) Method for determining source output data from source input data based on a cryptographic operation modifies a cryptographic operation according to forward/reverse-modifying rules.
WO2013127519A2 (en) Calculation protected against spying

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15713647

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

REEP Request for entry into the european phase

Ref document number: 2015713647

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 2015713647

Country of ref document: EP