1
1
.. _crypto :
2
2
3
- TinyCrypt Cryptographic Library
4
- ####################################
3
+ TinyCrypt Cryptographic Library
4
+ ###############################
5
5
Copyright (C) 2015 by Intel Corporation, All Rights Reserved.
6
6
7
7
Overview
8
8
********
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
18
18
corresponding header file.
19
19
20
20
* SHA-256:
@@ -76,81 +76,74 @@ corresponding header file.
76
76
* Type of primitive: Digital signature.
77
77
* Standard Specification: RFC 6090.
78
78
* Requires: ECC auxiliary functions (ecc.h/c).
79
-
80
- ===============================================================================
79
+
81
80
Design Goals
82
81
************
83
82
84
83
* Minimize the code size of each cryptographic primitive. This means minimize
85
84
the size of a platform-independent implementation, as presented in TinyCrypt.
86
85
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.
89
88
90
- * Minimize the dependencies among the cryptographic primitives. This means
89
+ * Minimize the dependencies among the cryptographic primitives. This means
91
90
that it is unnecessary to build and allocate object code for more primitives
92
91
than the ones strictly required by the intended application. In other words,
93
92
one can select and compile only the primitives required by the application.
94
93
95
94
96
95
Important Remarks
97
- ***********
96
+ *****************
98
97
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.
104
102
105
103
General Remarks
106
- ===================
104
+ ***************
107
105
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,
112
110
TinyCrypt only implements certain generic timing-attack countermeasures.
113
111
114
112
Specific Remarks
115
- ====================
113
+ ****************
116
114
117
115
* SHA-256:
118
116
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
120
118
however that this will only be a problem if you intend to hash more than
121
119
2^64 bits, which is an extremely large window.
122
120
123
121
* HMAC:
124
122
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
-
129
123
* 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
134
128
function provided in lib/utils.c).
135
129
136
130
* HMAC-PRNG:
137
131
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
141
135
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.
148
141
149
142
* AES-128:
150
143
151
144
* 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
154
147
twice the size as for AES-128, and the key schedule is 40% larger.
155
148
156
149
* CTR mode:
@@ -188,7 +181,7 @@ Specific Remarks
188
181
invocations is defined as 2^(8q) bytes.
189
182
190
183
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
192
185
implications of this choice are:
193
186
194
187
The nonce size is: 13 bytes.
@@ -213,13 +206,13 @@ Specific Remarks
213
206
214
207
* Non-empty associated data and empty payload (it degenerates to an
215
208
authentication-only mode on the associated data).
216
-
209
+
217
210
* RFC-3610, which also specifies CCM, presents a few relevant security
218
211
suggestions, such as: it is recommended for most applications to use a
219
212
mac size greater than 8. Besides, it is emphasized that the usage of the
220
213
same nonce for two different messages which are encrypted with the same
221
214
key obviously destroys the security properties of CCM mode.
222
-
215
+
223
216
* ECC-DH and ECC-DSA:
224
217
225
218
* TinyCrypt ECC implementation is based on nano-ecc (see
@@ -257,10 +250,10 @@ of cryptography usages:
257
250
* Create an authenticated, replay-protected session (HMAC-SHA256 + HMAC-PRNG);
258
251
259
252
* 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);
264
257
265
258
Test Vectors
266
259
************
@@ -306,8 +299,10 @@ References
306
299
307
300
.. _NIST SP 800-38B (AES-CMAC) :
308
301
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) :
311
306
http://csrc.nist.gov/publications/nistpubs/800-38C/SP800-38C_updated-July20_2007.pdf
312
307
313
308
* `NIST Statistical Test Suite `_
0 commit comments