11.. _crypto :
22
3- TinyCrypt Cryptographic Library
4- ####################################
3+ TinyCrypt Cryptographic Library
4+ ###############################
55Copyright (C) 2015 by Intel Corporation, All Rights Reserved.
66
77Overview
88********
9- The TinyCrypt Library provides an implementation targeting constrained devices
10- of a minimal set of standard cryptography primitives, as listed below. TinyCrypt
11- implementations differ in many aspects from the standard specifications in
12- in the hope to better serve applications targeting constrained devices (see the
13- Important Remarks section for some important differences). Certain cryptographic
14- primitives depend on other primitives , as mentioned in the list below.
15-
16- Besides the Important Remarks section below, valuable information on the usage,
17- security and technicalities of each cryptographic primitive can be found in the
9+ The TinyCrypt Library provides an implementation for targeting constrained devices
10+ with a minimal set of standard cryptography primitives, as listed below. To better
11+ serve applications targeting constrained devices, TinyCrypt implementations differ
12+ from the standard specifications (see the Important Remarks section for some
13+ important differences). Certain cryptographic primitives depend on other
14+ primitives, as mentioned in the list below.
15+
16+ Aside from the Important Remarks section below, valuable information on the usage,
17+ security and technicalities of each cryptographic primitive are found in the
1818corresponding header file.
1919
2020* SHA-256:
@@ -76,81 +76,74 @@ corresponding header file.
7676 * Type of primitive: Digital signature.
7777 * Standard Specification: RFC 6090.
7878 * Requires: ECC auxiliary functions (ecc.h/c).
79-
80- ===============================================================================
79+
8180Design Goals
8281************
8382
8483* Minimize the code size of each cryptographic primitive. This means minimize
8584 the size of a platform-independent implementation, as presented in TinyCrypt.
8685 Note that various applications may require further features, optimizations with
87- respect to other metrics and countermeasures for particular threats. These
88- pecularities would increase the code size and thus are not considered here.
86+ respect to other metrics and countermeasures for particular threats. These
87+ peculiarities would increase the code size and thus are not considered here.
8988
90- * Minimize the dependencies among the cryptographic primitives. This means
89+ * Minimize the dependencies among the cryptographic primitives. This means
9190 that it is unnecessary to build and allocate object code for more primitives
9291 than the ones strictly required by the intended application. In other words,
9392 one can select and compile only the primitives required by the application.
9493
9594
9695Important Remarks
97- ***********
96+ *****************
9897
99- The cryptographic implementations in TinyCrypt library have some limitations.
100- Some of these limitations are inherent to the cryptographic primitives
101- themselves, but others are specific to TinyCrypt in order to meet its design
102- goals (in special, minimal code size) and to better serve applications targeting
103- constrained devices in general. Below, some of these limitations are discussed.
98+ The cryptographic implementations in TinyCrypt library have some limitations.
99+ Some of these limitations are inherent to the cryptographic primitives
100+ themselves, while others are specific to TinyCrypt. Some of these limitations
101+ are discussed in-depth below.
104102
105103General Remarks
106- ===================
104+ ***************
107105
108- * TinyCrypt does **not ** intend to be fully side-channel resistant. There is a huge
109- variety of side-channel attacks, many of them only relevant to certain
110- platforms . In this sense, instead of penalizing all library users with
111- side-channel countermeasures (i.e., increasing the overall code size) ,
106+ * TinyCrypt does **not ** intend to be fully side-channel resistant. Due to the
107+ variety of side-channel attacks, many of them making certain platforms
108+ vulnerable . In this sense, instead of penalizing all library users with
109+ side-channel countermeasures such as increasing the overall code size,
112110 TinyCrypt only implements certain generic timing-attack countermeasures.
113111
114112Specific Remarks
115- ====================
113+ ****************
116114
117115* SHA-256:
118116
119- * The number of bits_hashed in the state is not checked for overflow. Note
117+ * The number of bits_hashed in the state is not checked for overflow. Note
120118 however that this will only be a problem if you intend to hash more than
121119 2^64 bits, which is an extremely large window.
122120
123121* HMAC:
124122
125- * The HMAC state stays in memory after processing. If your application
126- intends to have sensitive data in this buffer, remind to erase it after
127- the data is processed.
128-
129123 * The HMAC verification process is assumed to be performed by the application.
130- This process boils down to compare the computed tag with some given tag.
131- Note that conventional memory comparison methods (such as memcmp function)
132- might be vulnerable to timing attacks, thus be sure to use a constant-time
133- memory comparison function for this purpose (such as compare_constant_time
124+ This compares the computed tag with some given tag.
125+ Note that conventional memory- comparison methods (such as memcmp function)
126+ might be vulnerable to timing attacks; thus be sure to use a constant-time
127+ memory comparison function (such as compare_constant_time
134128 function provided in lib/utils.c).
135129
136130* HMAC-PRNG:
137131
138- * Before using HMAC-PRNG, you *MUST * find an entropy source to produce a seed.
139- PRNGs only stretch the seed into a seemingly random output of arbitrary
140- length. The security of the output is exactly equal to the
132+ * Before using HMAC-PRNG, you *must * find an entropy source to produce a seed.
133+ PRNGs only stretch the seed into a seemingly random output of arbitrary
134+ length. The security of the output is exactly equal to the
141135 unpredictability of the seed.
142-
143- * NIST SP 800-90A requires three items as seed material in the initialization
144- step: entropy seed, personalization and a nonce (which is optional). To
145- achieve small code size, TinyCrypts only requires the personalization
146- (which is always available to the user) and indirectly requires the
147- entropy seed by requiring a mandatory call to the re-seed function).
136+
137+ * NIST SP 800-90A requires three items as seed material in the initialization
138+ step: entropy seed, personalization and a nonce (which is not implemented).
139+ TinyCrypt requires the personalization byte array and automatically creates
140+ the entropy seed using a mandatory call to the re-seed function.
148141
149142* AES-128:
150143
151144 * The current implementation does not support other key-lengths (such as 256
152- bits). Note that if you need AES-256, it doesn't sound as though your
153- application is running in a constrained environment. AES-256 requires keys
145+ bits). Note that if you need AES-256, it doesn't sound as though your
146+ application is running in a constrained environment. AES-256 requires keys
154147 twice the size as for AES-128, and the key schedule is 40% larger.
155148
156149* CTR mode:
@@ -188,7 +181,7 @@ Specific Remarks
188181 invocations is defined as 2^(8q) bytes.
189182
190183 To achieve minimal code size, TinyCrypt CCM implementation fixes q = 2,
191- which is a quite reasonable choice for constrained applications. The
184+ which is a quite reasonable choice for constrained applications. The
192185 implications of this choice are:
193186
194187 The nonce size is: 13 bytes.
@@ -213,13 +206,13 @@ Specific Remarks
213206
214207 * Non-empty associated data and empty payload (it degenerates to an
215208 authentication-only mode on the associated data).
216-
209+
217210 * RFC-3610, which also specifies CCM, presents a few relevant security
218211 suggestions, such as: it is recommended for most applications to use a
219212 mac size greater than 8. Besides, it is emphasized that the usage of the
220213 same nonce for two different messages which are encrypted with the same
221214 key obviously destroys the security properties of CCM mode.
222-
215+
223216* ECC-DH and ECC-DSA:
224217
225218 * TinyCrypt ECC implementation is based on nano-ecc (see
@@ -257,10 +250,10 @@ of cryptography usages:
257250 * Create an authenticated, replay-protected session (HMAC-SHA256 + HMAC-PRNG);
258251
259252 * Authenticated encryption (AES-128 + AES-CCM);
260-
261- * Key-exchange (EC-DH);
262-
263- * Digital signature (EC-DSA);
253+
254+ * Key-exchange (EC-DH);
255+
256+ * Digital signature (EC-DSA);
264257
265258Test Vectors
266259************
@@ -306,8 +299,10 @@ References
306299
307300.. _NIST SP 800-38B (AES-CMAC) :
308301 http://csrc.nist.gov/publications/nistpubs/800-38B/SP_800-38B.pdf
309-
310- - `NIST SP 800-38C (AES-CCM) `_
302+
303+ * `NIST SP 800-38C (AES-CCM) `_
304+
305+ .. _NIST SP 800-38C (AES-CCM) :
311306 http://csrc.nist.gov/publications/nistpubs/800-38C/SP800-38C_updated-July20_2007.pdf
312307
313308* `NIST Statistical Test Suite `_
0 commit comments