Doc8184 PDF
Doc8184 PDF
Description
Many embedded applications consist of multiple units and often it can be necessary
for one unit to be sure of the identity of another connected unit. For example if a unit
only can be guaranteed to work correctly together with a certain model of another
unit, it needs to make sure what model it is. Just asking is not enough as the other
unit can lie; some form of secure authentication is needed.
This document describes authentication methods between digital devices. They can
be seen as a sort of lock and key; the lock wants to know that the correct key is
present before opening the door. But a physical key is easy to copy, while a secure
digital authentication is virtually impossible to copy.
The information in this document is intended as an introduction and overview to
cryptographic authentication. The reader is encouraged to find more thorough
information about specific algorithms and attacks from other sources, for example the
“Handbook of Applied Cryptography” (see [1], which is freely available on the internet,
and the Cryptography portal (see [2]) on Wikipedia.
Note that Atmel® cannot take responsibility for your company’s security guidelines.
Consult with a specialized security firm to get your implementation validated.
8184A−AVR−09/2012
1. Theory
Authentication can either be mutual, where both parts in the communication wants to be certain of the identity of the
other, or one-way, where only one part wants to authenticate the other. In many embedded applications, a one-way
authentication is probably enough. The authentication has to be secure even when an attacker can listen to all
communication. The authentication does in no way protect the privacy of data sent on the channel; it only proves the
authenticity of one or both parts at the time of authentication.
It is possible to prove the authenticity of every message, but it is more complex and creates a big overhead. In some
applications it might be necessary though and then encryption (a cipher) or keyed Message Authentication Codes
(MACs) can be used. This is not discussed in this document.
To be able to authenticate each other (or authenticate one part), the parts have to share a secret knowledge (that is, a
secret key) and they have to be able to prove that they posses the knowledge to each other without revealing it to
eavesdroppers.
1.1 Challenge-Response
A simple method for two devices to prove that they know the secret key is to exchange challenges (“puzzles”) that are
only (and always) solvable with the use of the correct key. The results are then exchanged and checked if they are
correct. This is called Challenge-Response authentication. For a one-way authentication, only the authenticating part
has to send a challenge to the part that has to authenticate itself.
It is very important that the challenge is different every authentication, otherwise an attacker can hard-code the
response, and then use a simple replay attack. The same applies to a small number of different challenges.
Figure 1-1. Example of a one-way challenge-response with an eavesdropper, highlighting the need to send different
challenges on every authentication.
The transformation can either be a keyed hash function or an encryption function. Only symmetric ciphers are
discussed in this document, asymmetric ciphers generally requires more computing power and is uncommon in
embedded application.
A symmetric encryption algorithm always has a key that determines how transformation is made and the output is the
same size as the input.
Hash algorithms transform an input of variable length into a fixed size output, called a one-way function. Note that it is
important to use a keyed hash algorithm, as un-keyed hash algorithms can be computed by anyone. For a
cryptographic hash, it shouldn’t be possible to find two inputs that generate the same output faster than trial-and-error
(that is, trying different inputs until two with the same output is found, known as a brute-force attack).
2. Key management
For a well-designed authentication, it is probably much easier and cheaper to get hold of the key using other, more
drastic methods than breaking the authentication.
If the key is vital for the profit of the company, it should be considered top secret. There is no need for any employee to
know the key; it can be randomly generated and securely distributed to the machine(s) that will program all devices that
uses the key. The machine(s) does not need to be connected to any network and should be locked away in a high-
security facility.
3.1 Brute-force
Trying all possible keys until the correct one is found is called a brute-force attack. If there are 100 different keys, it
would take on average 50 tries to find the correct key. However, the attacker can be lucky and find the key on the first
attempt, which is always a possibility.
For a 128-bit key it would take on average 2127 (~1.7*1038) transformations to find the correct key. The fastest
computer in the world at the beginning of 2008, the IBM® Sequoia machine, is capable of 16.32*1015 floating point
instructions per second. A machine capable of doing the same amount of transformations per second (which is highly
unlikely, as most encryptions and cryptographic hashes are quite complex) would still need 330 trillion years on average
to find the correct 128-bit key.
Other attacks try to decrease the number of possible keys to a manageable number by finding constraints on the key,
for example dependencies between different parts of the key. Different algorithms are more or less sensitive to this kind
of weaknesses; much research is put into finding those weaknesses and developing new algorithms that doesn’t have
them. Keeping up to date with the latest research for the algorithms you use is important.
Challenge #1
Challenge #1
Authentic device Attacker
Response
Response
This attack can be prevented by either defining an order for the authentication or appending ID information about the
receiver to the challenge before calculating the response, see Figure 3-3. A possible variant of this attack is when the
attacker sends the received challenge to another authentic device instead of the one that originally sent the challenge.
This can also be prevented with the use of ID information.
Challenge #1
Challenge #1 Attacker
Authentic device (pretends to
(ID ”host”) be device with
Response for challenge #1 + ”slave” ID ”slave”)
6. References
1. Handbook of Applied Cryptography.
http://www.cacr.math.uwaterloo.ca/hac/
2. Cryptography Portal.
http://en.wikipedia.org/wiki/Portal:Cryptography
3. Full Key-Recovery Attacks on HMAC/NMAC-MD4 and NMAC-MD5. Pierre-Alain Fouque, Gaëtan Leurent,
Phong Q. Nguyen.
http://www.eleves.ens.fr/home/leurent/files/HMAC_CR07.pdf
4. COPACOBANA. A Codebreaker for DES and other Ciphers.
http://www.copacobana.org/
5. HMAC. Multiple papers.
http://www.cs.ucsd.edu/~mihir/papers/hmac.html
6. DES and 3DES. Federal Information Processing Standards (FIPS, US government).
http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf
7. AES. Federal Information Processing Standards (FIPS, US government).
http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf
8. MD5. RFC1231.
http://tools.ietf.org/html/rfc1321
9. SHA. Federal Information Processing Standards (FIPS, US government).
http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf
Atmel®, Atmel logo and combinations thereof, AVR®, Enabling Unlimited Possibilities®, and others are registered trademarks or trademarks of Atmel Corporation
or its subsidiaries. IBM® is a registered trademark of IBM Corporation in U.S. and or other countries. Other terms and product names may be trademarks of others.
Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this
document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES
NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND PROFITS, BUSINESS INTERRUPTION, OR LOSS OF
INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no
representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and products descriptions at any time
without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in,
automotive applications. Atmel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life.