Next Article in Journal
A SIFT-Based DEM Extraction Approach Using GEOEYE-1 Satellite Stereo Pairs
Next Article in Special Issue
Context Definition and Query Language: Conceptual Specification, Implementation, and Evaluation
Previous Article in Journal
Real-Time Eyeblink Detector and Eye State Classifier for Virtual Reality (VR) Headsets (Head-Mounted Displays, HMDs)
Previous Article in Special Issue
An IoT-Based Solution for Intelligent Farming
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

White Box Implementations Using Non-Commutative Cryptography

Area of Applied Mathematics (DITEC), Faculty of Computer Science, University of Murcia, 30071 Murcia, Spain
Sensors 2019, 19(5), 1122; https://doi.org/10.3390/s19051122
Submission received: 26 November 2018 / Revised: 23 February 2019 / Accepted: 25 February 2019 / Published: 5 March 2019

Abstract

:
In this paper, we present a method to create a safe arithmetic that can be used to obfuscate implementations that require operations over commutative groups. The method is based on the structure of the endomorphisms of certain extensions of the original commutative group. The endomorphisms of a commutative group are non-commutative (in general), thus we can use a non-commutative group to emulate the arithmetic of a commutative one. The techniques presented in this paper are very flexible and the programmer has a wide variety of options to obfuscate the algorithms. The system can be parameterized using conjugations, thus it is possible to generate a different arithmetic for each instance of the program with a change in the security parameters, even in cases in which this number is huge (for example, in IoT applications). The security of this method is based not only on the difficulty of the conjugacy search problem (in a harder version because only partial information about the groups is known by the attacker), but also in a number of extra options that can be chosen by the programmer. The paper explains the general method, analyzes its algebraic properties and provides detailed examples based on the vector spaces over F 2 and XOR operators.

1. Introduction

The most traditional framework for cryptography is a pair of users, Alice and Bob, where Alice wants to send a message m to Bob through a communication channel. Alice and Bob live in secure bubbles, but the outside world is insecure and other users can be listening to the channel, therefore they agree to two functions E and D such that D ( E ( m ) ) = m and instead of sending m, Alice sends E ( m ) . Bob knows the function D and can compute m = D ( E ( m ) ) but any listener through the insecure channel would get E ( m ) and this information is useless without the function D. The functions E and D can be parameterized by a value k (the key) such that the algorithms can be made public and, if the value k is kept safe, the communication is secure.
This framework (the channel is insecure but the functions E and D are computed in a safe environment) is not valid in many real life situations. Consider the following examples:
  • A sensor network with multiple nodes in which an attacker could have full access to some of  them
  • A virus or an intruder getting valuable information from a running system
  • Cloud or fog computations in which the environment is not completely safe due to malicious nodes or vulnerabilities such as Meltdown, Spectre, etc.
  • Content providers broadcasting encrypted data to users that could try to obtain decryption keys to illegally distribute them to other users
  • Computer games with limited licenses that could be manipulated by the users to obtain upgraded versions for free
As we can see in these examples, the sensitive information can be the data used in the computation or even the algorithm itself. White box cryptography assumes that the attacker has full access to the hardware and software, and even in that insecure environment, the obfuscated software would not provide sensible information to the attacker.
To define clearly which information is available to the attacker and which design parameters are not visible, we consider that an obfuscated implementation has public and private elements. The code itself is one of these public elements. A system is considered safe if the private elements cannot be (easily) recovered using the public information. Although all the techniques explained in this paper can also be used to hide the algorithm, we consider the worst case in which the attacker knows the algorithm that is implemented.
This case is usually considered in white box cryptography, for example safe implementations of the Data Encryption Standard (DES) and the Advanced Encryption Standard (AES) have been a major target in the development of white box cryptography.
One of the first proposals for DES, made by Chow et al. in [1], attracted great interest, although it was almost immediately broken by Jacob et al. in [2] and Goubin et al. in [3]. Chow et al. also proposed a white-box implementation for AES in [4], broken by Billet et al. in [5]. The algorithms for DES and AES share a similar structure, they have several rounds with combinations of affine transformations, XOR operators and S-boxes. A general attack over this kind of algorithms applied to cases different from DES and AES was given by Michiels et al. in [6]. Another attack based on this structure was given by Biryukov et al. in [7].
One standard technique used in white box cryptography when we have an addition is to spread the information into pieces (called shares) that are combined using the addition and some hidden linear transformations. For example, suppose that a vector v is represented by two vector v 1 and v 2 , and we have secret linear transformations e 1 and e 2 such that v = e 1 ( v 1 ) + e 2 ( v 2 ) . The attacker can see v 1 and v 2 but e 1 and e 2 remain secret. If w = e 1 ( w 1 ) + e 2 ( w 2 ) is the representation of another vector, we know that v + w = e 1 ( v 1 + w 1 ) + e 2 ( v 2 + w 2 ) , thus the program can compute additions without revealing e 1 and e 2 . The problem is that the combination of these techniques with nonlinear transformations (S-boxes) can be analyzed to recover information.
A milestone in the history of white box cryptography was the WhibOx challenges that took place in 2017 (see [8]). In this contest, the developers created white box implementations of the advanced encryption standard (AES) following certain rules. The result was that the 94 challenges presented were broken 877 times. All of them were broken, in many cases using known techniques including the ones published in the previously mentioned examples. These kinds of breaks were done in a short period of time. Only 21 required more than one day to be broken for the first time. In general, those were the ones that required more special and unpublished attacks.
The second most resistant implementation on that contest is based on some of the ideas presented in this paper, although this paper is not about that implementation because the method presented in this paper is more sophisticated and it is not limited to the conditions of that contest. More details about the challenge and the attack made to the first implementation can be seen in [9,10].
It is possible to consider several approaches to white-box implementations. One of them is to consider an algorithm as a boolean circuit and implement methods for the basic boolean operators. This  is the idea presented in [10]. In this paper, we assume that the algorithm requires an obfuscated arithmetic over a commutative group V. Vector spaces are commutative groups and they are our main examples, but the theoretical construction is done in general. The role played by square matrices in the case of vector spaces, is played by the endomorphisms e : V V in the case of commutative groups.
To represent the elements, we combine endomorphisms and values in V, but instead of having invisible operators e i and visible values v i , we have visible information related with the operators e i and invisible values v i . There are many advantages in this new approach. First, we can have a huge number of endomorphisms even in small cases, for example a vector space with 2 8 vectors has 2 8 2 = 2 64 matrices and we only need a small number of them to represent all the vectors, thus we have a lot of freedom to choose the ones to be used. The actual matrices need not be revealed, only how they operate, and many subsets can have identical operation tables. Moving the representation from V to the side operators is a kind of nonlinear transformation similar to a logarithm. This non-linearity avoids the standard attacks based on linearity and new layers of security can be applied without risk. The problem is that we cannot apply the linearity to compute the addition, thus we have to learn how to add using this new representation. This can be done by introducing new operators that are different from traditional ones. This new arithmetic is also an advantage because it can be parameterized by choosing different subsets of transformations (something similar to having a free choice for the base of the logarithms). The new operators also require smaller tables than the standard ones because the growth of the tables is linear and not quadratic. Finally, the use of non-commutative subgroups given by endomorphisms forces the attacker to solve the conjugacy search problem (CSP), which is considered hard even for quantum computers; thus, systems based on non-commutative groups can be considered as post-quantum cryptosystems. Several protocols and cryptosystems have been developed in recent years based on non-commutative groups (see, for example, [11]).
This paper is structured as follows. After this Introduction, the theory is explained in two steps. The main public and private elements of the theory are explained in Section 2. The second step is given in Section 3, in which we show some mathematical properties of the theory that can be used for an attacker to analyze the system and protections against them. The method is discussed in Section 4. In that section, we include information about use cases and further applications, especially to IoT. In Section 5, we show a big example with the most advanced features. The conclusions are in Section 6. Section 7 has information about patents related with this research. Finally, the paper has two appendices. Appendix A gives some basic mathematical terminology that is used in the paper. Appendix B contains a small obfuscated implementation using the techniques explained in the paper, written in full detail.

2. Private Arithmetic (Basic Version)

In this section, we describe the mathematical structure of an obfuscated implementation using a private arithmetic. Cryptography and cryptanalysis are in many cases “cat-and-mouse” games, in which the cryptographer tries to mislead the attacker by breaking the original rules and the attacker also tries methods that were not originally considered by the cryptographer in order to analyze the system and reveal the secret information.
The intention of this section is to give the definitions that explain the structure of the proposed obfuscation in a logical way. However, these definitions and procedures can be made more flexible to include some traps or difficulties to the attacker. Examples of these traps could be that not all the elements of a group are used in actual computations and we can include some misbehavior in these elements. In this example, we cannot say that A is a commutative group if there are two elements in A that do not have a correct multiplication. These special cases are a nightmare for explanations and we have decided to start with a basic version without tricks and we consider them in Section 3.
The objective of this theory is to obfuscate algorithms or data used in mathematical computations. The computations take place in a commutative group V that is called the external commutative group. This group is considered public.
The idea behind the technique that we explain is to use another commutative group M that is called the internal commutative group to make the internal computations. This group is private and, in fact, is not visible in the implementation. The operations in M are done using tables that do not provide the usual group addition, but certain information that is used to compute other non-standard operators.
In this section, the relation between M and V is simple; we have a projection p : M V . This is a surjective group homomorphism and every element v V is represented using values m M such that p ( m ) = v . This relation is much more complex in the non-basic version given in Section 3.
The tables and methods that let us compute with the elements of M are called internal arithmetic. We call external arithmetic any computation that requires the actual value in the external group V and not only the value over M. A private arithmetic is a combination of an internal and an external  arithmetic.
A critical point in the program is a place at which the actual value in V has to be used for the computation. For example, the input and the output of the program are critical points. The  computations that take place in between are called connected components. A more detailed explanation about the connected components is provided in Section 2.10.
We decompose the analysis in two parts: first we analyze the internal arithmetic. This arithmetic can be used for several implementations. The elements of the internal arithmetic are:
  • Public:
    -
    Public Group (G)
    -
    Heading Spaces (X)
    -
    G-structure of the heading spaces ( G × X X )
    -
    Reduction Maps ( r : X Y )
    -
    Dissolving Maps ( D : X G n )
  • Private:
    -
    Internal Commutative Group (M)
    -
    Correspondence between heading spaces and valid elements ( π X )
    -
    Extended Arithmetical Group ( H φ G )
    -
    Action of H φ G on M.
    -
    Base points (B)
The second part is the elements that depend on the implementation and the group V (the external arithmetic). Its elements are:
  • Public:
    -
    The external commutative group V
    -
    The program
    -
    Input Tables
    -
    Output Table
    -
    Tables for non-linear operators
  • Private:
    -
    Control values and deals
    -
    Extra affine transformations
We have already mentioned the external commutative group V and the internal commutative group M; the rest of the elements are analyzed in different subsections.

2.1. Public Group G (Public)

The arithmetic is ruled by a group G. This group is given up to isomorphism. Therefore, it is possible to give it with its multiplication table or with any other representation that let us compute with the elements of the group. The group G is in general non-commutative.

2.2. Extended Group H φ G (Private)

We select a second group H and a group homomorphism φ : G Aut ( H ) to build the semi-direct product of the groups, H φ G . The group G is public, but the extension of the group to H φ G is not.

2.3. Representation of H φ G Using Endomorphisms of M (Private)

One of the most critical points in the security of the obfuscation is how the values of H φ G operate over the elements of M. This requires a group homomorphism ψ : H φ G Aut ( M ) . This is known in the literature as a representation of the group H φ G on M, but, in this paper, we use also the word representation for other constructions, for example the representation of an element of V using elements of M, or the representation of elements in M with other arithmetical expressions; therefore, we use the more generic term action of H φ G on M, which is used when M has no additional structure, but is valid in general.
The group G is a subgroup of H φ G , thus the action ψ also induces an action of G on M.
Given two actions ψ , ψ : H φ G Aut ( M ) , these are equivalent if there exists a group automorphism t : M M such that ψ ( u ) = t 1 ψ ( u ) t for all u H φ G .
Equivalent actions generate different arithmetics using the same groups. Their similar structures make them difficult to recognize for an attacker.
We next present an example of these kinds of constructions. Let M = F 2 4 and h = 1 1 0 0 1 0 0 0 0 0 1 1 0 0 1 0 and g = 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 0 .
Let G be the group generated by the matrix g and H the group generated by h. In this case, G has 2 elements and H has 3. The group H has a nontrivial automorphism τ : H H given by τ ( h ) = h 1 and one possible homomorphism φ : G Aut ( H ) would be φ ( g i ) = τ i . The semi-direct product H φ G is a group of six elements and ψ : H φ G Aut ( M ) is given using the matrices g and h that we have defined previously.
The group Aut ( M ) is the group of invertible matrices 4 × 4 over F 2 . This group has 20,160 elements and, using invertible matrices t to generate other actions equivalent to ψ , we get 540 essentially different actions of H φ G on M.

2.4. Heading Spaces (Public)

A heading space is a set X with an action G × X X . It is not even necessary that the set X has an additive structure; it can be any set that could be operated with the elements of G. We can have one or more heading spaces.
In this paper, we see several examples of heading spaces. We can have an additional structure on X, but it is not used; only the multiplication of the elements of G by the elements of X is relevant. It is also possible to have a set X with some values that are not really used in the computation. If this happens, we consider in this section that the real heading space is the subset of X given by the orbits actually used in the computation with legitimate values.
It is always possible to have heading spaces for any number of orbits. If we want to have n orbits, we can use the heading space X = G × { 1 , 2 , , n } with the action G × X X given by g · ( g , i ) = ( g g , i ) for all g , g G and all i { 1 , 2 , , n } . It is also possible to use any other set X with an action for the group G.
Definition 1.
A head is a pair ( h , x ) where x is in a heading space and h H . The value h is called the H-modifier of the head. The elements in the program is represented using heads, but the only visible element is the element x X . The H-modifier is known by the compiler or the programmer, but it is not visible during the computation.

2.5. Correspondence between Heads and Elements of M (Private)

For every heading space X, we have a map π X : X M such that π X ( g x ) = g π X ( x ) (a map between G-gets with this property is called a G-map).
We say that an element m M is represented by the head ( h , x ) if m = h π X ( x ) . In this section, all the elements of M should be representable by heads for any heading space X; therefore, π X : X M should be surjective.
To get this surjectivity, we have to analyze the orbits of M and get a subset of representatives, M 0 M such that M = m M 0 G m . For these elements m, we need to get values in X such that π X ( x ) = m , but this cannot be done without some restrictions.
Let m be an element of M 0 and suppose x X satisfies π X ( x ) = m . Let G m = { g G : g m = m } and G x = { g G : g x = x } be the stabilizers of these elements. The condition π X ( x ) = m implies that, for all g G x , g π X ( x ) = π X ( g x ) = π X ( x ) = m , therefore g G m . This proves that the element x X that represents m should satisfy the condition for the stabilizers G x G m . This is in fact the only condition required.
If we use a heading space of the type G × { 1 , 2 , , n } , the values ( 1 , i ) always have a trivial stabilizer G ( 1 , i ) = { 1 } and this is contained in any possible stabilizer G u m . In this case, we can pick any index i to represent the elements of the orbits G u m without restriction.

2.6. Base Points (Private)

We fix a set with one or more elements B M . They are called base points.
Definition 2.
A link is a triple ( h , g , b ) H × G × B . The value h is called the H-modifier of the link. The value h g b M is called the element represented by the link.
Elements in the program are represented using heads and links. In the case of links, the only visible element in the program is the element g G ; the values h and b are known only by the compiler or the programmer.
Not all the elements of M need to be representable using a single link. In fact, we use multiple links to represent the elements of M.
If we denote h G b = { h g b M : g G } , we represent the elements in M as a sum of elements in the subsets h G b for h H and b B . Given a number of subsets, the elements of M that can be written as the sum of elements in the chosen subsets is called a sumset. This problem is well studied in additive number theory (see [12] for details), but, in our case, we have multiple solutions and a simple check lets us find them.

2.7. Reduction Maps (Public)

Let X and Y be heading spaces. A reduction map r : X Y is a map for which we can find h H and b B such that
h π Y ( r ( x ) ) = π X ( x ) + b
for all x X . The pair ( b , h ) is called the type of the reduction.
These maps can always be constructed because we can take any x X , compute h 1 ( π X ( x ) + b ) M and find a value y such that π Y ( y ) = h 1 ( π X ( x ) + b ) . Any value y satisfying the condition can be defined as r ( x ) .
Let r : X Y and s : Y Z be two reduction maps with such that the type of r is ( b , h ) and the type of s is ( c , l ) . Then, we can make the composition of these reductions to have
h ( l π Z ( s ( r ( x ) ) ) ) = h ( π Y ( r ( x ) ) + c ) = h π Y ( r ( x ) ) + h c = π X ( x ) + b + h c .
This proves that the composition s r is actually a reduction map with type ( b + h c , h l ) .

2.8. Dissolving Maps (Public)

A dissolving map for the heading space X with dimension d is a map
D : X G × G × × G = G d D ( x ) = ( D 1 ( x ) , D 2 ( x ) , , D d ( x ) ) .
This map has hidden values b 1 , b 2 , , b d B and h 1 , h 2 , , h d H such that, for all x X ,
π X ( x ) = h 1 D 1 ( x ) b 1 + h 2 D 2 ( x ) b 2 + + h d D d ( x ) b d .
The values b i and h i could be repeated.
The dissolving maps are public, but values b i and h i are private. The number of dissolving maps depends on the implementation; it could be possible in some cases to create a full implementation without dissolving maps. The value d is not fixed; we can have dissolving maps with different dimensions in the implementation.
The dissolving maps are used to transform heads into links. This is something that could be necessary during the computation. If we know by construction that this is only applied to a certain subset of heads, it is possible to define the map D only over this subset.

2.9. Control Values and Deals (Private)

All elements in V can be represented in many ways in terms of M. During the computation, it may be reasonable not to reuse the representations, especially in critical points. For example, suppose V = F 2 4 , M = F 2 6 , and P is an invertible matrix 6 × 6 over Z 2 . We can define the projection p : M V as the first four bits of P m and consider the last two bits as control values.
If we use different control values at different critical points, we know that the representatives of the elements will never coincide.
There are many ways to define the control values. They can be checked before the H-modifiers or after them. It is also acceptable that the control values are not computed in the same way during the program. The multiple representation of the values and the way to control which representative is used during the computation is something that the programmer can use to increase the security level with great flexibility, but this is considered in Section 3.
A set of representatives that can represent all the elements of V but with a constant control value is called a deal. Using different deals at critical points is a way to protect against code injection.

2.10. The Program (Public)

Under white-box premises, the program is available to the attacker and, therefore, it can be considered as public information. The arithmetical elements in the program are a combination of heads and links. The number of heads and links used to represent a single element is dynamic and it changes during the execution of the program.
Each head or link has a visible part (the element x X or the element g G ), and hidden parts, the H-modifier h and a base point b B for links. Thus, the element x X can represent the value h π X ( x ) for any h H and the link with value g G in the program, can represent any h g b for h H and b B . These hidden parts of the arithmetical element are known by the compiler or the programmer to decide which operations are possible and which tables have to be used at a particular moment. The heads can be in different heading spaces.
Suppose we have an element given by some heads x i and some links g j , the real value could be i h i π X i ( x i ) + j h j g j b j . The addition of two arithmetical elements is just the juxtaposition of the values (i.e. it requires no code). The problem is that, after a number of operations, the elements are huge and we need a way to reduce their sizes. This is done with the reduction maps.
Suppose we have a head x X and a link g. Internally, we know that they have the same H-modifier (for example l H ) and we also know that the base point for the link is b B . Suppose  we have a reduction map r such that the associated partition of X is X i and x X i with associated constants h i = h and b i = b . In this case, we can proceed as follows:
l π X ( x ) + l g b = l g ( g 1 π X ( x ) + g b ) = l g ( π X ( g 1 x ) + b ) = l g h π Y ( r ( g 1 x ) )
= l φ g ( h ) g π Y ( r ( g 1 x ) ) = l φ g ( h ) π Y ( g r ( g 1 x ) ) .
This proves that the new head g r ( g 1 x ) is a head representing the value l π X ( x ) + l g b with hidden H-modifier l φ g ( h ) . This process lets us reduce the size of the arithmetical elements combining a head with a link if they have the correct hidden modifiers and we have the appropriate reduction map. If  this is not the case, the reduction is not possible.
One of the characteristics of this arithmetic is that the designer has a number of possible reductions and he has to decide the precise order of the reductions. Any attacker wishing to modify a value, or paste a part of the code in another part of the program, or interchange values, immediately gets many meaningless values. At the same time, this makes the generation of the code more difficult, but this is a problem that is not visible in the final result. To have some freedom, it is reasonable to have many reduction maps, although the number required is not excessively large.
The final code is several steps that, in the visible program, look like g r ( g 1 x ) for g G and x in a heading space. This long sequence of values is combined with the values coming from the input tables or even constants.
The reduction that we have explained thus far lets us combine a head with a link, but we could need to add two heads. In that case, one of the heads has to be dissolved using a dissolving map into a number of links that let us continue the reduction process. This is not strictly necessary; depending on the design, it could be possible to have an implementation without dissolving maps. We see an example of this in Appendix B.
The designer of the program has to keep track of the H-modifiers for all possible executions of the program. This can be difficult, because the new H-modifier ( l φ g ( h ) ) depends on g, which is a value that could be input dependent. To deal with this problem, it is better to have a very simple function φ that could have at most two or three different values. This would let us classify the elements of G depending on the value φ g and keep track of the subset of G in which the values can range. If this is too complex for the implementation, a reasonable solution is to take a trivial map φ and therefore use the direct product H × G instead of a semi-direct product H φ G .

2.11. Input Tables (Public)

One of the critical points in a white-box implementation is the input of new values. The designer has to decide the correct representation that is used for the input values; they can be given by a head, a number of links or a combination of both. The control values let us use different deals in critical points. It is a good idea to use a deal for the input values that are not used at any other critical point of the program.
The H-modifiers of the input values are known by the designer, and the actual values given in the tables have to be checked to guarantee that all possible computations give the correct H-modifier in the following critical point. This is what we have mentioned in the previous subsection regarding the values φ g for all g in the input table.

2.12. Output Tables (Public)

This is the second critical point in the program. As we have done with the input values, the output uses a deal that has not been used at any other critical point. The H-modifiers of the elements when the output is reached should be known by the designer in order to build the table.
If we use a fixed control value for the output, the number of valid values is not large, thus we can create small output tables.

2.13. Tables for Nonlinear Operators (Public)

It is quite common to have nonlinear operators that have to be applied to the arithmetical operators. These are elements outside the arithmetic and we need a special table to define them. The  input and output of these tables are critical points of the implementation and, as we have done with the input and output tables, it is a good idea to use a unique deal (not used with any other critical point) to define the input entries and the output entries of this table. The tables are usually applied to heads and the output can be a head, a link or a combination of both.

2.14. Additional Affine Transformations (Private)

Consider the flow chart of the algorithm. The general structure is a graph with some critical points and a number of linear operations. Two points in the chart are said to be linearly equivalent if there are no critical points in between. This equivalence relation defines several connected components. All operations in a connected component are group operations, therefore we can apply any affine transformation to a whole connected component with the rule that everything that is done at the entry points of the connected component has to be undone at the exit points of the connected component. These operations can be glued to the tables at the critical points.
Consider, for example, V = Z 7 and a program that computes a nonlinear operator S, adds a key value k and an input value v, and finally computes another operator T of the result. The graph of this connected component is in Figure 1.
Suppose that, by design, we decide that the output of S is multiplied by a and added to b. Instead of having x, we have a x + b and this has to be considered in the encoding of the input table, which should give us a v instead of v. We can now add the value to the output of S, ( a x + b ) + a v = a ( x + v ) + b . At the exit point of the connected component (the input of T), we have to undo the change and add the key k, thus the encoding of the table for T will compute a 1 ( y b ) + k before computing the real T. All these things can be included in the definition of the tables with no additional cost, but they are constant transformations that remain fixed for all executions of the  program.

3. Additional Security Measures

In Section 2, we are too strict in the definitions and properties required for a private arithmetic. This is a first approach and it is necessary to make a simplified version to introduce the theory. In this section, we are much more flexible. In a real implementation, it is important to include elements that could make the analysis more confusing to the attacker. The ideas of this section and others that could be considered by the programmer help to increase the security.

3.1. The Relation Between the Internal and the External Arithmetic

We have two commutative groups, V and M, and in Section 2 we have defined a projection p : M V that lets us represent every element v V by at least one element m M . If we have to add two elements v 1 and v 2 , we simply compute the sum of their representatives, and it is a representative of the sum because p is a homomorphism. However, this is not the only option. We could also have more than one element in M to represent the elements of V. Consider p : M × M × × M V a surjective group homomorphism and v 1 , v 2 V such that p ( m i 1 , m i 2 , , m i k ) = v i , then v 1 + v 2 = p ( m 1 1 + m 2 1 , m 1 2 + m 2 2 , , m 1 k + m 2 k ) . When this happens, V is said to be a group generated by the group  M.
The most general construction is to have a surjective group homomorphism p : M n N such that V is a subgroup of N. We can emulate the arithmetic of the elements of N using tuples of elements in M, thus we can do it for V because all the elements of V are in N. When V is a subgroup of a group generated by M, it is said to be subgenerated by M.
The category of groups or modules subgenerated by M is denoted by σ [ M ] in the literature (see  [13], Chapter 3, Section 15). This category is closed under submodules, coproducts and quotients, therefore we cannot get any further groups iterating the constructions.
Making the group M quite different from V is something that increase the security, because the group V is public (it is usually described in the algorithm), but the group M and the relation between M and V is not known by the attacker, thus the internal arithmetic would be safe.

3.2. Quasi-Reductions

In Section 2.7, we show that the reductions can be composed. This property could be used by the attacker because, making all possible compositions, some patterns could be revealed. It is also usual to compare different reductions in order to remove some security measures (this is usually called differential cryptanalysis). For example, consider X and Y two heading spaces, r : X Y a reduction with type ( b , h ) and x 1 , x 2 X .
The type of r gives
h π Y ( r ( x 1 ) ) = π X ( x 1 ) + b h π Y ( r ( x 2 ) ) = π X ( x 2 ) + b .
If we subtract these values, we get
h ( π Y ( r ( x 1 ) ) π Y ( r ( x 2 ) ) ) = π X ( x 1 ) π X ( x 2 ) .
This equation has removed the value b and introduced some equations that could be used by the  attacker.
The idea of quasi-reductions is to consider maps r : X Y that do not satisfy the condition h π Y ( r ( x ) ) = π X ( x ) + b for any ( h , b ) and mix them with real reduction maps to introduce a non-arithmetical behavior in the program that could make any attack based on arithmetical properties difficult, in particular, differential cryptanalysis. This property also avoids the possibility of  composition.
We show how to deal with these quasi-reductions with an example that is expanded in Section 5. Suppose V = F 2 8 and M = F 2 20 . The projection p : M V is given by the first eight bits and consider that the last four bits have a non-arithmetical behavior (let E be the subspace generated by these four bits).
A quasi-reduction r : X Y satisfies h π Y ( r ( x ) ) = π X ( x ) + b for the first 16 bits, but the last four bits have random values (or any other pattern that could be interesting to hide the real structure). If we have to compute the addition of two elements m 1 and m 2 , we can be sure that the first 16 bits are actually the addition of the first 16 bits of m 1 and the first 16 bits of m 2 , but the last four bits have a value fixed by the definition of r, but not following any addition rule. These extra values break the arithmetical analysis, thus, given two values x 1 and x 2 in X, we have
h ( π Y ( r ( x 1 ) ) π Y ( r ( x 2 ) ) ) = π X ( x 1 ) π X ( x 2 ) + e ( x 1 ) e ( x 2 ) .
where e ( x 1 ) e ( x 2 ) is an error that belongs to E and depends on x 1 and x 2 and, hence, it is quite difficult to analyze.
The main objective of this subspace E is to introduce values to break the arithmetical properties of the tables but we have to give correct results in spite of these errors. Therefore, we have to keep these values under control. The easiest way is that E would be a k [ H φ G ] -submodule of M. In this way, every element in M can be decomposed in two parts, the error e E and a value in M / E that behaves arithmetically (without errors). Space E is not visible, thus only the programmer can clean the errors from the values in order to generate correct computations.

3.3. Valid and Forbidden Elements

Consider an attacker trying to obtain information from the public elements. The attacker has a group G and elements in a heading space X that can be multiplied by elements in G, thus, given x G , it is quite natural to make all possible multiplications { g x : g G } . This is called the orbit of the action. These orbits over X are related with the orbits of the action G × M M because the element x represents an element in M.
The elements of M can be multiplied by elements of G and elements of H. The elements of H modify the element to be represented using some fixed rules, therefore it is interesting to analyze the orbits of M as H φ G -set. The orbit of m M is { h g m : h g H φ G } = ( H φ G ) m .
Our objective is to use orbits that cannot be easily recognized, but some elements could be a problem. For example, the case of 0 M is very particular. The elements of H and G are linear transformations, therefore h g 0 = 0 for all h H and g G , thus 0 generates an orbit with only one element. We would prefer orbits not to be very different and this special orbit can be a problem. This can also be true for other special orbits. The idea is to remove these special elements from the arithmetic and use only normal elements. We analyze in a bit more depth why these elements appear.
First, note that the elements of H and G are endomorphisms of M and therefore have linear properties in the multiplication ( H φ G ) × M M . This makes M not only an H φ G -set but also a R-module for the group ring R = Z [ H φ G ] . The commutative group M is thus a R-module and the composition series, 0 = M 0 M 1 M n = M , is unique up to equivalence (by Jordan–Hölder theorem). As we show, the orbit generated by M 0 only has one element, but it is possible to have small orbits in M 1 and even in M 2 . The elements of these small orbits are better to be removed.
Let M ˜ be a subset of elements in M that we want to remove from the arithmetic (they are called forbidden elements), and we have a reduction r : X Y with type ( b , h ) . The elements of M ˜ can be removed from the image of π Y and π X ; however, what happens if we have x X such that h 1 ( π X ( x ) + b ) is a forbidden element? In that case, we cannot make the definition of r ( x ) and the compiler should ensure that this reduction is never going to be executed in the program. If r : X Y is the only reduction with origin in X, this implies that π X ( x ) can also be considered a forbidden element for X and it can be included in M ˜ although its orbit could be normal.
This shows that the forbidden elements could depend on the heading space X and the projection π X : X M , which could be undefined, not only because π X ( x ) is a forbidden element but also because the reductions would take it to a forbidden element in another heading space, thus the family of forbidden elements is something dynamic. In Section 5, we show how to analyze the orbits and select the forbidden elements with an example.

3.4. Overlapping Orbits and Combinations of Heading Spaces

We show in previous subsections that the attacker can get some information by playing with the reductions and analyzing the orbits. The implementation should make this task as difficult as  possible.
A heading space is a set X with a multiplication by elements of G. It is not even necessary that all the multiplications give correct results, because they could correspond to forbidden elements. If  we have several heading spaces X 1 , X 2 , , X k , we can join them in a single set X as a disjoint union. If  X and Y are combinations of heading spaces, a reduction map r : X Y is a combination of reduction maps.
For an attacker, it is not completely trivial to decide if two elements x 1 , x 2 X belong to the same heading space or not. It is even more difficult to know all the elements that belong to the same heading space. The attacker could use the following claims to group the elements that belong to the same heading space.
  • All elements that appear at the same position in the program under different valid inputs belong to the same heading space.
  • For every x X , all elements in the orbit of x, G x , belong to the same heading space.
  • Let x X and r : X Y be reduction maps, then all the values r ( g x ) belong to the same heading space for all g G .
The first claim is difficult to avoid, but only gives partial information because, at a certain point of the program, the elements not only belong to the same heading space, but also have some fixed control values; therefore, the subset of X obtained using this technique is only a small part of the heading  space.
The second claim can be very useful to incorporate errors into the analysis of the attacker. We  know that not all the elements of the orbit G x are valid elements. Suppose that the elements not used in the orbit G x are precisely those needed by other orbit in another heading space to represent their valid elements. Then, we can use the orbit G x with two different meanings, depending on the value g G . We call this method overlapping orbits. It is not easy that this property happens by chance, but it could be possible if we select the orbits that belong to each heading space looking for this particular property. We show this in Section 4. Overlapping orbits is not easy, and the tables do not have more than a few of them overlapped, but these can be enough to introduce errors in the analysis of the attacker.
The third claim is not true. Several values of r ( g x ) are invalid and we can define the tables with any value we want. The values chosen for the invalid elements can be in any heading space. If  the orbit G x has elements overlapped with another orbit, it is even worse because the values r ( g x ) are in different heading spaces and they are actually used in the computation.

4. Discussion

We list some of the most notable features of this method. Some of them are qualitative and others can be quantified.

4.1. Flexibility

A private arithmetic assumes that the external commutative group is fixed, but all other constructions can be decided. All the internal arithmetic can be decided by the programmer depending on the resources (time and memory) and his own expertise in automorphism groups.
The selection of the orbits, their representatives, the base points, etc. can be decided freely. The  number of choices is really high.

4.2. Non-Standard Operators

The most natural choice to obfuscate the addition in a commutative group is to have one or more binary operators to be applied over encrypted operands. The standard attacks try to match encrypted values with plain values and to use the algebraic properties of the group addition to find as many plain values as possible.
The method given in this paper has one or more reduction maps. The reduction maps are unary operators. The visible algorithm also provides a multiplication between elements in a group G and the heading spaces. The group G cannot be matched with elements in the external commutative group and the standard attacks do not fit with the arithmetical structure given by the reductions.

4.3. Nonlinear Relations Between Values and Their Representatives

The arithmetical elements in the program are represented by heads and links. The visible elements are elements in the heading space for heads and elements in G for links. The connection between these elements is not linear; for example, suppose g 1 and g 2 are the visible part of two links. Even if they would have the same H-modifier and the same base point, h g 1 b + h g 2 b is in general not connected with any h g b for any g G , because G is closed under group multiplication, but the addition is not allowed. Something similar happens for heads. Consider the example given in Appendix B, two heads x 1 , x 2 could have visible representatives v 1 , v 2 Z 10 2 . The addition v 1 + v 2 Z 10 2 has no connection at all with the head that represents the addition of π X ( x 1 ) + π X ( x 2 )
The nonlinear relation between values and their representatives is something that many obfuscations consider, but, in most cases, it is done in an artificial way, which must be undone before the obfuscated additions. In this system, the non-linearity is completely natural and fits the structure of the computations.

4.4. Linear Growth

We have previously mentioned that the arithmetical operators (the reductions) are unary operators instead of binary ones. This property means that the growth of the tables is linear, while the growth of the security elements is quadratic. For example, suppose that M = F 2 k . The heading spaces has a number of elements with the same order of magnitude of M, and we can say O ( 2 k ) . The number of invertible matrices k × k over Z 2 (which could be considered as a measure of the security level, as shown in Section 4.6) is O ( ( 2 k ) 2 ) = O ( 2 2 k ) , a quadratic growth in comparison with the growth of the size of the tables. Using binary operators, the table would require two inputs and thus the growth of the tables would also be quadratic.
The linear growth lets us optimize the security for the resources available, increasing the size of M and getting a much greater increase in the security than when using binary operators. This property is especially relevant in the case of IoT because the resources are usually quite limited.

4.5. Protection against Differential Cryptanalysis

Another noteworthy characteristic of this system is that we can incorporate non-arithmetical behavior to the operators. This is what we have called quasi-reductions, and we explain them in Section 3.2. These quasi-reductions increase the protection against differential cryptanalysis.

4.6. Security and Conjugacy Search Problem

There are algorithms in which we can obtain the secret information only playing with the inputs and outputs. In that case, even a black-box implementation of the algorithm would reveal the secret information and it is worthless to make a white-box implementation that would not increase the security at all, because the attacker has a running implementation by definition of white-box. This is what we call intrinsic vulnerabilities and we show an example of this in Appendix B.1.
There are other vulnerabilities due to naive choices, for example, taking M = V , or a group G that generates orbits that can be easily analyzed.
There are also algorithms with many mathematical properties that are not evident at first sight and that can be used to get the secret information despite the encoding. Strictly speaking, these are not intrinsic vulnerabilities because they can be local to a piece of the code. For example, suppose that we have a program given in rounds, such that, if we randomly modify a value at the beginning of a round, this change is spread in a way that depends on the secret values. A blind obfuscation of the algorithm could make it easy to recognize the structure of rounds and independently of the arithmetical obfuscation, it is possible to modify a value at some point with the value given in a previous execution. This code injection combined with the mathematical property of the algorithm known by the attacker could reveal the secret information without actually breaking the arithmetic.
These vulnerabilities make it almost impossible for an automatic program to generate obfuscated code. There are even theoretical studies about the impossibility of having a general virtual black box system. See [14,15] for details.
The advanced encryption standard (AES) is a typical example of this. There are many publications studying the mathematical properties of this algorithm that can be used to break white-box implementations. In particular, AES is inherently vulnerable to differential fault analysis (DFA) and this kind of attacks can be applied to the majority of the public implementations of AES (see, for example, [2]). However, not only DFA, the number of known attacks to white-box implementations of AES is huge. The experience of the WhibOx Challenge (see [8]) shows that many implementations of AES can be broken independently of the arithmetical encoding.
The method presented in this paper helps to protect, mainly because it is possible to use multiple representations of the elements with different control codes, but not all possible design vulnerabilities can be avoided if the structure of the program is revealed in the obfuscated code, and this is something that the designer of the program has to decide, independently of the arithmetic.
What we can analyze here is the security related to the arithmetical elements. We use in this system a group G that is a subgroup of Aut ( M ) . The natural choice is to have a G much smaller than Aut ( M ) . For example, if M is F 2 20 , Aut ( M ) is the set of invertible matrices 20 × 20 over F 2 . The number of them is i = 0 19 ( 2 20 2 i ) 2 398.2 . The group G, in comparison, is really small; in the example given in Section 5, it has 2520 elements.
In recent years, the number of cryptographic algorithms based on non-commutative groups has increased. We can see in [11] several algorithms based on non-commutative groups and the group-theoretical problems on which they are based. In the system proposed in this paper, we have a group G that it is given by a table or any other method that lets us compute with the elements. The  attacker knows that this group is a subgroup of Aut ( M ) but the internal group M is not known. Using the critical points, in particular the input and output tables, it could be possible to get some information about the properties of the values in the external group V compared to their corresponding internal values in M. This information is always partial. In the worst scenario, the attacker could guess that the original representation of the group G in Aut ( M ) is made using some special representation. However, this original representation ψ : G Aut ( M ) can be modified up to conjugacy using any invertible element t Aut ( M ) with the equivalent representation ψ ( g ) = t ψ ( g ) t 1 . The  number of options for t can be huge and these new representations change completely the elements that belong to each orbit and their properties. The attacker needs to determine the conjugacy used with very short information about the effects in the external group. The conjugacy problems are considered hard to solve and the security of group-theoretic cryptography is very often based on them. See [11] for general background on these kinds of problems.

4.7. Use Cases and Further Applications

In the Introduction we give several use cases for white-box cryptography. In general, white-box cryptography should be considered when the attacker has access to the program and can manipulate it without restrictions to obtain the critical information, for example the keys.
As we can see in [16], the problem of mistrust in IoT is one of the main factors that have affected how IoT security is perceived. IoT devices can become adversaries themselves and they can be used to obtain critical information. The protection of our code with a white-box obfuscation makes this impossible, because the valuable information is not visible to the hostile environment.
The method proposed in this paper is not only valid in general as a white-box method. We show above that it is possible to generate a huge number of different arithmetics choosing some parameters, which makes it especially useful for the generation of code for IoT. Another characteristic of the code is the homogeneity. The code generated using this method has long sequences of reduction steps, each requiring a similar table lookup (we can see an example of this in Algorithm A3). The  white-box protection let us delegate the computation of a number of these reductions to other devices without risk, because the program is supposed to be public. As we can see in [17], the security is a major threat in edge and fog computing, but using this method it is possible to avoid that risk.

5. A Huge Private Arithmetic

In this section we analyze an example with all the security measures considered in the paper and a huge size. The arithmetic is generated for the group V = F 2 8 . We also analyze the memory requirements to generate this arithmetic.
The internal commutative group M is F 2 20 . The elements of M are decomposed infive subvectors of four bits each. Thus, we denote m = ( m 0 , m 1 , m 2 , m 3 , m 4 ) the vector of M and the m i is vectors in F 2 4 . We use the subvector m 4 as error space and the others as arithmetical values.
We use block matrices with five blocks of 4 × 4 -matrices in the diagonal to generate G. The group of invertible 4 × 4 -matrices over F 2 has 20 , 160 matrices and generates some orbits that are too big for our purposes. It is better to consider a subgroup of this group with 2520 elements and combine it with some permutations of the five blocks in the diagonal. In this case, we consider H the subgroup generated by the rotation of the first four blocks. This generates a group H with order four and the elements of H commute with the elements of G, thus we have a direct product instead of a semi-direct product for the extended arithmetical group H × G .
There are many combinations that let us generate the subgroup of 2520 elements. One of them is to use the matrices a = 1 0 1 1 0 1 0 0 1 1 1 0 0 0 1 1 and b = 1 0 1 0 1 1 0 0 0 0 0 1 0 1 0 0 in Mat 4 × 4 ( F 2 ) . Many others can be found by conjugacy.
The group G 0 generated by these two matrices has 2520 elements. For each g G 0 , we can make the block matrix g 0 0 0 0 0 g 0 0 0 0 0 g 0 0 0 0 0 g 0 0 0 0 0 g Mat 20 × 20 ( F 2 ) that is identified with g. The matrix h to generate H could be the block matrix h = 0 0 0 I 0 I 0 0 0 0 0 I 0 0 0 0 0 I 0 0 0 0 0 0 I Mat 20 × 20 ( F 2 ) , where I is the identity matrix in Mat 4 × 4 ( F 2 ) .
At this point, it is necessary to decide which elements of M that are valid. This  decision requires some analysis of the group ring and the orbits because our intention is to remove the elements that could have a recognizable behavior in the tables. We have to analyze the Z [ G ] structure of M. It is equivalent to use this structure or the F 2 [ G ] -structure because m has characteristic two, thus we can take R = Z [ G ] or R = F 2 [ G ] .
The R-module M has a composition series 0 = M 0 M 1 M 2 M 3 M 4 M 5 = M , in which M i + 1 / M i are simple R-modules. The composition series in this case has M i + 1 / M i always isomorphic to F 2 4 , the vector space of 16 elements with the structure given by G 0 × F 2 4 F 2 4 (note that G 0 and G are isomorphic). The Jordan–Hölder theorem says that any other composition series 0 = M 0 M 1 M 2 M 3 M 4 M 5 = M has the same length and M i + 1 / M i is also isomorphic to the same simple module.
We use a very simple decomposition in blocks that makes the structure visible. The structure (up to isomorphism) is not changed if we consider a conjugated action given by t 1 G t with any invertible matrix t. It is better to make the theoretical analysis with the original version and apply the conjugation afterwards.
It is an obvious choice to remove the element 0, but we also remove the elements of the different R-modules that can appear in the first two steps. In the version before conjugation, the elements ( m 0 , m 1 , m 2 , m 3 , m 4 ) M such that they can appear in the position M 1 in the composition series are the ones such that dim ( span ( m 0 , m 1 , m 2 , m 3 , m 4 ) ) 1 , and the ones that can appear in the position M 2 are the ones such that dim ( span ( m 0 , m 1 , m 2 , m 3 , m 4 ) ) 2 . If we want to consider them as forbidden elements, we have to restrict the subset of valid elements to those ones such that dim ( span ( m 0 , m 1 , m 2 , m 3 , m 4 ) ) 3 or a subset of these elements. There are 1 , 015 , 560 elements satisfying this condition. They are distributed in 403 orbits with 2520 elements per orbit.
They can be classified using matrices 4 × 5 with columns ( m 0 , m 1 , m 2 , m 3 , m 4 ) and defined normal forms for the generator of the orbits. Consider a map f : { 0 , 1 , 2 } { 0 , 1 , 2 , 3 , 4 } strictly increasing. We fix in the vectors 1 0 0 0 , 0 1 0 0 and 0 0 1 0 in the positions f ( 0 ) , f ( 1 ) and f ( 2 ) . The rest of the values will be free if they keep the matrix in an almost echelon form. Strictly speaking, it is not an echelon form because the group can reduce only three positions (it is not the full group of invertible matrices). The generators are given in Table 1.
For each heading space, we have to choose which elements are used. We have to be careful to have multiple representations for each element in V, but we can choose the orbits we want. We could decide to have heading spaces with a number of orbits between 200 and 300 from these 403 ones. The  selection of these orbits can be made in order to get properties such as overlapping orbits (see Section 3.4). For example, consider X and X as two heading spaces that have an orbit ( G , i ) overlapped. We define at the same time two reductions r : X Y and r : X Y . The types of the reductions r and r are ( h , b ) and ( h , b ) . We select a value x i X and x i X to be the base point on these orbits and finally we compute u g : = h 1 ( g x i + b ) , v g : = ( h ) 1 ( g x i + b ) for all g G . The values u g and v g will belong to some orbits, the idea is to choose the orbits in Y and Y in such a way that u g and v g are not valid elements in Y and Y at the same time. The rest of the orbits can be chosen randomly, bearing in mind that some of them are now forbidden to have a correct definition of r and r in the overlapped orbit ( G , i ) . The forbidden elements in the orbits are filled in tables r and r with fake values that can be part of different heading spaces, as explained in Section 3.4.
Let k 1 , k 2 , , k n be the number of orbits for each heading space. If they are between 200 and 300, we can consider that the number of elements in the combined heading space will be around 250 n . The  representation of each element is an index i for the orbit (two bytes) and two other bytes for the group element g G . The size of the tables required for these combinations of heading spaces and reductions are 2520 · 250 · n · 4 bytes, that is 2 . 5 n megabytes where n is the number of heading spaces. A big implementation could use eight heading spaces, and therefore a number around 200 megabytes would be reasonable.
The rest of the implementation would require tables for input and output, and also for possible S-boxes, another 200 megabytes could be required and the code depends on the algorithm, but could be another 100 megabytes. If we put together all these numbers, the size of a big implementation would be around 500 megabytes.
If the attacker knows the details of this construction, the security would be based on the choice of an invertible matrix t such that the actual group G would be t G t 1 . The number of choices for the non-arithmetical part is the number of maps E E . They do not even have to be bijective, thus the number is 16 16 = 2 64 . The number of choices for t is i = 0 15 ( 2 16 2 i ) 2 254 . 2 . The conjugation by t induces a new relation between M and V as well as a change in the base points used to represent the classes. The search for the conjugacy matrix is much more difficult than the standard conjugacy search problem, because only partial information is visible.

6. Conclusions

White box implementations are not a simple task. The protection of the arithmetic is something that requires a lot of resources, which might not be available (especially on IoT applications), therefore it is critical to decide which are the elements that should be protected. The method presented in this paper can be used to obfuscate the arithmetic of a commutative group using a related non-commutative group. The idea of the paper is to completely shuffle the additive structure and use the endomorphisms to make computations.
Non-commutative groups are attracting the attention of the cryptographic community because there are many hard problems related to them that can be used for cryptographic purposes. The  method presented in this paper is very flexible and it is possible to modify the implementations by conjugation. This makes it possible to generate a huge amount of essentially different implementations based on the same original groups. The search for this conjugacy is not the only problem that the attacker has to solve, because many different choices can be made to increase the difficulty of the analysis.

7. Patents

The contents of this paper may be related to the following patent applications: WO2018015325 and WO2018115143.

Funding

This research was funded by Philips as part of a research contract between Philips and the University of Murcia.

Acknowledgments

This research was made while the author was on the Philips premises at the High Tech Campus (Eindhoven, The Netherlands). The author would like to thank the friendly environment and hospitality of the Philips research group.

Conflicts of Interest

The author declares no conflict of interest.

Abbreviations

   The following abbreviations are used in this manuscript:
DITECDepartamento de Ingeniería y Tecnología de Computadores
DRMDigital Rights Management
IoTInternet of Things
AESAdvanced Encryption Standard
DESData Encryption Standard
CSPConjugacy Search Problem

Appendix A. Summary of Mathematical Concepts and Notations

This appendix contains some standard mathematical definitions and notations used in this paper. For further references we suggest the book by Bhattacharya et al. ([18], Chapters 1–14) for basic definitions, the book by Wisbauer ([13], Sections 1–6) for rings and modules and the books by Lam [19] and Aschbacher [20] for group representations and more advanced results on group theory and connections with rings and modules.
GroupA set G with an operation · : G × G G that is associative. There exists an element 1 G such that 1 g = g 1 = g for all g G and for every g G there exists g 1 G such that g · g 1 = 1 = g 1 · g .
Commutative GroupA set M with an operation + : M × M M that is associative and commutative. There exists an element 0 M such that 0 + m = m + 0 = m for all m M and for every m M there exists m M such that m + ( m ) = ( m ) + m = 0 .
RingA set R with two operations + , · : R × R R and two special elements 0 , 1 R such that ( R , + , 0 ) is a commutative group, the multiplication · is associative, r · 1 = 1 · r for all r R , and r ( s + t ) = r s + r t for all r , s , t R .
Commutative RingA ring R is said to be commutative if the multiplication is commutative. Examples are Z , the ring of integers and Z n the ring of modular integers for any integer n > 1 .
FieldA commutative ring in with every nonzero element r there exists r 1 R such that r · r 1 = 1 . Examples of fields are the rationals and the modular integers Z p when p is a prime number. If p is a prime, the field Z p can be denoted F p . For instance, Z 2 and F 2 are exactly the same thing.
ModuleLet R be a ring and M be a commutative group, we say that M is a module over the ring R if we have a multiplication · : R × M M such that ( r + s ) m = r m + s m , r ( m + n ) = r m + r n , 1 m = m and ( r s ) m = r ( s m ) for all r , s R and m , n M . Every commutative group M is, in particular, a module over Z using the multiplication r m = m + m + + m (r-times) and ( r ) m = r ( m ) for any integer r 0 and m M . If R is a field, the modules over R are the vector spaces.
Group HomomorphismLet G and H be groups. A map f : G H is said to be a group homomorphism if f ( k · g ) = f ( k ) · f ( g ) for all k , g G and f ( 1 ) = 1 . If the groups are commutative, a homomorphism f : M N should satisfy f ( m + k ) = f ( m ) + f ( k ) for all m , k M and f ( 0 ) = 0 .
Group IsomorphismA group homomorphism f is said to be a group isomorphism if the map f is bijective. The inverse map will also be a group isomorphism.
Group EndomorphismA group homomorphism between the group and itself is called an endomorphism.
Group AutomorphismA bijective group homomorphism is called automorphism. The set of group automorphisms is itself a group with the composition and the identity map as 1. Let p be a prime number and Z p the field of modular integers. The group of invertible matrices over Z p is an example of an automorphism group, because the automorphisms of Z p × Z p × × Z p can be identified with the invertible square matrices.
Module HomomorphismLet M and N be modules over R and f : M N a group homomorphism considered as abelian groups. We say that f is a module homomorphism if f ( r m ) = r f ( m ) for all r R and m M . Using this additional property, we can define module isomorphisms, endomorphisms and automorphisms. If R = Z , the module homomorphisms and group homomorphisms are the same thing because f ( r m ) = f ( m + m + + m ) = f ( m ) + f ( m ) + + f ( m ) = r f ( m ) . If R is a field, the module homomorphisms are the usual linear maps that can be identified with the matrices over the field.
Endomorphism RingLet M be a module over the ring R. The set of endomorphisms of M can be endowed with a ring structure if we define the addition of two endomorphisms f + g as ( f + g ) ( m ) = f ( m ) + g ( m ) for all m M . If R is a field, this ring is the ring of square matrices. If R = Z or any other ring, the endomorphisms are the natural generalization of matrices and play a similar role.
Direct ProductLet H and G be groups, the set H × G can be endowed with a group structure using the multiplication ( h , g ) ( h , g ) = ( h h , g g ) . With this structure the identity element in H × G is ( 1 , 1 ) . It is straightforward to identify G with the elements { ( g , 1 ) : g G } and H with { ( 1 , h ) : h H } . In this way, the direct product can be written as H G and the elements as products h g with the rule that, although the multiplication in H and G might be non-commutative, the elements of H commute with the elements of G, i.e. g h = h g for all g G and h H .
Semi-direct ProductLet H and G be groups and φ : G Aut ( H ) be a group homomorphism. We denote with φ g : H H the automorphism induced by g via φ . The semi-direct product of these groups, denoted by H φ G , is given by the pairs ( h , g ) with h H and g G endowed with the product ( h , g ) ( h , g ) = ( h φ g ( h ) , g g ) . As we can see, the homomorphism φ acts as a modifier for the product in H. The direct product is a special case of this construction using the trivial homomorphism φ : G Aut ( H ) such that φ g = id H for all g G . Semi-direct products are a very common construction in group theory to build non-commutative groups, for example, the dihedral groups.
Action of a GroupLet G be a group and X be a set. An action of G over X is a map · : G × X X such that 1 · x = x for all x and g · ( h · x ) = ( g · h ) x for all g , h G and all x X . A set X with an action G × X X is called a G-set.
Orbits and StabilizersIf we have an action of G on X, the orbit of an element x G is the subset of X given by { g x : g G } = G x . The stabilizer of the element x is the subgroup of G given by the elements that fix x, G x = { g G : g x = x } . The number of elements of G x is a divisor of the number of elements of G (by Lagrange’s theorem) and the number of elements in the orbit of x is | G | / | G x | (see ([18], Chapter 5, Theorem 4.7)).
Group RingLet G be a finite group and R be a ring. The group ring, denoted R [ G ] or R G , is the set of mappings u : G R with the multiplication given by the rule ( u · v ) ( h ) = g G u ( g ) v ( g 1 h ) . The standard notation for group rings is to identify the map u : G R with the formal sum g G u ( g ) · g and multiply using the standard rules ( r · g ) ( s · h ) = ( r s ) · ( g h ) for all r , s R and g , h G .

Appendix B. Full Detailed Example

In this appendix, we present a small example of the obfuscation of a cryptographic algorithm with the main elements that are commonly used in block ciphers and hash functions, in particular XOR operations and nonlinear permutations combined in several rounds. The example is developed in full detail, including all the tables required for the arithmetic. This requirement makes the example not completely realistic because the tables are much smaller than the ones used in a computer program. The idea of this appendix is to help the reader to reproduce the constructions with a guided example.
In this example, the arithmetic is over the vector space V = F 2 4 , which is the external commutative group. The nonlinear permutation is the first one given in the data encryption standard algorithm
S = ( 14 , 4 , 13 , 1 , 2 , 15 , 11 , 8 , 3 , 10 , 6 , 12 , 5 , 9 , 0 , 7 )
and the algorithm computes the function
ξ : V × V × V × V × V V ( v 0 , v 1 , v 2 , v 3 , v 4 ) ξ ( v 0 , v 1 , v 2 , v 3 , v 4 ) .
The computation combines these values with six hidden keys k 0 , , k 5 V using rounds. These values are the secret information that has to be protected.
Algorithm A1 Example (plain version).
1:
w 1 S ( k 0 v 0 )
2:
w 2 S ( k 1 v 1 w 1 )
3:
w 3 S ( k 2 v 2 w 2 )
4:
w 4 S ( k 3 v 3 w 3 )
5:
w 5 S ( k 4 v 4 w 4 )
6:
return k 5 w 5

Appendix B.1. Intrinsic Vulnerabilities

The first thing that we do with this example is to prove that it is possible to get the key playing with some inputs and outputs, independently of the implementation of the algorithm. This is what we call intrinsic vulnerabilities. Some algorithms reveal information regardless of the implementation. When this happens, it is impossible to get a secure version under the white box premises, because even a black box version of the program would be insecure. In this example, the reason is that the function ξ is too small but we make a white-box version of this function just to show the method, although we know that it is too small to be realistic.
The first and most evident reason this function is insecure is because the number of possible keys is 16 6 = 16777216 . This key space is small enough to be analyzed just by checking all the possibilities with a simple PC.
However, here, we give an attack that uses the nonlinearity of S to break the security. This vulnerability is not a special property of the permutation S that we have chosen. This is something general that can be done for all nonlinear permutations. Linear permutations do not have this vulnerability, but they have many others. Therefore, we cannot get rid of the nonlinearity, because it is a property required for the general security of the algorithms.
As a question of notation, we write the elements of V = F 2 4 using a single hexadecimal value. Thus, for example, the value b , that in binary form is 1010 represents the vector ( 1 , 0 , 1 , 0 ) .
We use the auxiliary function f ( v , u , k ) = k S ( v u ) and the associated functions g 1 ( u ) = f ( 0 , u , k ) f ( 3 , u , k ) and g 2 ( u ) = f ( 4 , u , k ) f ( a , u , k ) . The functions g 1 and g 2 do not depend on k because this value is canceled because k k = 0 . If we compute g 1 ( u ) and g 2 ( u ) for all possible values u, we get that the possible outputs for g 1 are { f , 9 , a , 4 , c , 2 } and the outputs for g 2 are { 4 , 3 , 8 , 2 , e } . If we know the values g 1 ( u ) and g 2 ( u ) for a hidden u, we can obtain the value u looking at the following table
f 9 a 4 c 2 4 0 e 3 b 1 5 f 8 8 2 7 6 9 c 2 3 d e 4 a
The values * are given to inputs that cannot be reached for any correct computation of the functions.
Now, we take the black-boxed version of ξ and fix the inputs v 0 , v 1 , v 2 and v 3 . These values produce a value w 4 after the first 4 rounds. We want to compute the hidden value u = k 4 w 4 , and, to do that, we see that f ( v , u , k 5 ) = ξ ( v 0 , v 1 , v 2 , v 3 , v ) is precisely k 5 S ( v u ) and we can compute the auxiliary values g 1 ( u ) = ξ ( v 0 , v 1 , v 2 , v 3 , 0 ) ξ ( v 0 , v 1 , v 2 , v 3 , 3 ) and g 2 ( u ) = ξ ( v 0 , v 1 , v 2 , v 3 , 3 ) ξ ( v 0 , v 1 , v 2 , v 3 , 4 ) . From the previous table, we get the value u. Now, we only need to compute ξ ( v 0 , v 1 , v 2 , v 3 , 0 ) = k 5 S ( u ) and recover k 5 because k 5 = ξ ( v 0 , v 1 , v 2 , v 3 , 0 ) S ( u ) . This technique has obtained the last key and reduced the problem to the function ξ ( v 0 , v 1 , v 2 , v 3 ) = S 1 ( k 5 ξ ( v 1 , v 2 , v 3 , v 4 , 0 ) ) . This function has exactly the same structure but with one round fewer. We can apply the same technique to get the key k 4 and afterwards k 3 , k 2 , k 1 and k 0 by removing the security layers of this algorithm one by one.
A full explanation of the reasons for choosing these particular parameters 0 , 3 , 4 and a is outside the scope of this paper. It is a general technique to break encodings that is much more general and based on differential cryptanalysis. It is especially powerful on block ciphers and there are many publications on the topic. One general book to learn about these techniques is [21].
The main ideas that should remain after this subsection is that the example is merely to show how the arithmetic works with something small and we do not claim that the obfuscated version of this function is secure, because even the black-box version is insecure. Any algorithm can introduce intrinsic vulnerabilities that have to be studied in detail before starting a white-box implementation.

Appendix B.2. Obfuscated Version (Public Elements)

In this subsection, we see a white-box implementation of the function ξ using the techniques explained in this paper. First, we show the public elements that are visible in the program and we make a simple computation. In the following subsection, we give the private elements of the implementation.
Apart for the external commutative group V = F 2 4 that it is part of the public algorithm, the first public element of this obfuscated implementation is the public group G. This group can be given by its multiplication table (Table A1). The structure of the group up to isomorphisms can also be considered public, because it can be easily computed using the multiplication table. The group G can be represented using endomorphisms over multiple commutative groups. For example, we can represent this group using matrices 2 × 2 over the rings Z 10 and also over Z 11 . The correspondence between the element of the group and the matrices is given in Table A2. We include in this table the inverses of the elements in the group that are used during the computation. The value X is used to represent the number 10 in the ring Z 11 .
Table A1. Group operation.
Table A1. Group operation.
g 0 g 1 g 2 g 3 g 4 g 5 g 6 g 7 g 8 g 9 g 10 g 11
g 0 g 0 g 1 g 2 g 3 g 4 g 5 g 6 g 7 g 8 g 9 g 10 g 11
g 1 g 1 g 0 g 5 g 6 g 7 g 2 g 3 g 4 g 10 g 11 g 8 g 9
g 2 g 2 g 5 g 0 g 9 g 8 g 1 g 11 g 10 g 4 g 3 g 7 g 6
g 3 g 3 g 8 g 7 g 10 g 5 g 11 g 1 g 9 g 6 g 2 g 0 g 4
g 4 g 4 g 9 g 6 g 5 g 3 g 10 g 7 g 1 g 2 g 8 g 11 g 0
g 5 g 5 g 2 g 1 g 11 g 10 g 0 g 9 g 8 g 7 g 6 g 4 g 3
g 6 g 6 g 10 g 4 g 8 g 2 g 9 g 0 g 11 g 3 g 5 g 1 g 7
g 7 g 7 g 11 g 3 g 2 g 6 g 8 g 4 g 0 g 5 g 10 g 9 g 1
g 8 g 8 g 3 g 11 g 1 g 9 g 7 g 10 g 5 g 0 g 4 g 6 g 2
g 9 g 9 g 4 g 10 g 7 g 1 g 6 g 5 g 3 g 11 g 0 g 2 g 8
g 10 g 10 g 6 g 9 g 0 g 11 g 4 g 8 g 2 g 1 g 7 g 3 g 5
g 11 g 11 g 7 g 8 g 4 g 0 g 3 g 2 g 6 g 9 g 1 g 5 g 10
Table A2. Group representations.
Table A2. Group representations.
Group End ( Z 10 2 ) End ( Z 11 2 ) Inverse
g 0 1 0 0 1 1 0 0 1 g 0
g 1 9 7 0 1 X 2 0 1 g 1
g 2 1 3 0 9 1 9 0 X g 2
g 3 9 2 2 5 6 1 1 4 g 10
g 4 5 2 2 1 7 1 1 5 g 11
g 5 9 0 0 9 X 0 0 X g 5
g 6 1 5 8 9 5 2 X 6 g 6
g 7 5 7 8 5 4 4 X 7 g 7
g 8 5 3 2 5 7 7 1 4 g 8
g 9 9 5 2 1 6 9 1 5 g 9
g 10 5 8 8 9 4 X X 6 g 3
g 11 1 8 8 5 5 X X 7 g 4
These matrices are used to operate the elements of the group with the elements of the heading spaces, which in this case are Z 10 2 and Z 11 2 . The elements of the heading spaces are denoted as column vectors and the operation by the elements of G is done using the standard multiplication of matrices. If we multiply g i with the head u v , we first have to know where the head is. If it is in Z 10 2 , we use the matrix associated to g i over Z 10 in Table A2, and, if the head is in Z 11 2 , we use the matrix over Z 11 given in the same table.
We have two reduction maps that switch the representations between the two heading spaces. The reduction R 0 , given in Table A3, takes values in Z 10 2 and gives the results in Z 11 2 . The reduction R 1 , given in Table A4, works the other way round. The values are given in Table A3 and  Table A4.
Table A3. Reduction 0.
Table A3. Reduction 0.
R 0 0 1 2 3 4 5 6 7 8 9
0 4 8 8 0 8 5 0 3 1 5 3 X 1 5 6 4 7 4 6 9
1 1 X 3 0 0 4 5 8 3 9 0 2 2 6 7 X X 6 7 3
2 1 5 0 X 3 X 0 1 9 X 9 6 1 5 8 7 9 5 2 7
3 5 1 X 5 5 0 2 5 X 8 3 9 0 6 5 3 0 1 X 2
4 4 8 6 7 7 2 0 8 7 0 4 7 4 2 1 7 3 8 8 8
5 1 4 X 7 8 X 2 2 6 3 X 6 6 3 1 8 9 3 9 6
6 X 3 3 3 X 1 6 X 9 1 3 4 6 0 0 8 2 1 1 4
7 5 1 8 0 3 0 6 8 3 X 0 X 1 3 5 4 5 0 7 9
8 1 5 8 1 2 9 3 6 1 5 X 7 9 X 0 1 3 X 7 6
9 3 1 9 9 6 2 0 9 2 6 0 6 2 9 2 4 0 7 3 0
Table A4. Reduction 1.
Table A4. Reduction 1.
R 1 0 1 2 3 4 5 6 7 8 9 X
0 7 3 7 3 1 5 6 9 8 2 1 7 9 3 8 2 4 2 7 6 2 1
1 9 7 4 1 5 7 9 5 3 3 4 4 8 3 3 0 8 1 5 3 6 6
2 9 8 4 1 8 8 9 2 4 5 0 3 9 8 4 0 8 0 9 4 0 2
3 2 9 7 8 9 3 4 7 7 9 2 9 5 4 8 2 0 4 2 3 3 9
4 4 8 1 5 9 7 6 3 5 3 8 7 3 5 4 6 1 1 7 7 1 0
5 9 2 4 9 5 3 8 9 4 3 7 7 7 7 8 5 0 8 9 0 3 3
6 5 8 7 9 9 0 3 1 5 1 7 7 8 3 5 9 3 5 5 3 6 3
7 4 8 5 2 7 7 5 7 2 7 9 3 8 7 5 3 5 3 0 2 3 4
8 9 1 1 9 8 7 1 0 8 2 6 5 2 7 1 3 4 7 5 1 6 2
9 4 6 9 7 1 6 1 0 4 0 2 8 6 8 4 5 7 3 6 0 0 7
X 6 2 1 8 5 3 0 1 7 0 8 3 5 2 8 6 9 5 1 1 1 7
This algorithm requires an extra table to compute the nonlinear permutation S. This table is also used for the output and is called B (see Table A5).
Table A5. B map.
Table A5. B map.
B 0 1 2 3 4 5 6 7 8 9
0 0 0 7 0 3 1 0 5 2 3 0 0 2 3 2 9 4 3 0 0
1 2 2 8 3 9 1 1 3 0 0 3 2 1 4 0 7 9 5 9 5
2 2 3 1 3 0 2 1 0 0 2 8 2 2 3 3 7 1 8 6 8
3 8 2 3 3 2 1 6 4 4 0 6 8 0 0 6 3 0 0 0 0
4 5 3 0 4 1 1 3 2 4 3 1 5 0 8 4 3 1 9 6 8
5 0 0 7 1 0 3 1 2 3 2 0 0 3 2 9 7 5 7 8 2
6 1 8 6 8 9 5 0 1 0 8 3 3 0 9 3 2 1 0 6 5
7 8 2 7 0 0 0 6 3 0 0 1 3 4 0 3 3 2 1 4 9
8 2 3 0 8 1 8 4 5 2 3 7 1 0 2 1 0 0 2 6 8
9 1 0 0 9 0 6 0 7 1 4 8 2 0 0 1 0 9 1 8 3
For each possible input, we need the values that are used to compute it in the algorithm. The  first input ( v 0 ) is introduced using a head in Z 10 2 and the other input values is introduced using three group values for each input. The values are given in Table A6.
Table A6. Input table.
Table A6. Input table.
I T v 0 v 1 v 2 v 3 v 4
i0123456789101112
0 3 3 g 1 g 8 g 9 g 6 g 1 g 6 g 4 g 3 g 1 g 11 g 6 g 3
1 8 2 g 8 g 5 g 11 g 8 g 7 g 4 g 9 g 4 g 3 g 1 g 1 g 4
2 1 8 g 6 g 7 g 0 g 7 g 10 g 1 g 1 g 4 g 11 g 11 g 1 g 2
3 0 1 g 3 g 5 g 3 g 2 g 2 g 5 g 9 g 11 g 4 g 11 g 6 g 8
4 6 8 g 9 g 8 g 9 g 6 g 8 g 4 g 11 g 8 g 7 g 9 g 10 g 8
5 9 5 g 11 g 1 g 5 g 1 g 4 g 7 g 0 g 3 g 3 g 0 g 9 g 9
6 1 0 g 2 g 10 g 0 g 6 g 3 g 7 g 1 g 6 g 5 g 8 g 3 g 7
7 6 7 g 3 g 1 g 8 g 4 g 2 g 1 g 1 g 3 g 0 g 1 g 4 g 1
8 3 1 g 3 g 8 g 1 g 6 g 0 g 1 g 0 g 11 g 5 g 6 g 9 g 11
9 7 8 g 5 g 11 g 5 g 4 g 1 g 7 g 3 g 9 g 7 g 1 g 7 g 5
a 0 2 g 10 g 7 g 0 g 6 g 0 g 5 g 11 g 6 g 8 g 5 g 4 g 5
b 1 9 g 2 g 6 g 2 g 5 g 6 g 0 g 5 g 8 g 2 g 1 g 8 g 10
c 7 0 g 8 g 5 g 9 g 4 g 6 g 1 g 3 g 10 g 1 g 1 g 6 g 11
d 1 3 g 1 g 8 g 11 g 5 g 0 g 2 g 2 g 8 g 3 g 8 g 5 g 0
e 2 3 g 10 g 7 g 6 g 4 g 8 g 2 g 8 g 10 g 9 g 8 g 9 g 7
f 2 9 g 8 g 11 g 8 g 10 g 9 g 4 g 3 g 1 g 6 g 9 g 8 g 10
The reduction step in this algorithm, which is called step , swaps the heads between Z 10 2 and Z 11 2 .
Algorithm A2 Basic reduction step.
Require: 
w is a head, g i G
1:
if w Z 10 2 then
2:
return g i R 0 ( g i 1 w )
3:
else { w Z 11 2 }
4:
return g i R 1 ( g i 1 w )
5:
end if
The multiplication of the elements of a group by the heads is done with the matrix representation of the group elements. Therefore, in the computation g i R j ( g i 1 w ) , the matrices corresponding to g i and g i 1 are over different rings. The full implementation is given in Algorithm A3.
The last public element of the implementation is the program itself.
Algorithm A3 Public program (obfuscated version).
1:
w I T 0 ( v 0 )
2:
w step ( I T 1 ( v 1 ) , w )
3:
w step ( g 6 , w )
4:
w step ( I T 2 ( v 1 ) , w )
5:
w step ( I T 3 ( v 1 ) , w )
6:
w B ( w )
7:
w step ( I T 4 ( v 2 ) , w )
8:
w step ( g 4 , w )
9:
w step ( I T 5 ( v 2 ) , w )
10:
w step ( I T 6 ( v 2 ) , w )
11:
w B ( w )
12:
w step ( I T 7 ( v 3 ) , w )
13:
w step ( g 10 , w )
14:
w step ( I T 8 ( v 3 ) , w )
15:
w step ( I T 9 ( v 3 ) , w )
16:
w B ( w )
17:
w step ( I T 10 ( v 4 ) , w )
18:
w step ( g 11 , w )
19:
w step ( I T 11 ( v 4 ) , w )
20:
w step ( I T 12 ( v 4 ) , w )
21:
w B ( w )
22:
return numeric value of w
We see an execution of the whole function with the input values v 0 = 1 , v 1 = 6 , v 2 = a , v 3 = 5 and v 4 = b .
1:
w 8 2
2:
w g 2 R 0 g 2 1 w = 4 4 X 7 R 0 5 7 8 5 8 2 = 6 4
3:
w g 6 R 1 g 6 1 w = 9 5 2 1 R 1 6 9 1 5 6 4 = 0 1
4:
w g 10 R 0 g 10 1 w = 4 X X 6 R 0 9 2 2 5 0 1 = 8 5
5:
w g 0 R 1 g 0 1 w = 1 0 0 1 R 1 1 0 0 1 8 5 = 6 5
6:
w B 6 5 = 3 3
7:
w g 6 R 0 g 6 1 w = 6 9 1 5 R 0 9 5 2 1 3 3 = 9 4
8:
w g 4 R 1 g 4 1 w = 9 2 2 5 R 1 4 X X 6 9 4 = 3 4
9:
w g 0 R 0 g 0 1 w = 1 0 0 1 R 0 1 0 0 1 3 4 = X 8
10:
w g 5 R 1 g 5 1 w = 5 3 2 5 R 1 7 7 1 4 X 8 = 5 8
11:
w B 5 8 = 5 7
12:
w g 0 R 0 g 0 1 w = 1 0 0 1 R 0 1 0 0 1 5 7 = 1 8
13:
w g 10 R 1 g 10 1 w = 5 8 8 9 R 1 6 1 1 4 1 8 = 2 7
14:
w g 3 R 0 g 3 1 w = 7 1 1 5 R 0 1 8 8 5 2 7 = 2 2
15:
w g 3 R 1 g 3 1 w = 5 2 2 1 R 1 5 X X 7 2 2 = 3 1
16:
w B 3 1 = 3 3
17:
w g 1 R 0 g 1 1 w = X 2 0 1 R 0 9 7 0 1 3 3 = 9 6
18:
w g 11 R 1 g 11 1 w = 9 0 0 9 R 1 X 0 0 X 9 6 = 0 7
19:
w g 8 R 0 g 8 1 w = 5 2 X 6 R 0 1 5 8 9 0 7 = 3 X
20:
w g 10 R 1 g 10 1 w = 5 8 8 9 R 1 6 1 1 4 3 X = 4 5
21:
w B 4 5 = 1 5
22:
return 10 · 1 + 5 = f

Appendix B.3. Obfuscated Version (Private Elements)

Beyond this point, we look at the information that is not available to the attacker, whose only visible elements are those given in the previous subsection. Some of the elements might be guessed by the attacker, but they are not visible.
The keys used in this implementation are k 0 = c , k 1 = 8 , k 2 = 1 , k 3 = f , k 4 = 1 and k 5 = 4 . We can check that the obfuscated computation of ξ ( 1 , 6 , a , 5 , b ) given in the previous subsection is correct using Algorithm A1 and the keys provided.
1:
w 1 S ( k 0 v 0 ) = S ( d ) = 9
2:
w 2 S ( k 1 v 1 w 1 ) = S ( 7 ) = 8
3:
w 3 S ( k 2 v 2 w 2 ) = S ( 3 ) = 1
4:
w 4 S ( k 3 v 3 w 3 ) = S ( b ) = c
5:
w 5 S ( k 4 v 4 w 4 ) = S ( 6 ) = b
6:
return k 5 w 5 = f
One of the things that could be surprising at first sight to someone not used to this arithmetic is that, although we make computations in the vector space V = F 2 4 , we use matrices over the rings Z 10 and Z 11 . We only need heading spaces that let us define the actions of the group G up to isomorphism, and in this case the group can be described using these particular matrices.
We give an alternative presentation of the public group G that is used to define further private elements of the obfuscation. The group G can be described as a non-commutative group generated by three elements, u , v and w, such that u 3 = v 2 = w 2 = 1 . The element w commutes with all the others, but the other two do not commute because u v = v u 2 . All the elements of the group can be written as w i v j v k for i { 0 , 1 } , j { 0 , 1 } and k { 0 , 1 , 2 } . One possible correspondence between the elements of G that we have been using and this representation is given in Table A7.
Table A7. Group correspondences.
Table A7. Group correspondences.
Group w i v j u k
g 0 1
g 1 w v u
g 2 v u
g 3 u 2
g 4 w u
g 5 w
g 6 w v u 2
g 7 v
g 8 w v
g 9 v u 2
g 10 u
g 11 w u 2
Although this group can be found using 4 × 4 -matrices over F 2 (in fact, there are 30,240 ways to select u , v and w matching the conditions in Mat 4 × 4 ( F 2 ) ), the implementation uses the internal commutative group M = F 2 6 and thus 6 × 6 matrices over F 2 to represent the endomorphisms.
The computation of the real value represented by each element and the control values is done with the matrix P = 1 1 1 0 0 1 1 1 0 1 0 0 0 1 1 1 0 0 0 1 0 0 1 1 1 1 1 0 1 0 1 1 1 1 0 1 .
The first four bits are the projection and the last two are a control value. In this case, the control value is computed in the same way during the program.
The representation of G using matrices in Mat 6 × 6 ( F 2 ) is made using the matrices
u = 1 0 1 1 1 0 1 0 1 1 1 1 1 0 0 0 1 1 1 1 0 1 1 1 1 1 0 1 0 0 1 1 0 0 0 1 , v = 1 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 1 0 1 0 1 0 1 1 0 and w = 1 1 1 1 1 1 1 0 1 1 1 0 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0 0 1 0 0 1 1 1 1 0 .
The action of the group G on M = F 2 6 using these matrices generates 11 orbits and all of them are valid elements in this implementation. For each of them, we fix an element m i that is the base point to generate the orbit. The other elements of the orbit are G m i = { g m i : g G } . For each of these representatives, we have to compute the stabilizer to find other elements in the heading spaces that could represent them. The list of representatives and stabilizers over the vector space F 2 6 is given in Table A8. The vectors in F 2 6 are represented in horizontal form, but they should be considered column vectors.
Table A8. Orbits representatives and stabilizers.
Table A8. Orbits representatives and stabilizers.
RepresentativeStabilizer
m 0 = ( 0 , 0 , 0 , 0 , 0 , 0 ) G m 0 = G
m 1 = ( 1 , 1 , 1 , 0 , 1 , 0 ) G m 1 = { 1 , v u 2 }
m 2 = ( 1 , 0 , 0 , 0 , 1 , 0 ) G m 2 = { 1 , v u 2 }
m 3 = ( 1 , 0 , 1 , 0 , 0 , 0 ) G m 3 = { 1 }
m 4 = ( 0 , 1 , 1 , 0 , 0 , 0 ) G m 4 = { 1 , v u 2 , w , w v u 2 }
m 5 = ( 0 , 0 , 0 , 1 , 0 , 0 ) G m 5 = { 1 , w v u }
m 6 = ( 1 , 0 , 0 , 1 , 0 , 0 ) G m 6 = { 1 }
m 7 = ( 1 , 1 , 0 , 0 , 0 , 1 ) G m 7 = { 1 , v u , w , w v u }
m 8 = ( 1 , 0 , 1 , 0 , 0 , 1 ) G m 8 = { 1 , w }
m 9 = ( 0 , 1 , 1 , 0 , 1 , 0 ) G m 9 = { 1 , w v u }
m 10 = ( 1 , 1 , 1 , 1 , 0 , 1 ) G m 10 = { 1 , v u 2 , w , w v u 2 }
If we use the action over the heading spaces with the corresponding matrices given in Table A2, we get more than 11 orbits, but we only need to consider representatives that can extend the arithmetic of the m i . Strictly speaking, the heading spaces are the subsets of Z 10 2 and Z 11 2 that belong to the orbits that we select for the representation, but this is not a problem because we define the tables over the other elements with some random values, and they are not reached during a legitimate execution of the program (unless we introduce fake instructions).
As we have seen, the construction of the correspondences between the heads and the elements of M requires the selection of elements x i and y i in the heading spaces such that that the stabilizer of the element(s) that represents m i in the heading spaces is (are) contained in the stabilizer of m i . In this case, we only use one representative for each m i , although more can be used. This would increase the number of possible representations for each element. In this case, we have multiple representations because, in some cases, the stabilizers of the elements in the heading spaces are strictly smaller than the stabilizers of the corresponding values m i . The tables with the corresponding representative in the heading spaces and the stabilizers of these representatives are given in Table A9 for the heading space Z 10 2 and Table A10 for the heading space Z 11 2 .
Table A9. Representatives in heading space Z 10 2 .
Table A9. Representatives in heading space Z 10 2 .
RepresentativeStabilizer
x 0 = 8 0 G x 0 = { 1 , v u } G = G m 0
x 1 = 0 8 G x 1 = { 1 , v u 2 } { 1 , v u 2 } = G m 1
x 2 = 5 2 G x 2 = { 1 , v u 2 } { 1 , v u 2 } = G m 2
x 3 = 4 7 G x 3 = { 1 } { 1 } = G m 3
x 4 = 5 6 G x 4 = { 1 , v u 2 } { 1 , v u 2 , w , w v u 2 } = G m 4
x 5 = 6 6 G x 5 = { 1 , w v u } { 1 , w v u } = G m 5
x 6 = 6 9 G x 6 = { 1 } { 1 } = G m 6
x 7 = 1 6 G x 7 = { 1 , w v u } { 1 , v u , w , w v u } = G m 7
x 8 = 3 7 G x 8 = { 1 } { 1 , w } = G m 8
x 9 = 7 1 G x 9 = { 1 } { 1 , w v u } = G m 9
x 10 = 6 4 G x 10 = { 1 , w v u 2 } { 1 , v u 2 , w , w v u 2 } = G m 10
Table A10. Representatives in heading space Z 11 2 .
Table A10. Representatives in heading space Z 11 2 .
RepresentativeStabilizer
y 0 = 6 9 G y 0 = { 1 , w v } G = G m 0
y 1 = 2 5 G y 1 = { 1 , v u 2 } { 1 , v u 2 } = G m 1
y 2 = 1 8 G y 2 = { 1 , v u 2 } { 1 , v u 2 } = G m 2
y 3 = 2 6 G y 3 = { 1 } { 1 } = G m 3
y 4 = 6 5 G y 4 = { 1 } { 1 , v u 2 , w , w v u 2 } = G m 4
y 5 = 9 9 G y 5 = { 1 , w v u } { 1 , w v u } = G m 5
y 6 = 8 7 G y 6 = { 1 } { 1 } = G m 6
y 7 = 3 3 G y 7 = { 1 , w v u } { 1 , v u , w , w v u } = G m 7
y 8 = 0 6 G y 8 = { 1 } { 1 , w } = G m 8
y 9 = 8 3 G y 9 = { 1 } { 1 , w v u } = G m 9
y 10 = 5 7 G y 10 = { 1 , v u 2 } { 1 , v u 2 , w , w v u 2 } = G m 10
To build the internal group of the obfuscation, we consider the group H, which is a cyclic group of order 3 generated by an element h. This group has a nontrivial automorphism τ : H H given by τ ( h t ) = h t and we can use it to define φ : G Aut ( H ) by φ ( w i v j u k ) = τ i . This is a group homomorphism because the subgroup generated by w is a direct summand of G. This direct summand has order 2 and thus it is isomorphic to Aut ( H ) . The homomorphism φ can be considered as the projection over the subgroup generated by w and the composition with the isomorphism between this subgroup and Aut ( H ) .
Using φ , we can generate the semi-direct product H φ G . This is the internal group of the obfuscation and it has 36 elements. This group can be represented on Aut ( M ) using the matrix h = 1 1 0 1 0 0 1 0 1 1 1 0 0 0 1 0 0 0 1 0 0 1 0 1 1 0 1 1 1 1 1 1 1 0 0 0 and the previous definitions of u , v and w. This means H φ G is a subgroup of Aut ( M ) . Note that H φ G cannot be given by an extension of G in Mat 2 × 2 ( Z 11 ) , but this is not necessary because we need actions only for the group G over the heading spaces.
We have only one base point b = ( 1 , 0 , 1 , 0 , 1 , 1 ) . Using these values, we can compute the values associated to the heads and links. Suppose g is a link with H-modifier h 2 , then the real value is h 2 g b M and we can use the matrix P to compute P h 2 g b , whose first four bits would be the value in V and the last two the control value.
Given a head x Z 10 2 with H-modifier h, we have to search for a group value g and a representative of the orbit x i such that x = g x i . This value g is a 2 × 2 matrix over Z 10 , but we have to get the matrix associated to the same group element, but in Mat 6 × 6 ( F 2 ) , to compute g m i and finally apply the H-modifier to it. The value in M is h g m i . The value in V and the control values are the first four bits of the vector P h g m i and the last two, respectively.
In this program, we have also included some extra affine transformations that modify the final value in V for heads and links. The flow and the critical points of the program are given in Figure A1.
This figure includes the information for the H-modifiers and the control values at each critical point. The critical points given by inputs with multiples links have H-modifiers for each entry, and they are not equal for all inputs. The only rule is that, at the next critical point, the H-modifier should be correct, and this is checked for all inputs because it depends on the values φ g and the previous H-modifiers.
The addition of keys has been combined with the affine transformations on each connected component, thus it is not necessary to make an explicit computation to add the key.
There are four connected components, I, II, III and IV. Each has an affine transformation that is made at the starting points of the component and restored at the ending point. The addition of the key is combined with the affine constant to get the correct result. The linear transformations and the additive constants are listed in Table A11.
Figure A1. Connected components, flow and critical points.
Figure A1. Connected components, flow and critical points.
Sensors 19 01122 g0a1
Table A11. Affine transformations on connected components.
Table A11. Affine transformations on connected components.
Connected ComponentLinear TransformationAdditive Constant
I 0 1 0 1 1 1 0 1 1 1 1 1 1 1 0 0 a
II 1 1 0 1 0 1 1 1 1 1 0 0 0 0 1 1 8
III 0 1 0 0 0 1 1 1 1 1 0 0 0 1 0 1 6
IV 0 1 0 0 1 0 1 1 0 0 0 1 0 1 1 0 b
Note that it is not necessary to use an output table because, using different control values, table B can be reused for the output when the control value is ( 1 , 1 ) . In this implementation, we have not used dissolving maps because the program is designed to compute combinations of heads and links and the combination of two heads it not required.

References

  1. Chow, S.; Eisen, P.A.; Johnson, H.; van Oorschot, P.C. A white-box DES implementation for DRM applications. In Security and Privacy in Digital Rights Management, Proceedings of the ACM CCS-9 Workshop, DRM 2002, Washington, DC, USA, 18 November 2002; Lecture Notes in Computer Science; Springer: Berlin, Germany, 2003; pp. 1–15. [Google Scholar]
  2. Jacob, M.; Boneh, D.; Felten, E.W. Attacking an obfuscated cipher by injecting faults. In Security and Privacy in Digital Rights Management, Proceedings of the ACM CCS-9 Workshop, DRM 2002, Washington, DC, USA, 18 November 2002; Lecture Notes in Computer Science; Springer: Berlin, Germany, 2003; pp. 16–31. [Google Scholar]
  3. Goubin, L.; Masereel, J.-M.; Quisquater, M. Cryptanalysis of white box DES implementations. In Selected Areas in Cryptography, Proceedings of the 14th International Workshop, SAC 2007, Ottawa, ON, Canada, 16–17 August 2007; Adams, C.M., Miri, A., Wiener, M.J., Eds.; Lecture Notes in Computer Science; Springer: Berlin, Germany, 2007; Volume 4876, pp. 278–295. [Google Scholar]
  4. Chow, S.; Eisen, P.A.; Johnson, H.; van Oorschot, P.C. White-box cryptography and an AES implementation. In Selected Areas in Cryptography, Proceedings of the 9th Annual International Workshop, SAC 2002, St. John’s, NL, Canada, 15–16 August 2002; Nyberg, K., Heys, H.M., Eds.; Lecture Notes in Computer Science; Springer: Berlin, Germany, 2002; Volume 2595, pp. 250–270. [Google Scholar]
  5. Billet, O.; Gilbert, H.; Ech-Chatbi, C. Cryptanalysis of a white box AES implementation. In Selected Areas in Cryptography, Proceedings of the 11th International Workshop, SAC 2004, Waterloo, ON, Canada, 9–10 August 2004; Handschuh, H., Hasan, M.A., Eds.; Lecture Notes in Computer Science; Springer: Berlin, Germany, 2004; Volume 3357, pp. 227–240. [Google Scholar]
  6. Michiels, W.; Gorissen, P.; Hollmann, H.D.L. Cryptanalysis of a generic class of white-box implementations. In Selected Areas in Cryptography, Proceedings of the 15th International Workshop, SAC 2008, Sackville, NB, Canada, 14–15 August 2008; Avanzi, R.M., Keliher, L., Sica, F., Eds.; Lecture Notes in Computer Science; Springer: Berlin, Germany, 2008; Volume 5381, pp. 414–428. [Google Scholar]
  7. Biryukov, A.; Shamir, A. Structural cryptanalysis of SASAS. J. Cryptol. 2010, 23, 505–518. [Google Scholar] [CrossRef]
  8. Whibox Contest. Ches 2017 Capture the Flag Challenge. Available online: https://whibox-contest.github.io/ (accessed on 1 May 2018).
  9. Goubin, L.; Paillier, P.; Rivain, M.; Wang, J. How to reveal the secrets of an obscure white-box implementation. IACR Cryptol. ePrint Arch. 2018, 98, 2018. [Google Scholar]
  10. Biryukov, A.; Udovenko, A. Attacks and countermeasures for white-box designs. In Advances in Cryptology, Proceedings of the ASIACRYPT 2018-24th International Conference on the Theory and Application of Cryptology and Information Security, Brisbane, Australia, 2–6 December 2018; Peyrin, T., Galbraith, S.D., Eds.; Lecture Notes in Computer Science; Springer: Berlin, Germany, 2018; Part II; Volume 11273, pp. 373–402. [Google Scholar]
  11. Myasnikov, A.U.A.; Shpilrain, V. Non-Commutative Cryptography and Complexity of Group-Theoretic Problems; Mathematical Surveys and Monographs 177; American Mathematical Society: Providence, RI, USA, 2011. [Google Scholar]
  12. Nathanson, M.B. Additive Number Theory. Inverse Problems and the Geometry of Sumsets; Graduate Texts in Mathematics 165; Springer: New York, NY, USA, 1996. [Google Scholar]
  13. Wisbauer, R. Foundations of Module and Ring Theory; Gordon and Breach Science Publishers: Washington, DC, USA, 1991. [Google Scholar]
  14. Barak, B.; Goldreich, O.; Impagliazzo, R.; Rudich, S.; Sahai, A.; Vadhan, S.P.; Yang, K. On the (im)possibility of obfuscating programs. In Advances in Cryptology, Proceedings of the CRYPTO 2001, 21st Annual International Cryptology Conference, Santa Barbara, CA, USA, 19–23 August 2001; Kilian, J., Ed.; Lecture Notes in Computer Science; Springer: Berlin, Germany, 2001; Volume 2139, pp. 1–18. [Google Scholar]
  15. Barak, B.; Goldreich, O.; Impagliazzo, R.; Rudich, S.; Sahai, A.; Vadhan, S.P.; Yang, K. On the (im)possibility of obfuscating programs. J. ACM 2012, 59, 6. [Google Scholar] [CrossRef]
  16. Castro, R.R.; López, J.; Gritzalis, S. Evolution and trends in iot security. IEEE Comput. 2018, 51, 16–25. [Google Scholar] [CrossRef]
  17. Roman, R.; López, J.; Mambo, M. Mobile edge computing, fog et al.: A survey and analysis of security threats and challenges. Future Gener. Comput. Syst. 2018, 78, 680–698. [Google Scholar] [CrossRef]
  18. Bhattacharya, P.B.; Jain, S.K.; Nagpaul, S.R. Basic Abstract Algebra, 2nd ed.; Cambridge University Press: Cambridge, UK, 1994. [Google Scholar]
  19. Lam, T.Y. A First Course in Noncommutative Rings; Graduate Texts in Mathematics 131; Springer: Berlin, Germany, 1991. [Google Scholar]
  20. Aschbacher, M. Finite Group Theory; Cambridge Studies in Advanced Mathematics 10; Cambridge University Press: Cambridge, UK, 1986. [Google Scholar]
  21. Knudsen, L.R.; Robshaw, M. The Block Cipher Companion (Information Security and Cryptography); Springer: Berlin, Germany, 2011. [Google Scholar]
Figure 1. Example of a connected component.
Figure 1. Example of a connected component.
Sensors 19 01122 g001
Table 1. Generators and number of orbits.
Table 1. Generators and number of orbits.
fGeneratorsNumber of Orbits
( 0 , 1 , 2 ) 1 0 0 0 1 0 0 0 1 0 0 0 2 8 = 256
( 0 , 1 , 3 ) 1 0 0 0 1 0 0 0 0 1 0 0 0 0 2 6 = 64
( 0 , 2 , 3 ) 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 2 5 = 32
( 1 , 2 , 3 ) 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 2 4 = 16
( 0 , 1 , 4 ) 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 2 4 = 16
( 0 , 2 , 4 ) 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 2 3 = 8
( 0 , 3 , 4 ) 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 2 2 = 4
( 1 , 2 , 4 ) 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 2 2 = 4
( 1 , 3 , 4 ) 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 2 1 = 2
( 2 , 3 , 4 ) 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 2 0 = 1
Total403

Share and Cite

MDPI and ACS Style

Marin, L. White Box Implementations Using Non-Commutative Cryptography. Sensors 2019, 19, 1122. https://doi.org/10.3390/s19051122

AMA Style

Marin L. White Box Implementations Using Non-Commutative Cryptography. Sensors. 2019; 19(5):1122. https://doi.org/10.3390/s19051122

Chicago/Turabian Style

Marin, Leandro. 2019. "White Box Implementations Using Non-Commutative Cryptography" Sensors 19, no. 5: 1122. https://doi.org/10.3390/s19051122

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop