diff --git a/AES128_8cpp_source.html b/AES128_8cpp_source.html index 1a843aea..59f4576e 100644 --- a/AES128_8cpp_source.html +++ b/AES128_8cpp_source.html @@ -175,7 +175,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/AES192_8cpp_source.html b/AES192_8cpp_source.html index 185b43d8..71024276 100644 --- a/AES192_8cpp_source.html +++ b/AES192_8cpp_source.html @@ -175,7 +175,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/AES256_8cpp_source.html b/AES256_8cpp_source.html index b255964a..ac29064e 100644 --- a/AES256_8cpp_source.html +++ b/AES256_8cpp_source.html @@ -182,7 +182,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/AESCommon_8cpp_source.html b/AESCommon_8cpp_source.html index fd016229..c18c191c 100644 --- a/AESCommon_8cpp_source.html +++ b/AESCommon_8cpp_source.html @@ -415,7 +415,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/AES_8h_source.html b/AES_8h_source.html index fe250160..6bf45c98 100644 --- a/AES_8h_source.html +++ b/AES_8h_source.html @@ -206,7 +206,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/AuthenticatedCipher_8cpp_source.html b/AuthenticatedCipher_8cpp_source.html index d2236523..29f57afe 100644 --- a/AuthenticatedCipher_8cpp_source.html +++ b/AuthenticatedCipher_8cpp_source.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/AuthenticatedCipher_8h_source.html b/AuthenticatedCipher_8h_source.html index df098438..9a9439c5 100644 --- a/AuthenticatedCipher_8h_source.html +++ b/AuthenticatedCipher_8h_source.html @@ -141,7 +141,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BLAKE2b_8cpp_source.html b/BLAKE2b_8cpp_source.html index 50a1977e..394f1c1f 100644 --- a/BLAKE2b_8cpp_source.html +++ b/BLAKE2b_8cpp_source.html @@ -330,7 +330,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BLAKE2b_8h_source.html b/BLAKE2b_8h_source.html index 154376f2..e580e47b 100644 --- a/BLAKE2b_8h_source.html +++ b/BLAKE2b_8h_source.html @@ -163,7 +163,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BLAKE2s_8cpp_source.html b/BLAKE2s_8cpp_source.html index 8b702994..c0060ca5 100644 --- a/BLAKE2s_8cpp_source.html +++ b/BLAKE2s_8cpp_source.html @@ -322,7 +322,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BLAKE2s_8h_source.html b/BLAKE2s_8h_source.html index 87128561..e1c0ee19 100644 --- a/BLAKE2s_8h_source.html +++ b/BLAKE2s_8h_source.html @@ -162,7 +162,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BigNumberUtil_8cpp_source.html b/BigNumberUtil_8cpp_source.html index 645a56d6..4aa65ae2 100644 --- a/BigNumberUtil_8cpp_source.html +++ b/BigNumberUtil_8cpp_source.html @@ -112,281 +112,452 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
22 
23 #include "BigNumberUtil.h"
24 #include "utility/EndianUtil.h"
-
25 #include <string.h>
-
26 
-
54 void BigNumberUtil::unpackLE(limb_t *limbs, size_t count,
-
55  const uint8_t *bytes, size_t len)
-
56 {
-
57 #if BIGNUMBER_LIMB_8BIT
-
58  if (len < count) {
-
59  memcpy(limbs, bytes, len);
-
60  memset(limbs + len, 0, count - len);
-
61  } else {
-
62  memcpy(limbs, bytes, count);
-
63  }
-
64 #elif CRYPTO_LITTLE_ENDIAN
-
65  count *= sizeof(limb_t);
-
66  if (len < count) {
-
67  memcpy(limbs, bytes, len);
-
68  memset(((uint8_t *)limbs) + len, 0, count - len);
-
69  } else {
-
70  memcpy(limbs, bytes, count);
-
71  }
-
72 #elif BIGNUMBER_LIMB_16BIT
-
73  while (count > 0 && len >= 2) {
-
74  *limbs++ = ((limb_t)(bytes[0])) |
-
75  (((limb_t)(bytes[1])) << 8);
-
76  bytes += 2;
-
77  --count;
-
78  len -= 2;
-
79  }
-
80  if (count > 0 && len == 1) {
-
81  *limbs++ = ((limb_t)(bytes[0]));
-
82  --count;
-
83  }
-
84  while (count > 0) {
-
85  *limbs++ = 0;
-
86  --count;
-
87  }
-
88 #elif BIGNUMBER_LIMB_32BIT
-
89  while (count > 0 && len >= 4) {
-
90  *limbs++ = ((limb_t)(bytes[0])) |
-
91  (((limb_t)(bytes[1])) << 8) |
-
92  (((limb_t)(bytes[2])) << 16) |
-
93  (((limb_t)(bytes[3])) << 24);
-
94  bytes += 4;
-
95  --count;
-
96  len -= 4;
-
97  }
-
98  if (count > 0) {
-
99  if (len == 3) {
-
100  *limbs++ = ((limb_t)(bytes[0])) |
-
101  (((limb_t)(bytes[1])) << 8) |
-
102  (((limb_t)(bytes[2])) << 16);
-
103  } else if (len == 2) {
-
104  *limbs++ = ((limb_t)(bytes[0])) |
-
105  (((limb_t)(bytes[1])) << 8);
-
106  } else if (len == 1) {
-
107  *limbs++ = ((limb_t)(bytes[0]));
-
108  }
-
109  --count;
-
110  }
-
111  while (count > 0) {
-
112  *limbs++ = 0;
-
113  --count;
-
114  }
-
115 #endif
-
116 }
-
117 
-
133 void BigNumberUtil::unpackBE(limb_t *limbs, size_t count,
-
134  const uint8_t *bytes, size_t len)
-
135 {
-
136 #if BIGNUMBER_LIMB_8BIT
-
137  while (count > 0 && len > 0) {
-
138  --count;
-
139  --len;
-
140  *limbs++ = bytes[len];
-
141  }
-
142  memset(limbs, 0, count);
-
143 #elif BIGNUMBER_LIMB_16BIT
-
144  bytes += len;
-
145  while (count > 0 && len >= 2) {
-
146  --count;
-
147  bytes -= 2;
-
148  len -= 2;
-
149  *limbs++ = ((limb_t)(bytes[1])) |
-
150  (((limb_t)(bytes[0])) << 8);
-
151  }
-
152  if (count > 0 && len == 1) {
-
153  --count;
-
154  --bytes;
-
155  *limbs++ = (limb_t)(bytes[0]);
-
156  }
-
157  memset(limbs, 0, count * sizeof(limb_t));
-
158 #elif BIGNUMBER_LIMB_32BIT
-
159  bytes += len;
-
160  while (count > 0 && len >= 4) {
-
161  --count;
-
162  bytes -= 4;
-
163  len -= 4;
-
164  *limbs++ = ((limb_t)(bytes[3])) |
-
165  (((limb_t)(bytes[2])) << 8) |
-
166  (((limb_t)(bytes[1])) << 16) |
-
167  (((limb_t)(bytes[0])) << 24);
-
168  }
-
169  if (count > 0) {
-
170  if (len == 3) {
-
171  --count;
-
172  bytes -= 3;
-
173  *limbs++ = ((limb_t)(bytes[2])) |
-
174  (((limb_t)(bytes[1])) << 8) |
-
175  (((limb_t)(bytes[0])) << 16);
-
176  } else if (len == 2) {
-
177  --count;
-
178  bytes -= 2;
-
179  *limbs++ = ((limb_t)(bytes[1])) |
-
180  (((limb_t)(bytes[0])) << 8);
-
181  } else if (len == 1) {
-
182  --count;
-
183  --bytes;
-
184  *limbs++ = (limb_t)(bytes[0]);
-
185  }
-
186  }
-
187  memset(limbs, 0, count * sizeof(limb_t));
-
188 #endif
-
189 }
-
190 
-
207 void BigNumberUtil::packLE(uint8_t *bytes, size_t len,
-
208  const limb_t *limbs, size_t count)
-
209 {
-
210 #if BIGNUMBER_LIMB_8BIT
-
211  if (len <= count) {
-
212  memcpy(bytes, limbs, len);
-
213  } else {
-
214  memcpy(bytes, limbs, count);
-
215  memset(bytes + count, 0, len - count);
-
216  }
-
217 #elif CRYPTO_LITTLE_ENDIAN
-
218  count *= sizeof(limb_t);
-
219  if (len <= count) {
-
220  memcpy(bytes, limbs, len);
-
221  } else {
-
222  memcpy(bytes, limbs, count);
-
223  memset(bytes + count, 0, len - count);
-
224  }
-
225 #elif BIGNUMBER_LIMB_16BIT
-
226  limb_t word;
-
227  while (count > 0 && len >= 2) {
-
228  word = *limbs++;
-
229  bytes[0] = (uint8_t)word;
-
230  bytes[1] = (uint8_t)(word >> 8);
-
231  --count;
-
232  len -= 2;
-
233  bytes += 2;
-
234  }
-
235  if (count > 0 && len == 1) {
-
236  bytes[0] = (uint8_t)(*limbs);
-
237  --len;
-
238  ++bytes;
-
239  }
-
240  memset(bytes, 0, len);
-
241 #elif BIGNUMBER_LIMB_32BIT
-
242  limb_t word;
-
243  while (count > 0 && len >= 4) {
-
244  word = *limbs++;
-
245  bytes[0] = (uint8_t)word;
-
246  bytes[1] = (uint8_t)(word >> 8);
-
247  bytes[2] = (uint8_t)(word >> 16);
-
248  bytes[3] = (uint8_t)(word >> 24);
-
249  --count;
-
250  len -= 4;
-
251  bytes += 4;
-
252  }
-
253  if (count > 0) {
-
254  if (len == 3) {
-
255  word = *limbs;
-
256  bytes[0] = (uint8_t)word;
-
257  bytes[1] = (uint8_t)(word >> 8);
-
258  bytes[2] = (uint8_t)(word >> 16);
-
259  len -= 3;
-
260  bytes += 3;
-
261  } else if (len == 2) {
-
262  word = *limbs;
-
263  bytes[0] = (uint8_t)word;
-
264  bytes[1] = (uint8_t)(word >> 8);
-
265  len -= 2;
-
266  bytes += 2;
-
267  } else if (len == 1) {
-
268  bytes[0] = (uint8_t)(*limbs);
-
269  --len;
-
270  ++bytes;
-
271  }
-
272  }
-
273  memset(bytes, 0, len);
-
274 #endif
-
275 }
-
276 
-
293 void BigNumberUtil::packBE(uint8_t *bytes, size_t len,
-
294  const limb_t *limbs, size_t count)
-
295 {
-
296 #if BIGNUMBER_LIMB_8BIT
-
297  if (len > count) {
-
298  size_t size = len - count;
-
299  memset(bytes, 0, size);
-
300  len -= size;
-
301  bytes += size;
-
302  } else if (len < count) {
-
303  count = len;
-
304  }
-
305  limbs += count;
-
306  while (count > 0) {
-
307  --count;
-
308  *bytes++ = *(--limbs);
-
309  }
-
310 #elif BIGNUMBER_LIMB_16BIT
-
311  size_t countBytes = count * sizeof(limb_t);
-
312  limb_t word;
-
313  if (len >= countBytes) {
-
314  size_t size = len - countBytes;
-
315  memset(bytes, 0, size);
-
316  len -= size;
-
317  bytes += size;
-
318  limbs += count;
-
319  } else {
-
320  count = len / sizeof(limb_t);
-
321  limbs += count;
-
322  if ((len & 1) != 0)
-
323  *bytes++ = (uint8_t)(*limbs);
-
324  }
-
325  while (count > 0) {
-
326  --count;
-
327  word = *(--limbs);
-
328  *bytes++ = (uint8_t)(word >> 8);
-
329  *bytes++ = (uint8_t)word;
-
330  }
-
331 #elif BIGNUMBER_LIMB_32BIT
-
332  size_t countBytes = count * sizeof(limb_t);
-
333  limb_t word;
-
334  if (len >= countBytes) {
-
335  size_t size = len - countBytes;
-
336  memset(bytes, 0, size);
-
337  len -= size;
-
338  bytes += size;
-
339  limbs += count;
-
340  } else {
-
341  count = len / sizeof(limb_t);
-
342  limbs += count;
-
343  if ((len & 3) == 3) {
-
344  word = *limbs;
-
345  *bytes++ = (uint8_t)(word >> 16);
-
346  *bytes++ = (uint8_t)(word >> 8);
-
347  *bytes++ = (uint8_t)word;
-
348  } else if ((len & 3) == 2) {
-
349  word = *limbs;
-
350  *bytes++ = (uint8_t)(word >> 8);
-
351  *bytes++ = (uint8_t)word;
-
352  } else if ((len & 3) == 1) {
-
353  *bytes++ = (uint8_t)(*limbs);
-
354  }
-
355  }
-
356  while (count > 0) {
-
357  --count;
-
358  word = *(--limbs);
-
359  *bytes++ = (uint8_t)(word >> 24);
-
360  *bytes++ = (uint8_t)(word >> 16);
-
361  *bytes++ = (uint8_t)(word >> 8);
-
362  *bytes++ = (uint8_t)word;
-
363  }
-
364 #endif
-
365 }
-
BigNumberUtil::packBE
static void packBE(uint8_t *bytes, size_t len, const limb_t *limbs, size_t count)
Packs the big-endian byte representation of a big number into a byte array.
Definition: BigNumberUtil.cpp:293
-
BigNumberUtil::unpackLE
static void unpackLE(limb_t *limbs, size_t count, const uint8_t *bytes, size_t len)
Unpacks the little-endian byte representation of a big number into a limb array.
Definition: BigNumberUtil.cpp:54
-
BigNumberUtil::unpackBE
static void unpackBE(limb_t *limbs, size_t count, const uint8_t *bytes, size_t len)
Unpacks the big-endian byte representation of a big number into a limb array.
Definition: BigNumberUtil.cpp:133
-
BigNumberUtil::packLE
static void packLE(uint8_t *bytes, size_t len, const limb_t *limbs, size_t count)
Packs the little-endian byte representation of a big number into a byte array.
Definition: BigNumberUtil.cpp:207
+
25 #include "utility/LimbUtil.h"
+
26 #include <string.h>
+
27 
+
55 void BigNumberUtil::unpackLE(limb_t *limbs, size_t count,
+
56  const uint8_t *bytes, size_t len)
+
57 {
+
58 #if BIGNUMBER_LIMB_8BIT
+
59  if (len < count) {
+
60  memcpy(limbs, bytes, len);
+
61  memset(limbs + len, 0, count - len);
+
62  } else {
+
63  memcpy(limbs, bytes, count);
+
64  }
+
65 #elif CRYPTO_LITTLE_ENDIAN
+
66  count *= sizeof(limb_t);
+
67  if (len < count) {
+
68  memcpy(limbs, bytes, len);
+
69  memset(((uint8_t *)limbs) + len, 0, count - len);
+
70  } else {
+
71  memcpy(limbs, bytes, count);
+
72  }
+
73 #elif BIGNUMBER_LIMB_16BIT
+
74  while (count > 0 && len >= 2) {
+
75  *limbs++ = ((limb_t)(bytes[0])) |
+
76  (((limb_t)(bytes[1])) << 8);
+
77  bytes += 2;
+
78  --count;
+
79  len -= 2;
+
80  }
+
81  if (count > 0 && len == 1) {
+
82  *limbs++ = ((limb_t)(bytes[0]));
+
83  --count;
+
84  }
+
85  while (count > 0) {
+
86  *limbs++ = 0;
+
87  --count;
+
88  }
+
89 #elif BIGNUMBER_LIMB_32BIT
+
90  while (count > 0 && len >= 4) {
+
91  *limbs++ = ((limb_t)(bytes[0])) |
+
92  (((limb_t)(bytes[1])) << 8) |
+
93  (((limb_t)(bytes[2])) << 16) |
+
94  (((limb_t)(bytes[3])) << 24);
+
95  bytes += 4;
+
96  --count;
+
97  len -= 4;
+
98  }
+
99  if (count > 0) {
+
100  if (len == 3) {
+
101  *limbs++ = ((limb_t)(bytes[0])) |
+
102  (((limb_t)(bytes[1])) << 8) |
+
103  (((limb_t)(bytes[2])) << 16);
+
104  } else if (len == 2) {
+
105  *limbs++ = ((limb_t)(bytes[0])) |
+
106  (((limb_t)(bytes[1])) << 8);
+
107  } else if (len == 1) {
+
108  *limbs++ = ((limb_t)(bytes[0]));
+
109  }
+
110  --count;
+
111  }
+
112  while (count > 0) {
+
113  *limbs++ = 0;
+
114  --count;
+
115  }
+
116 #endif
+
117 }
+
118 
+
134 void BigNumberUtil::unpackBE(limb_t *limbs, size_t count,
+
135  const uint8_t *bytes, size_t len)
+
136 {
+
137 #if BIGNUMBER_LIMB_8BIT
+
138  while (count > 0 && len > 0) {
+
139  --count;
+
140  --len;
+
141  *limbs++ = bytes[len];
+
142  }
+
143  memset(limbs, 0, count);
+
144 #elif BIGNUMBER_LIMB_16BIT
+
145  bytes += len;
+
146  while (count > 0 && len >= 2) {
+
147  --count;
+
148  bytes -= 2;
+
149  len -= 2;
+
150  *limbs++ = ((limb_t)(bytes[1])) |
+
151  (((limb_t)(bytes[0])) << 8);
+
152  }
+
153  if (count > 0 && len == 1) {
+
154  --count;
+
155  --bytes;
+
156  *limbs++ = (limb_t)(bytes[0]);
+
157  }
+
158  memset(limbs, 0, count * sizeof(limb_t));
+
159 #elif BIGNUMBER_LIMB_32BIT
+
160  bytes += len;
+
161  while (count > 0 && len >= 4) {
+
162  --count;
+
163  bytes -= 4;
+
164  len -= 4;
+
165  *limbs++ = ((limb_t)(bytes[3])) |
+
166  (((limb_t)(bytes[2])) << 8) |
+
167  (((limb_t)(bytes[1])) << 16) |
+
168  (((limb_t)(bytes[0])) << 24);
+
169  }
+
170  if (count > 0) {
+
171  if (len == 3) {
+
172  --count;
+
173  bytes -= 3;
+
174  *limbs++ = ((limb_t)(bytes[2])) |
+
175  (((limb_t)(bytes[1])) << 8) |
+
176  (((limb_t)(bytes[0])) << 16);
+
177  } else if (len == 2) {
+
178  --count;
+
179  bytes -= 2;
+
180  *limbs++ = ((limb_t)(bytes[1])) |
+
181  (((limb_t)(bytes[0])) << 8);
+
182  } else if (len == 1) {
+
183  --count;
+
184  --bytes;
+
185  *limbs++ = (limb_t)(bytes[0]);
+
186  }
+
187  }
+
188  memset(limbs, 0, count * sizeof(limb_t));
+
189 #endif
+
190 }
+
191 
+
208 void BigNumberUtil::packLE(uint8_t *bytes, size_t len,
+
209  const limb_t *limbs, size_t count)
+
210 {
+
211 #if BIGNUMBER_LIMB_8BIT
+
212  if (len <= count) {
+
213  memcpy(bytes, limbs, len);
+
214  } else {
+
215  memcpy(bytes, limbs, count);
+
216  memset(bytes + count, 0, len - count);
+
217  }
+
218 #elif CRYPTO_LITTLE_ENDIAN
+
219  count *= sizeof(limb_t);
+
220  if (len <= count) {
+
221  memcpy(bytes, limbs, len);
+
222  } else {
+
223  memcpy(bytes, limbs, count);
+
224  memset(bytes + count, 0, len - count);
+
225  }
+
226 #elif BIGNUMBER_LIMB_16BIT
+
227  limb_t word;
+
228  while (count > 0 && len >= 2) {
+
229  word = *limbs++;
+
230  bytes[0] = (uint8_t)word;
+
231  bytes[1] = (uint8_t)(word >> 8);
+
232  --count;
+
233  len -= 2;
+
234  bytes += 2;
+
235  }
+
236  if (count > 0 && len == 1) {
+
237  bytes[0] = (uint8_t)(*limbs);
+
238  --len;
+
239  ++bytes;
+
240  }
+
241  memset(bytes, 0, len);
+
242 #elif BIGNUMBER_LIMB_32BIT
+
243  limb_t word;
+
244  while (count > 0 && len >= 4) {
+
245  word = *limbs++;
+
246  bytes[0] = (uint8_t)word;
+
247  bytes[1] = (uint8_t)(word >> 8);
+
248  bytes[2] = (uint8_t)(word >> 16);
+
249  bytes[3] = (uint8_t)(word >> 24);
+
250  --count;
+
251  len -= 4;
+
252  bytes += 4;
+
253  }
+
254  if (count > 0) {
+
255  if (len == 3) {
+
256  word = *limbs;
+
257  bytes[0] = (uint8_t)word;
+
258  bytes[1] = (uint8_t)(word >> 8);
+
259  bytes[2] = (uint8_t)(word >> 16);
+
260  len -= 3;
+
261  bytes += 3;
+
262  } else if (len == 2) {
+
263  word = *limbs;
+
264  bytes[0] = (uint8_t)word;
+
265  bytes[1] = (uint8_t)(word >> 8);
+
266  len -= 2;
+
267  bytes += 2;
+
268  } else if (len == 1) {
+
269  bytes[0] = (uint8_t)(*limbs);
+
270  --len;
+
271  ++bytes;
+
272  }
+
273  }
+
274  memset(bytes, 0, len);
+
275 #endif
+
276 }
+
277 
+
294 void BigNumberUtil::packBE(uint8_t *bytes, size_t len,
+
295  const limb_t *limbs, size_t count)
+
296 {
+
297 #if BIGNUMBER_LIMB_8BIT
+
298  if (len > count) {
+
299  size_t size = len - count;
+
300  memset(bytes, 0, size);
+
301  len -= size;
+
302  bytes += size;
+
303  } else if (len < count) {
+
304  count = len;
+
305  }
+
306  limbs += count;
+
307  while (count > 0) {
+
308  --count;
+
309  *bytes++ = *(--limbs);
+
310  }
+
311 #elif BIGNUMBER_LIMB_16BIT
+
312  size_t countBytes = count * sizeof(limb_t);
+
313  limb_t word;
+
314  if (len >= countBytes) {
+
315  size_t size = len - countBytes;
+
316  memset(bytes, 0, size);
+
317  len -= size;
+
318  bytes += size;
+
319  limbs += count;
+
320  } else {
+
321  count = len / sizeof(limb_t);
+
322  limbs += count;
+
323  if ((len & 1) != 0)
+
324  *bytes++ = (uint8_t)(*limbs);
+
325  }
+
326  while (count > 0) {
+
327  --count;
+
328  word = *(--limbs);
+
329  *bytes++ = (uint8_t)(word >> 8);
+
330  *bytes++ = (uint8_t)word;
+
331  }
+
332 #elif BIGNUMBER_LIMB_32BIT
+
333  size_t countBytes = count * sizeof(limb_t);
+
334  limb_t word;
+
335  if (len >= countBytes) {
+
336  size_t size = len - countBytes;
+
337  memset(bytes, 0, size);
+
338  len -= size;
+
339  bytes += size;
+
340  limbs += count;
+
341  } else {
+
342  count = len / sizeof(limb_t);
+
343  limbs += count;
+
344  if ((len & 3) == 3) {
+
345  word = *limbs;
+
346  *bytes++ = (uint8_t)(word >> 16);
+
347  *bytes++ = (uint8_t)(word >> 8);
+
348  *bytes++ = (uint8_t)word;
+
349  } else if ((len & 3) == 2) {
+
350  word = *limbs;
+
351  *bytes++ = (uint8_t)(word >> 8);
+
352  *bytes++ = (uint8_t)word;
+
353  } else if ((len & 3) == 1) {
+
354  *bytes++ = (uint8_t)(*limbs);
+
355  }
+
356  }
+
357  while (count > 0) {
+
358  --count;
+
359  word = *(--limbs);
+
360  *bytes++ = (uint8_t)(word >> 24);
+
361  *bytes++ = (uint8_t)(word >> 16);
+
362  *bytes++ = (uint8_t)(word >> 8);
+
363  *bytes++ = (uint8_t)word;
+
364  }
+
365 #endif
+
366 }
+
367 
+
381 limb_t BigNumberUtil::add(limb_t *result, const limb_t *x,
+
382  const limb_t *y, size_t size)
+
383 {
+
384  dlimb_t carry = 0;
+
385  while (size > 0) {
+
386  carry += *x++;
+
387  carry += *y++;
+
388  *result++ = (limb_t)carry;
+
389  carry >>= LIMB_BITS;
+
390  --size;
+
391  }
+
392  return (limb_t)carry;
+
393 }
+
394 
+
408 limb_t BigNumberUtil::sub(limb_t *result, const limb_t *x,
+
409  const limb_t *y, size_t size)
+
410 {
+
411  dlimb_t borrow = 0;
+
412  while (size > 0) {
+
413  borrow = ((dlimb_t)(*x++)) - (*y++) - ((borrow >> LIMB_BITS) & 0x01);
+
414  *result++ = (limb_t)borrow;
+
415  --size;
+
416  }
+
417  return ((limb_t)(borrow >> LIMB_BITS)) & 0x01;
+
418 }
+
419 
+
432 void BigNumberUtil::mul(limb_t *result, const limb_t *x, size_t xcount,
+
433  const limb_t *y, size_t ycount)
+
434 {
+
435  size_t i, j;
+
436  dlimb_t carry;
+
437  limb_t word;
+
438  const limb_t *xx;
+
439  limb_t *rr;
+
440 
+
441  // Multiply the lowest limb of y by x.
+
442  carry = 0;
+
443  word = y[0];
+
444  xx = x;
+
445  rr = result;
+
446  for (i = 0; i < xcount; ++i) {
+
447  carry += ((dlimb_t)(*xx++)) * word;
+
448  *rr++ = (limb_t)carry;
+
449  carry >>= LIMB_BITS;
+
450  }
+
451  *rr = (limb_t)carry;
+
452 
+
453  // Multiply and add the remaining limbs of y by x.
+
454  for (i = 1; i < ycount; ++i) {
+
455  word = y[i];
+
456  carry = 0;
+
457  xx = x;
+
458  rr = result + i;
+
459  for (j = 0; j < xcount; ++j) {
+
460  carry += ((dlimb_t)(*xx++)) * word;
+
461  carry += *rr;
+
462  *rr++ = (limb_t)carry;
+
463  carry >>= LIMB_BITS;
+
464  }
+
465  *rr = (limb_t)carry;
+
466  }
+
467 }
+
468 
+
484 void BigNumberUtil::reduceQuick(limb_t *result, const limb_t *x,
+
485  const limb_t *y, size_t size)
+
486 {
+
487  // Subtract "y" from "x" and turn the borrow into an AND mask.
+
488  limb_t mask = sub(result, x, y, size);
+
489  mask = (~mask) + 1;
+
490 
+
491  // Add "y" back to the result if the mask is non-zero.
+
492  dlimb_t carry = 0;
+
493  while (size > 0) {
+
494  carry += *result;
+
495  carry += (*y++ & mask);
+
496  *result++ = (limb_t)carry;
+
497  carry >>= LIMB_BITS;
+
498  --size;
+
499  }
+
500 }
+
501 
+
514 limb_t BigNumberUtil::add_P(limb_t *result, const limb_t *x,
+
515  const limb_t *y, size_t size)
+
516 {
+
517  dlimb_t carry = 0;
+
518  while (size > 0) {
+
519  carry += *x++;
+
520  carry += pgm_read_limb(y++);
+
521  *result++ = (limb_t)carry;
+
522  carry >>= LIMB_BITS;
+
523  --size;
+
524  }
+
525  return (limb_t)carry;
+
526 }
+
527 
+
541 limb_t BigNumberUtil::sub_P(limb_t *result, const limb_t *x,
+
542  const limb_t *y, size_t size)
+
543 {
+
544  dlimb_t borrow = 0;
+
545  while (size > 0) {
+
546  borrow = ((dlimb_t)(*x++)) - pgm_read_limb(y++) - ((borrow >> LIMB_BITS) & 0x01);
+
547  *result++ = (limb_t)borrow;
+
548  --size;
+
549  }
+
550  return ((limb_t)(borrow >> LIMB_BITS)) & 0x01;
+
551 }
+
552 
+
566 void BigNumberUtil::mul_P(limb_t *result, const limb_t *x, size_t xcount,
+
567  const limb_t *y, size_t ycount)
+
568 {
+
569  size_t i, j;
+
570  dlimb_t carry;
+
571  limb_t word;
+
572  const limb_t *xx;
+
573  limb_t *rr;
+
574 
+
575  // Multiply the lowest limb of y by x.
+
576  carry = 0;
+
577  word = pgm_read_limb(&(y[0]));
+
578  xx = x;
+
579  rr = result;
+
580  for (i = 0; i < xcount; ++i) {
+
581  carry += ((dlimb_t)(*xx++)) * word;
+
582  *rr++ = (limb_t)carry;
+
583  carry >>= LIMB_BITS;
+
584  }
+
585  *rr = (limb_t)carry;
+
586 
+
587  // Multiply and add the remaining limb of y by x.
+
588  for (i = 1; i < ycount; ++i) {
+
589  word = pgm_read_limb(&(y[i]));
+
590  carry = 0;
+
591  xx = x;
+
592  rr = result + i;
+
593  for (j = 0; j < xcount; ++j) {
+
594  carry += ((dlimb_t)(*xx++)) * word;
+
595  carry += *rr;
+
596  *rr++ = (limb_t)carry;
+
597  carry >>= LIMB_BITS;
+
598  }
+
599  *rr = (limb_t)carry;
+
600  }
+
601 }
+
602 
+
620 void BigNumberUtil::reduceQuick_P(limb_t *result, const limb_t *x,
+
621  const limb_t *y, size_t size)
+
622 {
+
623  // Subtract "y" from "x" and turn the borrow into an AND mask.
+
624  limb_t mask = sub_P(result, x, y, size);
+
625  mask = (~mask) + 1;
+
626 
+
627  // Add "y" back to the result if the mask is non-zero.
+
628  dlimb_t carry = 0;
+
629  while (size > 0) {
+
630  carry += *result;
+
631  carry += (pgm_read_limb(y++) & mask);
+
632  *result++ = (limb_t)carry;
+
633  carry >>= LIMB_BITS;
+
634  --size;
+
635  }
+
636 }
+
BigNumberUtil::reduceQuick_P
static void reduceQuick_P(limb_t *result, const limb_t *x, const limb_t *y, size_t size)
Reduces x modulo y using subtraction where y is in program memory.
Definition: BigNumberUtil.cpp:620
+
BigNumberUtil::add
static limb_t add(limb_t *result, const limb_t *x, const limb_t *y, size_t size)
Adds two big numbers.
Definition: BigNumberUtil.cpp:381
+
BigNumberUtil::sub_P
static limb_t sub_P(limb_t *result, const limb_t *x, const limb_t *y, size_t size)
Subtracts one big number from another where one is in program memory.
Definition: BigNumberUtil.cpp:541
+
BigNumberUtil::reduceQuick
static void reduceQuick(limb_t *result, const limb_t *x, const limb_t *y, size_t size)
Reduces x modulo y using subtraction.
Definition: BigNumberUtil.cpp:484
+
BigNumberUtil::sub
static limb_t sub(limb_t *result, const limb_t *x, const limb_t *y, size_t size)
Subtracts one big number from another.
Definition: BigNumberUtil.cpp:408
+
BigNumberUtil::mul_P
static void mul_P(limb_t *result, const limb_t *x, size_t xcount, const limb_t *y, size_t ycount)
Multiplies two big numbers where one is in program memory.
Definition: BigNumberUtil.cpp:566
+
BigNumberUtil::packBE
static void packBE(uint8_t *bytes, size_t len, const limb_t *limbs, size_t count)
Packs the big-endian byte representation of a big number into a byte array.
Definition: BigNumberUtil.cpp:294
+
BigNumberUtil::unpackLE
static void unpackLE(limb_t *limbs, size_t count, const uint8_t *bytes, size_t len)
Unpacks the little-endian byte representation of a big number into a limb array.
Definition: BigNumberUtil.cpp:55
+
BigNumberUtil::mul
static void mul(limb_t *result, const limb_t *x, size_t xcount, const limb_t *y, size_t ycount)
Multiplies two big numbers.
Definition: BigNumberUtil.cpp:432
+
BigNumberUtil::unpackBE
static void unpackBE(limb_t *limbs, size_t count, const uint8_t *bytes, size_t len)
Unpacks the big-endian byte representation of a big number into a limb array.
Definition: BigNumberUtil.cpp:134
+
BigNumberUtil::packLE
static void packLE(uint8_t *bytes, size_t len, const limb_t *limbs, size_t count)
Packs the little-endian byte representation of a big number into a byte array.
Definition: BigNumberUtil.cpp:208
+
BigNumberUtil::add_P
static limb_t add_P(limb_t *result, const limb_t *x, const limb_t *y, size_t size)
Adds two big numbers where one of them is in program memory.
Definition: BigNumberUtil.cpp:514
diff --git a/BigNumberUtil_8h_source.html b/BigNumberUtil_8h_source.html index 6c5ecfca..83ffcac6 100644 --- a/BigNumberUtil_8h_source.html +++ b/BigNumberUtil_8h_source.html @@ -151,22 +151,48 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
61  static void packBE(uint8_t *bytes, size_t len,
62  const limb_t *limbs, size_t count);
63 
-
64 private:
-
65  // Constructor and destructor are private - cannot instantiate this class.
-
66  BigNumberUtil() {}
-
67  ~BigNumberUtil() {}
-
68 };
-
69 
-
70 #endif
+
64  static limb_t add(limb_t *result, const limb_t *x,
+
65  const limb_t *y, size_t size);
+
66  static limb_t sub(limb_t *result, const limb_t *x,
+
67  const limb_t *y, size_t size);
+
68  static void mul(limb_t *result, const limb_t *x, size_t xcount,
+
69  const limb_t *y, size_t ycount);
+
70  static void reduceQuick(limb_t *result, const limb_t *x,
+
71  const limb_t *y, size_t size);
+
72 
+
73  static limb_t add_P(limb_t *result, const limb_t *x,
+
74  const limb_t *y, size_t size);
+
75  static limb_t sub_P(limb_t *result, const limb_t *x,
+
76  const limb_t *y, size_t size);
+
77  static void mul_P(limb_t *result, const limb_t *x, size_t xcount,
+
78  const limb_t *y, size_t ycount);
+
79  static void reduceQuick_P(limb_t *result, const limb_t *x,
+
80  const limb_t *y, size_t size);
+
81 
+
82 private:
+
83  // Constructor and destructor are private - cannot instantiate this class.
+
84  BigNumberUtil() {}
+
85  ~BigNumberUtil() {}
+
86 };
+
87 
+
88 #endif
+
BigNumberUtil::reduceQuick_P
static void reduceQuick_P(limb_t *result, const limb_t *x, const limb_t *y, size_t size)
Reduces x modulo y using subtraction where y is in program memory.
Definition: BigNumberUtil.cpp:620
+
BigNumberUtil::add
static limb_t add(limb_t *result, const limb_t *x, const limb_t *y, size_t size)
Adds two big numbers.
Definition: BigNumberUtil.cpp:381
+
BigNumberUtil::sub_P
static limb_t sub_P(limb_t *result, const limb_t *x, const limb_t *y, size_t size)
Subtracts one big number from another where one is in program memory.
Definition: BigNumberUtil.cpp:541
+
BigNumberUtil::reduceQuick
static void reduceQuick(limb_t *result, const limb_t *x, const limb_t *y, size_t size)
Reduces x modulo y using subtraction.
Definition: BigNumberUtil.cpp:484
+
BigNumberUtil::sub
static limb_t sub(limb_t *result, const limb_t *x, const limb_t *y, size_t size)
Subtracts one big number from another.
Definition: BigNumberUtil.cpp:408
BigNumberUtil
Utilities to assist with implementing big number arithmetic.
Definition: BigNumberUtil.h:52
-
BigNumberUtil::packBE
static void packBE(uint8_t *bytes, size_t len, const limb_t *limbs, size_t count)
Packs the big-endian byte representation of a big number into a byte array.
Definition: BigNumberUtil.cpp:293
-
BigNumberUtil::unpackLE
static void unpackLE(limb_t *limbs, size_t count, const uint8_t *bytes, size_t len)
Unpacks the little-endian byte representation of a big number into a limb array.
Definition: BigNumberUtil.cpp:54
-
BigNumberUtil::unpackBE
static void unpackBE(limb_t *limbs, size_t count, const uint8_t *bytes, size_t len)
Unpacks the big-endian byte representation of a big number into a limb array.
Definition: BigNumberUtil.cpp:133
-
BigNumberUtil::packLE
static void packLE(uint8_t *bytes, size_t len, const limb_t *limbs, size_t count)
Packs the little-endian byte representation of a big number into a byte array.
Definition: BigNumberUtil.cpp:207
+
BigNumberUtil::mul_P
static void mul_P(limb_t *result, const limb_t *x, size_t xcount, const limb_t *y, size_t ycount)
Multiplies two big numbers where one is in program memory.
Definition: BigNumberUtil.cpp:566
+
BigNumberUtil::packBE
static void packBE(uint8_t *bytes, size_t len, const limb_t *limbs, size_t count)
Packs the big-endian byte representation of a big number into a byte array.
Definition: BigNumberUtil.cpp:294
+
BigNumberUtil::unpackLE
static void unpackLE(limb_t *limbs, size_t count, const uint8_t *bytes, size_t len)
Unpacks the little-endian byte representation of a big number into a limb array.
Definition: BigNumberUtil.cpp:55
+
BigNumberUtil::mul
static void mul(limb_t *result, const limb_t *x, size_t xcount, const limb_t *y, size_t ycount)
Multiplies two big numbers.
Definition: BigNumberUtil.cpp:432
+
BigNumberUtil::unpackBE
static void unpackBE(limb_t *limbs, size_t count, const uint8_t *bytes, size_t len)
Unpacks the big-endian byte representation of a big number into a limb array.
Definition: BigNumberUtil.cpp:134
+
BigNumberUtil::packLE
static void packLE(uint8_t *bytes, size_t len, const limb_t *limbs, size_t count)
Packs the little-endian byte representation of a big number into a byte array.
Definition: BigNumberUtil.cpp:208
+
BigNumberUtil::add_P
static limb_t add_P(limb_t *result, const limb_t *x, const limb_t *y, size_t size)
Adds two big numbers where one of them is in program memory.
Definition: BigNumberUtil.cpp:514
diff --git a/Bitmap_8cpp_source.html b/Bitmap_8cpp_source.html index 7a9d5124..39c7a19b 100644 --- a/Bitmap_8cpp_source.html +++ b/Bitmap_8cpp_source.html @@ -694,7 +694,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Bitmap_8h_source.html b/Bitmap_8h_source.html index 9afe823d..5402b0c4 100644 --- a/Bitmap_8h_source.html +++ b/Bitmap_8h_source.html @@ -271,7 +271,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BlinkLED_8cpp_source.html b/BlinkLED_8cpp_source.html index 151c24b5..d74b5019 100644 --- a/BlinkLED_8cpp_source.html +++ b/BlinkLED_8cpp_source.html @@ -196,7 +196,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BlinkLED_8h_source.html b/BlinkLED_8h_source.html index 8ab33dea..5e4d1229 100644 --- a/BlinkLED_8h_source.html +++ b/BlinkLED_8h_source.html @@ -157,7 +157,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BlockCipher_8cpp_source.html b/BlockCipher_8cpp_source.html index d2acca86..a2b9f5ba 100644 --- a/BlockCipher_8cpp_source.html +++ b/BlockCipher_8cpp_source.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BlockCipher_8h_source.html b/BlockCipher_8h_source.html index aba70a9f..00890dc8 100644 --- a/BlockCipher_8h_source.html +++ b/BlockCipher_8h_source.html @@ -146,7 +146,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BoolField_8cpp_source.html b/BoolField_8cpp_source.html index 1a8142e9..de66a05b 100644 --- a/BoolField_8cpp_source.html +++ b/BoolField_8cpp_source.html @@ -202,7 +202,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BoolField_8h_source.html b/BoolField_8h_source.html index 7f09374e..0db57a03 100644 --- a/BoolField_8h_source.html +++ b/BoolField_8h_source.html @@ -160,7 +160,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/CBC_8cpp_source.html b/CBC_8cpp_source.html index 0302e1fb..d5bb13ed 100644 --- a/CBC_8cpp_source.html +++ b/CBC_8cpp_source.html @@ -208,7 +208,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/CBC_8h_source.html b/CBC_8h_source.html index 0df22e60..32db72ae 100644 --- a/CBC_8h_source.html +++ b/CBC_8h_source.html @@ -172,7 +172,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/CFB_8cpp_source.html b/CFB_8cpp_source.html index 341a7b43..3d59c645 100644 --- a/CFB_8cpp_source.html +++ b/CFB_8cpp_source.html @@ -233,7 +233,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/CFB_8h_source.html b/CFB_8h_source.html index 24741487..301b500a 100644 --- a/CFB_8h_source.html +++ b/CFB_8h_source.html @@ -171,7 +171,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/CTR_8cpp_source.html b/CTR_8cpp_source.html index d0f446c7..cc56776c 100644 --- a/CTR_8cpp_source.html +++ b/CTR_8cpp_source.html @@ -228,7 +228,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/CTR_8h_source.html b/CTR_8h_source.html index 470da414..5b669f21 100644 --- a/CTR_8h_source.html +++ b/CTR_8h_source.html @@ -175,7 +175,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ChaChaPoly_8cpp_source.html b/ChaChaPoly_8cpp_source.html index bfdd0f54..365ade70 100644 --- a/ChaChaPoly_8cpp_source.html +++ b/ChaChaPoly_8cpp_source.html @@ -237,8 +237,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
167  clean(state);
168  state.ivSize = 8;
169 }
-
Poly1305::finalize
void finalize(const void *nonce, void *token, size_t len)
Finalizes the authentication process and returns the token.
Definition: Poly1305.cpp:180
-
Poly1305::reset
void reset(const void *key)
Resets the Poly1305 message authenticator for a new session.
Definition: Poly1305.cpp:111
+
Poly1305::finalize
void finalize(const void *nonce, void *token, size_t len)
Finalizes the authentication process and returns the token.
Definition: Poly1305.cpp:179
+
Poly1305::reset
void reset(const void *key)
Resets the Poly1305 message authenticator for a new session.
Definition: Poly1305.cpp:110
ChaCha::setKey
bool setKey(const uint8_t *key, size_t len)
Sets the key to use for future encryption and decryption operations.
Definition: ChaCha.cpp:87
ChaChaPoly::~ChaChaPoly
virtual ~ChaChaPoly()
Destroys this ChaChaPoly authenticated cipher.
Definition: ChaChaPoly.cpp:56
ChaChaPoly::tagSize
size_t tagSize() const
Returns the size of the authentication tag.
Definition: ChaChaPoly.cpp:73
@@ -251,18 +251,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
ChaChaPoly::addAuthData
void addAuthData(const void *data, size_t len)
Adds extra data that will be authenticated but not encrypted.
Definition: ChaChaPoly.cpp:126
ChaChaPoly::encrypt
void encrypt(uint8_t *output, const uint8_t *input, size_t len)
Encrypts an input buffer and writes the ciphertext to an output buffer.
Definition: ChaChaPoly.cpp:104
ChaChaPoly::ivSize
size_t ivSize() const
Size of the initialization vector for this cipher, in bytes.
-
Poly1305::update
void update(const void *data, size_t len)
Updates the message authenticator with more data.
Definition: Poly1305.cpp:143
+
Poly1305::update
void update(const void *data, size_t len)
Updates the message authenticator with more data.
Definition: Poly1305.cpp:142
ChaCha::clear
void clear()
Clears all security-sensitive state from this cipher.
Definition: ChaCha.cpp:218
ChaChaPoly::clear
void clear()
Clears all security-sensitive state from this cipher.
Definition: ChaChaPoly.cpp:163
ChaChaPoly::decrypt
void decrypt(uint8_t *output, const uint8_t *input, size_t len)
Decrypts an input buffer and writes the plaintext to an output buffer.
Definition: ChaChaPoly.cpp:115
-
Poly1305::pad
void pad()
Pads the input stream with zero bytes to a multiple of 16.
Definition: Poly1305.cpp:251
-
Poly1305::clear
void clear()
Clears the authenticator's state, removing all sensitive data.
Definition: Poly1305.cpp:265
+
Poly1305::pad
void pad()
Pads the input stream with zero bytes to a multiple of 16.
Definition: Poly1305.cpp:250
+
Poly1305::clear
void clear()
Clears the authenticator's state, removing all sensitive data.
Definition: Poly1305.cpp:264
ChaChaPoly::setKey
bool setKey(const uint8_t *key, size_t len)
Sets the key to use for future encryption and decryption operations.
Definition: ChaChaPoly.cpp:79
ChaChaPoly::checkTag
bool checkTag(const void *tag, size_t len)
Finalizes the decryption process and checks the authentication tag.
Definition: ChaChaPoly.cpp:149
diff --git a/ChaChaPoly_8h_source.html b/ChaChaPoly_8h_source.html index 67200ed1..bac49f7e 100644 --- a/ChaChaPoly_8h_source.html +++ b/ChaChaPoly_8h_source.html @@ -173,7 +173,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ChaCha_8cpp_source.html b/ChaCha_8cpp_source.html index 33fa3826..f54bd0fc 100644 --- a/ChaCha_8cpp_source.html +++ b/ChaCha_8cpp_source.html @@ -311,7 +311,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ChaCha_8h_source.html b/ChaCha_8h_source.html index df283015..8fa6cea9 100644 --- a/ChaCha_8h_source.html +++ b/ChaCha_8h_source.html @@ -170,7 +170,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Charlieplex_8cpp_source.html b/Charlieplex_8cpp_source.html index 9d56867d..99c1ed6c 100644 --- a/Charlieplex_8cpp_source.html +++ b/Charlieplex_8cpp_source.html @@ -232,7 +232,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Charlieplex_8h_source.html b/Charlieplex_8h_source.html index fd67e3b6..635ce841 100644 --- a/Charlieplex_8h_source.html +++ b/Charlieplex_8h_source.html @@ -162,7 +162,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ChaseLEDs_8cpp_source.html b/ChaseLEDs_8cpp_source.html index a9053193..0eae2696 100644 --- a/ChaseLEDs_8cpp_source.html +++ b/ChaseLEDs_8cpp_source.html @@ -160,7 +160,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ChaseLEDs_8h_source.html b/ChaseLEDs_8h_source.html index 91dacb83..7343c6ef 100644 --- a/ChaseLEDs_8h_source.html +++ b/ChaseLEDs_8h_source.html @@ -149,7 +149,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Cipher_8cpp_source.html b/Cipher_8cpp_source.html index b85401b7..c8388ca7 100644 --- a/Cipher_8cpp_source.html +++ b/Cipher_8cpp_source.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Cipher_8h_source.html b/Cipher_8h_source.html index 67496273..eccfdb30 100644 --- a/Cipher_8h_source.html +++ b/Cipher_8h_source.html @@ -148,7 +148,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Crypto_8cpp_source.html b/Crypto_8cpp_source.html index 50052e43..2932e1e6 100644 --- a/Crypto_8cpp_source.html +++ b/Crypto_8cpp_source.html @@ -138,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Crypto_8h_source.html b/Crypto_8h_source.html index 1097082f..e2e60ba0 100644 --- a/Crypto_8h_source.html +++ b/Crypto_8h_source.html @@ -130,7 +130,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Curve25519_8cpp_source.html b/Curve25519_8cpp_source.html index 6e49bdb8..d6c01bcd 100644 --- a/Curve25519_8cpp_source.html +++ b/Curve25519_8cpp_source.html @@ -113,604 +113,706 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
23 #include "Curve25519.h"
24 #include "Crypto.h"
25 #include "RNG.h"
-
26 #include "utility/ProgMemUtil.h"
+
26 #include "utility/LimbUtil.h"
27 #include <string.h>
28 
-
42 // Number of limbs in a value from the field modulo 2^255 - 19.
-
43 // We assume that sizeof(limb_t) is a power of 2: 1, 2, 4, etc.
-
44 #define NUM_LIMBS (32 / sizeof(limb_t))
-
45 
-
46 // Number of bits in limb_t.
-
47 #define LIMB_BITS (8 * sizeof(limb_t))
-
48 
-
49 // The overhead of clean() calls in mul(), reduceQuick(), etc can
-
50 // add up to a lot of processing time during eval(). Only do such
-
51 // cleanups if strict mode has been enabled. Other implementations
-
52 // like curve25519-donna don't do any cleaning at all so the value
-
53 // of cleaning up the stack is dubious at best anyway.
-
54 #if defined(CURVE25519_STRICT_CLEAN)
-
55 #define strict_clean(x) clean(x)
-
56 #else
-
57 #define strict_clean(x) do { ; } while (0)
-
58 #endif
-
59 
-
79 bool Curve25519::eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[32])
-
80 {
-
81  limb_t x_1[NUM_LIMBS];
-
82  limb_t x_2[NUM_LIMBS];
-
83  limb_t x_3[NUM_LIMBS];
-
84  limb_t z_2[NUM_LIMBS];
-
85  limb_t z_3[NUM_LIMBS];
-
86  limb_t A[NUM_LIMBS];
-
87  limb_t B[NUM_LIMBS];
-
88  limb_t C[NUM_LIMBS];
-
89  limb_t D[NUM_LIMBS];
-
90  limb_t E[NUM_LIMBS];
-
91  limb_t AA[NUM_LIMBS];
-
92  limb_t BB[NUM_LIMBS];
-
93  limb_t DA[NUM_LIMBS];
-
94  limb_t CB[NUM_LIMBS];
-
95  uint8_t mask;
-
96  uint8_t sposn;
-
97  uint8_t select;
-
98  uint8_t swap;
-
99  bool retval;
-
100 
-
101  // Unpack the "x" argument into the limb representation
-
102  // which also masks off the high bit. NULL means 9.
-
103  if (x) {
-
104  // x1 = x
-
105  BigNumberUtil::unpackLE(x_1, NUM_LIMBS, x, 32);
-
106  x_1[NUM_LIMBS - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
-
107  } else {
-
108  memset(x_1, 0, sizeof(x_1)); // x_1 = 9
-
109  x_1[0] = 9;
-
110  }
-
111 
-
112  // Check that "x" is within the range of the modulo field.
-
113  // We can do this with a reduction - if there was no borrow
-
114  // then the value of "x" was out of range. Timing is sensitive
-
115  // here so that we don't reveal anything about the value of "x".
-
116  // If there was a reduction, then continue executing the rest
-
117  // of this function with the (now) in-range "x" value and
-
118  // report the failure at the end.
-
119  retval = (bool)(reduceQuick(x_1) & 0x01);
-
120 
-
121  // Initialize the other temporary variables.
-
122  memset(x_2, 0, sizeof(x_2)); // x_2 = 1
-
123  x_2[0] = 1;
-
124  memset(z_2, 0, sizeof(z_2)); // z_2 = 0
-
125  memcpy(x_3, x_1, sizeof(x_1)); // x_3 = x
-
126  memcpy(z_3, x_2, sizeof(x_2)); // z_3 = 1
-
127 
-
128  // Iterate over all 255 bits of "s" from the highest to the lowest.
-
129  // We ignore the high bit of the 256-bit representation of "s".
-
130  mask = 0x40;
-
131  sposn = 31;
-
132  swap = 0;
-
133  for (uint8_t t = 255; t > 0; --t) {
-
134  // Conditional swaps on entry to this bit but only if we
-
135  // didn't swap on the previous bit.
-
136  select = s[sposn] & mask;
-
137  swap ^= select;
-
138  cswap(swap, x_2, x_3);
-
139  cswap(swap, z_2, z_3);
-
140 
-
141  // Evaluate the curve.
-
142  add(A, x_2, z_2); // A = x_2 + z_2
-
143  square(AA, A); // AA = A^2
-
144  sub(B, x_2, z_2); // B = x_2 - z_2
-
145  square(BB, B); // BB = B^2
-
146  sub(E, AA, BB); // E = AA - BB
-
147  add(C, x_3, z_3); // C = x_3 + z_3
-
148  sub(D, x_3, z_3); // D = x_3 - z_3
-
149  mul(DA, D, A); // DA = D * A
-
150  mul(CB, C, B); // CB = C * B
-
151  add(x_3, DA, CB); // x_3 = (DA + CB)^2
-
152  square(x_3, x_3);
-
153  sub(z_3, DA, CB); // z_3 = x_1 * (DA - CB)^2
-
154  square(z_3, z_3);
-
155  mul(z_3, z_3, x_1);
-
156  mul(x_2, AA, BB); // x_2 = AA * BB
-
157  mulA24(z_2, E); // z_2 = E * (AA + a24 * E)
-
158  add(z_2, z_2, AA);
-
159  mul(z_2, z_2, E);
-
160 
-
161  // Move onto the next lower bit of "s".
-
162  mask >>= 1;
-
163  if (!mask) {
-
164  --sposn;
-
165  mask = 0x80;
-
166  swap = select << 7;
-
167  } else {
-
168  swap = select >> 1;
-
169  }
-
170  }
-
171 
-
172  // Final conditional swaps.
-
173  cswap(swap, x_2, x_3);
-
174  cswap(swap, z_2, z_3);
-
175 
-
176  // Compute x_2 * (z_2 ^ (p - 2)) where p = 2^255 - 19.
-
177  recip(z_3, z_2);
-
178  mul(x_2, x_2, z_3);
-
179 
-
180  // Pack the result into the return array.
-
181  BigNumberUtil::packLE(result, 32, x_2, NUM_LIMBS);
-
182 
-
183  // Clean up and exit.
-
184  clean(x_1);
-
185  clean(x_2);
-
186  clean(x_3);
-
187  clean(z_2);
-
188  clean(z_3);
-
189  clean(A);
-
190  clean(B);
-
191  clean(C);
-
192  clean(D);
-
193  clean(E);
-
194  clean(AA);
-
195  clean(BB);
-
196  clean(DA);
-
197  clean(CB);
-
198  return retval;
-
199 }
-
200 
-
244 void Curve25519::dh1(uint8_t k[32], uint8_t f[32])
-
245 {
-
246  do {
-
247  // Generate a random "f" value and then adjust the value to make
-
248  // it valid as an "s" value for eval(). According to the specification
-
249  // we need to mask off the 3 right-most bits of f[0], mask off the
-
250  // left-most bit of f[31], and set the second to left-most bit of f[31].
-
251  RNG.rand(f, 32);
-
252  f[0] &= 0xF8;
-
253  f[31] = (f[31] & 0x7F) | 0x40;
-
254 
-
255  // Evaluate the curve function: k = Curve25519::eval(f, 9).
-
256  // We pass NULL to eval() to indicate the value 9. There is no
-
257  // need to check the return value from eval() because we know
-
258  // that 9 is a valid field element.
-
259  eval(k, f, 0);
-
260 
-
261  // If "k" is weak for contributory behaviour then reject it,
-
262  // generate another "f" value, and try again. This case is
-
263  // highly unlikely but we still perform the check just in case.
-
264  } while (isWeakPoint(k));
-
265 }
-
266 
-
282 bool Curve25519::dh2(uint8_t k[32], uint8_t f[32])
-
283 {
-
284  uint8_t weak;
-
285 
-
286  // Evaluate the curve function: k = Curve25519::eval(f, k).
-
287  // If "k" is weak for contributory behaviour before or after
-
288  // the curve evaluation, then fail the exchange. For safety
-
289  // we perform every phase of the weak checks even if we could
-
290  // bail out earlier so that the execution takes the same
-
291  // amount of time for weak and non-weak "k" values.
-
292  weak = isWeakPoint(k); // Is "k" weak before?
-
293  weak |= ((eval(k, f, k) ^ 0x01) & 0x01); // Is "k" weak during?
-
294  weak |= isWeakPoint(k); // Is "k" weak after?
-
295  clean(f, 32);
-
296  return (bool)((weak ^ 0x01) & 0x01);
-
297 }
-
298 
-
306 uint8_t Curve25519::isWeakPoint(const uint8_t k[32])
-
307 {
-
308  // List of weak points from http://cr.yp.to/ecdh.html
-
309  // That page lists some others but they are variants on these
-
310  // of the form "point + i * (2^255 - 19)" for i = 0, 1, 2.
-
311  // Here we mask off the high bit and eval() catches the rest.
-
312  static const uint8_t points[5][32] PROGMEM = {
-
313  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
44 // The overhead of clean() calls in mul(), reduceQuick(), etc can
+
45 // add up to a lot of processing time during eval(). Only do such
+
46 // cleanups if strict mode has been enabled. Other implementations
+
47 // like curve25519-donna don't do any cleaning at all so the value
+
48 // of cleaning up the stack is dubious at best anyway.
+
49 #if defined(CURVE25519_STRICT_CLEAN)
+
50 #define strict_clean(x) clean(x)
+
51 #else
+
52 #define strict_clean(x) do { ; } while (0)
+
53 #endif
+
54 
+
74 bool Curve25519::eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[32])
+
75 {
+
76  limb_t x_1[NUM_LIMBS_256BIT];
+
77  limb_t x_2[NUM_LIMBS_256BIT];
+
78  limb_t x_3[NUM_LIMBS_256BIT];
+
79  limb_t z_2[NUM_LIMBS_256BIT];
+
80  limb_t z_3[NUM_LIMBS_256BIT];
+
81  limb_t A[NUM_LIMBS_256BIT];
+
82  limb_t B[NUM_LIMBS_256BIT];
+
83  limb_t C[NUM_LIMBS_256BIT];
+
84  limb_t D[NUM_LIMBS_256BIT];
+
85  limb_t E[NUM_LIMBS_256BIT];
+
86  limb_t AA[NUM_LIMBS_256BIT];
+
87  limb_t BB[NUM_LIMBS_256BIT];
+
88  limb_t DA[NUM_LIMBS_256BIT];
+
89  limb_t CB[NUM_LIMBS_256BIT];
+
90  uint8_t mask;
+
91  uint8_t sposn;
+
92  uint8_t select;
+
93  uint8_t swap;
+
94  bool retval;
+
95 
+
96  // Unpack the "x" argument into the limb representation
+
97  // which also masks off the high bit. NULL means 9.
+
98  if (x) {
+
99  // x1 = x
+
100  BigNumberUtil::unpackLE(x_1, NUM_LIMBS_256BIT, x, 32);
+
101  x_1[NUM_LIMBS_256BIT - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
+
102  } else {
+
103  memset(x_1, 0, sizeof(x_1)); // x_1 = 9
+
104  x_1[0] = 9;
+
105  }
+
106 
+
107  // Check that "x" is within the range of the modulo field.
+
108  // We can do this with a reduction - if there was no borrow
+
109  // then the value of "x" was out of range. Timing is sensitive
+
110  // here so that we don't reveal anything about the value of "x".
+
111  // If there was a reduction, then continue executing the rest
+
112  // of this function with the (now) in-range "x" value and
+
113  // report the failure at the end.
+
114  retval = (bool)(reduceQuick(x_1) & 0x01);
+
115 
+
116  // Initialize the other temporary variables.
+
117  memset(x_2, 0, sizeof(x_2)); // x_2 = 1
+
118  x_2[0] = 1;
+
119  memset(z_2, 0, sizeof(z_2)); // z_2 = 0
+
120  memcpy(x_3, x_1, sizeof(x_1)); // x_3 = x
+
121  memcpy(z_3, x_2, sizeof(x_2)); // z_3 = 1
+
122 
+
123  // Iterate over all 255 bits of "s" from the highest to the lowest.
+
124  // We ignore the high bit of the 256-bit representation of "s".
+
125  mask = 0x40;
+
126  sposn = 31;
+
127  swap = 0;
+
128  for (uint8_t t = 255; t > 0; --t) {
+
129  // Conditional swaps on entry to this bit but only if we
+
130  // didn't swap on the previous bit.
+
131  select = s[sposn] & mask;
+
132  swap ^= select;
+
133  cswap(swap, x_2, x_3);
+
134  cswap(swap, z_2, z_3);
+
135 
+
136  // Evaluate the curve.
+
137  add(A, x_2, z_2); // A = x_2 + z_2
+
138  square(AA, A); // AA = A^2
+
139  sub(B, x_2, z_2); // B = x_2 - z_2
+
140  square(BB, B); // BB = B^2
+
141  sub(E, AA, BB); // E = AA - BB
+
142  add(C, x_3, z_3); // C = x_3 + z_3
+
143  sub(D, x_3, z_3); // D = x_3 - z_3
+
144  mul(DA, D, A); // DA = D * A
+
145  mul(CB, C, B); // CB = C * B
+
146  add(x_3, DA, CB); // x_3 = (DA + CB)^2
+
147  square(x_3, x_3);
+
148  sub(z_3, DA, CB); // z_3 = x_1 * (DA - CB)^2
+
149  square(z_3, z_3);
+
150  mul(z_3, z_3, x_1);
+
151  mul(x_2, AA, BB); // x_2 = AA * BB
+
152  mulA24(z_2, E); // z_2 = E * (AA + a24 * E)
+
153  add(z_2, z_2, AA);
+
154  mul(z_2, z_2, E);
+
155 
+
156  // Move onto the next lower bit of "s".
+
157  mask >>= 1;
+
158  if (!mask) {
+
159  --sposn;
+
160  mask = 0x80;
+
161  swap = select << 7;
+
162  } else {
+
163  swap = select >> 1;
+
164  }
+
165  }
+
166 
+
167  // Final conditional swaps.
+
168  cswap(swap, x_2, x_3);
+
169  cswap(swap, z_2, z_3);
+
170 
+
171  // Compute x_2 * (z_2 ^ (p - 2)) where p = 2^255 - 19.
+
172  recip(z_3, z_2);
+
173  mul(x_2, x_2, z_3);
+
174 
+
175  // Pack the result into the return array.
+
176  BigNumberUtil::packLE(result, 32, x_2, NUM_LIMBS_256BIT);
+
177 
+
178  // Clean up and exit.
+
179  clean(x_1);
+
180  clean(x_2);
+
181  clean(x_3);
+
182  clean(z_2);
+
183  clean(z_3);
+
184  clean(A);
+
185  clean(B);
+
186  clean(C);
+
187  clean(D);
+
188  clean(E);
+
189  clean(AA);
+
190  clean(BB);
+
191  clean(DA);
+
192  clean(CB);
+
193  return retval;
+
194 }
+
195 
+
239 void Curve25519::dh1(uint8_t k[32], uint8_t f[32])
+
240 {
+
241  do {
+
242  // Generate a random "f" value and then adjust the value to make
+
243  // it valid as an "s" value for eval(). According to the specification
+
244  // we need to mask off the 3 right-most bits of f[0], mask off the
+
245  // left-most bit of f[31], and set the second to left-most bit of f[31].
+
246  RNG.rand(f, 32);
+
247  f[0] &= 0xF8;
+
248  f[31] = (f[31] & 0x7F) | 0x40;
+
249 
+
250  // Evaluate the curve function: k = Curve25519::eval(f, 9).
+
251  // We pass NULL to eval() to indicate the value 9. There is no
+
252  // need to check the return value from eval() because we know
+
253  // that 9 is a valid field element.
+
254  eval(k, f, 0);
+
255 
+
256  // If "k" is weak for contributory behaviour then reject it,
+
257  // generate another "f" value, and try again. This case is
+
258  // highly unlikely but we still perform the check just in case.
+
259  } while (isWeakPoint(k));
+
260 }
+
261 
+
277 bool Curve25519::dh2(uint8_t k[32], uint8_t f[32])
+
278 {
+
279  uint8_t weak;
+
280 
+
281  // Evaluate the curve function: k = Curve25519::eval(f, k).
+
282  // If "k" is weak for contributory behaviour before or after
+
283  // the curve evaluation, then fail the exchange. For safety
+
284  // we perform every phase of the weak checks even if we could
+
285  // bail out earlier so that the execution takes the same
+
286  // amount of time for weak and non-weak "k" values.
+
287  weak = isWeakPoint(k); // Is "k" weak before?
+
288  weak |= ((eval(k, f, k) ^ 0x01) & 0x01); // Is "k" weak during?
+
289  weak |= isWeakPoint(k); // Is "k" weak after?
+
290  clean(f, 32);
+
291  return (bool)((weak ^ 0x01) & 0x01);
+
292 }
+
293 
+
301 uint8_t Curve25519::isWeakPoint(const uint8_t k[32])
+
302 {
+
303  // List of weak points from http://cr.yp.to/ecdh.html
+
304  // That page lists some others but they are variants on these
+
305  // of the form "point + i * (2^255 - 19)" for i = 0, 1, 2.
+
306  // Here we mask off the high bit and eval() catches the rest.
+
307  static const uint8_t points[5][32] PROGMEM = {
+
308  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
309  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
310  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
311  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+
312  {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
313  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
314  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
315  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
316  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-
317  {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
318  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
319  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
320  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-
321  {0xE0, 0xEB, 0x7A, 0x7C, 0x3B, 0x41, 0xB8, 0xAE,
-
322  0x16, 0x56, 0xE3, 0xFA, 0xF1, 0x9F, 0xC4, 0x6A,
-
323  0xDA, 0x09, 0x8D, 0xEB, 0x9C, 0x32, 0xB1, 0xFD,
-
324  0x86, 0x62, 0x05, 0x16, 0x5F, 0x49, 0xB8, 0x00},
-
325  {0x5F, 0x9C, 0x95, 0xBC, 0xA3, 0x50, 0x8C, 0x24,
-
326  0xB1, 0xD0, 0xB1, 0x55, 0x9C, 0x83, 0xEF, 0x5B,
-
327  0x04, 0x44, 0x5C, 0xC4, 0x58, 0x1C, 0x8E, 0x86,
-
328  0xD8, 0x22, 0x4E, 0xDD, 0xD0, 0x9F, 0x11, 0x57},
-
329  {0xEC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-
330  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-
331  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-
332  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F}
-
333  };
-
334 
-
335  // Check each of the weak points in turn. We perform the
-
336  // comparisons carefully so as not to reveal the value of "k"
-
337  // in the instruction timing. If "k" is indeed weak then
-
338  // we still check everything so as not to reveal which
-
339  // weak point it is.
-
340  uint8_t result = 0;
-
341  for (uint8_t posn = 0; posn < 5; ++posn) {
-
342  const uint8_t *point = points[posn];
-
343  uint8_t check = (pgm_read_byte(point + 31) ^ k[31]) & 0x7F;
-
344  for (uint8_t index = 31; index > 0; --index)
-
345  check |= (pgm_read_byte(point + index - 1) ^ k[index - 1]);
-
346  result |= (uint8_t)((((uint16_t)0x0100) - check) >> 8);
-
347  }
-
348 
-
349  // The "result" variable will be non-zero if there was a match.
-
350  return result;
-
351 }
-
352 
-
365 void Curve25519::reduce(limb_t *result, limb_t *x, uint8_t size)
-
366 {
-
367  /*
-
368  Note: This explaination is best viewed with a UTF-8 text viewer.
-
369 
-
370  To help explain what this function is doing, the following describes
-
371  how to efficiently compute reductions modulo a base of the form (2ⁿ - b)
-
372  where b is greater than zero and (b + 1)² <= 2ⁿ.
-
373 
-
374  Here we are interested in reducing the result of multiplying two
-
375  numbers that are less than or equal to (2ⁿ - b - 1). That is,
-
376  multiplying numbers that have already been reduced.
+
315  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+
316  {0xE0, 0xEB, 0x7A, 0x7C, 0x3B, 0x41, 0xB8, 0xAE,
+
317  0x16, 0x56, 0xE3, 0xFA, 0xF1, 0x9F, 0xC4, 0x6A,
+
318  0xDA, 0x09, 0x8D, 0xEB, 0x9C, 0x32, 0xB1, 0xFD,
+
319  0x86, 0x62, 0x05, 0x16, 0x5F, 0x49, 0xB8, 0x00},
+
320  {0x5F, 0x9C, 0x95, 0xBC, 0xA3, 0x50, 0x8C, 0x24,
+
321  0xB1, 0xD0, 0xB1, 0x55, 0x9C, 0x83, 0xEF, 0x5B,
+
322  0x04, 0x44, 0x5C, 0xC4, 0x58, 0x1C, 0x8E, 0x86,
+
323  0xD8, 0x22, 0x4E, 0xDD, 0xD0, 0x9F, 0x11, 0x57},
+
324  {0xEC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+
325  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+
326  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+
327  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F}
+
328  };
+
329 
+
330  // Check each of the weak points in turn. We perform the
+
331  // comparisons carefully so as not to reveal the value of "k"
+
332  // in the instruction timing. If "k" is indeed weak then
+
333  // we still check everything so as not to reveal which
+
334  // weak point it is.
+
335  uint8_t result = 0;
+
336  for (uint8_t posn = 0; posn < 5; ++posn) {
+
337  const uint8_t *point = points[posn];
+
338  uint8_t check = (pgm_read_byte(point + 31) ^ k[31]) & 0x7F;
+
339  for (uint8_t index = 31; index > 0; --index)
+
340  check |= (pgm_read_byte(point + index - 1) ^ k[index - 1]);
+
341  result |= (uint8_t)((((uint16_t)0x0100) - check) >> 8);
+
342  }
+
343 
+
344  // The "result" variable will be non-zero if there was a match.
+
345  return result;
+
346 }
+
347 
+
360 void Curve25519::reduce(limb_t *result, limb_t *x, uint8_t size)
+
361 {
+
362  /*
+
363  Note: This explaination is best viewed with a UTF-8 text viewer.
+
364 
+
365  To help explain what this function is doing, the following describes
+
366  how to efficiently compute reductions modulo a base of the form (2ⁿ - b)
+
367  where b is greater than zero and (b + 1)² <= 2ⁿ.
+
368 
+
369  Here we are interested in reducing the result of multiplying two
+
370  numbers that are less than or equal to (2ⁿ - b - 1). That is,
+
371  multiplying numbers that have already been reduced.
+
372 
+
373  Given some x less than or equal to (2ⁿ - b - 1)², we want to find a
+
374  y less than (2ⁿ - b) such that:
+
375 
+
376  y ≡ x mod (2ⁿ - b)
377 
-
378  Given some x less than or equal to (2ⁿ - b - 1)², we want to find a
-
379  y less than (2ⁿ - b) such that:
-
380 
-
381  y ≡ x mod (2ⁿ - b)
+
378  We know that for all integer values of k >= 0:
+
379 
+
380  y ≡ x - k * (2ⁿ - b)
+
381  ≡ x - k * 2ⁿ + k * b
382 
-
383  We know that for all integer values of k >= 0:
+
383  In our case we choose k = ⌊x / 2ⁿ⌋ and then let:
384 
-
385  y ≡ x - k * (2ⁿ - b)
-
386  ≡ x - k * 2ⁿ + k * b
-
387 
-
388  In our case we choose k = ⌊x / 2ⁿ⌋ and then let:
-
389 
-
390  w = (x mod 2ⁿ) + ⌊x / 2ⁿ⌋ * b
-
391 
-
392  The value w will either be the answer y or y can be obtained by
-
393  repeatedly subtracting (2ⁿ - b) from w until it is less than (2ⁿ - b).
-
394  At most b subtractions will be required.
-
395 
-
396  In our case b is 19 which is more subtractions than we would like to do,
-
397  but we can handle that by performing the above reduction twice and then
-
398  performing a single trial subtraction:
+
385  w = (x mod 2ⁿ) + ⌊x / 2ⁿ⌋ * b
+
386 
+
387  The value w will either be the answer y or y can be obtained by
+
388  repeatedly subtracting (2ⁿ - b) from w until it is less than (2ⁿ - b).
+
389  At most b subtractions will be required.
+
390 
+
391  In our case b is 19 which is more subtractions than we would like to do,
+
392  but we can handle that by performing the above reduction twice and then
+
393  performing a single trial subtraction:
+
394 
+
395  w = (x mod 2ⁿ) + ⌊x / 2ⁿ⌋ * b
+
396  y = (w mod 2ⁿ) + ⌊w / 2ⁿ⌋ * b
+
397  if y >= (2ⁿ - b)
+
398  y -= (2ⁿ - b)
399 
-
400  w = (x mod 2ⁿ) + ⌊x / 2ⁿ⌋ * b
-
401  y = (w mod 2ⁿ) + ⌊w / 2ⁿ⌋ * b
-
402  if y >= (2ⁿ - b)
-
403  y -= (2ⁿ - b)
-
404 
-
405  The value y is the answer we want for reducing x modulo (2ⁿ - b).
-
406  */
-
407 
-
408  dlimb_t carry;
-
409  uint8_t posn;
-
410 
-
411  // Calculate (x mod 2^255) + ((x / 2^255) * 19) which will
-
412  // either produce the answer we want or it will produce a
-
413  // value of the form "answer + j * (2^255 - 19)".
-
414  carry = ((dlimb_t)(x[NUM_LIMBS - 1] >> (LIMB_BITS - 1))) * 19U;
-
415  x[NUM_LIMBS - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
-
416  for (posn = 0; posn < size; ++posn) {
-
417  carry += ((dlimb_t)(x[posn + NUM_LIMBS])) * 38U;
-
418  carry += x[posn];
-
419  x[posn] = (limb_t)carry;
-
420  carry >>= LIMB_BITS;
-
421  }
-
422  if (size < NUM_LIMBS) {
-
423  // The high order half of the number is short; e.g. for mulA24().
-
424  // Propagate the carry through the rest of the low order part.
-
425  for (posn = size; posn < NUM_LIMBS; ++posn) {
-
426  carry += x[posn];
-
427  x[posn] = (limb_t)carry;
-
428  carry >>= LIMB_BITS;
-
429  }
-
430  }
-
431 
-
432  // The "j" value may still be too large due to the final carry-out.
-
433  // We must repeat the reduction. If we already have the answer,
-
434  // then this won't do any harm but we must still do the calculation
-
435  // to preserve the overall timing.
-
436  carry *= 38U;
-
437  carry += ((dlimb_t)(x[NUM_LIMBS - 1] >> (LIMB_BITS - 1))) * 19U;
-
438  x[NUM_LIMBS - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
-
439  for (posn = 0; posn < NUM_LIMBS; ++posn) {
-
440  carry += x[posn];
-
441  x[posn] = (limb_t)carry;
-
442  carry >>= LIMB_BITS;
-
443  }
-
444 
-
445  // At this point "x" will either be the answer or it will be the
-
446  // answer plus (2^255 - 19). Perform a trial subtraction which
-
447  // is equivalent to adding 19 and subtracting 2^255. We put the
-
448  // trial answer into the top-most limbs of the original "x" array.
-
449  // We add 19 here; the subtraction of 2^255 occurs in the next step.
-
450  carry = 19U;
-
451  for (posn = 0; posn < NUM_LIMBS; ++posn) {
-
452  carry += x[posn];
-
453  x[posn + NUM_LIMBS] = (limb_t)carry;
-
454  carry >>= LIMB_BITS;
-
455  }
-
456 
-
457  // If there was a borrow, then the bottom-most limbs of "x" are the
-
458  // correct answer. If there was no borrow, then the top-most limbs
-
459  // of "x" are the correct answer. Select the correct answer but do
-
460  // it in a way that instruction timing will not reveal which value
-
461  // was selected. Borrow will occur if the high bit of the previous
-
462  // result is 0: turn the high bit into a selection mask.
-
463  limb_t mask = (limb_t)(((slimb_t)(x[NUM_LIMBS * 2 - 1])) >> (LIMB_BITS - 1));
-
464  limb_t nmask = ~mask;
-
465  x[NUM_LIMBS * 2 - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
-
466  for (posn = 0; posn < NUM_LIMBS; ++posn) {
-
467  result[posn] = (x[posn] & nmask) | (x[posn + NUM_LIMBS] & mask);
-
468  }
-
469 }
-
470 
-
484 limb_t Curve25519::reduceQuick(limb_t *x)
-
485 {
-
486  limb_t temp[NUM_LIMBS];
-
487  dlimb_t carry;
-
488  uint8_t posn;
-
489  limb_t *xx;
-
490  limb_t *tt;
-
491 
-
492  // Perform a trial subtraction of (2^255 - 19) from "x" which is
-
493  // equivalent to adding 19 and subtracting 2^255. We add 19 here;
-
494  // the subtraction of 2^255 occurs in the next step.
-
495  carry = 19U;
-
496  xx = x;
-
497  tt = temp;
-
498  for (posn = 0; posn < NUM_LIMBS; ++posn) {
-
499  carry += *xx++;
-
500  *tt++ = (limb_t)carry;
-
501  carry >>= LIMB_BITS;
-
502  }
-
503 
-
504  // If there was a borrow, then the original "x" is the correct answer.
-
505  // If there was no borrow, then "temp" is the correct answer. Select the
-
506  // correct answer but do it in a way that instruction timing will not
-
507  // reveal which value was selected. Borrow will occur if the high bit
-
508  // of "temp" is 0: turn the high bit into a selection mask.
-
509  limb_t mask = (limb_t)(((slimb_t)(temp[NUM_LIMBS - 1])) >> (LIMB_BITS - 1));
-
510  limb_t nmask = ~mask;
-
511  temp[NUM_LIMBS - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
-
512  xx = x;
-
513  tt = temp;
-
514  for (posn = 0; posn < NUM_LIMBS; ++posn) {
-
515  *xx = ((*xx) & nmask) | ((*tt++) & mask);
-
516  ++xx;
-
517  }
-
518 
-
519  // Clean up "temp".
-
520  strict_clean(temp);
-
521 
-
522  // Return a zero value if we actually subtracted (2^255 - 19) from "x".
-
523  return nmask;
-
524 }
-
525 
-
536 void Curve25519::mul(limb_t *result, const limb_t *x, const limb_t *y)
-
537 {
-
538  limb_t temp[NUM_LIMBS * 2];
-
539  uint8_t i, j;
-
540  dlimb_t carry;
-
541  limb_t word;
-
542  const limb_t *yy;
-
543  limb_t *tt;
-
544 
-
545  // Multiply the lowest word of x by y.
-
546  carry = 0;
-
547  word = x[0];
-
548  yy = y;
-
549  tt = temp;
-
550  for (i = 0; i < NUM_LIMBS; ++i) {
-
551  carry += ((dlimb_t)(*yy++)) * word;
-
552  *tt++ = (limb_t)carry;
-
553  carry >>= LIMB_BITS;
-
554  }
-
555  *tt = (limb_t)carry;
-
556 
-
557  // Multiply and add the remaining words of x by y.
-
558  for (i = 1; i < NUM_LIMBS; ++i) {
-
559  word = x[i];
-
560  carry = 0;
-
561  yy = y;
-
562  tt = temp + i;
-
563  for (j = 0; j < NUM_LIMBS; ++j) {
-
564  carry += ((dlimb_t)(*yy++)) * word;
-
565  carry += *tt;
-
566  *tt++ = (limb_t)carry;
-
567  carry >>= LIMB_BITS;
-
568  }
-
569  *tt = (limb_t)carry;
-
570  }
-
571 
-
572  // Reduce the intermediate result modulo 2^255 - 19.
-
573  reduce(result, temp, NUM_LIMBS);
-
574  strict_clean(temp);
-
575 }
-
576 
-
596 void Curve25519::mulA24(limb_t *result, const limb_t *x)
-
597 {
-
598  // The constant a24 = 121665 (0x1DB41) as a limb array.
-
599 #if BIGNUMBER_LIMB_8BIT
-
600  static limb_t const a24[3] PROGMEM = {0x41, 0xDB, 0x01};
-
601  #define pgm_read_a24(index) (pgm_read_byte(&(a24[(index)])))
-
602 #elif BIGNUMBER_LIMB_16BIT
-
603  static limb_t const a24[2] PROGMEM = {0xDB41, 0x0001};
-
604  #define pgm_read_a24(index) (pgm_read_word(&(a24[(index)])))
-
605 #elif BIGNUMBER_LIMB_32BIT
-
606  static limb_t const a24[1] PROGMEM = {0x0001DB41};
-
607  #define pgm_read_a24(index) (pgm_read_dword(&(a24[(index)])))
-
608 #else
-
609  #error "limb_t must be 8, 16, or 32 bits in size"
-
610 #endif
-
611  #define NUM_A24_LIMBS (sizeof(a24) / sizeof(limb_t))
-
612 
-
613  // Multiply the lowest limb of a24 by x and zero-extend into the result.
-
614  limb_t temp[NUM_LIMBS * 2];
-
615  uint8_t i, j;
-
616  dlimb_t carry = 0;
-
617  limb_t word = pgm_read_a24(0);
-
618  const limb_t *xx = x;
-
619  limb_t *tt = temp;
-
620  for (i = 0; i < NUM_LIMBS; ++i) {
-
621  carry += ((dlimb_t)(*xx++)) * word;
-
622  *tt++ = (limb_t)carry;
-
623  carry >>= LIMB_BITS;
-
624  }
-
625  *tt = (limb_t)carry;
-
626 
-
627  // Multiply and add the remaining limbs of a24.
-
628  for (i = 1; i < NUM_A24_LIMBS; ++i) {
-
629  word = pgm_read_a24(i);
-
630  carry = 0;
-
631  xx = x;
-
632  tt = temp + i;
-
633  for (j = 0; j < NUM_LIMBS; ++j) {
-
634  carry += ((dlimb_t)(*xx++)) * word;
-
635  carry += *tt;
-
636  *tt++ = (limb_t)carry;
-
637  carry >>= LIMB_BITS;
-
638  }
-
639  *tt = (limb_t)carry;
-
640  }
-
641 
-
642  // Reduce the intermediate result modulo 2^255 - 19.
-
643  reduce(result, temp, NUM_A24_LIMBS);
-
644  strict_clean(temp);
-
645 }
-
646 
-
657 void Curve25519::add(limb_t *result, const limb_t *x, const limb_t *y)
-
658 {
-
659  dlimb_t carry = 0;
-
660  uint8_t posn;
-
661  limb_t *rr = result;
-
662 
-
663  // Add the two arrays to obtain the intermediate result.
-
664  for (posn = 0; posn < NUM_LIMBS; ++posn) {
-
665  carry += *x++;
-
666  carry += *y++;
-
667  *rr++ = (limb_t)carry;
-
668  carry >>= LIMB_BITS;
-
669  }
-
670 
-
671  // Reduce the result using the quick trial subtraction method.
-
672  reduceQuick(result);
-
673 }
-
674 
-
685 void Curve25519::sub(limb_t *result, const limb_t *x, const limb_t *y)
-
686 {
-
687  dlimb_t borrow;
-
688  uint8_t posn;
-
689  limb_t *rr = result;
-
690 
-
691  // Subtract y from x to generate the intermediate result.
-
692  borrow = 0;
-
693  for (posn = 0; posn < NUM_LIMBS; ++posn) {
-
694  borrow = ((dlimb_t)(*x++)) - (*y++) - ((borrow >> LIMB_BITS) & 0x01);
-
695  *rr++ = (limb_t)borrow;
-
696  }
-
697 
-
698  // If we had a borrow, then the result has gone negative and we
-
699  // have to add 2^255 - 19 to the result to make it positive again.
-
700  // The top bits of "borrow" will be all 1's if there is a borrow
-
701  // or it will be all 0's if there was no borrow. Easiest is to
-
702  // conditionally subtract 19 and then mask off the high bit.
-
703  rr = result;
-
704  borrow = (borrow >> LIMB_BITS) & 19U;
-
705  borrow = ((dlimb_t)(*rr)) - borrow;
-
706  *rr++ = (limb_t)borrow;
-
707  for (posn = 1; posn < NUM_LIMBS; ++posn) {
-
708  borrow = ((dlimb_t)(*rr)) - ((borrow >> LIMB_BITS) & 0x01);
-
709  *rr++ = (limb_t)borrow;
-
710  }
-
711  *(--rr) &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
-
712 }
-
713 
-
724 void Curve25519::cswap(uint8_t select, limb_t *x, limb_t *y)
-
725 {
-
726  uint8_t posn;
-
727  limb_t dummy;
-
728  limb_t sel;
-
729 
-
730  // Turn "select" into an all-zeroes or all-ones mask. We don't care
-
731  // which bit or bits is set in the original "select" value.
-
732  sel = (limb_t)(((((dlimb_t)1) << LIMB_BITS) - select) >> LIMB_BITS);
-
733  --sel;
-
734 
-
735  // Swap the two values based on "select". Algorithm from:
-
736  // https://tools.ietf.org/html/draft-irtf-cfrg-curves-02
-
737  for (posn = 0; posn < NUM_LIMBS; ++posn) {
-
738  dummy = sel & (x[posn] ^ y[posn]);
-
739  x[posn] ^= dummy;
-
740  y[posn] ^= dummy;
-
741  }
-
742 }
-
743 
-
751 void Curve25519::recip(limb_t *result, const limb_t *x)
-
752 {
-
753  limb_t t1[NUM_LIMBS];
-
754  uint8_t i, j;
-
755 
-
756  // The reciprocal is the same as x ^ (p - 2) where p = 2^255 - 19.
-
757  // The big-endian hexadecimal expansion of (p - 2) is:
-
758  // 7FFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFEB
-
759  //
-
760  // The naive implementation needs to do 2 multiplications per 1 bit and
-
761  // 1 multiplication per 0 bit. We can improve upon this by creating a
-
762  // pattern 0000000001 ... 0000000001. If we square and multiply the
-
763  // pattern by itself we can turn the pattern into the partial results
-
764  // 0000000011 ... 0000000011, 0000000111 ... 0000000111, etc.
-
765  // This averages out to about 1.1 multiplications per 1 bit instead of 2.
-
766 
-
767  // Build a pattern of 250 bits in length of repeated copies of 0000000001.
-
768  #define RECIP_GROUP_SIZE 10
-
769  #define RECIP_GROUP_BITS 250 // Must be a multiple of RECIP_GROUP_SIZE.
-
770  square(t1, x);
-
771  for (j = 0; j < (RECIP_GROUP_SIZE - 1); ++j)
-
772  square(t1, t1);
-
773  mul(result, t1, x);
-
774  for (i = 0; i < ((RECIP_GROUP_BITS / RECIP_GROUP_SIZE) - 2); ++i) {
-
775  for (j = 0; j < RECIP_GROUP_SIZE; ++j)
-
776  square(t1, t1);
-
777  mul(result, result, t1);
-
778  }
-
779 
-
780  // Multiply bit-shifted versions of the 0000000001 pattern into
-
781  // the result to "fill in" the gaps in the pattern.
-
782  square(t1, result);
-
783  mul(result, result, t1);
-
784  for (j = 0; j < (RECIP_GROUP_SIZE - 2); ++j) {
-
785  square(t1, t1);
-
786  mul(result, result, t1);
-
787  }
-
788 
-
789  // Deal with the 5 lowest bits of (p - 2), 01011, from highest to lowest.
-
790  square(result, result);
-
791  square(result, result);
-
792  mul(result, result, x);
-
793  square(result, result);
-
794  square(result, result);
-
795  mul(result, result, x);
-
796  square(result, result);
-
797  mul(result, result, x);
-
798 
-
799  // Clean up and exit.
-
800  clean(t1);
-
801 }
+
400  The value y is the answer we want for reducing x modulo (2ⁿ - b).
+
401  */
+
402 
+
403  dlimb_t carry;
+
404  uint8_t posn;
+
405 
+
406  // Calculate (x mod 2^255) + ((x / 2^255) * 19) which will
+
407  // either produce the answer we want or it will produce a
+
408  // value of the form "answer + j * (2^255 - 19)".
+
409  carry = ((dlimb_t)(x[NUM_LIMBS_256BIT - 1] >> (LIMB_BITS - 1))) * 19U;
+
410  x[NUM_LIMBS_256BIT - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
+
411  for (posn = 0; posn < size; ++posn) {
+
412  carry += ((dlimb_t)(x[posn + NUM_LIMBS_256BIT])) * 38U;
+
413  carry += x[posn];
+
414  x[posn] = (limb_t)carry;
+
415  carry >>= LIMB_BITS;
+
416  }
+
417  if (size < NUM_LIMBS_256BIT) {
+
418  // The high order half of the number is short; e.g. for mulA24().
+
419  // Propagate the carry through the rest of the low order part.
+
420  for (posn = size; posn < NUM_LIMBS_256BIT; ++posn) {
+
421  carry += x[posn];
+
422  x[posn] = (limb_t)carry;
+
423  carry >>= LIMB_BITS;
+
424  }
+
425  }
+
426 
+
427  // The "j" value may still be too large due to the final carry-out.
+
428  // We must repeat the reduction. If we already have the answer,
+
429  // then this won't do any harm but we must still do the calculation
+
430  // to preserve the overall timing.
+
431  carry *= 38U;
+
432  carry += ((dlimb_t)(x[NUM_LIMBS_256BIT - 1] >> (LIMB_BITS - 1))) * 19U;
+
433  x[NUM_LIMBS_256BIT - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
+
434  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
+
435  carry += x[posn];
+
436  x[posn] = (limb_t)carry;
+
437  carry >>= LIMB_BITS;
+
438  }
+
439 
+
440  // At this point "x" will either be the answer or it will be the
+
441  // answer plus (2^255 - 19). Perform a trial subtraction which
+
442  // is equivalent to adding 19 and subtracting 2^255. We put the
+
443  // trial answer into the top-most limbs of the original "x" array.
+
444  // We add 19 here; the subtraction of 2^255 occurs in the next step.
+
445  carry = 19U;
+
446  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
+
447  carry += x[posn];
+
448  x[posn + NUM_LIMBS_256BIT] = (limb_t)carry;
+
449  carry >>= LIMB_BITS;
+
450  }
+
451 
+
452  // If there was a borrow, then the bottom-most limbs of "x" are the
+
453  // correct answer. If there was no borrow, then the top-most limbs
+
454  // of "x" are the correct answer. Select the correct answer but do
+
455  // it in a way that instruction timing will not reveal which value
+
456  // was selected. Borrow will occur if the high bit of the previous
+
457  // result is 0: turn the high bit into a selection mask.
+
458  limb_t mask = (limb_t)(((slimb_t)(x[NUM_LIMBS_512BIT - 1])) >> (LIMB_BITS - 1));
+
459  limb_t nmask = ~mask;
+
460  x[NUM_LIMBS_512BIT - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
+
461  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
+
462  result[posn] = (x[posn] & nmask) | (x[posn + NUM_LIMBS_256BIT] & mask);
+
463  }
+
464 }
+
465 
+
479 limb_t Curve25519::reduceQuick(limb_t *x)
+
480 {
+
481  limb_t temp[NUM_LIMBS_256BIT];
+
482  dlimb_t carry;
+
483  uint8_t posn;
+
484  limb_t *xx;
+
485  limb_t *tt;
+
486 
+
487  // Perform a trial subtraction of (2^255 - 19) from "x" which is
+
488  // equivalent to adding 19 and subtracting 2^255. We add 19 here;
+
489  // the subtraction of 2^255 occurs in the next step.
+
490  carry = 19U;
+
491  xx = x;
+
492  tt = temp;
+
493  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
+
494  carry += *xx++;
+
495  *tt++ = (limb_t)carry;
+
496  carry >>= LIMB_BITS;
+
497  }
+
498 
+
499  // If there was a borrow, then the original "x" is the correct answer.
+
500  // If there was no borrow, then "temp" is the correct answer. Select the
+
501  // correct answer but do it in a way that instruction timing will not
+
502  // reveal which value was selected. Borrow will occur if the high bit
+
503  // of "temp" is 0: turn the high bit into a selection mask.
+
504  limb_t mask = (limb_t)(((slimb_t)(temp[NUM_LIMBS_256BIT - 1])) >> (LIMB_BITS - 1));
+
505  limb_t nmask = ~mask;
+
506  temp[NUM_LIMBS_256BIT - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
+
507  xx = x;
+
508  tt = temp;
+
509  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
+
510  *xx = ((*xx) & nmask) | ((*tt++) & mask);
+
511  ++xx;
+
512  }
+
513 
+
514  // Clean up "temp".
+
515  strict_clean(temp);
+
516 
+
517  // Return a zero value if we actually subtracted (2^255 - 19) from "x".
+
518  return nmask;
+
519 }
+
520 
+
533 void Curve25519::mulNoReduce(limb_t *result, const limb_t *x, const limb_t *y)
+
534 {
+
535  uint8_t i, j;
+
536  dlimb_t carry;
+
537  limb_t word;
+
538  const limb_t *yy;
+
539  limb_t *rr;
+
540 
+
541  // Multiply the lowest word of x by y.
+
542  carry = 0;
+
543  word = x[0];
+
544  yy = y;
+
545  rr = result;
+
546  for (i = 0; i < NUM_LIMBS_256BIT; ++i) {
+
547  carry += ((dlimb_t)(*yy++)) * word;
+
548  *rr++ = (limb_t)carry;
+
549  carry >>= LIMB_BITS;
+
550  }
+
551  *rr = (limb_t)carry;
+
552 
+
553  // Multiply and add the remaining words of x by y.
+
554  for (i = 1; i < NUM_LIMBS_256BIT; ++i) {
+
555  word = x[i];
+
556  carry = 0;
+
557  yy = y;
+
558  rr = result + i;
+
559  for (j = 0; j < NUM_LIMBS_256BIT; ++j) {
+
560  carry += ((dlimb_t)(*yy++)) * word;
+
561  carry += *rr;
+
562  *rr++ = (limb_t)carry;
+
563  carry >>= LIMB_BITS;
+
564  }
+
565  *rr = (limb_t)carry;
+
566  }
+
567 }
+
568 
+
579 void Curve25519::mul(limb_t *result, const limb_t *x, const limb_t *y)
+
580 {
+
581  limb_t temp[NUM_LIMBS_512BIT];
+
582  mulNoReduce(temp, x, y);
+
583  reduce(result, temp, NUM_LIMBS_256BIT);
+
584  strict_clean(temp);
+
585 }
+
586 
+
606 void Curve25519::mulA24(limb_t *result, const limb_t *x)
+
607 {
+
608  // The constant a24 = 121665 (0x1DB41) as a limb array.
+
609 #if BIGNUMBER_LIMB_8BIT
+
610  static limb_t const a24[3] PROGMEM = {0x41, 0xDB, 0x01};
+
611 #elif BIGNUMBER_LIMB_16BIT
+
612  static limb_t const a24[2] PROGMEM = {0xDB41, 0x0001};
+
613 #elif BIGNUMBER_LIMB_32BIT
+
614  static limb_t const a24[1] PROGMEM = {0x0001DB41};
+
615 #else
+
616  #error "limb_t must be 8, 16, or 32 bits in size"
+
617 #endif
+
618  #define NUM_A24_LIMBS (sizeof(a24) / sizeof(limb_t))
+
619 
+
620  // Multiply the lowest limb of a24 by x and zero-extend into the result.
+
621  limb_t temp[NUM_LIMBS_512BIT];
+
622  uint8_t i, j;
+
623  dlimb_t carry = 0;
+
624  limb_t word = pgm_read_limb(&(a24[0]));
+
625  const limb_t *xx = x;
+
626  limb_t *tt = temp;
+
627  for (i = 0; i < NUM_LIMBS_256BIT; ++i) {
+
628  carry += ((dlimb_t)(*xx++)) * word;
+
629  *tt++ = (limb_t)carry;
+
630  carry >>= LIMB_BITS;
+
631  }
+
632  *tt = (limb_t)carry;
+
633 
+
634  // Multiply and add the remaining limbs of a24.
+
635  for (i = 1; i < NUM_A24_LIMBS; ++i) {
+
636  word = pgm_read_limb(&(a24[i]));
+
637  carry = 0;
+
638  xx = x;
+
639  tt = temp + i;
+
640  for (j = 0; j < NUM_LIMBS_256BIT; ++j) {
+
641  carry += ((dlimb_t)(*xx++)) * word;
+
642  carry += *tt;
+
643  *tt++ = (limb_t)carry;
+
644  carry >>= LIMB_BITS;
+
645  }
+
646  *tt = (limb_t)carry;
+
647  }
+
648 
+
649  // Reduce the intermediate result modulo 2^255 - 19.
+
650  reduce(result, temp, NUM_A24_LIMBS);
+
651  strict_clean(temp);
+
652 }
+
653 
+
665 void Curve25519::mul_P(limb_t *result, const limb_t *x, const limb_t *y)
+
666 {
+
667  limb_t temp[NUM_LIMBS_512BIT];
+
668  uint8_t i, j;
+
669  dlimb_t carry;
+
670  limb_t word;
+
671  const limb_t *yy;
+
672  limb_t *tt;
+
673 
+
674  // Multiply the lowest word of x by y.
+
675  carry = 0;
+
676  word = x[0];
+
677  yy = y;
+
678  tt = temp;
+
679  for (i = 0; i < NUM_LIMBS_256BIT; ++i) {
+
680  carry += ((dlimb_t)(pgm_read_limb(yy))) * word;
+
681  *tt++ = (limb_t)carry;
+
682  carry >>= LIMB_BITS;
+
683  ++yy;
+
684  }
+
685  *tt = (limb_t)carry;
+
686 
+
687  // Multiply and add the remaining words of x by y.
+
688  for (i = 1; i < NUM_LIMBS_256BIT; ++i) {
+
689  word = x[i];
+
690  carry = 0;
+
691  yy = y;
+
692  tt = temp + i;
+
693  for (j = 0; j < NUM_LIMBS_256BIT; ++j) {
+
694  carry += ((dlimb_t)(pgm_read_limb(yy))) * word;
+
695  carry += *tt;
+
696  *tt++ = (limb_t)carry;
+
697  carry >>= LIMB_BITS;
+
698  ++yy;
+
699  }
+
700  *tt = (limb_t)carry;
+
701  }
+
702 
+
703  // Reduce the intermediate result modulo 2^255 - 19.
+
704  reduce(result, temp, NUM_LIMBS_256BIT);
+
705  strict_clean(temp);
+
706 }
+
707 
+
718 void Curve25519::add(limb_t *result, const limb_t *x, const limb_t *y)
+
719 {
+
720  dlimb_t carry = 0;
+
721  uint8_t posn;
+
722  limb_t *rr = result;
+
723 
+
724  // Add the two arrays to obtain the intermediate result.
+
725  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
+
726  carry += *x++;
+
727  carry += *y++;
+
728  *rr++ = (limb_t)carry;
+
729  carry >>= LIMB_BITS;
+
730  }
+
731 
+
732  // Reduce the result using the quick trial subtraction method.
+
733  reduceQuick(result);
+
734 }
+
735 
+
746 void Curve25519::sub(limb_t *result, const limb_t *x, const limb_t *y)
+
747 {
+
748  dlimb_t borrow;
+
749  uint8_t posn;
+
750  limb_t *rr = result;
+
751 
+
752  // Subtract y from x to generate the intermediate result.
+
753  borrow = 0;
+
754  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
+
755  borrow = ((dlimb_t)(*x++)) - (*y++) - ((borrow >> LIMB_BITS) & 0x01);
+
756  *rr++ = (limb_t)borrow;
+
757  }
+
758 
+
759  // If we had a borrow, then the result has gone negative and we
+
760  // have to add 2^255 - 19 to the result to make it positive again.
+
761  // The top bits of "borrow" will be all 1's if there is a borrow
+
762  // or it will be all 0's if there was no borrow. Easiest is to
+
763  // conditionally subtract 19 and then mask off the high bit.
+
764  rr = result;
+
765  borrow = (borrow >> LIMB_BITS) & 19U;
+
766  borrow = ((dlimb_t)(*rr)) - borrow;
+
767  *rr++ = (limb_t)borrow;
+
768  for (posn = 1; posn < NUM_LIMBS_256BIT; ++posn) {
+
769  borrow = ((dlimb_t)(*rr)) - ((borrow >> LIMB_BITS) & 0x01);
+
770  *rr++ = (limb_t)borrow;
+
771  }
+
772  *(--rr) &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
+
773 }
+
774 
+
787 void Curve25519::cswap(limb_t select, limb_t *x, limb_t *y)
+
788 {
+
789  uint8_t posn;
+
790  limb_t dummy;
+
791  limb_t sel;
+
792 
+
793  // Turn "select" into an all-zeroes or all-ones mask. We don't care
+
794  // which bit or bits is set in the original "select" value.
+
795  sel = (limb_t)(((((dlimb_t)1) << LIMB_BITS) - select) >> LIMB_BITS);
+
796  --sel;
+
797 
+
798  // Swap the two values based on "select". Algorithm from:
+
799  // https://tools.ietf.org/html/draft-irtf-cfrg-curves-02
+
800  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
+
801  dummy = sel & (x[posn] ^ y[posn]);
+
802  x[posn] ^= dummy;
+
803  y[posn] ^= dummy;
+
804  }
+
805 }
+
806 
+
819 void Curve25519::cmove(limb_t select, limb_t *x, const limb_t *y)
+
820 {
+
821  uint8_t posn;
+
822  limb_t dummy;
+
823  limb_t sel;
+
824 
+
825  // Turn "select" into an all-zeroes or all-ones mask. We don't care
+
826  // which bit or bits is set in the original "select" value.
+
827  sel = (limb_t)(((((dlimb_t)1) << LIMB_BITS) - select) >> LIMB_BITS);
+
828  --sel;
+
829 
+
830  // Move y into x based on "select". Similar to conditional swap above.
+
831  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
+
832  dummy = sel & (x[posn] ^ y[posn]);
+
833  x[posn] ^= dummy;
+
834  }
+
835 }
+
836 
+
843 void Curve25519::pow250(limb_t *result, const limb_t *x)
+
844 {
+
845  limb_t t1[NUM_LIMBS_256BIT];
+
846  uint8_t i, j;
+
847 
+
848  // The big-endian hexadecimal expansion of (2^250 - 1) is:
+
849  // 03FFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF
+
850  //
+
851  // The naive implementation needs to do 2 multiplications per 1 bit and
+
852  // 1 multiplication per 0 bit. We can improve upon this by creating a
+
853  // pattern 0000000001 ... 0000000001. If we square and multiply the
+
854  // pattern by itself we can turn the pattern into the partial results
+
855  // 0000000011 ... 0000000011, 0000000111 ... 0000000111, etc.
+
856  // This averages out to about 1.1 multiplications per 1 bit instead of 2.
+
857 
+
858  // Build a pattern of 250 bits in length of repeated copies of 0000000001.
+
859  #define RECIP_GROUP_SIZE 10
+
860  #define RECIP_GROUP_BITS 250 // Must be a multiple of RECIP_GROUP_SIZE.
+
861  square(t1, x);
+
862  for (j = 0; j < (RECIP_GROUP_SIZE - 1); ++j)
+
863  square(t1, t1);
+
864  mul(result, t1, x);
+
865  for (i = 0; i < ((RECIP_GROUP_BITS / RECIP_GROUP_SIZE) - 2); ++i) {
+
866  for (j = 0; j < RECIP_GROUP_SIZE; ++j)
+
867  square(t1, t1);
+
868  mul(result, result, t1);
+
869  }
+
870 
+
871  // Multiply bit-shifted versions of the 0000000001 pattern into
+
872  // the result to "fill in" the gaps in the pattern.
+
873  square(t1, result);
+
874  mul(result, result, t1);
+
875  for (j = 0; j < (RECIP_GROUP_SIZE - 2); ++j) {
+
876  square(t1, t1);
+
877  mul(result, result, t1);
+
878  }
+
879 
+
880  // Clean up and exit.
+
881  clean(t1);
+
882 }
+
883 
+
891 void Curve25519::recip(limb_t *result, const limb_t *x)
+
892 {
+
893  // The reciprocal is the same as x ^ (p - 2) where p = 2^255 - 19.
+
894  // The big-endian hexadecimal expansion of (p - 2) is:
+
895  // 7FFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFEB
+
896  // Start with the 250 upper bits of the expansion of (p - 2).
+
897  pow250(result, x);
+
898 
+
899  // Deal with the 5 lowest bits of (p - 2), 01011, from highest to lowest.
+
900  square(result, result);
+
901  square(result, result);
+
902  mul(result, result, x);
+
903  square(result, result);
+
904  square(result, result);
+
905  mul(result, result, x);
+
906  square(result, result);
+
907  mul(result, result, x);
+
908 }
+
909 
+
925 bool Curve25519::sqrt(limb_t *result, const limb_t *x)
+
926 {
+
927  // sqrt(-1) mod (2^255 - 19).
+
928  static limb_t const numSqrtM1[NUM_LIMBS_256BIT] PROGMEM = {
+
929  LIMB(0x4A0EA0B0), LIMB(0xC4EE1B27), LIMB(0xAD2FE478), LIMB(0x2F431806),
+
930  LIMB(0x3DFBD7A7), LIMB(0x2B4D0099), LIMB(0x4FC1DF0B), LIMB(0x2B832480)
+
931  };
+
932  limb_t y[NUM_LIMBS_256BIT];
+
933 
+
934  // Algorithm from:
+
935  // https://tools.ietf.org/id/draft-josefsson-eddsa-ed25519-02.txt
+
936 
+
937  // Compute a candidate root: result = x^((p + 3) / 8) mod p.
+
938  // (p + 3) / 8 = (2^252 - 2) which is 251 one bits followed by a zero:
+
939  // 0FFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE
+
940  pow250(result, x);
+
941  square(result, result);
+
942  mul(result, result, x);
+
943  square(result, result);
+
944 
+
945  // Did we get the square root immediately?
+
946  square(y, result);
+
947  if (memcmp(x, y, sizeof(y)) == 0) {
+
948  clean(y);
+
949  return true;
+
950  }
+
951 
+
952  // Multiply the result by sqrt(-1) and check again.
+
953  mul_P(result, result, numSqrtM1);
+
954  square(y, result);
+
955  if (memcmp(x, y, sizeof(y)) == 0) {
+
956  clean(y);
+
957  return true;
+
958  }
+
959 
+
960  // The number does not have a square root.
+
961  clean(y);
+
962  return false;
+
963 }
RNGClass::rand
void rand(uint8_t *data, size_t len)
Generates random bytes into a caller-supplied buffer.
Definition: RNG.cpp:298
-
Curve25519::eval
static bool eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[32])
Evaluates the raw Curve25519 function.
Definition: Curve25519.cpp:79
-
BigNumberUtil::unpackLE
static void unpackLE(limb_t *limbs, size_t count, const uint8_t *bytes, size_t len)
Unpacks the little-endian byte representation of a big number into a limb array.
Definition: BigNumberUtil.cpp:54
-
BigNumberUtil::packLE
static void packLE(uint8_t *bytes, size_t len, const limb_t *limbs, size_t count)
Packs the little-endian byte representation of a big number into a byte array.
Definition: BigNumberUtil.cpp:207
-
Curve25519::dh1
static void dh1(uint8_t k[32], uint8_t f[32])
Performs phase 1 of a Diffie-Hellman key exchange using Curve25519.
Definition: Curve25519.cpp:244
-
Curve25519::dh2
static bool dh2(uint8_t k[32], uint8_t f[32])
Performs phase 2 of a Diffie-Hellman key exchange using Curve25519.
Definition: Curve25519.cpp:282
+
Curve25519::eval
static bool eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[32])
Evaluates the raw Curve25519 function.
Definition: Curve25519.cpp:74
+
BigNumberUtil::unpackLE
static void unpackLE(limb_t *limbs, size_t count, const uint8_t *bytes, size_t len)
Unpacks the little-endian byte representation of a big number into a limb array.
Definition: BigNumberUtil.cpp:55
+
BigNumberUtil::packLE
static void packLE(uint8_t *bytes, size_t len, const limb_t *limbs, size_t count)
Packs the little-endian byte representation of a big number into a byte array.
Definition: BigNumberUtil.cpp:208
+
Curve25519::dh1
static void dh1(uint8_t k[32], uint8_t f[32])
Performs phase 1 of a Diffie-Hellman key exchange using Curve25519.
Definition: Curve25519.cpp:239
+
Curve25519::dh2
static bool dh2(uint8_t k[32], uint8_t f[32])
Performs phase 2 of a Diffie-Hellman key exchange using Curve25519.
Definition: Curve25519.cpp:277
diff --git a/Curve25519_8h_source.html b/Curve25519_8h_source.html index 3df3ed47..9fb8584c 100644 --- a/Curve25519_8h_source.html +++ b/Curve25519_8h_source.html @@ -115,53 +115,65 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
25 
26 #include "BigNumberUtil.h"
27 
-
28 class Curve25519
-
29 {
-
30 public:
-
31  static bool eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[32]);
-
32 
-
33  static void dh1(uint8_t k[32], uint8_t f[32]);
-
34  static bool dh2(uint8_t k[32], uint8_t f[32]);
-
35 
-
36 #if defined(TEST_CURVE25519_FIELD_OPS)
-
37 public:
-
38 #else
-
39 private:
-
40 #endif
-
41  static uint8_t isWeakPoint(const uint8_t k[32]);
-
42 
-
43  static void reduce(limb_t *result, limb_t *x, uint8_t size);
-
44  static limb_t reduceQuick(limb_t *x);
-
45 
-
46  static void mul(limb_t *result, const limb_t *x, const limb_t *y);
-
47  static void square(limb_t *result, const limb_t *x)
-
48  {
-
49  mul(result, x, x);
-
50  }
-
51 
-
52  static void mulA24(limb_t *result, const limb_t *x);
-
53 
-
54  static void add(limb_t *result, const limb_t *x, const limb_t *y);
-
55  static void sub(limb_t *result, const limb_t *x, const limb_t *y);
-
56 
-
57  static void cswap(uint8_t select, limb_t *x, limb_t *y);
-
58 
-
59  static void recip(limb_t *result, const limb_t *x);
-
60 
-
61  // Constructor and destructor are private - cannot instantiate this class.
-
62  Curve25519() {}
-
63  ~Curve25519() {}
-
64 };
+
28 class Ed25519;
+
29 
+
30 class Curve25519
+
31 {
+
32 public:
+
33  static bool eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[32]);
+
34 
+
35  static void dh1(uint8_t k[32], uint8_t f[32]);
+
36  static bool dh2(uint8_t k[32], uint8_t f[32]);
+
37 
+
38 #if defined(TEST_CURVE25519_FIELD_OPS)
+
39 public:
+
40 #else
+
41 private:
+
42 #endif
+
43  static uint8_t isWeakPoint(const uint8_t k[32]);
+
44 
+
45  static void reduce(limb_t *result, limb_t *x, uint8_t size);
+
46  static limb_t reduceQuick(limb_t *x);
+
47 
+
48  static void mulNoReduce(limb_t *result, const limb_t *x, const limb_t *y);
+
49 
+
50  static void mul(limb_t *result, const limb_t *x, const limb_t *y);
+
51  static void square(limb_t *result, const limb_t *x)
+
52  {
+
53  mul(result, x, x);
+
54  }
+
55 
+
56  static void mulA24(limb_t *result, const limb_t *x);
+
57 
+
58  static void mul_P(limb_t *result, const limb_t *x, const limb_t *y);
+
59 
+
60  static void add(limb_t *result, const limb_t *x, const limb_t *y);
+
61  static void sub(limb_t *result, const limb_t *x, const limb_t *y);
+
62 
+
63  static void cswap(limb_t select, limb_t *x, limb_t *y);
+
64  static void cmove(limb_t select, limb_t *x, const limb_t *y);
65 
-
66 #endif
-
Curve25519
Diffie-Hellman key agreement based on the elliptic curve modulo 2^255 - 19.
Definition: Curve25519.h:28
-
Curve25519::eval
static bool eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[32])
Evaluates the raw Curve25519 function.
Definition: Curve25519.cpp:79
-
Curve25519::dh1
static void dh1(uint8_t k[32], uint8_t f[32])
Performs phase 1 of a Diffie-Hellman key exchange using Curve25519.
Definition: Curve25519.cpp:244
-
Curve25519::dh2
static bool dh2(uint8_t k[32], uint8_t f[32])
Performs phase 2 of a Diffie-Hellman key exchange using Curve25519.
Definition: Curve25519.cpp:282
+
66  static void pow250(limb_t *result, const limb_t *x);
+
67  static void recip(limb_t *result, const limb_t *x);
+
68  static bool sqrt(limb_t *result, const limb_t *x);
+
69 
+
70  // Constructor and destructor are private - cannot instantiate this class.
+
71  Curve25519() {}
+
72  ~Curve25519() {}
+
73 
+
74  friend class Ed25519;
+
75 };
+
76 
+
77 #endif
+
Curve25519
Diffie-Hellman key agreement based on the elliptic curve modulo 2^255 - 19.
Definition: Curve25519.h:30
+
Curve25519::eval
static bool eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[32])
Evaluates the raw Curve25519 function.
Definition: Curve25519.cpp:74
+
Ed25519
Digital signatures based on the elliptic curve modulo 2^255 - 19.
Definition: Ed25519.h:29
+
Curve25519::dh1
static void dh1(uint8_t k[32], uint8_t f[32])
Performs phase 1 of a Diffie-Hellman key exchange using Curve25519.
Definition: Curve25519.cpp:239
+
Curve25519::dh2
static bool dh2(uint8_t k[32], uint8_t f[32])
Performs phase 2 of a Diffie-Hellman key exchange using Curve25519.
Definition: Curve25519.cpp:277
diff --git a/DMD_8cpp_source.html b/DMD_8cpp_source.html index b75180ce..a3ffb870 100644 --- a/DMD_8cpp_source.html +++ b/DMD_8cpp_source.html @@ -456,7 +456,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DMD_8h_source.html b/DMD_8h_source.html index c80982c9..ad7b29d1 100644 --- a/DMD_8h_source.html +++ b/DMD_8h_source.html @@ -170,7 +170,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DS1307RTC_8cpp_source.html b/DS1307RTC_8cpp_source.html index eff184c3..1ffff0ba 100644 --- a/DS1307RTC_8cpp_source.html +++ b/DS1307RTC_8cpp_source.html @@ -415,7 +415,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DS1307RTC_8h_source.html b/DS1307RTC_8h_source.html index e8ffaa30..bc093575 100644 --- a/DS1307RTC_8h_source.html +++ b/DS1307RTC_8h_source.html @@ -172,7 +172,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DS3231RTC_8cpp_source.html b/DS3231RTC_8cpp_source.html index a665c440..37f97d13 100644 --- a/DS3231RTC_8cpp_source.html +++ b/DS3231RTC_8cpp_source.html @@ -657,7 +657,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DS3231RTC_8h_source.html b/DS3231RTC_8h_source.html index 6c3a8248..24978977 100644 --- a/DS3231RTC_8h_source.html +++ b/DS3231RTC_8h_source.html @@ -202,7 +202,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DS3232RTC_8cpp_source.html b/DS3232RTC_8cpp_source.html index 94e02360..90b389fe 100644 --- a/DS3232RTC_8cpp_source.html +++ b/DS3232RTC_8cpp_source.html @@ -575,7 +575,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DS3232RTC_8h_source.html b/DS3232RTC_8h_source.html index f209e96a..a67bbce4 100644 --- a/DS3232RTC_8h_source.html +++ b/DS3232RTC_8h_source.html @@ -190,7 +190,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DejaVuSans9_8h_source.html b/DejaVuSans9_8h_source.html index 73a6c8e8..f83d39f0 100644 --- a/DejaVuSans9_8h_source.html +++ b/DejaVuSans9_8h_source.html @@ -257,7 +257,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DejaVuSansBold9_8h_source.html b/DejaVuSansBold9_8h_source.html index a9504e17..a1aed297 100644 --- a/DejaVuSansBold9_8h_source.html +++ b/DejaVuSansBold9_8h_source.html @@ -257,7 +257,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DejaVuSansItalic9_8h_source.html b/DejaVuSansItalic9_8h_source.html index 45d96bbe..1d4b3f5d 100644 --- a/DejaVuSansItalic9_8h_source.html +++ b/DejaVuSansItalic9_8h_source.html @@ -257,7 +257,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/EEPROM24_8cpp_source.html b/EEPROM24_8cpp_source.html index 5a574af0..047497c4 100644 --- a/EEPROM24_8cpp_source.html +++ b/EEPROM24_8cpp_source.html @@ -282,7 +282,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/EEPROM24_8h_source.html b/EEPROM24_8h_source.html index ae479006..1dcf41b3 100644 --- a/EEPROM24_8h_source.html +++ b/EEPROM24_8h_source.html @@ -186,7 +186,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Ed25519_8cpp_source.html b/Ed25519_8cpp_source.html new file mode 100644 index 00000000..c5dc2925 --- /dev/null +++ b/Ed25519_8cpp_source.html @@ -0,0 +1,580 @@ + + + + + + +ArduinoLibs: Ed25519.cpp Source File + + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs +
+
+
+ + + + + + +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
+ + +
+ +
+ + +
+
+
+
Ed25519.cpp
+
+
+
1 /*
+
2  * Copyright (C) 2015 Southern Storm Software, Pty Ltd.
+
3  *
+
4  * Permission is hereby granted, free of charge, to any person obtaining a
+
5  * copy of this software and associated documentation files (the "Software"),
+
6  * to deal in the Software without restriction, including without limitation
+
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+
8  * and/or sell copies of the Software, and to permit persons to whom the
+
9  * Software is furnished to do so, subject to the following conditions:
+
10  *
+
11  * The above copyright notice and this permission notice shall be included
+
12  * in all copies or substantial portions of the Software.
+
13  *
+
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+
20  * DEALINGS IN THE SOFTWARE.
+
21  */
+
22 
+
23 #include "Ed25519.h"
+
24 #include "Curve25519.h"
+
25 #include "Crypto.h"
+
26 #include "RNG.h"
+
27 #include "utility/LimbUtil.h"
+
28 #include <string.h>
+
29 
+
78 // 37095705934669439343138083508754565189542113879843219016388785533085940283555
+
79 static limb_t const numD[NUM_LIMBS_256BIT] PROGMEM = {
+
80  LIMB(0x135978A3), LIMB(0x75EB4DCA), LIMB(0x4141D8AB), LIMB(0x00700A4D),
+
81  LIMB(0x7779E898), LIMB(0x8CC74079), LIMB(0x2B6FFE73), LIMB(0x52036CEE)
+
82 };
+
83 
+
84 // d * 2
+
85 static limb_t const numDx2[NUM_LIMBS_256BIT] PROGMEM = {
+
86  LIMB(0x26B2F159), LIMB(0xEBD69B94), LIMB(0x8283B156), LIMB(0x00E0149A),
+
87  LIMB(0xEEF3D130), LIMB(0x198E80F2), LIMB(0x56DFFCE7), LIMB(0x2406D9DC)
+
88 };
+
89 
+
90 // Extended homogenous co-ordinates for the base point.
+
91 static limb_t const numBx[NUM_LIMBS_256BIT] PROGMEM = {
+
92  LIMB(0x8F25D51A), LIMB(0xC9562D60), LIMB(0x9525A7B2), LIMB(0x692CC760),
+
93  LIMB(0xFDD6DC5C), LIMB(0xC0A4E231), LIMB(0xCD6E53FE), LIMB(0x216936D3)
+
94 };
+
95 static limb_t const numBy[NUM_LIMBS_256BIT] PROGMEM = {
+
96  LIMB(0x66666658), LIMB(0x66666666), LIMB(0x66666666), LIMB(0x66666666),
+
97  LIMB(0x66666666), LIMB(0x66666666), LIMB(0x66666666), LIMB(0x66666666)
+
98 };
+
99 static limb_t const numBz[NUM_LIMBS_256BIT] PROGMEM = {
+
100  LIMB(0x00000001), LIMB(0x00000000), LIMB(0x00000000), LIMB(0x00000000),
+
101  LIMB(0x00000000), LIMB(0x00000000), LIMB(0x00000000), LIMB(0x00000000)
+
102 };
+
103 static limb_t const numBt[NUM_LIMBS_256BIT] PROGMEM = {
+
104  LIMB(0xA5B7DDA3), LIMB(0x6DDE8AB3), LIMB(0x775152F5), LIMB(0x20F09F80),
+
105  LIMB(0x64ABE37D), LIMB(0x66EA4E8E), LIMB(0xD78B7665), LIMB(0x67875F0F)
+
106 };
+
107 
+
108 // 2^252 + 27742317777372353535851937790883648493
+
109 static limb_t const numQ[NUM_LIMBS_256BIT] PROGMEM = {
+
110  LIMB(0x5CF5D3ED), LIMB(0x5812631A), LIMB(0xA2F79CD6), LIMB(0x14DEF9DE),
+
111  LIMB(0x00000000), LIMB(0x00000000), LIMB(0x00000000), LIMB(0x10000000)
+
112 };
+
113 
+
127 void Ed25519::sign(uint8_t signature[64], const uint8_t privateKey[32],
+
128  const uint8_t publicKey[32], const void *message, size_t len)
+
129 {
+
130  SHA512 hash;
+
131  uint8_t *buf = (uint8_t *)(hash.state.w); // Reuse hash buffer to save memory.
+
132  limb_t a[NUM_LIMBS_256BIT];
+
133  limb_t r[NUM_LIMBS_256BIT];
+
134  limb_t k[NUM_LIMBS_256BIT];
+
135  limb_t t[NUM_LIMBS_512BIT + 1];
+
136  Point rB;
+
137 
+
138  // Derive the secret scalar a and the message prefix from the private key.
+
139  deriveKeys(&hash, a, privateKey);
+
140 
+
141  // Hash the prefix and the message to derive r.
+
142  hash.reset();
+
143  hash.update(buf + 32, 32);
+
144  hash.update(message, len);
+
145  hash.finalize(buf, 0);
+
146  reduceQFromBuffer(r, buf, t);
+
147 
+
148  // Encode rB into the first half of the signature buffer as R.
+
149  mul(rB, r);
+
150  encodePoint(signature, rB);
+
151 
+
152  // Hash R, A, and the message to get k.
+
153  hash.reset();
+
154  hash.update(signature, 32); // R
+
155  hash.update(publicKey, 32); // A
+
156  hash.update(message, len);
+
157  hash.finalize(buf, 0);
+
158  reduceQFromBuffer(k, buf, t);
+
159 
+
160  // Compute s = (r + k * a) mod q.
+
161  Curve25519::mulNoReduce(t, k, a);
+
162  t[NUM_LIMBS_512BIT] = 0;
+
163  reduceQ(t, t);
+
164  BigNumberUtil::add(t, t, r, NUM_LIMBS_256BIT);
+
165  BigNumberUtil::reduceQuick_P(t, t, numQ, NUM_LIMBS_256BIT);
+
166  BigNumberUtil::packLE(signature + 32, 32, t, NUM_LIMBS_256BIT);
+
167 
+
168  // Clean up.
+
169  clean(a);
+
170  clean(r);
+
171  clean(k);
+
172  clean(t);
+
173  clean(rB);
+
174 }
+
175 
+
189 bool Ed25519::verify(const uint8_t signature[64], const uint8_t publicKey[32],
+
190  const void *message, size_t len)
+
191 {
+
192  SHA512 hash;
+
193  Point A;
+
194  Point R;
+
195  Point sB;
+
196  Point kA;
+
197  uint8_t *k = (uint8_t *)(hash.state.w); // Reuse hash buffer to save memory.
+
198  bool result = false;
+
199 
+
200  // Decode the public key and the R component of the signature.
+
201  if (decodePoint(A, publicKey) && decodePoint(R, signature)) {
+
202  // Reconstruct the k value from the signing step.
+
203  hash.reset();
+
204  hash.update(signature, 32);
+
205  hash.update(publicKey, 32);
+
206  hash.update(message, len);
+
207  hash.finalize(k, 0);
+
208 
+
209  // Calculate s * B. The s value is stored temporarily in kA.t.
+
210  BigNumberUtil::unpackLE(kA.t, NUM_LIMBS_256BIT, signature + 32, 32);
+
211  mul(sB, kA.t, false);
+
212 
+
213  // Calculate R + k * A. We don't need sB.t in equal() below,
+
214  // so we reuse that as a temporary buffer when reducing k.
+
215  reduceQFromBuffer(sB.t, k, kA.x);
+
216  mul(kA, sB.t, A, false);
+
217  add(R, kA);
+
218 
+
219  // Compare s * B and R + k * A for equality.
+
220  result = equal(sB, R);
+
221  }
+
222 
+
223  // Clean up and exit.
+
224  clean(A);
+
225  clean(R);
+
226  clean(sB);
+
227  clean(kA);
+
228  return result;
+
229 }
+
230 
+
243 void Ed25519::generatePrivateKey(uint8_t privateKey[32])
+
244 {
+
245  RNG.rand(privateKey, 32);
+
246 }
+
247 
+
256 void Ed25519::derivePublicKey(uint8_t publicKey[32], const uint8_t privateKey[32])
+
257 {
+
258  SHA512 hash;
+
259  uint8_t *buf = (uint8_t *)(hash.state.w);
+
260  limb_t a[NUM_LIMBS_256BIT];
+
261  Point ptA;
+
262 
+
263  // Derive the secret scalar a from the private key.
+
264  deriveKeys(&hash, a, privateKey);
+
265 
+
266  // Compute the point A = aB and encode it.
+
267  mul(ptA, a);
+
268  encodePoint(publicKey, ptA);
+
269 
+
270  // Clean up and exit.
+
271  clean(a);
+
272  clean(ptA);
+
273 }
+
274 
+
284 void Ed25519::reduceQFromBuffer(limb_t *result, const uint8_t buf[64], limb_t *temp)
+
285 {
+
286  BigNumberUtil::unpackLE(temp, NUM_LIMBS_512BIT, buf, 64);
+
287  temp[NUM_LIMBS_512BIT] = 0;
+
288  reduceQ(result, temp);
+
289 }
+
290 
+
303 void Ed25519::reduceQ(limb_t *result, limb_t *r)
+
304 {
+
305  // Algorithm from: http://en.wikipedia.org/wiki/Barrett_reduction
+
306  //
+
307  // We assume that r is less than or equal to (q - 1)^2.
+
308  //
+
309  // We want to compute result = r mod q. Find the smallest k such
+
310  // that 2^k > q. In our case, k = 253. Then set m = floor(4^k / q)
+
311  // and let r = r - q * floor(m * r / 4^k). This will be the result
+
312  // or it will be at most one subtraction of q away from the result.
+
313  //
+
314  // Note: 4^k = 4^253 = 2^506 = 2^512/2^6. We can more easily compute
+
315  // the result we want if we set m = floor(4^k * 2^6 / q) instead and
+
316  // then r = r - q * floor(m * r / 2^512). Because the slight extra
+
317  // precision in m, r is at most two subtractions of q away from the
+
318  // final result.
+
319  static limb_t const numM[NUM_LIMBS_256BIT + 1] PROGMEM = {
+
320  LIMB(0x0A2C131B), LIMB(0xED9CE5A3), LIMB(0x086329A7), LIMB(0x2106215D),
+
321  LIMB(0xFFFFFFEB), LIMB(0xFFFFFFFF), LIMB(0xFFFFFFFF), LIMB(0xFFFFFFFF),
+
322  0x0F
+
323  };
+
324  limb_t temp[NUM_LIMBS_512BIT + NUM_LIMBS_256BIT + 1];
+
325 
+
326  // Multiply r by m.
+
327  BigNumberUtil::mul_P(temp, r, NUM_LIMBS_512BIT, numM, NUM_LIMBS_256BIT + 1);
+
328 
+
329  // Multiply (m * r) / 2^512 by q and subtract it from r.
+
330  // We can ignore the high words of the subtraction result
+
331  // because they will all turn into zero after the subtraction.
+
332  BigNumberUtil::mul_P(temp, temp + NUM_LIMBS_512BIT, NUM_LIMBS_256BIT + 1,
+
333  numQ, NUM_LIMBS_256BIT);
+
334  BigNumberUtil::sub(r, r, temp, NUM_LIMBS_256BIT);
+
335 
+
336  // Perform two subtractions of q from the result to reduce it.
+
337  BigNumberUtil::reduceQuick_P(result, r, numQ, NUM_LIMBS_256BIT);
+
338  BigNumberUtil::reduceQuick_P(result, result, numQ, NUM_LIMBS_256BIT);
+
339 
+
340  // Clean up and exit.
+
341  clean(temp);
+
342 }
+
343 
+
353 void Ed25519::mul(Point &result, const limb_t *s, Point &p, bool constTime)
+
354 {
+
355  Point q;
+
356  limb_t A[NUM_LIMBS_256BIT];
+
357  limb_t B[NUM_LIMBS_256BIT];
+
358  limb_t C[NUM_LIMBS_256BIT];
+
359  limb_t D[NUM_LIMBS_256BIT];
+
360  limb_t mask, select;
+
361  uint8_t sposn, t;
+
362 
+
363  // Initialize the result to (0, 1, 1, 0).
+
364  memset(&result, 0, sizeof(Point));
+
365  result.y[0] = 1;
+
366  result.z[0] = 1;
+
367 
+
368  // Iterate over the 255 bits of "s" to calculate "s * p".
+
369  mask = 1;
+
370  sposn = 0;
+
371  for (t = 255; t > 0; --t) {
+
372  // Add p to the result to produce q. The specification refers
+
373  // to temporary variables A to H. We can dispense with E to H
+
374  // by using B, D, q.z, and q.t to hold those values temporarily.
+
375  select = s[sposn] & mask;
+
376  if (constTime || select) {
+
377  Curve25519::sub(A, result.y, result.x);
+
378  Curve25519::sub(C, p.y, p.x);
+
379  Curve25519::mul(A, A, C);
+
380  Curve25519::add(B, result.y, result.x);
+
381  Curve25519::add(C, p.y, p.x);
+
382  Curve25519::mul(B, B, C);
+
383  Curve25519::mul(C, result.t, p.t);
+
384  Curve25519::mul_P(C, C, numDx2);
+
385  Curve25519::mul(D, result.z, p.z);
+
386  Curve25519::add(D, D, D);
+
387  Curve25519::sub(q.t, B, A); // E = B - A
+
388  Curve25519::sub(q.z, D, C); // F = D - C
+
389  Curve25519::add(D, D, C); // G = D + C
+
390  Curve25519::add(B, B, A); // H = B + A
+
391  if (constTime) {
+
392  // Put the intermediate value into q.
+
393  Curve25519::mul(q.x, q.t, q.z); // q.x = E * F
+
394  Curve25519::mul(q.y, D, B); // q.y = G * H
+
395  Curve25519::mul(q.z, q.z, D); // q.z = F * G
+
396  Curve25519::mul(q.t, q.t, B); // q.t = E * H
+
397 
+
398  // Copy q into the result if the current bit of s is 1.
+
399  Curve25519::cmove(select, result.x, q.x);
+
400  Curve25519::cmove(select, result.y, q.y);
+
401  Curve25519::cmove(select, result.z, q.z);
+
402  Curve25519::cmove(select, result.t, q.t);
+
403  } else {
+
404  // Put the intermediate value directly into the result.
+
405  Curve25519::mul(result.x, q.t, q.z); // q.x = E * F
+
406  Curve25519::mul(result.y, D, B); // q.y = G * H
+
407  Curve25519::mul(result.z, q.z, D); // q.z = F * G
+
408  Curve25519::mul(result.t, q.t, B); // q.t = E * H
+
409  }
+
410  }
+
411 
+
412  // Double p for the next iteration.
+
413  Curve25519::sub(A, p.y, p.x);
+
414  Curve25519::square(A, A);
+
415  Curve25519::add(B, p.y, p.x);
+
416  Curve25519::square(B, B);
+
417  Curve25519::square(C, p.t);
+
418  Curve25519::mul_P(C, C, numDx2);
+
419  Curve25519::square(D, p.z);
+
420  Curve25519::add(D, D, D);
+
421  Curve25519::sub(p.t, B, A); // E = B - A
+
422  Curve25519::sub(p.z, D, C); // F = D - C
+
423  Curve25519::add(D, D, C); // G = D + C
+
424  Curve25519::add(B, B, A); // H = B + A
+
425  Curve25519::mul(p.x, p.t, p.z); // p.x = E * F
+
426  Curve25519::mul(p.y, D, B); // p.y = G * H
+
427  Curve25519::mul(p.z, p.z, D); // p.z = F * G
+
428  Curve25519::mul(p.t, p.t, B); // p.t = E * H
+
429 
+
430  // Move onto the next bit of s from lowest to highest.
+
431  if (mask != (((limb_t)1) << (LIMB_BITS - 1))) {
+
432  mask <<= 1;
+
433  } else {
+
434  ++sposn;
+
435  mask = 1;
+
436  }
+
437  }
+
438 
+
439  // Clean up.
+
440  clean(q);
+
441  clean(A);
+
442  clean(B);
+
443  clean(C);
+
444  clean(D);
+
445 }
+
446 
+
455 void Ed25519::mul(Point &result, const limb_t *s, bool constTime)
+
456 {
+
457  Point P;
+
458  memcpy_P(P.x, numBx, sizeof(P.x));
+
459  memcpy_P(P.y, numBy, sizeof(P.y));
+
460  memcpy_P(P.z, numBz, sizeof(P.z));
+
461  memcpy_P(P.t, numBt, sizeof(P.t));
+
462  mul(result, s, P, constTime);
+
463  clean(P);
+
464 }
+
465 
+
472 void Ed25519::add(Point &p, const Point &q)
+
473 {
+
474  limb_t A[NUM_LIMBS_256BIT];
+
475  limb_t B[NUM_LIMBS_256BIT];
+
476  limb_t C[NUM_LIMBS_256BIT];
+
477  limb_t D[NUM_LIMBS_256BIT];
+
478 
+
479  Curve25519::sub(A, p.y, p.x);
+
480  Curve25519::sub(C, q.y, q.x);
+
481  Curve25519::mul(A, A, C);
+
482  Curve25519::add(B, p.y, p.x);
+
483  Curve25519::add(C, q.y, q.x);
+
484  Curve25519::mul(B, B, C);
+
485  Curve25519::mul(C, p.t, q.t);
+
486  Curve25519::mul_P(C, C, numDx2);
+
487  Curve25519::mul(D, p.z, q.z);
+
488  Curve25519::add(D, D, D);
+
489  Curve25519::sub(p.t, B, A); // E = B - A
+
490  Curve25519::sub(p.z, D, C); // F = D - C
+
491  Curve25519::add(D, D, C); // G = D + C
+
492  Curve25519::add(B, B, A); // H = B + A
+
493  Curve25519::mul(p.x, p.t, p.z); // p.x = E * F
+
494  Curve25519::mul(p.y, D, B); // p.y = G * H
+
495  Curve25519::mul(p.z, p.z, D); // p.z = F * G
+
496  Curve25519::mul(p.t, p.t, B); // p.t = E * H
+
497 
+
498  clean(A);
+
499  clean(B);
+
500  clean(C);
+
501  clean(D);
+
502 }
+
503 
+
512 bool Ed25519::equal(const Point &p, const Point &q)
+
513 {
+
514  limb_t a[NUM_LIMBS_256BIT];
+
515  limb_t b[NUM_LIMBS_256BIT];
+
516  bool result = true;
+
517 
+
518  Curve25519::mul(a, p.x, q.z);
+
519  Curve25519::mul(b, q.x, p.z);
+
520  result &= secure_compare(a, b, sizeof(a));
+
521 
+
522  Curve25519::mul(a, p.y, q.z);
+
523  Curve25519::mul(b, q.y, p.z);
+
524  result &= secure_compare(a, b, sizeof(a));
+
525 
+
526  clean(a);
+
527  clean(b);
+
528  return result;
+
529 }
+
530 
+
540 void Ed25519::encodePoint(uint8_t *buf, Point &point)
+
541 {
+
542  // Convert the homogeneous coordinates into plain (x, y) coordinates:
+
543  // zinv = z^(-1) mod p
+
544  // x = x * zinv mod p
+
545  // y = y * zinv mod p
+
546  // We don't need the t coordinate, so use that to store zinv temporarily.
+
547  Curve25519::recip(point.t, point.z);
+
548  Curve25519::mul(point.x, point.x, point.t);
+
549  Curve25519::mul(point.y, point.y, point.t);
+
550 
+
551  // Copy the lowest bit of x to the highest bit of y.
+
552  point.y[NUM_LIMBS_256BIT - 1] |= (point.x[0] << (LIMB_BITS - 1));
+
553 
+
554  // Convert y into little-endian in the return buffer.
+
555  BigNumberUtil::packLE(buf, 32, point.y, NUM_LIMBS_256BIT);
+
556 }
+
557 
+
570 bool Ed25519::decodePoint(Point &point, const uint8_t *buf)
+
571 {
+
572  limb_t temp[NUM_LIMBS_256BIT];
+
573 
+
574  // Convert the input buffer from little-endian into the limbs of y.
+
575  BigNumberUtil::unpackLE(point.y, NUM_LIMBS_256BIT, buf, 32);
+
576 
+
577  // The high bit of y is the sign bit for x.
+
578  limb_t sign = point.y[NUM_LIMBS_256BIT - 1] >> (LIMB_BITS - 1);
+
579  point.y[NUM_LIMBS_256BIT - 1] &= ~(((limb_t)1) << (LIMB_BITS - 1));
+
580 
+
581  // Set z to 1.
+
582  memcpy_P(point.z, numBz, sizeof(point.z));
+
583 
+
584  // Compute t = (y * y - 1) * modinv(d * y * y + 1).
+
585  Curve25519::square(point.t, point.y);
+
586  Curve25519::sub(point.x, point.t, point.z);
+
587  Curve25519::mul_P(point.t, point.t, numD);
+
588  Curve25519::add(point.t, point.t, point.z);
+
589  Curve25519::recip(temp, point.t);
+
590  Curve25519::mul(point.t, point.x, temp);
+
591  clean(temp);
+
592 
+
593  // Check for t = 0.
+
594  limb_t check = point.t[0];
+
595  for (uint8_t posn = 1; posn < NUM_LIMBS_256BIT; ++posn)
+
596  check |= point.t[posn];
+
597  if (!check) {
+
598  // If the sign bit is set, then decoding has failed.
+
599  // Otherwise x is zero and we're done.
+
600  if (sign)
+
601  return false;
+
602  memset(point.x, 0, sizeof(point.x));
+
603  return true;
+
604  }
+
605 
+
606  // Recover x by taking the sqrt of t and flipping the sign if necessary.
+
607  if (!Curve25519::sqrt(point.x, point.t))
+
608  return false;
+
609  if (sign != (point.x[0] & ((limb_t)1))) {
+
610  // The signs are different so we want the other square root.
+
611  memset(point.t, 0, sizeof(point.t));
+
612  Curve25519::sub(point.x, point.t, point.x);
+
613  }
+
614 
+
615  // Finally, t = x * y.
+
616  Curve25519::mul(point.t, point.x, point.y);
+
617  return true;
+
618 }
+
619 
+
630 void Ed25519::deriveKeys(SHA512 *hash, limb_t *a, const uint8_t privateKey[32])
+
631 {
+
632  // Hash the private key to get the "a" scalar and the message prefix.
+
633  uint8_t *buf = (uint8_t *)(hash->state.w); // Reuse hash buffer to save memory.
+
634  hash->reset();
+
635  hash->update(privateKey, 32);
+
636  hash->finalize(buf, 0);
+
637  buf[0] &= 0xF8;
+
638  buf[31] &= 0x7F;
+
639  buf[31] |= 0x40;
+
640 
+
641  // Unpack the first half of the hash value into "a".
+
642  BigNumberUtil::unpackLE(a, NUM_LIMBS_256BIT, buf, 32);
+
643 }
+
static void reduceQuick_P(limb_t *result, const limb_t *x, const limb_t *y, size_t size)
Reduces x modulo y using subtraction where y is in program memory.
+
static void generatePrivateKey(uint8_t privateKey[32])
Generates a private key for Ed25519 signing operations.
Definition: Ed25519.cpp:243
+
static limb_t add(limb_t *result, const limb_t *x, const limb_t *y, size_t size)
Adds two big numbers.
+
void rand(uint8_t *data, size_t len)
Generates random bytes into a caller-supplied buffer.
Definition: RNG.cpp:298
+
static bool verify(const uint8_t signature[64], const uint8_t publicKey[32], const void *message, size_t len)
Verifies a signature using a specific Ed25519 public key.
Definition: Ed25519.cpp:189
+
SHA-512 hash algorithm.
Definition: SHA512.h:30
+
void reset()
Resets the hash ready for a new hashing process.
Definition: SHA512.cpp:66
+
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: SHA512.cpp:79
+
static limb_t sub(limb_t *result, const limb_t *x, const limb_t *y, size_t size)
Subtracts one big number from another.
+
static void mul_P(limb_t *result, const limb_t *x, size_t xcount, const limb_t *y, size_t ycount)
Multiplies two big numbers where one is in program memory.
+
static void unpackLE(limb_t *limbs, size_t count, const uint8_t *bytes, size_t len)
Unpacks the little-endian byte representation of a big number into a limb array.
+
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: SHA512.cpp:105
+
static void packLE(uint8_t *bytes, size_t len, const limb_t *limbs, size_t count)
Packs the little-endian byte representation of a big number into a byte array.
+
static void sign(uint8_t signature[64], const uint8_t privateKey[32], const uint8_t publicKey[32], const void *message, size_t len)
Signs a message using a specific Ed25519 private key.
Definition: Ed25519.cpp:127
+
static void derivePublicKey(uint8_t publicKey[32], const uint8_t privateKey[32])
Derives the public key from a private key.
Definition: Ed25519.cpp:256
+
+ + + + diff --git a/Ed25519_8h_source.html b/Ed25519_8h_source.html new file mode 100644 index 00000000..7fa5430b --- /dev/null +++ b/Ed25519_8h_source.html @@ -0,0 +1,176 @@ + + + + + + +ArduinoLibs: Ed25519.h Source File + + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs +
+
+
+ + + + + + +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
+ + +
+ +
+ + +
+
+
+
Ed25519.h
+
+
+
1 /*
+
2  * Copyright (C) 2015 Southern Storm Software, Pty Ltd.
+
3  *
+
4  * Permission is hereby granted, free of charge, to any person obtaining a
+
5  * copy of this software and associated documentation files (the "Software"),
+
6  * to deal in the Software without restriction, including without limitation
+
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+
8  * and/or sell copies of the Software, and to permit persons to whom the
+
9  * Software is furnished to do so, subject to the following conditions:
+
10  *
+
11  * The above copyright notice and this permission notice shall be included
+
12  * in all copies or substantial portions of the Software.
+
13  *
+
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+
20  * DEALINGS IN THE SOFTWARE.
+
21  */
+
22 
+
23 #ifndef CRYPTO_ED25519_h
+
24 #define CRYPTO_ED25519_h
+
25 
+
26 #include "BigNumberUtil.h"
+
27 #include "SHA512.h"
+
28 
+
29 class Ed25519
+
30 {
+
31 public:
+
32  static void sign(uint8_t signature[64], const uint8_t privateKey[32],
+
33  const uint8_t publicKey[32], const void *message,
+
34  size_t len);
+
35  static bool verify(const uint8_t signature[64], const uint8_t publicKey[32],
+
36  const void *message, size_t len);
+
37 
+
38  static void generatePrivateKey(uint8_t privateKey[32]);
+
39  static void derivePublicKey(uint8_t publicKey[32], const uint8_t privateKey[32]);
+
40 
+
41 private:
+
42  // Constructor and destructor are private - cannot instantiate this class.
+
43  Ed25519();
+
44  ~Ed25519();
+
45 
+
46  // Curve point represented in extended homogeneous coordinates.
+
47  struct Point
+
48  {
+
49  limb_t x[32 / sizeof(limb_t)];
+
50  limb_t y[32 / sizeof(limb_t)];
+
51  limb_t z[32 / sizeof(limb_t)];
+
52  limb_t t[32 / sizeof(limb_t)];
+
53  };
+
54 
+
55  static void reduceQFromBuffer(limb_t *result, const uint8_t buf[64], limb_t *temp);
+
56  static void reduceQ(limb_t *result, limb_t *r);
+
57 
+
58  static void mul(Point &result, const limb_t *s, Point &p, bool constTime = true);
+
59  static void mul(Point &result, const limb_t *s, bool constTime = true);
+
60 
+
61  static void add(Point &p, const Point &q);
+
62 
+
63  static bool equal(const Point &p, const Point &q);
+
64 
+
65  static void encodePoint(uint8_t *buf, Point &point);
+
66  static bool decodePoint(Point &point, const uint8_t *buf);
+
67 
+
68  static void deriveKeys(SHA512 *hash, limb_t *a, const uint8_t privateKey[32]);
+
69 };
+
70 
+
71 #endif
+
static void generatePrivateKey(uint8_t privateKey[32])
Generates a private key for Ed25519 signing operations.
Definition: Ed25519.cpp:243
+
static bool verify(const uint8_t signature[64], const uint8_t publicKey[32], const void *message, size_t len)
Verifies a signature using a specific Ed25519 public key.
Definition: Ed25519.cpp:189
+
SHA-512 hash algorithm.
Definition: SHA512.h:30
+
Digital signatures based on the elliptic curve modulo 2^255 - 19.
Definition: Ed25519.h:29
+
static void sign(uint8_t signature[64], const uint8_t privateKey[32], const uint8_t publicKey[32], const void *message, size_t len)
Signs a message using a specific Ed25519 private key.
Definition: Ed25519.cpp:127
+
static void derivePublicKey(uint8_t publicKey[32], const uint8_t privateKey[32])
Derives the public key from a private key.
Definition: Ed25519.cpp:256
+
+ + + + diff --git a/Field_8cpp_source.html b/Field_8cpp_source.html index 805753a7..8e99aae5 100644 --- a/Field_8cpp_source.html +++ b/Field_8cpp_source.html @@ -196,7 +196,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Field_8h_source.html b/Field_8h_source.html index 43e8ba7c..33f254a1 100644 --- a/Field_8h_source.html +++ b/Field_8h_source.html @@ -164,7 +164,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Form_8cpp_source.html b/Form_8cpp_source.html index 9ee254f3..60be9a98 100644 --- a/Form_8cpp_source.html +++ b/Form_8cpp_source.html @@ -278,7 +278,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Form_8h_source.html b/Form_8h_source.html index a6fe27b2..fd3a060b 100644 --- a/Form_8h_source.html +++ b/Form_8h_source.html @@ -172,7 +172,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/GCM_8cpp_source.html b/GCM_8cpp_source.html index 8f543348..d43afcfd 100644 --- a/GCM_8cpp_source.html +++ b/GCM_8cpp_source.html @@ -352,7 +352,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/GCM_8h_source.html b/GCM_8h_source.html index bfdbfd81..9f57a7ee 100644 --- a/GCM_8h_source.html +++ b/GCM_8h_source.html @@ -191,7 +191,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/GHASH_8cpp_source.html b/GHASH_8cpp_source.html index f7c026b3..ba49cb2b 100644 --- a/GHASH_8cpp_source.html +++ b/GHASH_8cpp_source.html @@ -239,7 +239,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/GHASH_8h_source.html b/GHASH_8h_source.html index ca5d4e90..e6b04711 100644 --- a/GHASH_8h_source.html +++ b/GHASH_8h_source.html @@ -152,7 +152,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Hash_8cpp_source.html b/Hash_8cpp_source.html index 37fae6e2..55cd34a6 100644 --- a/Hash_8cpp_source.html +++ b/Hash_8cpp_source.html @@ -151,7 +151,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Hash_8h_source.html b/Hash_8h_source.html index 8e8a63c8..40526873 100644 --- a/Hash_8h_source.html +++ b/Hash_8h_source.html @@ -154,7 +154,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/I2CMaster_8cpp_source.html b/I2CMaster_8cpp_source.html index 9854a226..a1cdee6c 100644 --- a/I2CMaster_8cpp_source.html +++ b/I2CMaster_8cpp_source.html @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/I2CMaster_8h_source.html b/I2CMaster_8h_source.html index 92492cf9..2726a169 100644 --- a/I2CMaster_8h_source.html +++ b/I2CMaster_8h_source.html @@ -140,7 +140,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/IRreceiver_8cpp_source.html b/IRreceiver_8cpp_source.html index d9646a71..f4fe5e9d 100644 --- a/IRreceiver_8cpp_source.html +++ b/IRreceiver_8cpp_source.html @@ -261,7 +261,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/IRreceiver_8h_source.html b/IRreceiver_8h_source.html index 430c81ff..73bf9e30 100644 --- a/IRreceiver_8h_source.html +++ b/IRreceiver_8h_source.html @@ -157,7 +157,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/IntField_8cpp_source.html b/IntField_8cpp_source.html index 705986f3..76631d50 100644 --- a/IntField_8cpp_source.html +++ b/IntField_8cpp_source.html @@ -208,7 +208,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/IntField_8h_source.html b/IntField_8h_source.html index 455eae43..e2a119d4 100644 --- a/IntField_8h_source.html +++ b/IntField_8h_source.html @@ -173,7 +173,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/KeccakCore_8cpp_source.html b/KeccakCore_8cpp_source.html index 495f6d07..e97fd80d 100644 --- a/KeccakCore_8cpp_source.html +++ b/KeccakCore_8cpp_source.html @@ -358,7 +358,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/KeccakCore_8h_source.html b/KeccakCore_8h_source.html index a75f379f..454bb93e 100644 --- a/KeccakCore_8h_source.html +++ b/KeccakCore_8h_source.html @@ -166,7 +166,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/LCD_8cpp_source.html b/LCD_8cpp_source.html index bf744ef1..b976e359 100644 --- a/LCD_8cpp_source.html +++ b/LCD_8cpp_source.html @@ -290,7 +290,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/LCD_8h_source.html b/LCD_8h_source.html index c77ff5b2..c9ddfd9d 100644 --- a/LCD_8h_source.html +++ b/LCD_8h_source.html @@ -202,7 +202,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ListField_8cpp_source.html b/ListField_8cpp_source.html index 7a5dfc31..11876106 100644 --- a/ListField_8cpp_source.html +++ b/ListField_8cpp_source.html @@ -221,7 +221,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ListField_8h_source.html b/ListField_8h_source.html index 83c62371..f5a73098 100644 --- a/ListField_8h_source.html +++ b/ListField_8h_source.html @@ -159,7 +159,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Melody_8cpp_source.html b/Melody_8cpp_source.html index 66bfa73a..3eeea7e7 100644 --- a/Melody_8cpp_source.html +++ b/Melody_8cpp_source.html @@ -215,7 +215,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Melody_8h_source.html b/Melody_8h_source.html index f1599865..d7d2144d 100644 --- a/Melody_8h_source.html +++ b/Melody_8h_source.html @@ -258,7 +258,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Mono5x7_8h_source.html b/Mono5x7_8h_source.html index aab288e0..f124bd8a 100644 --- a/Mono5x7_8h_source.html +++ b/Mono5x7_8h_source.html @@ -246,7 +246,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/NoiseSource_8cpp_source.html b/NoiseSource_8cpp_source.html index 907ae237..3f21b91f 100644 --- a/NoiseSource_8cpp_source.html +++ b/NoiseSource_8cpp_source.html @@ -138,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/NoiseSource_8h_source.html b/NoiseSource_8h_source.html index eeb882b5..7829d3b0 100644 --- a/NoiseSource_8h_source.html +++ b/NoiseSource_8h_source.html @@ -142,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/OFB_8cpp_source.html b/OFB_8cpp_source.html index b6e15c13..0e245ac6 100644 --- a/OFB_8cpp_source.html +++ b/OFB_8cpp_source.html @@ -206,7 +206,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/OFB_8h_source.html b/OFB_8h_source.html index 4e89aa34..00509463 100644 --- a/OFB_8h_source.html +++ b/OFB_8h_source.html @@ -171,7 +171,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Poly1305_8cpp_source.html b/Poly1305_8cpp_source.html index de315b99..908c0137 100644 --- a/Poly1305_8cpp_source.html +++ b/Poly1305_8cpp_source.html @@ -113,247 +113,246 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
23 #include "Poly1305.h"
24 #include "Crypto.h"
25 #include "utility/EndianUtil.h"
-
26 #include <string.h>
-
27 
-
61 // Useful sizes for limb array and word manipulation.
-
62 #define NUM_LIMBS_128BIT (16 / sizeof(limb_t))
-
63 #define NUM_LIMBS_130BIT ((16 / sizeof(limb_t)) + 1)
-
64 #define LIMB_BITS (sizeof(limb_t) * 8)
-
65 
-
66 // Endian helper macros for limbs and arrays of limbs.
-
67 #if BIGNUMBER_LIMB_8BIT
-
68 #define lelimbtoh(x) (x)
-
69 #define htolelimb(x) (x)
-
70 #elif BIGNUMBER_LIMB_16BIT
-
71 #define lelimbtoh(x) (le16toh((x)))
-
72 #define htolelimb(x) (htole16((x)))
-
73 #elif BIGNUMBER_LIMB_32BIT
-
74 #define lelimbtoh(x) (le32toh((x)))
-
75 #define htolelimb(x) (htole32((x)))
-
76 #endif
-
77 #if defined(CRYPTO_LITTLE_ENDIAN)
-
78 #define littleToHost(r,size) do { ; } while (0)
-
79 #else
-
80 #define littleToHost(r,size) \
-
81  do { \
-
82  for (uint8_t i = 0; i < (size); ++i) \
-
83  (r)[i] = lelimbtoh((r)[i]); \
-
84  } while (0)
-
85 #endif
-
86 
-
90 Poly1305::Poly1305()
-
91 {
-
92  state.chunkSize = 0;
-
93 }
-
94 
-
99 Poly1305::~Poly1305()
-
100 {
-
101  clean(state);
-
102 }
-
103 
-
111 void Poly1305::reset(const void *key)
-
112 {
-
113  // Copy the key into place and clear the bits we don't need.
-
114  uint8_t *r = (uint8_t *)state.r;
-
115  memcpy(r, key, 16);
-
116  r[3] &= 0x0F;
-
117  r[4] &= 0xFC;
-
118  r[7] &= 0x0F;
-
119  r[8] &= 0xFC;
-
120  r[11] &= 0x0F;
-
121  r[12] &= 0xFC;
-
122  r[15] &= 0x0F;
-
123 
-
124  // Convert into little-endian if necessary.
-
125  littleToHost(state.r, NUM_LIMBS_128BIT);
-
126 
-
127  // Reset the hashing process.
-
128  state.chunkSize = 0;
-
129  memset(state.h, 0, sizeof(state.h));
-
130 }
-
131 
-
143 void Poly1305::update(const void *data, size_t len)
-
144 {
-
145  // Break the input up into 128-bit chunks and process each in turn.
-
146  const uint8_t *d = (const uint8_t *)data;
-
147  while (len > 0) {
-
148  uint8_t size = 16 - state.chunkSize;
-
149  if (size > len)
-
150  size = len;
-
151  memcpy(((uint8_t *)state.c) + state.chunkSize, d, size);
-
152  state.chunkSize += size;
-
153  len -= size;
-
154  d += size;
-
155  if (state.chunkSize == 16) {
-
156  littleToHost(state.c, NUM_LIMBS_128BIT);
-
157  state.c[NUM_LIMBS_128BIT] = 1;
-
158  processChunk();
-
159  state.chunkSize = 0;
-
160  }
-
161  }
-
162 }
-
163 
-
180 void Poly1305::finalize(const void *nonce, void *token, size_t len)
-
181 {
-
182  dlimb_t carry;
-
183  uint8_t i;
-
184 
-
185  // Pad and flush the final chunk.
-
186  if (state.chunkSize > 0) {
-
187  uint8_t *c = (uint8_t *)state.c;
-
188  c[state.chunkSize] = 1;
-
189  memset(c + state.chunkSize + 1, 0, 16 - state.chunkSize - 1);
-
190  littleToHost(state.c, NUM_LIMBS_128BIT);
-
191  state.c[NUM_LIMBS_128BIT] = 0;
-
192  processChunk();
-
193  }
-
194 
-
195  // At this point, processChunk() has left h as a partially reduced
-
196  // result that is less than (2^130 - 5) * 6. Perform one more
-
197  // reduction and a trial subtraction to produce the final result.
-
198 
-
199  // Multiply the high bits of h by 5 and add them to the 130 low bits.
-
200  carry = (dlimb_t)((state.h[NUM_LIMBS_128BIT] >> 2) +
-
201  (state.h[NUM_LIMBS_128BIT] & ~((limb_t)3)));
-
202  state.h[NUM_LIMBS_128BIT] &= 0x0003;
-
203  for (i = 0; i < NUM_LIMBS_128BIT; ++i) {
-
204  carry += state.h[i];
-
205  state.h[i] = (limb_t)carry;
-
206  carry >>= LIMB_BITS;
-
207  }
-
208  state.h[i] += (limb_t)carry;
-
209 
-
210  // Subtract (2^130 - 5) from h by computing t = h + 5 - 2^130.
-
211  // The "minus 2^130" step is implicit.
-
212  carry = 5;
-
213  for (i = 0; i < NUM_LIMBS_130BIT; ++i) {
-
214  carry += state.h[i];
-
215  state.t[i] = (limb_t)carry;
-
216  carry >>= LIMB_BITS;
-
217  }
-
218 
-
219  // Borrow occurs if bit 2^130 of the previous t result is zero.
-
220  // Carefully turn this into a selection mask so we can select either
-
221  // h or t as the final result. We don't care about the highest word
-
222  // of the result because we are about to drop it in the next step.
-
223  // We have to do it this way to avoid giving away any information
-
224  // about the value of h in the instruction timing.
-
225  limb_t mask = (~((state.t[NUM_LIMBS_128BIT] >> 2) & 1)) + 1;
-
226  limb_t nmask = ~mask;
-
227  for (i = 0; i < NUM_LIMBS_128BIT; ++i) {
-
228  state.h[i] = (state.h[i] & nmask) | (state.t[i] & mask);
-
229  }
-
230 
-
231  // Add the encrypted nonce and format the final hash.
-
232  memcpy(state.c, nonce, 16);
-
233  littleToHost(state.c, NUM_LIMBS_128BIT);
-
234  carry = 0;
-
235  for (i = 0; i < NUM_LIMBS_128BIT; ++i) {
-
236  carry += state.h[i];
-
237  carry += state.c[i];
-
238  state.h[i] = htolelimb((limb_t)carry);
-
239  carry >>= LIMB_BITS;
-
240  }
-
241  if (len > 16)
-
242  len = 16;
-
243  memcpy(token, state.h, len);
-
244 }
-
245 
-
251 void Poly1305::pad()
-
252 {
-
253  if (state.chunkSize != 0) {
-
254  memset(((uint8_t *)state.c) + state.chunkSize, 0, 16 - state.chunkSize);
-
255  littleToHost(state.c, NUM_LIMBS_128BIT);
-
256  state.c[NUM_LIMBS_128BIT] = 1;
-
257  processChunk();
-
258  state.chunkSize = 0;
-
259  }
-
260 }
-
261 
-
265 void Poly1305::clear()
-
266 {
-
267  clean(state);
-
268 }
-
269 
-
273 void Poly1305::processChunk()
-
274 {
-
275  // Compute h = ((h + c) * r) mod (2^130 - 5).
-
276 
-
277  // Start with h += c. We assume that h is less than (2^130 - 5) * 6
-
278  // and that c is less than 2^129, so the result will be less than 2^133.
-
279  dlimb_t carry = 0;
-
280  uint8_t i, j;
-
281  for (i = 0; i < NUM_LIMBS_130BIT; ++i) {
-
282  carry += state.h[i];
-
283  carry += state.c[i];
-
284  state.h[i] = (limb_t)carry;
-
285  carry >>= LIMB_BITS;
-
286  }
-
287 
-
288  // Multiply h by r. We know that r is less than 2^124 because the
-
289  // top 4 bits were AND-ed off by reset(). That makes h * r less
-
290  // than 2^257. Which is less than the (2^130 - 6)^2 we want for
-
291  // the modulo reduction step that follows.
-
292  carry = 0;
-
293  limb_t word = state.r[0];
-
294  for (i = 0; i < NUM_LIMBS_130BIT; ++i) {
-
295  carry += ((dlimb_t)(state.h[i])) * word;
-
296  state.t[i] = (limb_t)carry;
-
297  carry >>= LIMB_BITS;
-
298  }
-
299  state.t[NUM_LIMBS_130BIT] = (limb_t)carry;
-
300  for (i = 1; i < NUM_LIMBS_128BIT; ++i) {
-
301  word = state.r[i];
-
302  carry = 0;
-
303  for (j = 0; j < NUM_LIMBS_130BIT; ++j) {
-
304  carry += ((dlimb_t)(state.h[j])) * word;
-
305  carry += state.t[i + j];
-
306  state.t[i + j] = (limb_t)carry;
-
307  carry >>= LIMB_BITS;
-
308  }
-
309  state.t[i + NUM_LIMBS_130BIT] = (limb_t)carry;
-
310  }
-
311 
-
312  // Reduce h * r modulo (2^130 - 5) by multiplying the high 130 bits by 5
-
313  // and adding them to the low 130 bits. See the explaination in the
-
314  // comments for Curve25519::reduce() for a description of how this works.
-
315  carry = ((dlimb_t)(state.t[NUM_LIMBS_128BIT] >> 2)) +
-
316  (state.t[NUM_LIMBS_128BIT] & ~((limb_t)3));
-
317  state.t[NUM_LIMBS_128BIT] &= 0x0003;
-
318  for (i = 0; i < NUM_LIMBS_128BIT; ++i) {
-
319  // Shift the next word of t up by (LIMB_BITS - 2) bits and then
-
320  // multiply it by 5. Breaking it down, we can add the results
-
321  // of shifting up by LIMB_BITS and shifting up by (LIMB_BITS - 2).
-
322  // The main wrinkle here is that this can result in an intermediate
-
323  // carry that is (LIMB_BITS * 2 + 1) bits in size which doesn't
-
324  // fit within a dlimb_t variable. However, we can defer adding
-
325  // (word << LIMB_BITS) until after the "carry >>= LIMB_BITS" step
-
326  // because it won't affect the low bits of the carry.
-
327  word = state.t[i + NUM_LIMBS_130BIT];
-
328  carry += ((dlimb_t)word) << (LIMB_BITS - 2);
-
329  carry += state.t[i];
-
330  state.h[i] = (limb_t)carry;
-
331  carry >>= LIMB_BITS;
-
332  carry += word;
-
333  }
-
334  state.h[i] = (limb_t)(carry + state.t[NUM_LIMBS_128BIT]);
-
335 
-
336  // At this point, h is either the answer of reducing modulo (2^130 - 5)
-
337  // or it is at most 5 subtractions away from the answer we want.
-
338  // Leave it as-is for now with h less than (2^130 - 5) * 6. It is
-
339  // still within a range where the next h * r step will not overflow.
-
340 }
-
Poly1305::finalize
void finalize(const void *nonce, void *token, size_t len)
Finalizes the authentication process and returns the token.
Definition: Poly1305.cpp:180
-
Poly1305::reset
void reset(const void *key)
Resets the Poly1305 message authenticator for a new session.
Definition: Poly1305.cpp:111
-
Poly1305::update
void update(const void *data, size_t len)
Updates the message authenticator with more data.
Definition: Poly1305.cpp:143
-
Poly1305::pad
void pad()
Pads the input stream with zero bytes to a multiple of 16.
Definition: Poly1305.cpp:251
-
Poly1305::~Poly1305
~Poly1305()
Destroys this Poly1305 message authenticator after clearing all sensitive information.
Definition: Poly1305.cpp:99
-
Poly1305::Poly1305
Poly1305()
Constructs a new Poly1305 message authenticator.
Definition: Poly1305.cpp:90
-
Poly1305::clear
void clear()
Clears the authenticator's state, removing all sensitive data.
Definition: Poly1305.cpp:265
+
26 #include "utility/LimbUtil.h"
+
27 #include <string.h>
+
28 
+
62 // Limb array with enough space for 130 bits.
+
63 #define NUM_LIMBS_130BIT (NUM_LIMBS_128BIT + 1)
+
64 
+
65 // Endian helper macros for limbs and arrays of limbs.
+
66 #if BIGNUMBER_LIMB_8BIT
+
67 #define lelimbtoh(x) (x)
+
68 #define htolelimb(x) (x)
+
69 #elif BIGNUMBER_LIMB_16BIT
+
70 #define lelimbtoh(x) (le16toh((x)))
+
71 #define htolelimb(x) (htole16((x)))
+
72 #elif BIGNUMBER_LIMB_32BIT
+
73 #define lelimbtoh(x) (le32toh((x)))
+
74 #define htolelimb(x) (htole32((x)))
+
75 #endif
+
76 #if defined(CRYPTO_LITTLE_ENDIAN)
+
77 #define littleToHost(r,size) do { ; } while (0)
+
78 #else
+
79 #define littleToHost(r,size) \
+
80  do { \
+
81  for (uint8_t i = 0; i < (size); ++i) \
+
82  (r)[i] = lelimbtoh((r)[i]); \
+
83  } while (0)
+
84 #endif
+
85 
+
89 Poly1305::Poly1305()
+
90 {
+
91  state.chunkSize = 0;
+
92 }
+
93 
+
98 Poly1305::~Poly1305()
+
99 {
+
100  clean(state);
+
101 }
+
102 
+
110 void Poly1305::reset(const void *key)
+
111 {
+
112  // Copy the key into place and clear the bits we don't need.
+
113  uint8_t *r = (uint8_t *)state.r;
+
114  memcpy(r, key, 16);
+
115  r[3] &= 0x0F;
+
116  r[4] &= 0xFC;
+
117  r[7] &= 0x0F;
+
118  r[8] &= 0xFC;
+
119  r[11] &= 0x0F;
+
120  r[12] &= 0xFC;
+
121  r[15] &= 0x0F;
+
122 
+
123  // Convert into little-endian if necessary.
+
124  littleToHost(state.r, NUM_LIMBS_128BIT);
+
125 
+
126  // Reset the hashing process.
+
127  state.chunkSize = 0;
+
128  memset(state.h, 0, sizeof(state.h));
+
129 }
+
130 
+
142 void Poly1305::update(const void *data, size_t len)
+
143 {
+
144  // Break the input up into 128-bit chunks and process each in turn.
+
145  const uint8_t *d = (const uint8_t *)data;
+
146  while (len > 0) {
+
147  uint8_t size = 16 - state.chunkSize;
+
148  if (size > len)
+
149  size = len;
+
150  memcpy(((uint8_t *)state.c) + state.chunkSize, d, size);
+
151  state.chunkSize += size;
+
152  len -= size;
+
153  d += size;
+
154  if (state.chunkSize == 16) {
+
155  littleToHost(state.c, NUM_LIMBS_128BIT);
+
156  state.c[NUM_LIMBS_128BIT] = 1;
+
157  processChunk();
+
158  state.chunkSize = 0;
+
159  }
+
160  }
+
161 }
+
162 
+
179 void Poly1305::finalize(const void *nonce, void *token, size_t len)
+
180 {
+
181  dlimb_t carry;
+
182  uint8_t i;
+
183 
+
184  // Pad and flush the final chunk.
+
185  if (state.chunkSize > 0) {
+
186  uint8_t *c = (uint8_t *)state.c;
+
187  c[state.chunkSize] = 1;
+
188  memset(c + state.chunkSize + 1, 0, 16 - state.chunkSize - 1);
+
189  littleToHost(state.c, NUM_LIMBS_128BIT);
+
190  state.c[NUM_LIMBS_128BIT] = 0;
+
191  processChunk();
+
192  }
+
193 
+
194  // At this point, processChunk() has left h as a partially reduced
+
195  // result that is less than (2^130 - 5) * 6. Perform one more
+
196  // reduction and a trial subtraction to produce the final result.
+
197 
+
198  // Multiply the high bits of h by 5 and add them to the 130 low bits.
+
199  carry = (dlimb_t)((state.h[NUM_LIMBS_128BIT] >> 2) +
+
200  (state.h[NUM_LIMBS_128BIT] & ~((limb_t)3)));
+
201  state.h[NUM_LIMBS_128BIT] &= 0x0003;
+
202  for (i = 0; i < NUM_LIMBS_128BIT; ++i) {
+
203  carry += state.h[i];
+
204  state.h[i] = (limb_t)carry;
+
205  carry >>= LIMB_BITS;
+
206  }
+
207  state.h[i] += (limb_t)carry;
+
208 
+
209  // Subtract (2^130 - 5) from h by computing t = h + 5 - 2^130.
+
210  // The "minus 2^130" step is implicit.
+
211  carry = 5;
+
212  for (i = 0; i < NUM_LIMBS_130BIT; ++i) {
+
213  carry += state.h[i];
+
214  state.t[i] = (limb_t)carry;
+
215  carry >>= LIMB_BITS;
+
216  }
+
217 
+
218  // Borrow occurs if bit 2^130 of the previous t result is zero.
+
219  // Carefully turn this into a selection mask so we can select either
+
220  // h or t as the final result. We don't care about the highest word
+
221  // of the result because we are about to drop it in the next step.
+
222  // We have to do it this way to avoid giving away any information
+
223  // about the value of h in the instruction timing.
+
224  limb_t mask = (~((state.t[NUM_LIMBS_128BIT] >> 2) & 1)) + 1;
+
225  limb_t nmask = ~mask;
+
226  for (i = 0; i < NUM_LIMBS_128BIT; ++i) {
+
227  state.h[i] = (state.h[i] & nmask) | (state.t[i] & mask);
+
228  }
+
229 
+
230  // Add the encrypted nonce and format the final hash.
+
231  memcpy(state.c, nonce, 16);
+
232  littleToHost(state.c, NUM_LIMBS_128BIT);
+
233  carry = 0;
+
234  for (i = 0; i < NUM_LIMBS_128BIT; ++i) {
+
235  carry += state.h[i];
+
236  carry += state.c[i];
+
237  state.h[i] = htolelimb((limb_t)carry);
+
238  carry >>= LIMB_BITS;
+
239  }
+
240  if (len > 16)
+
241  len = 16;
+
242  memcpy(token, state.h, len);
+
243 }
+
244 
+
250 void Poly1305::pad()
+
251 {
+
252  if (state.chunkSize != 0) {
+
253  memset(((uint8_t *)state.c) + state.chunkSize, 0, 16 - state.chunkSize);
+
254  littleToHost(state.c, NUM_LIMBS_128BIT);
+
255  state.c[NUM_LIMBS_128BIT] = 1;
+
256  processChunk();
+
257  state.chunkSize = 0;
+
258  }
+
259 }
+
260 
+
264 void Poly1305::clear()
+
265 {
+
266  clean(state);
+
267 }
+
268 
+
272 void Poly1305::processChunk()
+
273 {
+
274  // Compute h = ((h + c) * r) mod (2^130 - 5).
+
275 
+
276  // Start with h += c. We assume that h is less than (2^130 - 5) * 6
+
277  // and that c is less than 2^129, so the result will be less than 2^133.
+
278  dlimb_t carry = 0;
+
279  uint8_t i, j;
+
280  for (i = 0; i < NUM_LIMBS_130BIT; ++i) {
+
281  carry += state.h[i];
+
282  carry += state.c[i];
+
283  state.h[i] = (limb_t)carry;
+
284  carry >>= LIMB_BITS;
+
285  }
+
286 
+
287  // Multiply h by r. We know that r is less than 2^124 because the
+
288  // top 4 bits were AND-ed off by reset(). That makes h * r less
+
289  // than 2^257. Which is less than the (2^130 - 6)^2 we want for
+
290  // the modulo reduction step that follows.
+
291  carry = 0;
+
292  limb_t word = state.r[0];
+
293  for (i = 0; i < NUM_LIMBS_130BIT; ++i) {
+
294  carry += ((dlimb_t)(state.h[i])) * word;
+
295  state.t[i] = (limb_t)carry;
+
296  carry >>= LIMB_BITS;
+
297  }
+
298  state.t[NUM_LIMBS_130BIT] = (limb_t)carry;
+
299  for (i = 1; i < NUM_LIMBS_128BIT; ++i) {
+
300  word = state.r[i];
+
301  carry = 0;
+
302  for (j = 0; j < NUM_LIMBS_130BIT; ++j) {
+
303  carry += ((dlimb_t)(state.h[j])) * word;
+
304  carry += state.t[i + j];
+
305  state.t[i + j] = (limb_t)carry;
+
306  carry >>= LIMB_BITS;
+
307  }
+
308  state.t[i + NUM_LIMBS_130BIT] = (limb_t)carry;
+
309  }
+
310 
+
311  // Reduce h * r modulo (2^130 - 5) by multiplying the high 130 bits by 5
+
312  // and adding them to the low 130 bits. See the explaination in the
+
313  // comments for Curve25519::reduce() for a description of how this works.
+
314  carry = ((dlimb_t)(state.t[NUM_LIMBS_128BIT] >> 2)) +
+
315  (state.t[NUM_LIMBS_128BIT] & ~((limb_t)3));
+
316  state.t[NUM_LIMBS_128BIT] &= 0x0003;
+
317  for (i = 0; i < NUM_LIMBS_128BIT; ++i) {
+
318  // Shift the next word of t up by (LIMB_BITS - 2) bits and then
+
319  // multiply it by 5. Breaking it down, we can add the results
+
320  // of shifting up by LIMB_BITS and shifting up by (LIMB_BITS - 2).
+
321  // The main wrinkle here is that this can result in an intermediate
+
322  // carry that is (LIMB_BITS * 2 + 1) bits in size which doesn't
+
323  // fit within a dlimb_t variable. However, we can defer adding
+
324  // (word << LIMB_BITS) until after the "carry >>= LIMB_BITS" step
+
325  // because it won't affect the low bits of the carry.
+
326  word = state.t[i + NUM_LIMBS_130BIT];
+
327  carry += ((dlimb_t)word) << (LIMB_BITS - 2);
+
328  carry += state.t[i];
+
329  state.h[i] = (limb_t)carry;
+
330  carry >>= LIMB_BITS;
+
331  carry += word;
+
332  }
+
333  state.h[i] = (limb_t)(carry + state.t[NUM_LIMBS_128BIT]);
+
334 
+
335  // At this point, h is either the answer of reducing modulo (2^130 - 5)
+
336  // or it is at most 5 subtractions away from the answer we want.
+
337  // Leave it as-is for now with h less than (2^130 - 5) * 6. It is
+
338  // still within a range where the next h * r step will not overflow.
+
339 }
+
Poly1305::finalize
void finalize(const void *nonce, void *token, size_t len)
Finalizes the authentication process and returns the token.
Definition: Poly1305.cpp:179
+
Poly1305::reset
void reset(const void *key)
Resets the Poly1305 message authenticator for a new session.
Definition: Poly1305.cpp:110
+
Poly1305::update
void update(const void *data, size_t len)
Updates the message authenticator with more data.
Definition: Poly1305.cpp:142
+
Poly1305::pad
void pad()
Pads the input stream with zero bytes to a multiple of 16.
Definition: Poly1305.cpp:250
+
Poly1305::~Poly1305
~Poly1305()
Destroys this Poly1305 message authenticator after clearing all sensitive information.
Definition: Poly1305.cpp:98
+
Poly1305::Poly1305
Poly1305()
Constructs a new Poly1305 message authenticator.
Definition: Poly1305.cpp:89
+
Poly1305::clear
void clear()
Clears the authenticator's state, removing all sensitive data.
Definition: Poly1305.cpp:264
diff --git a/Poly1305_8h_source.html b/Poly1305_8h_source.html index 6196b287..e38620d1 100644 --- a/Poly1305_8h_source.html +++ b/Poly1305_8h_source.html @@ -144,17 +144,17 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
54 
55 #endif
Poly1305
Poly1305 message authenticator.
Definition: Poly1305.h:29
-
Poly1305::finalize
void finalize(const void *nonce, void *token, size_t len)
Finalizes the authentication process and returns the token.
Definition: Poly1305.cpp:180
-
Poly1305::reset
void reset(const void *key)
Resets the Poly1305 message authenticator for a new session.
Definition: Poly1305.cpp:111
-
Poly1305::update
void update(const void *data, size_t len)
Updates the message authenticator with more data.
Definition: Poly1305.cpp:143
-
Poly1305::pad
void pad()
Pads the input stream with zero bytes to a multiple of 16.
Definition: Poly1305.cpp:251
-
Poly1305::~Poly1305
~Poly1305()
Destroys this Poly1305 message authenticator after clearing all sensitive information.
Definition: Poly1305.cpp:99
-
Poly1305::Poly1305
Poly1305()
Constructs a new Poly1305 message authenticator.
Definition: Poly1305.cpp:90
-
Poly1305::clear
void clear()
Clears the authenticator's state, removing all sensitive data.
Definition: Poly1305.cpp:265
+
Poly1305::finalize
void finalize(const void *nonce, void *token, size_t len)
Finalizes the authentication process and returns the token.
Definition: Poly1305.cpp:179
+
Poly1305::reset
void reset(const void *key)
Resets the Poly1305 message authenticator for a new session.
Definition: Poly1305.cpp:110
+
Poly1305::update
void update(const void *data, size_t len)
Updates the message authenticator with more data.
Definition: Poly1305.cpp:142
+
Poly1305::pad
void pad()
Pads the input stream with zero bytes to a multiple of 16.
Definition: Poly1305.cpp:250
+
Poly1305::~Poly1305
~Poly1305()
Destroys this Poly1305 message authenticator after clearing all sensitive information.
Definition: Poly1305.cpp:98
+
Poly1305::Poly1305
Poly1305()
Constructs a new Poly1305 message authenticator.
Definition: Poly1305.cpp:89
+
Poly1305::clear
void clear()
Clears the authenticator's state, removing all sensitive data.
Definition: Poly1305.cpp:264
diff --git a/PowerSave_8cpp_source.html b/PowerSave_8cpp_source.html index c1cec514..d69531f6 100644 --- a/PowerSave_8cpp_source.html +++ b/PowerSave_8cpp_source.html @@ -155,7 +155,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/PowerSave_8h_source.html b/PowerSave_8h_source.html index 0fb9536b..5e01a728 100644 --- a/PowerSave_8h_source.html +++ b/PowerSave_8h_source.html @@ -158,7 +158,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RC5_8h_source.html b/RC5_8h_source.html index 6b733f8f..15e4e9fd 100644 --- a/RC5_8h_source.html +++ b/RC5_8h_source.html @@ -435,7 +435,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RNG_8cpp_source.html b/RNG_8cpp_source.html index 2a88ed2c..0297fb58 100644 --- a/RNG_8cpp_source.html +++ b/RNG_8cpp_source.html @@ -375,7 +375,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RNG_8h_source.html b/RNG_8h_source.html index 1cadff17..35602b53 100644 --- a/RNG_8h_source.html +++ b/RNG_8h_source.html @@ -176,7 +176,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RTC_8cpp_source.html b/RTC_8cpp_source.html index 496bd8fb..e2fb98a5 100644 --- a/RTC_8cpp_source.html +++ b/RTC_8cpp_source.html @@ -380,7 +380,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RTC_8h_source.html b/RTC_8h_source.html index 65be2122..9aca11d4 100644 --- a/RTC_8h_source.html +++ b/RTC_8h_source.html @@ -237,7 +237,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RingOscillatorNoiseSource_8cpp_source.html b/RingOscillatorNoiseSource_8cpp_source.html index edec38fb..276ad964 100644 --- a/RingOscillatorNoiseSource_8cpp_source.html +++ b/RingOscillatorNoiseSource_8cpp_source.html @@ -285,7 +285,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RingOscillatorNoiseSource_8h_source.html b/RingOscillatorNoiseSource_8h_source.html index acea9ddb..dee12fbc 100644 --- a/RingOscillatorNoiseSource_8h_source.html +++ b/RingOscillatorNoiseSource_8h_source.html @@ -145,7 +145,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SHA1_8cpp_source.html b/SHA1_8cpp_source.html index 7fadeaa2..567317b7 100644 --- a/SHA1_8cpp_source.html +++ b/SHA1_8cpp_source.html @@ -323,7 +323,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SHA1_8h_source.html b/SHA1_8h_source.html index a0750d7c..4bf274f4 100644 --- a/SHA1_8h_source.html +++ b/SHA1_8h_source.html @@ -160,7 +160,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SHA256_8cpp_source.html b/SHA256_8cpp_source.html index b696bdf3..cb7d8098 100644 --- a/SHA256_8cpp_source.html +++ b/SHA256_8cpp_source.html @@ -339,7 +339,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SHA256_8h_source.html b/SHA256_8h_source.html index 812234ad..d0e17956 100644 --- a/SHA256_8h_source.html +++ b/SHA256_8h_source.html @@ -160,7 +160,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SHA3_8cpp_source.html b/SHA3_8cpp_source.html index 4f392502..fbd7b1b2 100644 --- a/SHA3_8cpp_source.html +++ b/SHA3_8cpp_source.html @@ -257,7 +257,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SHA3_8h_source.html b/SHA3_8h_source.html index d177dc0f..0f2c0fba 100644 --- a/SHA3_8h_source.html +++ b/SHA3_8h_source.html @@ -188,7 +188,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SHA512_8cpp_source.html b/SHA512_8cpp_source.html index ea468960..6e3c4b8f 100644 --- a/SHA512_8cpp_source.html +++ b/SHA512_8cpp_source.html @@ -355,7 +355,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SHA512_8h_source.html b/SHA512_8h_source.html index 56edd76f..fc785d10 100644 --- a/SHA512_8h_source.html +++ b/SHA512_8h_source.html @@ -115,45 +115,50 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
25 
26 #include "Hash.h"
27 
-
28 class SHA512 : public Hash
-
29 {
-
30 public:
-
31  SHA512();
-
32  virtual ~SHA512();
-
33 
-
34  size_t hashSize() const;
-
35  size_t blockSize() const;
-
36 
-
37  void reset();
-
38  void update(const void *data, size_t len);
-
39  void finalize(void *hash, size_t len);
-
40 
-
41  void clear();
+
28 class Ed25519;
+
29 
+
30 class SHA512 : public Hash
+
31 {
+
32 public:
+
33  SHA512();
+
34  virtual ~SHA512();
+
35 
+
36  size_t hashSize() const;
+
37  size_t blockSize() const;
+
38 
+
39  void reset();
+
40  void update(const void *data, size_t len);
+
41  void finalize(void *hash, size_t len);
42 
-
43  void resetHMAC(const void *key, size_t keyLen);
-
44  void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen);
-
45 
-
46 private:
-
47  struct {
-
48  uint64_t h[8];
-
49  uint64_t w[16];
-
50  uint64_t lengthLow;
-
51  uint64_t lengthHigh;
-
52  uint8_t chunkSize;
-
53  } state;
-
54 
-
55  void processChunk();
-
56 };
-
57 
-
58 #endif
+
43  void clear();
+
44 
+
45  void resetHMAC(const void *key, size_t keyLen);
+
46  void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen);
+
47 
+
48 private:
+
49  struct {
+
50  uint64_t h[8];
+
51  uint64_t w[16];
+
52  uint64_t lengthLow;
+
53  uint64_t lengthHigh;
+
54  uint8_t chunkSize;
+
55  } state;
+
56 
+
57  void processChunk();
+
58 
+
59  friend class Ed25519;
+
60 };
+
61 
+
62 #endif
SHA512::hashSize
size_t hashSize() const
Size of the hash result from finalize().
Definition: SHA512.cpp:56
SHA512::blockSize
size_t blockSize() const
Size of the internal block used by the hash algorithm.
Definition: SHA512.cpp:61
SHA512::~SHA512
virtual ~SHA512()
Destroys this SHA-512 hash object after clearing sensitive information.
Definition: SHA512.cpp:51
Hash
Abstract base class for cryptographic hash algorithms.
Definition: Hash.h:29
SHA512::clear
void clear()
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing ...
Definition: SHA512.cpp:136
-
SHA512
SHA-512 hash algorithm.
Definition: SHA512.h:28
+
SHA512
SHA-512 hash algorithm.
Definition: SHA512.h:30
SHA512::reset
void reset()
Resets the hash ready for a new hashing process.
Definition: SHA512.cpp:66
SHA512::update
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: SHA512.cpp:79
+
Ed25519
Digital signatures based on the elliptic curve modulo 2^255 - 19.
Definition: Ed25519.h:29
SHA512::finalize
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: SHA512.cpp:105
SHA512::finalizeHMAC
void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
Finalizes the HMAC hashing process and returns the hash.
Definition: SHA512.cpp:149
SHA512::SHA512
SHA512()
Constructs a SHA-512 hash object.
Definition: SHA512.cpp:42
@@ -161,7 +166,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SoftI2C_8cpp_source.html b/SoftI2C_8cpp_source.html index c147cdc5..022c53f4 100644 --- a/SoftI2C_8cpp_source.html +++ b/SoftI2C_8cpp_source.html @@ -283,7 +283,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SoftI2C_8h_source.html b/SoftI2C_8h_source.html index dd8d0429..cb86ec52 100644 --- a/SoftI2C_8h_source.html +++ b/SoftI2C_8h_source.html @@ -157,7 +157,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/TextField_8cpp_source.html b/TextField_8cpp_source.html index 163be570..0334c54a 100644 --- a/TextField_8cpp_source.html +++ b/TextField_8cpp_source.html @@ -156,7 +156,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/TextField_8h_source.html b/TextField_8h_source.html index ac2e9546..b6deb3e5 100644 --- a/TextField_8h_source.html +++ b/TextField_8h_source.html @@ -142,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/TimeField_8cpp_source.html b/TimeField_8cpp_source.html index b67e5676..53e775bc 100644 --- a/TimeField_8cpp_source.html +++ b/TimeField_8cpp_source.html @@ -325,7 +325,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/TimeField_8h_source.html b/TimeField_8h_source.html index c9745670..c6623e63 100644 --- a/TimeField_8h_source.html +++ b/TimeField_8h_source.html @@ -167,7 +167,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/TransistorNoiseSource_8cpp_source.html b/TransistorNoiseSource_8cpp_source.html index ceb33af8..2edd55b8 100644 --- a/TransistorNoiseSource_8cpp_source.html +++ b/TransistorNoiseSource_8cpp_source.html @@ -295,7 +295,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/TransistorNoiseSource_8h_source.html b/TransistorNoiseSource_8h_source.html index 182cf214..d4d87b84 100644 --- a/TransistorNoiseSource_8h_source.html +++ b/TransistorNoiseSource_8h_source.html @@ -151,7 +151,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/alarm-clock_8dox.html b/alarm-clock_8dox.html index 1e423622..1a71d663 100644 --- a/alarm-clock_8dox.html +++ b/alarm-clock_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/alarm_clock.html b/alarm_clock.html index 7be52572..4e77fee0 100644 --- a/alarm_clock.html +++ b/alarm_clock.html @@ -140,7 +140,7 @@ Completed Clock diff --git a/annotated.html b/annotated.html index 27a9a17d..acd503ee 100644 --- a/annotated.html +++ b/annotated.html @@ -117,45 +117,46 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); oCDS1307RTCCommunicates with a DS1307 realtime clock chip via I2C oCDS3231RTCCommunicates with a DS3231 realtime clock chip via I2C oCDS3232RTCCommunicates with a DS3232 realtime clock chip via I2C -oCEEPROM24Reading and writing EEPROM's from the 24LCXX family -oCFieldManages a single data input/output field within a Form -oCFormManager for a form containing data input/output fields -oCGCMImplementation of the Galois Counter Mode (GCM) -oCGCMCommonConcrete base class to assist with implementing GCM for 128-bit block ciphers -oCGHASHImplementation of the GHASH message authenticator -oCHashAbstract base class for cryptographic hash algorithms -oCI2CMasterAbstract base class for I2C master implementations -oCIntFieldField that manages the input of an integer value -oCIRreceiverManages the reception of RC-5 commands from an infrared remote control -oCKeccakCoreKeccak core sponge function -oCLCDEnhanced library for Freetronics 16x2 LCD shields -oCListFieldField that manages selection from a static list of items -oCMelodyPlays a melody on a digital output pin using tone() -oCNoiseSourceAbstract base class for random noise sources -oCOFBImplementation of the Output Feedback (OFB) mode for 128-bit block ciphers -oCOFBCommonConcrete base class to assist with implementing OFB for 128-bit block ciphers -oCPoly1305Poly1305 message authenticator -oCRingOscillatorNoiseSourceProcesses the signal from a ring oscillator based noise source -oCRNGClassPseudo random number generator suitable for cryptography -oCRTCBase class for realtime clock handlers -oCRTCAlarmStores alarm information from a realtime clock chip -oCRTCDateStores date information from a realtime clock chip -oCRTCTimeStores time information from a realtime clock chip -oCSHA1SHA-1 hash algorithm -oCSHA256SHA-256 hash algorithm -oCSHA3_256SHA3-256 hash algorithm -oCSHA3_512SHA3-512 hash algorithm -oCSHA512SHA-512 hash algorithm -oCSoftI2CBit-banged implementation of an I2C master -oCTextFieldField that displays a read-only text value -oCTimeFieldField that manages the display and editing of a time value -\CTransistorNoiseSourceProcesses the signal from a transistor-based noise source +oCEd25519Digital signatures based on the elliptic curve modulo 2^255 - 19 +oCEEPROM24Reading and writing EEPROM's from the 24LCXX family +oCFieldManages a single data input/output field within a Form +oCFormManager for a form containing data input/output fields +oCGCMImplementation of the Galois Counter Mode (GCM) +oCGCMCommonConcrete base class to assist with implementing GCM for 128-bit block ciphers +oCGHASHImplementation of the GHASH message authenticator +oCHashAbstract base class for cryptographic hash algorithms +oCI2CMasterAbstract base class for I2C master implementations +oCIntFieldField that manages the input of an integer value +oCIRreceiverManages the reception of RC-5 commands from an infrared remote control +oCKeccakCoreKeccak core sponge function +oCLCDEnhanced library for Freetronics 16x2 LCD shields +oCListFieldField that manages selection from a static list of items +oCMelodyPlays a melody on a digital output pin using tone() +oCNoiseSourceAbstract base class for random noise sources +oCOFBImplementation of the Output Feedback (OFB) mode for 128-bit block ciphers +oCOFBCommonConcrete base class to assist with implementing OFB for 128-bit block ciphers +oCPoly1305Poly1305 message authenticator +oCRingOscillatorNoiseSourceProcesses the signal from a ring oscillator based noise source +oCRNGClassPseudo random number generator suitable for cryptography +oCRTCBase class for realtime clock handlers +oCRTCAlarmStores alarm information from a realtime clock chip +oCRTCDateStores date information from a realtime clock chip +oCRTCTimeStores time information from a realtime clock chip +oCSHA1SHA-1 hash algorithm +oCSHA256SHA-256 hash algorithm +oCSHA3_256SHA3-256 hash algorithm +oCSHA3_512SHA3-512 hash algorithm +oCSHA512SHA-512 hash algorithm +oCSoftI2CBit-banged implementation of an I2C master +oCTextFieldField that displays a read-only text value +oCTimeFieldField that manages the display and editing of a time value +\CTransistorNoiseSourceProcesses the signal from a transistor-based noise source diff --git a/blink-blink_8dox.html b/blink-blink_8dox.html index 0dcac3ee..5252d303 100644 --- a/blink-blink_8dox.html +++ b/blink-blink_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink-charlieplex_8dox.html b/blink-charlieplex_8dox.html index 5f281297..f08d20a0 100644 --- a/blink-charlieplex_8dox.html +++ b/blink-charlieplex_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink-cylon_8dox.html b/blink-cylon_8dox.html index 8946c7af..ccbd7d89 100644 --- a/blink-cylon_8dox.html +++ b/blink-cylon_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink-startrek_8dox.html b/blink-startrek_8dox.html index a492cd37..b537d8de 100644 --- a/blink-startrek_8dox.html +++ b/blink-startrek_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink_blink.html b/blink_blink.html index c539550b..51813c81 100644 --- a/blink_blink.html +++ b/blink_blink.html @@ -120,7 +120,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink_charlieplex.html b/blink_charlieplex.html index 8c1450ab..ea115652 100644 --- a/blink_charlieplex.html +++ b/blink_charlieplex.html @@ -160,7 +160,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink_cylon.html b/blink_cylon.html index 45e823a6..9cd872bf 100644 --- a/blink_cylon.html +++ b/blink_cylon.html @@ -171,7 +171,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink_startrek.html b/blink_startrek.html index c3cc4e9a..77a535df 100644 --- a/blink_startrek.html +++ b/blink_startrek.html @@ -237,7 +237,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classAES128-members.html b/classAES128-members.html index cc80f0e0..497f5ecd 100644 --- a/classAES128-members.html +++ b/classAES128-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classAES128.html b/classAES128.html index 6986c767..c326400f 100644 --- a/classAES128.html +++ b/classAES128.html @@ -265,7 +265,7 @@ Additional Inherited Members diff --git a/classAES192-members.html b/classAES192-members.html index 55fc6cd2..72982183 100644 --- a/classAES192-members.html +++ b/classAES192-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classAES192.html b/classAES192.html index 15219d2e..3c72af60 100644 --- a/classAES192.html +++ b/classAES192.html @@ -265,7 +265,7 @@ Additional Inherited Members diff --git a/classAES256-members.html b/classAES256-members.html index f4ba54d6..38a98598 100644 --- a/classAES256-members.html +++ b/classAES256-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classAES256.html b/classAES256.html index 7ce2d321..f83ec311 100644 --- a/classAES256.html +++ b/classAES256.html @@ -265,7 +265,7 @@ Additional Inherited Members diff --git a/classAESCommon-members.html b/classAESCommon-members.html index f4842162..7b308e72 100644 --- a/classAESCommon-members.html +++ b/classAESCommon-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classAESCommon.html b/classAESCommon.html index 0ade6e15..86eb40f8 100644 --- a/classAESCommon.html +++ b/classAESCommon.html @@ -322,7 +322,7 @@ Protected Member Functions diff --git a/classAuthenticatedCipher-members.html b/classAuthenticatedCipher-members.html index e8238ccf..d0770e9c 100644 --- a/classAuthenticatedCipher-members.html +++ b/classAuthenticatedCipher-members.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classAuthenticatedCipher.html b/classAuthenticatedCipher.html index d0249b0c..3a4e7741 100644 --- a/classAuthenticatedCipher.html +++ b/classAuthenticatedCipher.html @@ -349,7 +349,7 @@ virtual  diff --git a/classBLAKE2b-members.html b/classBLAKE2b-members.html index 0a1a5af3..2e329a94 100644 --- a/classBLAKE2b-members.html +++ b/classBLAKE2b-members.html @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classBLAKE2b.html b/classBLAKE2b.html index 4330adbb..4d73d148 100644 --- a/classBLAKE2b.html +++ b/classBLAKE2b.html @@ -536,7 +536,7 @@ Additional Inherited Members diff --git a/classBLAKE2s-members.html b/classBLAKE2s-members.html index 475fc24b..af272dc9 100644 --- a/classBLAKE2s-members.html +++ b/classBLAKE2s-members.html @@ -112,7 +112,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classBLAKE2s.html b/classBLAKE2s.html index 0cba593c..864ee690 100644 --- a/classBLAKE2s.html +++ b/classBLAKE2s.html @@ -536,7 +536,7 @@ Additional Inherited Members diff --git a/classBigNumberUtil-members.html b/classBigNumberUtil-members.html index e9e645d5..c239209e 100644 --- a/classBigNumberUtil-members.html +++ b/classBigNumberUtil-members.html @@ -90,14 +90,22 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

This is the complete list of members for BigNumberUtil, including all inherited members.

+ + + + + + + +
add(limb_t *result, const limb_t *x, const limb_t *y, size_t size)BigNumberUtilstatic
add_P(limb_t *result, const limb_t *x, const limb_t *y, size_t size)BigNumberUtilstatic
mul(limb_t *result, const limb_t *x, size_t xcount, const limb_t *y, size_t ycount)BigNumberUtilstatic
mul_P(limb_t *result, const limb_t *x, size_t xcount, const limb_t *y, size_t ycount)BigNumberUtilstatic
packBE(uint8_t *bytes, size_t len, const limb_t *limbs, size_t count)BigNumberUtilstatic
packLE(uint8_t *bytes, size_t len, const limb_t *limbs, size_t count)BigNumberUtilstatic
reduceQuick(limb_t *result, const limb_t *x, const limb_t *y, size_t size)BigNumberUtilstatic
reduceQuick_P(limb_t *result, const limb_t *x, const limb_t *y, size_t size)BigNumberUtilstatic
sub(limb_t *result, const limb_t *x, const limb_t *y, size_t size)BigNumberUtilstatic
sub_P(limb_t *result, const limb_t *x, const limb_t *y, size_t size)BigNumberUtilstatic
unpackBE(limb_t *limbs, size_t count, const uint8_t *bytes, size_t len)BigNumberUtilstatic
unpackLE(limb_t *limbs, size_t count, const uint8_t *bytes, size_t len)BigNumberUtilstatic
diff --git a/classBigNumberUtil.html b/classBigNumberUtil.html index be3b3615..f2f90e68 100644 --- a/classBigNumberUtil.html +++ b/classBigNumberUtil.html @@ -110,6 +110,30 @@ Static Public Member Functions static void packBE (uint8_t *bytes, size_t len, const limb_t *limbs, size_t count)  Packs the big-endian byte representation of a big number into a byte array. More...
  +static limb_t add (limb_t *result, const limb_t *x, const limb_t *y, size_t size) + Adds two big numbers. More...
+  +static limb_t sub (limb_t *result, const limb_t *x, const limb_t *y, size_t size) + Subtracts one big number from another. More...
+  +static void mul (limb_t *result, const limb_t *x, size_t xcount, const limb_t *y, size_t ycount) + Multiplies two big numbers. More...
+  +static void reduceQuick (limb_t *result, const limb_t *x, const limb_t *y, size_t size) + Reduces x modulo y using subtraction. More...
+  +static limb_t add_P (limb_t *result, const limb_t *x, const limb_t *y, size_t size) + Adds two big numbers where one of them is in program memory. More...
+  +static limb_t sub_P (limb_t *result, const limb_t *x, const limb_t *y, size_t size) + Subtracts one big number from another where one is in program memory. More...
+  +static void mul_P (limb_t *result, const limb_t *x, size_t xcount, const limb_t *y, size_t ycount) + Multiplies two big numbers where one is in program memory. More...
+  +static void reduceQuick_P (limb_t *result, const limb_t *x, const limb_t *y, size_t size) + Reduces x modulo y using subtraction where y is in program memory. More...

Detailed Description

Utilities to assist with implementing big number arithmetic.

@@ -118,6 +142,262 @@ Static Public Member Functions

Definition at line 52 of file BigNumberUtil.h.

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
limb_t BigNumberUtil::add (limb_t * result,
const limb_t * x,
const limb_t * y,
size_t size 
)
+
+static
+
+ +

Adds two big numbers.

+
Parameters
+ + + + + +
resultThe result of the addition. This can be the same as either x or y.
xThe first big number.
yThe second big number.
sizeThe size of the values in limbs.
+
+
+
Returns
Returns 1 if there was a carry out or 0 if there was no carry out.
+
See Also
sub(), mul()
+ +

Definition at line 381 of file BigNumberUtil.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
limb_t BigNumberUtil::add_P (limb_t * result,
const limb_t * x,
const limb_t * y,
size_t size 
)
+
+static
+
+ +

Adds two big numbers where one of them is in program memory.

+
Parameters
+ + + + + +
resultThe result of the addition. This can be the same as x.
xThe first big number.
yThe second big number. This must point into program memory.
sizeThe size of the values in limbs.
+
+
+
Returns
Returns 1 if there was a carry out or 0 if there was no carry out.
+
See Also
sub_P(), mul_P()
+ +

Definition at line 514 of file BigNumberUtil.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void BigNumberUtil::mul (limb_t * result,
const limb_t * x,
size_t xcount,
const limb_t * y,
size_t ycount 
)
+
+static
+
+ +

Multiplies two big numbers.

+
Parameters
+ + + + + + +
resultThe result of the multiplication. The array must be xcount + ycount limbs in size.
xPoints to the first value to multiply.
xcountThe number of limbs in x.
yPoints to the second value to multiply.
ycountThe number of limbs in y.
+
+
+
See Also
mul_P()
+ +

Definition at line 432 of file BigNumberUtil.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void BigNumberUtil::mul_P (limb_t * result,
const limb_t * x,
size_t xcount,
const limb_t * y,
size_t ycount 
)
+
+static
+
+ +

Multiplies two big numbers where one is in program memory.

+
Parameters
+ + + + + + +
resultThe result of the multiplication. The array must be xcount + ycount limbs in size.
xPoints to the first value to multiply.
xcountThe number of limbs in x.
yPoints to the second value to multiply. This must point into program memory.
ycountThe number of limbs in y.
+
+
+
See Also
mul()
+ +

Definition at line 566 of file BigNumberUtil.cpp.

+ +
+
@@ -175,7 +455,7 @@ Static Public Member Functions

If len is shorter than the length of limbs, then the number will be truncated to the least significant len bytes. If len is longer than the length of limbs, then the high bytes will be filled with zeroes.

See Also
unpackLE(), packBE()
-

Definition at line 293 of file BigNumberUtil.cpp.

+

Definition at line 294 of file BigNumberUtil.cpp.

@@ -236,7 +516,251 @@ Static Public Member Functions

If len is shorter than the length of limbs, then the number will be truncated to the least significant len bytes. If len is longer than the length of limbs, then the high bytes will be filled with zeroes.

See Also
unpackLE(), packBE()
-

Definition at line 207 of file BigNumberUtil.cpp.

+

Definition at line 208 of file BigNumberUtil.cpp.

+ + + + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void BigNumberUtil::reduceQuick (limb_t * result,
const limb_t * x,
const limb_t * y,
size_t size 
)
+
+static
+
+ +

Reduces x modulo y using subtraction.

+
Parameters
+ + + + + +
resultThe result of the reduction. This can be the same as x.
xThe number to be reduced.
yThe base to use for the modulo reduction.
sizeThe size of the values in limbs.
+
+
+

It is assumed that x is less than y * 2 so that a single conditional subtraction will bring it down below y. The reduction is performed in constant time.

+
See Also
reduceQuick_P()
+ +

Definition at line 484 of file BigNumberUtil.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void BigNumberUtil::reduceQuick_P (limb_t * result,
const limb_t * x,
const limb_t * y,
size_t size 
)
+
+static
+
+ +

Reduces x modulo y using subtraction where y is in program memory.

+
Parameters
+ + + + + +
resultThe result of the reduction. This can be the same as x.
xThe number to be reduced.
yThe base to use for the modulo reduction. This must point into program memory.
sizeThe size of the values in limbs.
+
+
+

It is assumed that x is less than y * 2 so that a single conditional subtraction will bring it down below y. The reduction is performed in constant time.

+
See Also
reduceQuick()
+ +

Definition at line 620 of file BigNumberUtil.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
limb_t BigNumberUtil::sub (limb_t * result,
const limb_t * x,
const limb_t * y,
size_t size 
)
+
+static
+
+ +

Subtracts one big number from another.

+
Parameters
+ + + + + +
resultThe result of the subtraction. This can be the same as either x or y.
xThe first big number.
yThe second big number to subtract from x.
sizeThe size of the values in limbs.
+
+
+
Returns
Returns 1 if there was a borrow, or 0 if there was no borrow.
+
See Also
add(), mul()
+ +

Definition at line 408 of file BigNumberUtil.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
limb_t BigNumberUtil::sub_P (limb_t * result,
const limb_t * x,
const limb_t * y,
size_t size 
)
+
+static
+
+ +

Subtracts one big number from another where one is in program memory.

+
Parameters
+ + + + + +
resultThe result of the subtraction. This can be the same as x.
xThe first big number.
yThe second big number to subtract from x. This must point into program memory.
sizeThe size of the values in limbs.
+
+
+
Returns
Returns 1 if there was a borrow, or 0 if there was no borrow.
+
See Also
add_P(), mul_P()
+ +

Definition at line 541 of file BigNumberUtil.cpp.

@@ -297,7 +821,7 @@ Static Public Member Functions

If len is shorter than the length of limbs, then the high bytes will be filled with zeroes. If len is longer than the length of limbs, then the high bytes will be truncated and lost.

See Also
packBE(), unpackLE()
-

Definition at line 133 of file BigNumberUtil.cpp.

+

Definition at line 134 of file BigNumberUtil.cpp.

@@ -358,7 +882,7 @@ Static Public Member Functions

If len is shorter than the length of limbs, then the high bytes will be filled with zeroes. If len is longer than the length of limbs, then the high bytes will be truncated and lost.

See Also
packLE(), unpackBE()
-

Definition at line 54 of file BigNumberUtil.cpp.

+

Definition at line 55 of file BigNumberUtil.cpp.

@@ -369,7 +893,7 @@ Static Public Member Functions diff --git a/classBitmap-members.html b/classBitmap-members.html index d61293a2..017c07f0 100644 --- a/classBitmap-members.html +++ b/classBitmap-members.html @@ -138,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classBitmap.html b/classBitmap.html index c68a88e0..647963f5 100644 --- a/classBitmap.html +++ b/classBitmap.html @@ -1745,7 +1745,7 @@ class DMD diff --git a/classBlinkLED-members.html b/classBlinkLED-members.html index 6da626ee..c0cd8919 100644 --- a/classBlinkLED-members.html +++ b/classBlinkLED-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classBlinkLED.html b/classBlinkLED.html index 8dee45c4..6fb1c1e1 100644 --- a/classBlinkLED.html +++ b/classBlinkLED.html @@ -428,7 +428,7 @@ Public Member Functions diff --git a/classBlockCipher-members.html b/classBlockCipher-members.html index e23ec9d1..cb3b6c13 100644 --- a/classBlockCipher-members.html +++ b/classBlockCipher-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classBlockCipher.html b/classBlockCipher.html index 989ec03c..a0c4fcb1 100644 --- a/classBlockCipher.html +++ b/classBlockCipher.html @@ -407,7 +407,7 @@ Public Member Functions diff --git a/classBoolField-members.html b/classBoolField-members.html index 03d3e35c..81d40247 100644 --- a/classBoolField-members.html +++ b/classBoolField-members.html @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classBoolField.html b/classBoolField.html index 77d089a6..13f04b19 100644 --- a/classBoolField.html +++ b/classBoolField.html @@ -506,7 +506,7 @@ LiquidCrystal *  diff --git a/classCBC-members.html b/classCBC-members.html index 5ef11f95..e9964d37 100644 --- a/classCBC-members.html +++ b/classCBC-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCBC.html b/classCBC.html index 0d12d5ef..64d57ea8 100644 --- a/classCBC.html +++ b/classCBC.html @@ -185,7 +185,7 @@ class CBC< T > diff --git a/classCBCCommon-members.html b/classCBCCommon-members.html index d66d42b8..3c4b3b51 100644 --- a/classCBCCommon-members.html +++ b/classCBCCommon-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCBCCommon.html b/classCBCCommon.html index 762d38c3..23a70408 100644 --- a/classCBCCommon.html +++ b/classCBCCommon.html @@ -534,7 +534,7 @@ Protected Member Functions diff --git a/classCFB-members.html b/classCFB-members.html index ec8696ff..58008bbb 100644 --- a/classCFB-members.html +++ b/classCFB-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCFB.html b/classCFB.html index bfa7ba82..bba0b646 100644 --- a/classCFB.html +++ b/classCFB.html @@ -185,7 +185,7 @@ class CFB< T > diff --git a/classCFBCommon-members.html b/classCFBCommon-members.html index 5e79af84..e3911e85 100644 --- a/classCFBCommon-members.html +++ b/classCFBCommon-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCFBCommon.html b/classCFBCommon.html index 1a2e84af..4226b4b7 100644 --- a/classCFBCommon.html +++ b/classCFBCommon.html @@ -534,7 +534,7 @@ Protected Member Functions diff --git a/classCTR-members.html b/classCTR-members.html index 805da335..94b0e31e 100644 --- a/classCTR-members.html +++ b/classCTR-members.html @@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCTR.html b/classCTR.html index 50e1755f..2b43d14c 100644 --- a/classCTR.html +++ b/classCTR.html @@ -181,7 +181,7 @@ class CTR< T > diff --git a/classCTRCommon-members.html b/classCTRCommon-members.html index 6d9f9bfa..075d8a78 100644 --- a/classCTRCommon-members.html +++ b/classCTRCommon-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCTRCommon.html b/classCTRCommon.html index 3738dbec..10fad6a3 100644 --- a/classCTRCommon.html +++ b/classCTRCommon.html @@ -563,7 +563,7 @@ Protected Member Functions diff --git a/classChaCha-members.html b/classChaCha-members.html index 6f60bbae..1868a22b 100644 --- a/classChaCha-members.html +++ b/classChaCha-members.html @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classChaCha.html b/classChaCha.html index 1ca44874..6b1233fa 100644 --- a/classChaCha.html +++ b/classChaCha.html @@ -673,7 +673,7 @@ class ChaChaPoly< diff --git a/classChaChaPoly-members.html b/classChaChaPoly-members.html index 6b2dc01e..8a317b82 100644 --- a/classChaChaPoly-members.html +++ b/classChaChaPoly-members.html @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classChaChaPoly.html b/classChaChaPoly.html index 301c4b5e..cf74762b 100644 --- a/classChaChaPoly.html +++ b/classChaChaPoly.html @@ -665,7 +665,7 @@ virtual  diff --git a/classCharlieplex-members.html b/classCharlieplex-members.html index e66a5e17..38d8fabb 100644 --- a/classCharlieplex-members.html +++ b/classCharlieplex-members.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCharlieplex.html b/classCharlieplex.html index 4cf45e3f..743c0c4e 100644 --- a/classCharlieplex.html +++ b/classCharlieplex.html @@ -538,7 +538,7 @@ Public Member Functions diff --git a/classChaseLEDs-members.html b/classChaseLEDs-members.html index 53d1122f..5fdb214d 100644 --- a/classChaseLEDs-members.html +++ b/classChaseLEDs-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classChaseLEDs.html b/classChaseLEDs.html index bbc086d3..802a6e26 100644 --- a/classChaseLEDs.html +++ b/classChaseLEDs.html @@ -347,7 +347,7 @@ Protected Member Functions diff --git a/classCipher-members.html b/classCipher-members.html index 22ea8953..79af7fb5 100644 --- a/classCipher-members.html +++ b/classCipher-members.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCipher.html b/classCipher.html index 08060bb4..120c2dc3 100644 --- a/classCipher.html +++ b/classCipher.html @@ -483,7 +483,7 @@ Public Member Functions diff --git a/classCurve25519-members.html b/classCurve25519-members.html index 12d44cf7..4c85fda0 100644 --- a/classCurve25519-members.html +++ b/classCurve25519-members.html @@ -92,11 +92,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); - + +
dh1(uint8_t k[32], uint8_t f[32])Curve25519static
dh2(uint8_t k[32], uint8_t f[32])Curve25519static
eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[32])Curve25519static
Ed25519 (defined in Curve25519)Curve25519friend
eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[32])Curve25519static
diff --git a/classCurve25519.html b/classCurve25519.html index c9a29521..4d159ba5 100644 --- a/classCurve25519.html +++ b/classCurve25519.html @@ -85,6 +85,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
Static Public Member Functions | +Friends | List of all members
Curve25519 Class Reference
@@ -107,13 +108,20 @@ Static Public Member Functions static bool dh2 (uint8_t k[32], uint8_t f[32])  Performs phase 2 of a Diffie-Hellman key exchange using Curve25519. More...
  + + + +

+Friends

+class Ed25519
 

Detailed Description

Diffie-Hellman key agreement based on the elliptic curve modulo 2^255 - 19.

Note
The public functions in this class need a substantial amount of stack space to store intermediate results while the curve function is being evaluated. About 1k of free stack space is recommended for safety.
-

References: http://cr.yp.to/ecdh.html https://tools.ietf.org/html/draft-irtf-cfrg-curves-02

+

References: http://cr.yp.to/ecdh.html https://tools.ietf.org/html/draft-irtf-cfrg-curves-02

+
See Also
Ed25519
-

Definition at line 28 of file Curve25519.h.

+

Definition at line 30 of file Curve25519.h.

Member Function Documentation

@@ -180,7 +188,7 @@ Static Public Member Functions

Reference: https://tools.ietf.org/html/draft-irtf-cfrg-curves-02

See Also
dh2()
-

Definition at line 244 of file Curve25519.cpp.

+

Definition at line 239 of file Curve25519.cpp.

@@ -228,7 +236,7 @@ Static Public Member Functions

Reference: https://tools.ietf.org/html/draft-irtf-cfrg-curves-02

See Also
dh1()
-

Definition at line 282 of file Curve25519.cpp.

+

Definition at line 277 of file Curve25519.cpp.

@@ -284,7 +292,7 @@ Static Public Member Functions

Reference: https://tools.ietf.org/html/draft-irtf-cfrg-curves-02

See Also
dh1(), dh2()
-

Definition at line 79 of file Curve25519.cpp.

+

Definition at line 74 of file Curve25519.cpp.

@@ -295,7 +303,7 @@ Static Public Member Functions diff --git a/classDMD-members.html b/classDMD-members.html index a22c626c..edb05182 100644 --- a/classDMD-members.html +++ b/classDMD-members.html @@ -150,7 +150,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classDMD.html b/classDMD.html index de9bc879..b4830b26 100644 --- a/classDMD.html +++ b/classDMD.html @@ -755,7 +755,7 @@ Multiple panels diff --git a/classDS1307RTC-members.html b/classDS1307RTC-members.html index 1132e12d..2d20c7c3 100644 --- a/classDS1307RTC-members.html +++ b/classDS1307RTC-members.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classDS1307RTC.html b/classDS1307RTC.html index 75f0535b..622178c7 100644 --- a/classDS1307RTC.html +++ b/classDS1307RTC.html @@ -598,7 +598,7 @@ static const uint8_t  diff --git a/classDS3231RTC-members.html b/classDS3231RTC-members.html index 85c97f7f..4db49e04 100644 --- a/classDS3231RTC-members.html +++ b/classDS3231RTC-members.html @@ -133,7 +133,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classDS3231RTC.html b/classDS3231RTC.html index 217cbd65..4b05cfdf 100644 --- a/classDS3231RTC.html +++ b/classDS3231RTC.html @@ -713,7 +713,7 @@ static const uint8_t  diff --git a/classDS3232RTC-members.html b/classDS3232RTC-members.html index bf955e7b..59fb3634 100644 --- a/classDS3232RTC-members.html +++ b/classDS3232RTC-members.html @@ -130,7 +130,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classDS3232RTC.html b/classDS3232RTC.html index e41d5bb7..f478ef44 100644 --- a/classDS3232RTC.html +++ b/classDS3232RTC.html @@ -750,7 +750,7 @@ static const uint8_t  diff --git a/classEEPROM24-members.html b/classEEPROM24-members.html index 4b958120..7dbc4fd1 100644 --- a/classEEPROM24-members.html +++ b/classEEPROM24-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classEEPROM24.html b/classEEPROM24.html index a24316f6..73ad9077 100644 --- a/classEEPROM24.html +++ b/classEEPROM24.html @@ -431,7 +431,7 @@ Public Member Functions diff --git a/classEd25519-members.html b/classEd25519-members.html new file mode 100644 index 00000000..447e5675 --- /dev/null +++ b/classEd25519-members.html @@ -0,0 +1,105 @@ + + + + + + +ArduinoLibs: Member List + + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs +
+
+
+ + + + + + +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
+ + +
+ +
+ +
+
+
+
Ed25519 Member List
+
+
+ +

This is the complete list of members for Ed25519, including all inherited members.

+ + + + + +
derivePublicKey(uint8_t publicKey[32], const uint8_t privateKey[32])Ed25519static
generatePrivateKey(uint8_t privateKey[32])Ed25519static
sign(uint8_t signature[64], const uint8_t privateKey[32], const uint8_t publicKey[32], const void *message, size_t len)Ed25519static
verify(const uint8_t signature[64], const uint8_t publicKey[32], const void *message, size_t len)Ed25519static
+ + + + diff --git a/classEd25519.html b/classEd25519.html new file mode 100644 index 00000000..a0dd79f3 --- /dev/null +++ b/classEd25519.html @@ -0,0 +1,362 @@ + + + + + + +ArduinoLibs: Ed25519 Class Reference + + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs +
+
+
+ + + + + + +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
+ + +
+ +
+ +
+
+
+Classes | +Static Public Member Functions | +List of all members
+
+
Ed25519 Class Reference
+
+
+ +

Digital signatures based on the elliptic curve modulo 2^255 - 19. + More...

+ +

#include <Ed25519.h>

+ + + + + + + + + + + + + + +

+Static Public Member Functions

static void sign (uint8_t signature[64], const uint8_t privateKey[32], const uint8_t publicKey[32], const void *message, size_t len)
 Signs a message using a specific Ed25519 private key. More...
 
static bool verify (const uint8_t signature[64], const uint8_t publicKey[32], const void *message, size_t len)
 Verifies a signature using a specific Ed25519 public key. More...
 
static void generatePrivateKey (uint8_t privateKey[32])
 Generates a private key for Ed25519 signing operations. More...
 
static void derivePublicKey (uint8_t publicKey[32], const uint8_t privateKey[32])
 Derives the public key from a private key. More...
 
+

Detailed Description

+

Digital signatures based on the elliptic curve modulo 2^255 - 19.

+

The first step in creating a digital signature with Ed25519 is to generate a key pair:

+
uint8_t privateKey[32];
+
uint8_t publicKey[32];
+
+ +
Ed25519::derivePublicKey(publicKey, privateKey);
+

The application can store both the private and public key for later signing operations. Or it can store just the private key and then derive the public key at the point where signing is to occur.

+

Message signing produces a 64-byte signature as follows:

+
uint8_t message[N];
+
uint8_t signature[64];
+
+
Ed25519::sign(signature, privateKey, publicKey, message, N);
+

And then to verify the signature:

+
if (!Ed25519::verify(signature, publicKey, message, N)) {
+
// The signature is invalid.
+
...
+
}
+
Note
The public functions in this class need a substantial amount of stack space to store intermediate results while the curve function is being evaluated. About 1.5k of free stack space is recommended for safety.
+

References: https://tools.ietf.org/id/draft-josefsson-eddsa-ed25519-02.txt

+
See Also
Curve25519
+ +

Definition at line 29 of file Ed25519.h.

+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void Ed25519::derivePublicKey (uint8_t publicKey[32],
const uint8_t privateKey[32] 
)
+
+static
+
+ +

Derives the public key from a private key.

+
Parameters
+ + + +
publicKeyThe public key.
privateKeyThe private key.
+
+
+
See Also
generatePrivateKey()
+ +

Definition at line 256 of file Ed25519.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void Ed25519::generatePrivateKey (uint8_t privateKey[32])
+
+static
+
+ +

Generates a private key for Ed25519 signing operations.

+
Parameters
+ + +
privateKeyThe resulting private key.
+
+
+

The private key is generated with RNG.rand(). It is the caller's responsibility to ensure that the global random number pool has sufficient entropy to generate the 32 bytes of the key safely before calling this function.

+
See Also
derivePublicKey()
+ +

Definition at line 243 of file Ed25519.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void Ed25519::sign (uint8_t signature[64],
const uint8_t privateKey[32],
const uint8_t publicKey[32],
const void * message,
size_t len 
)
+
+static
+
+ +

Signs a message using a specific Ed25519 private key.

+
Parameters
+ + + + + + +
signatureThe signature value.
privateKeyThe private key to use to sign the message.
publicKeyThe public key corresponding to privateKey.
messagePoints to the message to be signed.
lenThe length of the message to be signed.
+
+
+
See Also
verify(), derivePublicKey()
+ +

Definition at line 127 of file Ed25519.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool Ed25519::verify (const uint8_t signature[64],
const uint8_t publicKey[32],
const void * message,
size_t len 
)
+
+static
+
+ +

Verifies a signature using a specific Ed25519 public key.

+
Parameters
+ + + + + +
signatureThe signature value to be verified.
publicKeyThe public key to use to verify the signature.
messageThe message whose signature is to be verified.
lenThe length of the message to be verified.
+
+
+
Returns
Returns true if the signature is valid for message; or false if the signature is not valid.
+
See Also
sign()
+ +

Definition at line 189 of file Ed25519.cpp.

+ +
+
+
The documentation for this class was generated from the following files: +
+ + + + diff --git a/classField-members.html b/classField-members.html index 9603c9a6..a8ba02a0 100644 --- a/classField-members.html +++ b/classField-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classField.html b/classField.html index 8d92eb0c..de9e32b4 100644 --- a/classField.html +++ b/classField.html @@ -424,7 +424,7 @@ class Form diff --git a/classForm-members.html b/classForm-members.html index acf17ae5..462a6190 100644 --- a/classForm-members.html +++ b/classForm-members.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classForm.html b/classForm.html index 96411281..0644de6e 100644 --- a/classForm.html +++ b/classForm.html @@ -485,7 +485,7 @@ class Field diff --git a/classGCM-members.html b/classGCM-members.html index c49538a2..3a70ffb4 100644 --- a/classGCM-members.html +++ b/classGCM-members.html @@ -119,7 +119,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classGCM.html b/classGCM.html index fe414b58..7c334781 100644 --- a/classGCM.html +++ b/classGCM.html @@ -223,7 +223,7 @@ class GCM< T > diff --git a/classGCMCommon-members.html b/classGCMCommon-members.html index 78c84b0d..982ad9c9 100644 --- a/classGCMCommon-members.html +++ b/classGCMCommon-members.html @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classGCMCommon.html b/classGCMCommon.html index 8500eb80..feea9069 100644 --- a/classGCMCommon.html +++ b/classGCMCommon.html @@ -736,7 +736,7 @@ Protected Member Functions diff --git a/classGHASH-members.html b/classGHASH-members.html index 8a628eda..5216e92f 100644 --- a/classGHASH-members.html +++ b/classGHASH-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classGHASH.html b/classGHASH.html index ba639471..93cce48a 100644 --- a/classGHASH.html +++ b/classGHASH.html @@ -265,7 +265,7 @@ void  diff --git a/classHash-members.html b/classHash-members.html index d7c7ca82..054872a9 100644 --- a/classHash-members.html +++ b/classHash-members.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classHash.html b/classHash.html index 218c66f8..5f0ef59c 100644 --- a/classHash.html +++ b/classHash.html @@ -212,7 +212,7 @@ Protected Member Functions

Size of the internal block used by the hash algorithm.

See Also
update(), hashSize()
-

Implemented in SHA3_512, SHA3_256, BLAKE2b, BLAKE2s, SHA1, SHA256, and SHA512.

+

Implemented in SHA3_512, SHA512, SHA3_256, BLAKE2b, BLAKE2s, SHA1, and SHA256.

@@ -240,7 +240,7 @@ Protected Member Functions

Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing process.

See Also
reset()
-

Implemented in SHA3_512, BLAKE2b, BLAKE2s, SHA3_256, SHA1, SHA256, and SHA512.

+

Implemented in SHA3_512, SHA512, BLAKE2b, BLAKE2s, SHA3_256, SHA1, and SHA256.

@@ -288,7 +288,7 @@ Protected Member Functions

If finalize() is called again, then the returned hash value is undefined. Call reset() first to start a new hashing process.

See Also
reset(), update(), finalizeHMAC()
-

Implemented in SHA3_512, BLAKE2b, BLAKE2s, SHA3_256, SHA1, SHA256, and SHA512.

+

Implemented in SHA3_512, SHA512, BLAKE2b, BLAKE2s, SHA3_256, SHA1, and SHA256.

@@ -348,7 +348,7 @@ Protected Member Functions
See Also
resetHMAC(), finalize()
-

Implemented in SHA3_512, BLAKE2b, BLAKE2s, SHA3_256, SHA1, SHA256, and SHA512.

+

Implemented in SHA3_512, SHA512, BLAKE2b, BLAKE2s, SHA3_256, SHA1, and SHA256.

@@ -436,7 +436,7 @@ Protected Member Functions

Size of the hash result from finalize().

See Also
finalize(), blockSize()
-

Implemented in SHA3_512, SHA3_256, BLAKE2b, BLAKE2s, SHA1, SHA256, and SHA512.

+

Implemented in SHA3_512, SHA512, SHA3_256, BLAKE2b, BLAKE2s, SHA1, and SHA256.

@@ -464,7 +464,7 @@ Protected Member Functions

Resets the hash ready for a new hashing process.

See Also
update(), finalize(), resetHMAC()
-

Implemented in SHA3_512, SHA3_256, BLAKE2b, BLAKE2s, SHA1, SHA256, and SHA512.

+

Implemented in SHA3_512, SHA512, SHA3_256, BLAKE2b, BLAKE2s, SHA1, and SHA256.

@@ -518,7 +518,7 @@ Protected Member Functions

The same key must be passed to both resetHMAC() and finalizeHMAC().

See Also
finalizeHMAC(), reset()
-

Implemented in SHA3_512, BLAKE2b, BLAKE2s, SHA3_256, SHA1, SHA256, and SHA512.

+

Implemented in SHA3_512, SHA512, BLAKE2b, BLAKE2s, SHA3_256, SHA1, and SHA256.

@@ -565,7 +565,7 @@ Protected Member Functions

If finalize() has already been called, then the behavior of update() will be undefined. Call reset() first to start a new hashing process.

See Also
reset(), finalize()
-

Implemented in SHA3_512, BLAKE2b, BLAKE2s, SHA3_256, SHA1, SHA256, and SHA512.

+

Implemented in SHA3_512, SHA512, BLAKE2b, BLAKE2s, SHA3_256, SHA1, and SHA256.

@@ -576,7 +576,7 @@ Protected Member Functions diff --git a/classI2CMaster-members.html b/classI2CMaster-members.html index b6135c9b..28625fd5 100644 --- a/classI2CMaster-members.html +++ b/classI2CMaster-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classI2CMaster.html b/classI2CMaster.html index 3b384600..cce49b64 100644 --- a/classI2CMaster.html +++ b/classI2CMaster.html @@ -328,7 +328,7 @@ virtual unsigned int  diff --git a/classIRreceiver-members.html b/classIRreceiver-members.html index 0ef442ce..7de8a990 100644 --- a/classIRreceiver-members.html +++ b/classIRreceiver-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classIRreceiver.html b/classIRreceiver.html index 7e106f37..92cc4ee5 100644 --- a/classIRreceiver.html +++ b/classIRreceiver.html @@ -328,7 +328,7 @@ void _IR_receive_interrupt diff --git a/classIntField-members.html b/classIntField-members.html index a00807be..f0d3736c 100644 --- a/classIntField-members.html +++ b/classIntField-members.html @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classIntField.html b/classIntField.html index 27821a0d..6d6f632d 100644 --- a/classIntField.html +++ b/classIntField.html @@ -647,7 +647,7 @@ LiquidCrystal *  diff --git a/classKeccakCore-members.html b/classKeccakCore-members.html index c2295ada..c20b3412 100644 --- a/classKeccakCore-members.html +++ b/classKeccakCore-members.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classKeccakCore.html b/classKeccakCore.html index ee5bfb00..22806891 100644 --- a/classKeccakCore.html +++ b/classKeccakCore.html @@ -425,7 +425,7 @@ void  diff --git a/classLCD-members.html b/classLCD-members.html index 739a4b84..b3f7a604 100644 --- a/classLCD-members.html +++ b/classLCD-members.html @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classLCD.html b/classLCD.html index b89d973f..e7c97bef 100644 --- a/classLCD.html +++ b/classLCD.html @@ -592,7 +592,7 @@ Support for DFRobot LCD Shield diff --git a/classListField-members.html b/classListField-members.html index 7f9456ab..89347bad 100644 --- a/classListField-members.html +++ b/classListField-members.html @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classListField.html b/classListField.html index b699571d..8feeceb1 100644 --- a/classListField.html +++ b/classListField.html @@ -411,7 +411,7 @@ LiquidCrystal *  diff --git a/classMelody-members.html b/classMelody-members.html index 2a5660d7..3d73cb4f 100644 --- a/classMelody-members.html +++ b/classMelody-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classMelody.html b/classMelody.html index f5fdeb81..3ebfaaf3 100644 --- a/classMelody.html +++ b/classMelody.html @@ -371,7 +371,7 @@ bool  diff --git a/classNoiseSource-members.html b/classNoiseSource-members.html index f7ba2955..2dce426e 100644 --- a/classNoiseSource-members.html +++ b/classNoiseSource-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classNoiseSource.html b/classNoiseSource.html index a2e92876..5cbbe755 100644 --- a/classNoiseSource.html +++ b/classNoiseSource.html @@ -289,7 +289,7 @@ Protected Member Functions diff --git a/classOFB-members.html b/classOFB-members.html index 3df2218b..beadcbc6 100644 --- a/classOFB-members.html +++ b/classOFB-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classOFB.html b/classOFB.html index 6f17d4fa..5218bd73 100644 --- a/classOFB.html +++ b/classOFB.html @@ -181,7 +181,7 @@ class OFB< T > diff --git a/classOFBCommon-members.html b/classOFBCommon-members.html index a86ee4d7..4d223a0e 100644 --- a/classOFBCommon-members.html +++ b/classOFBCommon-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classOFBCommon.html b/classOFBCommon.html index 6d94cff9..13329e1f 100644 --- a/classOFBCommon.html +++ b/classOFBCommon.html @@ -534,7 +534,7 @@ Protected Member Functions diff --git a/classPoly1305-members.html b/classPoly1305-members.html index ad9ddf0d..a1b9cea6 100644 --- a/classPoly1305-members.html +++ b/classPoly1305-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classPoly1305.html b/classPoly1305.html index d2a234ec..8933bec6 100644 --- a/classPoly1305.html +++ b/classPoly1305.html @@ -183,7 +183,7 @@ void finalize() is called again, then the returned token value is undefined. Call reset() first to start a new authentication process.

See Also
reset(), update()
-

Definition at line 180 of file Poly1305.cpp.

+

Definition at line 179 of file Poly1305.cpp.

@@ -203,7 +203,7 @@ void 
See Also
update()
-

Definition at line 251 of file Poly1305.cpp.

+

Definition at line 250 of file Poly1305.cpp.

@@ -230,7 +230,7 @@ void 
See Also
update(), finalize()
-

Definition at line 111 of file Poly1305.cpp.

+

Definition at line 110 of file Poly1305.cpp.

@@ -269,7 +269,7 @@ void finalize() has already been called, then the behavior of update() will be undefined. Call reset() first to start a new authentication process.

See Also
pad(), reset(), finalize()
-

Definition at line 143 of file Poly1305.cpp.

+

Definition at line 142 of file Poly1305.cpp.

@@ -280,7 +280,7 @@ void  diff --git a/classRNGClass-members.html b/classRNGClass-members.html index 7704ad6f..10d420b2 100644 --- a/classRNGClass-members.html +++ b/classRNGClass-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classRNGClass.html b/classRNGClass.html index d75790b1..89268595 100644 --- a/classRNGClass.html +++ b/classRNGClass.html @@ -517,7 +517,7 @@ static const int  diff --git a/classRTC-members.html b/classRTC-members.html index c1c8313f..92ead22c 100644 --- a/classRTC-members.html +++ b/classRTC-members.html @@ -123,7 +123,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classRTC.html b/classRTC.html index aeb178da..1374be96 100644 --- a/classRTC.html +++ b/classRTC.html @@ -779,7 +779,7 @@ static const uint8_t  diff --git a/classRTCAlarm-members.html b/classRTCAlarm-members.html index e0f9136c..3884f1e4 100644 --- a/classRTCAlarm-members.html +++ b/classRTCAlarm-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classRTCDate-members.html b/classRTCDate-members.html index e8ed3666..9dbea9d2 100644 --- a/classRTCDate-members.html +++ b/classRTCDate-members.html @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classRTCTime-members.html b/classRTCTime-members.html index e043dc2c..4f2a9494 100644 --- a/classRTCTime-members.html +++ b/classRTCTime-members.html @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classRingOscillatorNoiseSource-members.html b/classRingOscillatorNoiseSource-members.html index 5ce88f6e..645fbef0 100644 --- a/classRingOscillatorNoiseSource-members.html +++ b/classRingOscillatorNoiseSource-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classRingOscillatorNoiseSource.html b/classRingOscillatorNoiseSource.html index 203db7cb..ce7a3880 100644 --- a/classRingOscillatorNoiseSource.html +++ b/classRingOscillatorNoiseSource.html @@ -253,7 +253,7 @@ Additional Inherited Members diff --git a/classSHA1-members.html b/classSHA1-members.html index 5f74ee46..f3a1ec92 100644 --- a/classSHA1-members.html +++ b/classSHA1-members.html @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classSHA1.html b/classSHA1.html index 0c026d8c..dd835283 100644 --- a/classSHA1.html +++ b/classSHA1.html @@ -506,7 +506,7 @@ Additional Inherited Members diff --git a/classSHA256-members.html b/classSHA256-members.html index f12b334e..b1fa51e7 100644 --- a/classSHA256-members.html +++ b/classSHA256-members.html @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classSHA256.html b/classSHA256.html index 6d7a328e..70ad4346 100644 --- a/classSHA256.html +++ b/classSHA256.html @@ -506,7 +506,7 @@ Additional Inherited Members diff --git a/classSHA3__256-members.html b/classSHA3__256-members.html index 706cbfe2..b52841fc 100644 --- a/classSHA3__256-members.html +++ b/classSHA3__256-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classSHA3__256.html b/classSHA3__256.html index 6e534d01..4d55f814 100644 --- a/classSHA3__256.html +++ b/classSHA3__256.html @@ -506,7 +506,7 @@ Additional Inherited Members diff --git a/classSHA3__512-members.html b/classSHA3__512-members.html index 7424b638..7970d5fd 100644 --- a/classSHA3__512-members.html +++ b/classSHA3__512-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classSHA3__512.html b/classSHA3__512.html index 4899dea2..912a6384 100644 --- a/classSHA3__512.html +++ b/classSHA3__512.html @@ -506,7 +506,7 @@ Additional Inherited Members diff --git a/classSHA512-members.html b/classSHA512-members.html index f3207cd5..ebe742a5 100644 --- a/classSHA512-members.html +++ b/classSHA512-members.html @@ -93,25 +93,26 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); blockSize() const SHA512virtual chunkSize (defined in SHA512)SHA512 clear()SHA512virtual - finalize(void *hash, size_t len)SHA512virtual - finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)SHA512virtual - formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)Hashprotected - h (defined in SHA512)SHA512 - Hash()Hash - hashSize() const SHA512virtual - lengthHigh (defined in SHA512)SHA512 - lengthLow (defined in SHA512)SHA512 - reset()SHA512virtual - resetHMAC(const void *key, size_t keyLen)SHA512virtual - SHA512()SHA512 - update(const void *data, size_t len)SHA512virtual - w (defined in SHA512)SHA512 - ~Hash()Hashvirtual - ~SHA512()SHA512virtual + Ed25519 (defined in SHA512)SHA512friend + finalize(void *hash, size_t len)SHA512virtual + finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)SHA512virtual + formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)Hashprotected + h (defined in SHA512)SHA512 + Hash()Hash + hashSize() const SHA512virtual + lengthHigh (defined in SHA512)SHA512 + lengthLow (defined in SHA512)SHA512 + reset()SHA512virtual + resetHMAC(const void *key, size_t keyLen)SHA512virtual + SHA512()SHA512 + update(const void *data, size_t len)SHA512virtual + w (defined in SHA512)SHA512 + ~Hash()Hashvirtual + ~SHA512()SHA512virtual diff --git a/classSHA512.html b/classSHA512.html index f9f6cc92..9c7ba08f 100644 --- a/classSHA512.html +++ b/classSHA512.html @@ -85,6 +85,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
SHA512 Class Reference
@@ -148,6 +149,12 @@ virtual  Destroys this hash object. More...
  + + + +

+Friends

+class Ed25519
 
@@ -160,7 +167,7 @@ Additional Inherited Members

Reference: http://en.wikipedia.org/wiki/SHA-2

See Also
SHA256, SHA1
-

Definition at line 28 of file SHA512.h.

+

Definition at line 30 of file SHA512.h.

Member Function Documentation

@@ -506,7 +513,7 @@ Additional Inherited Members
diff --git a/classSoftI2C-members.html b/classSoftI2C-members.html index c2889795..bbc7a999 100644 --- a/classSoftI2C-members.html +++ b/classSoftI2C-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

Additional Inherited Members

- Protected Member Functions inherited from Hash
diff --git a/classSoftI2C.html b/classSoftI2C.html index ec0adc59..90c851cf 100644 --- a/classSoftI2C.html +++ b/classSoftI2C.html @@ -346,7 +346,7 @@ unsigned int  diff --git a/classTextField-members.html b/classTextField-members.html index 31f1d91a..1b4ee300 100644 --- a/classTextField-members.html +++ b/classTextField-members.html @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classTextField.html b/classTextField.html index 2b7f4741..3ec734cd 100644 --- a/classTextField.html +++ b/classTextField.html @@ -343,7 +343,7 @@ LiquidCrystal *  diff --git a/classTimeField-members.html b/classTimeField-members.html index 07eca50b..8e4b4a5d 100644 --- a/classTimeField-members.html +++ b/classTimeField-members.html @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classTimeField.html b/classTimeField.html index 2a4c062c..c931cf60 100644 --- a/classTimeField.html +++ b/classTimeField.html @@ -541,7 +541,7 @@ LiquidCrystal *  diff --git a/classTransistorNoiseSource-members.html b/classTransistorNoiseSource-members.html index 33104a88..7f815e98 100644 --- a/classTransistorNoiseSource-members.html +++ b/classTransistorNoiseSource-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classTransistorNoiseSource.html b/classTransistorNoiseSource.html index 5c89ac3b..a2fb0739 100644 --- a/classTransistorNoiseSource.html +++ b/classTransistorNoiseSource.html @@ -280,7 +280,7 @@ Additional Inherited Members diff --git a/classes.html b/classes.html index 9b93e65b..a4079969 100644 --- a/classes.html +++ b/classes.html @@ -90,52 +90,50 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
A | B | C | D | E | F | G | H | I | K | L | M | N | O | P | R | S | T
- + + + + - - - - - + - - + + + + + + - - - - - + - - - - - + + + +
  A  
-
CFB   Form   ListField   RTCDate   
CFBCommon   
  G  
+
CFB   
  F  
+
  L  
+
RNGClass   
CFBCommon   RTC   
AES128   ChaCha   Field   LCD   RTCAlarm   
AES192   ChaChaPoly   Form   ListField   RTCDate   
AES256   Charlieplex   
  G  
  M  
RTCTime   
AES128   ChaCha   
  S  
+
AESCommon   ChaseLEDs   
  S  
AES192   ChaChaPoly   GCM   Melody   
AES256   Charlieplex   GCMCommon   
  N  
-
SHA1   
AESCommon   ChaseLEDs   GHASH   SHA256   
AuthenticatedCipher   Cipher   
  H  
-
NoiseSource   SHA3_256   
AuthenticatedCipher   Cipher   GCM   Melody   
  B  
-
CTR   
  O  
-
SHA3_512   
CTRCommon   Hash   SHA512   
BigNumberUtil   Curve25519   
  I  
-
OFB   SoftI2C   
CTR   GCMCommon   
  N  
+
SHA1   
CTRCommon   GHASH   SHA256   
BigNumberUtil   Curve25519   
  H  
+
NoiseSource   SHA3_256   
Bitmap   
  D  
-
OFBCommon   
  T  
+
  O  
+
SHA3_512   
BLAKE2b   Hash   SHA512   
BLAKE2s   DMD   
  I  
+
OFB   SoftI2C   
BlinkLED   DS1307RTC   OFBCommon   
  T  
BLAKE2b   I2CMaster   
  P  
+
BlockCipher   DS3231RTC   I2CMaster   
  P  
BLAKE2s   DMD   IntField   TextField   
BlinkLED   DS1307RTC   IRreceiver   Poly1305   TimeField   
BlockCipher   DS3231RTC   
  K  
-
  R  
-
TransistorNoiseSource   
BoolField   DS3232RTC   
BoolField   DS3232RTC   IntField   TextField   
  C  
  E  
-
KeccakCore   RingOscillatorNoiseSource   
  L  
-
RNGClass   
CBC   EEPROM24   RTC   
CBCCommon   
  F  
-
LCD   RTCAlarm   
Field   
IRreceiver   Poly1305   TimeField   
  K  
+
  R  
+
TransistorNoiseSource   
CBC   Ed25519   
CBCCommon   EEPROM24   KeccakCore   RingOscillatorNoiseSource   
A | B | C | D | E | F | G | H | I | K | L | M | N | O | P | R | S | T
diff --git a/crypto-rng-ring_8dox.html b/crypto-rng-ring_8dox.html index 8d34062a..dccb1add 100644 --- a/crypto-rng-ring_8dox.html +++ b/crypto-rng-ring_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/crypto-rng_8dox.html b/crypto-rng_8dox.html index 99e0a161..f5bb9f08 100644 --- a/crypto-rng_8dox.html +++ b/crypto-rng_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/crypto.html b/crypto.html index d8c43523..9db07f09 100644 --- a/crypto.html +++ b/crypto.html @@ -88,7 +88,7 @@ Supported Algorithms
  • Authenticated encryption with associated data (AEAD): ChaChaPoly, GCM
  • Hash algorithms: SHA1, SHA256, SHA512, SHA3_256, SHA3_512, BLAKE2s, BLAKE2b (regular and HMAC modes)
  • Message authenticators: Poly1305, GHASH
  • -
  • Public key algorithms: Curve25519
  • +
  • Public key algorithms: Curve25519, Ed25519
  • Random number generation: RNG, TransistorNoiseSource, RingOscillatorNoiseSource
  • All cryptographic algorithms have been optimized for 8-bit Arduino platforms like the Uno. Memory usage is also reduced, particularly for SHA1, SHA256, and SHA512 which save 256, 192, and 512 bytes respectively over traditional implementations. For all algorithms, static sbox tables and the like are placed into program memory to further reduce data memory usage.

    @@ -171,12 +171,18 @@ Performance Curve25519::dh1()3121msFirst half of Diffie-Hellman key agreement Curve25519::dh2()3120msSecond half of Diffie-Hellman key agreement + +Ed25519::sign()5688msDigital signature generation + +Ed25519::verify()9030msDigital signature verification + +Ed25519::derivePublicKey()5642msDerive a public key from a private key

    Where a cipher supports more than one key size (such as ChaCha), the values are typically almost identical for 128-bit and 256-bit keys so only the maximum is shown above.

    diff --git a/crypto_8dox.html b/crypto_8dox.html index 334e89c5..f33d3ebf 100644 --- a/crypto_8dox.html +++ b/crypto_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/crypto_rng.html b/crypto_rng.html index f894aee9..6e2235c1 100644 --- a/crypto_rng.html +++ b/crypto_rng.html @@ -182,7 +182,7 @@ Destroying secret data diff --git a/crypto_rng_ring.html b/crypto_rng_ring.html index 7fdcec70..84e62302 100644 --- a/crypto_rng_ring.html +++ b/crypto_rng_ring.html @@ -151,7 +151,7 @@ Connecting to the Arduino diff --git a/dir_1586d320a3b1e622174530fde769cda9.html b/dir_1586d320a3b1e622174530fde769cda9.html index 57190919..3b176e24 100644 --- a/dir_1586d320a3b1e622174530fde769cda9.html +++ b/dir_1586d320a3b1e622174530fde769cda9.html @@ -102,7 +102,7 @@ Files diff --git a/dir_3dd03323535933fb3f714c41ff7a94da.html b/dir_3dd03323535933fb3f714c41ff7a94da.html index baa6e1a7..91764f91 100644 --- a/dir_3dd03323535933fb3f714c41ff7a94da.html +++ b/dir_3dd03323535933fb3f714c41ff7a94da.html @@ -94,7 +94,7 @@ Files diff --git a/dir_48f64e79f12bd77ba047e9e436ec978c.html b/dir_48f64e79f12bd77ba047e9e436ec978c.html index ceea8e56..1fef9ce2 100644 --- a/dir_48f64e79f12bd77ba047e9e436ec978c.html +++ b/dir_48f64e79f12bd77ba047e9e436ec978c.html @@ -122,7 +122,7 @@ Files diff --git a/dir_5e87a7229a108582288ef7eda1233dc3.html b/dir_5e87a7229a108582288ef7eda1233dc3.html index 15e97168..97a163bd 100644 --- a/dir_5e87a7229a108582288ef7eda1233dc3.html +++ b/dir_5e87a7229a108582288ef7eda1233dc3.html @@ -94,7 +94,7 @@ Files diff --git a/dir_6591a2127a29f6cea3994dcb5b0596d1.html b/dir_6591a2127a29f6cea3994dcb5b0596d1.html index d2f3cae9..8437446c 100644 --- a/dir_6591a2127a29f6cea3994dcb5b0596d1.html +++ b/dir_6591a2127a29f6cea3994dcb5b0596d1.html @@ -106,7 +106,7 @@ Files diff --git a/dir_7e6ab9b017486261fe80629d442521f0.html b/dir_7e6ab9b017486261fe80629d442521f0.html index d4ce78d0..0bf44fae 100644 --- a/dir_7e6ab9b017486261fe80629d442521f0.html +++ b/dir_7e6ab9b017486261fe80629d442521f0.html @@ -94,7 +94,7 @@ Files diff --git a/dir_9a34040863d1190c0e01b23e6b44de01.html b/dir_9a34040863d1190c0e01b23e6b44de01.html index 5eee7c9f..8025698a 100644 --- a/dir_9a34040863d1190c0e01b23e6b44de01.html +++ b/dir_9a34040863d1190c0e01b23e6b44de01.html @@ -96,7 +96,7 @@ Files diff --git a/dir_bc0718b08fb2015b8e59c47b2805f60c.html b/dir_bc0718b08fb2015b8e59c47b2805f60c.html index f7b15b09..7e12014d 100644 --- a/dir_bc0718b08fb2015b8e59c47b2805f60c.html +++ b/dir_bc0718b08fb2015b8e59c47b2805f60c.html @@ -112,7 +112,7 @@ Directories diff --git a/dir_be059bf9978ae156837504b1b8a7568c.html b/dir_be059bf9978ae156837504b1b8a7568c.html index 81c3e295..c9b3bcca 100644 --- a/dir_be059bf9978ae156837504b1b8a7568c.html +++ b/dir_be059bf9978ae156837504b1b8a7568c.html @@ -94,7 +94,7 @@ Files diff --git a/dir_e2ce51835550ba18edf07a8311722290.html b/dir_e2ce51835550ba18edf07a8311722290.html index 1390df44..5b588e12 100644 --- a/dir_e2ce51835550ba18edf07a8311722290.html +++ b/dir_e2ce51835550ba18edf07a8311722290.html @@ -148,6 +148,10 @@ Files   file  Curve25519.h [code]   +file  Ed25519.cpp [code] +  +file  Ed25519.h [code] +  file  GCM.cpp [code]   file  GCM.h [code] @@ -200,7 +204,7 @@ Files diff --git a/dir_f34881fcf60f680b800190d5274dfaea.html b/dir_f34881fcf60f680b800190d5274dfaea.html index 887ba87e..e96cd344 100644 --- a/dir_f34881fcf60f680b800190d5274dfaea.html +++ b/dir_f34881fcf60f680b800190d5274dfaea.html @@ -106,7 +106,7 @@ Files diff --git a/dir_f9b96888882c2691b8eeaeafd1b9501d.html b/dir_f9b96888882c2691b8eeaeafd1b9501d.html index 09176c71..3c6e37c4 100644 --- a/dir_f9b96888882c2691b8eeaeafd1b9501d.html +++ b/dir_f9b96888882c2691b8eeaeafd1b9501d.html @@ -102,7 +102,7 @@ Files diff --git a/dmd-demo_8dox.html b/dmd-demo_8dox.html index dc61c742..e23db1fe 100644 --- a/dmd-demo_8dox.html +++ b/dmd-demo_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/dmd-running-figure_8dox.html b/dmd-running-figure_8dox.html index d95827b2..edcc31f4 100644 --- a/dmd-running-figure_8dox.html +++ b/dmd-running-figure_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/dmd_demo.html b/dmd_demo.html index 823ec634..397c2c6c 100644 --- a/dmd_demo.html +++ b/dmd_demo.html @@ -236,7 +236,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/dmd_running_figure.html b/dmd_running_figure.html index 82083655..2b5a283d 100644 --- a/dmd_running_figure.html +++ b/dmd_running_figure.html @@ -430,7 +430,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/files.html b/files.html index 982c519b..22d7f5c5 100644 --- a/files.html +++ b/files.html @@ -138,70 +138,72 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); o*DS3231RTC.h o*DS3232RTC.cpp o*DS3232RTC.h -o*EEPROM24.cpp -o*EEPROM24.h -o*Field.cpp -o*Field.h -o*Form.cpp -o*Form.h -o*GCM.cpp -o*GCM.h -o*GHASH.cpp -o*GHASH.h -o*Hash.cpp -o*Hash.h -o*I2CMaster.cpp -o*I2CMaster.h -o*IntField.cpp -o*IntField.h -o*IRreceiver.cpp -o*IRreceiver.h -o*KeccakCore.cpp -o*KeccakCore.h -o*LCD.cpp -o*LCD.h -o*ListField.cpp -o*ListField.h -o*Melody.cpp -o*Melody.h -o*Mono5x7.h -o*NoiseSource.cpp -o*NoiseSource.h -o*OFB.cpp -o*OFB.h -o*Poly1305.cpp -o*Poly1305.h -o*PowerSave.cpp -o*PowerSave.h -o*RC5.h -o*RingOscillatorNoiseSource.cpp -o*RingOscillatorNoiseSource.h -o*RNG.cpp -o*RNG.h -o*RTC.cpp -o*RTC.h -o*SHA1.cpp -o*SHA1.h -o*SHA256.cpp -o*SHA256.h -o*SHA3.cpp -o*SHA3.h -o*SHA512.cpp -o*SHA512.h -o*SoftI2C.cpp -o*SoftI2C.h -o*TextField.cpp -o*TextField.h -o*TimeField.cpp -o*TimeField.h -o*TransistorNoiseSource.cpp -\*TransistorNoiseSource.h +o*Ed25519.cpp +o*Ed25519.h +o*EEPROM24.cpp +o*EEPROM24.h +o*Field.cpp +o*Field.h +o*Form.cpp +o*Form.h +o*GCM.cpp +o*GCM.h +o*GHASH.cpp +o*GHASH.h +o*Hash.cpp +o*Hash.h +o*I2CMaster.cpp +o*I2CMaster.h +o*IntField.cpp +o*IntField.h +o*IRreceiver.cpp +o*IRreceiver.h +o*KeccakCore.cpp +o*KeccakCore.h +o*LCD.cpp +o*LCD.h +o*ListField.cpp +o*ListField.h +o*Melody.cpp +o*Melody.h +o*Mono5x7.h +o*NoiseSource.cpp +o*NoiseSource.h +o*OFB.cpp +o*OFB.h +o*Poly1305.cpp +o*Poly1305.h +o*PowerSave.cpp +o*PowerSave.h +o*RC5.h +o*RingOscillatorNoiseSource.cpp +o*RingOscillatorNoiseSource.h +o*RNG.cpp +o*RNG.h +o*RTC.cpp +o*RTC.h +o*SHA1.cpp +o*SHA1.h +o*SHA256.cpp +o*SHA256.h +o*SHA3.cpp +o*SHA3.h +o*SHA512.cpp +o*SHA512.h +o*SoftI2C.cpp +o*SoftI2C.h +o*TextField.cpp +o*TextField.h +o*TimeField.cpp +o*TimeField.h +o*TransistorNoiseSource.cpp +\*TransistorNoiseSource.h diff --git a/functions.html b/functions.html index 6ea411bc..3395b0ef 100644 --- a/functions.html +++ b/functions.html @@ -123,6 +123,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    Here is a list of all documented class members with links to the class documentation for each member:

    - a -

    diff --git a/functions_func_w.html b/functions_func_w.html index e4c83892..093fae8b 100644 --- a/functions_func_w.html +++ b/functions_func_w.html @@ -157,7 +157,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_~.html b/functions_func_~.html index 729075b2..53292618 100644 --- a/functions_func_~.html +++ b/functions_func_~.html @@ -207,7 +207,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_g.html b/functions_g.html index 85ba8a87..962e3477 100644 --- a/functions_g.html +++ b/functions_g.html @@ -129,6 +129,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • GCMCommon() : GCMCommon
  • +
  • generatePrivateKey() +: Ed25519 +
  • getButton() : LCD
  • @@ -139,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_h.html b/functions_h.html index d74bb88b..99b2ed1f 100644 --- a/functions_h.html +++ b/functions_h.html @@ -162,7 +162,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_i.html b/functions_i.html index 19b8e057..b2889e1b 100644 --- a/functions_i.html +++ b/functions_i.html @@ -176,7 +176,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_k.html b/functions_k.html index 53e2a7d8..5c819860 100644 --- a/functions_k.html +++ b/functions_k.html @@ -144,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_l.html b/functions_l.html index 7a800567..1c787c71 100644 --- a/functions_l.html +++ b/functions_l.html @@ -130,7 +130,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : Field
  • LCD() -: LCD +: LCD
  • led() : Charlieplex @@ -152,7 +152,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_m.html b/functions_m.html index 3242ba8f..6c0c9f69 100644 --- a/functions_m.html +++ b/functions_m.html @@ -146,11 +146,17 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • month : RTCDate
  • +
  • mul() +: BigNumberUtil +
  • +
  • mul_P() +: BigNumberUtil +
  • diff --git a/functions_n.html b/functions_n.html index e4d0646d..e6866f31 100644 --- a/functions_n.html +++ b/functions_n.html @@ -145,7 +145,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_o.html b/functions_o.html index 7c9c0e58..55b021db 100644 --- a/functions_o.html +++ b/functions_o.html @@ -142,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_p.html b/functions_p.html index 71bdd604..44e6fedc 100644 --- a/functions_p.html +++ b/functions_p.html @@ -168,7 +168,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_r.html b/functions_r.html index 69f431ea..4cbc2e03 100644 --- a/functions_r.html +++ b/functions_r.html @@ -162,6 +162,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , DS3232RTC , RTC +
  • reduceQuick() +: BigNumberUtil +
  • +
  • reduceQuick_P() +: BigNumberUtil +
  • refresh() : Charlieplex , DMD @@ -170,8 +176,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : Form
  • reset() -: BLAKE2b -, BLAKE2s +: BLAKE2b +, BLAKE2s , GHASH , Hash , KeccakCore @@ -208,7 +214,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_s.html b/functions_s.html index a267d6f0..a3bab499 100644 --- a/functions_s.html +++ b/functions_s.html @@ -126,12 +126,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • save() : RNGClass
  • -
  • ScreenSaverMode -: LCD -
  • screenSaverMode() : LCD
  • +
  • ScreenSaverMode +: LCD +
  • scroll() : Bitmap
  • @@ -300,6 +300,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • show() : Form
  • +
  • sign() +: Ed25519 +
  • size() : EEPROM24
  • @@ -332,6 +335,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • stride() : Bitmap
  • +
  • sub() +: BigNumberUtil +
  • +
  • sub_P() +: BigNumberUtil +
  • suffix() : IntField
  • @@ -351,7 +360,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_t.html b/functions_t.html index a23d1791..76c66956 100644 --- a/functions_t.html +++ b/functions_t.html @@ -153,7 +153,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_type.html b/functions_type.html index 5c6f7060..8b4eb8a5 100644 --- a/functions_type.html +++ b/functions_type.html @@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_u.html b/functions_u.html index 01bcc85c..60cd04a0 100644 --- a/functions_u.html +++ b/functions_u.html @@ -149,7 +149,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_v.html b/functions_v.html index 592a79a6..879e4a1d 100644 --- a/functions_v.html +++ b/functions_v.html @@ -130,11 +130,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , TextField , TimeField +
  • verify() +: Ed25519 +
  • diff --git a/functions_vars.html b/functions_vars.html index 94b988c2..25f5fb12 100644 --- a/functions_vars.html +++ b/functions_vars.html @@ -156,7 +156,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_w.html b/functions_w.html index 5d5618dc..2e18ed74 100644 --- a/functions_w.html +++ b/functions_w.html @@ -164,7 +164,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_y.html b/functions_y.html index 952c010a..e7b9a89d 100644 --- a/functions_y.html +++ b/functions_y.html @@ -130,7 +130,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_~.html b/functions_~.html index cb646c5f..b0896208 100644 --- a/functions_~.html +++ b/functions_~.html @@ -208,7 +208,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/group__power__save.html b/group__power__save.html index 5ac8b148..17ef418d 100644 --- a/group__power__save.html +++ b/group__power__save.html @@ -201,7 +201,7 @@ void  diff --git a/hierarchy.html b/hierarchy.html index 0379b980..cbdc725c 100644 --- a/hierarchy.html +++ b/hierarchy.html @@ -115,48 +115,49 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); |\COFBCommonConcrete base class to assist with implementing OFB for 128-bit block ciphers | \COFB< T >Implementation of the Output Feedback (OFB) mode for 128-bit block ciphers oCCurve25519Diffie-Hellman key agreement based on the elliptic curve modulo 2^255 - 19 -oCEEPROM24Reading and writing EEPROM's from the 24LCXX family -oCFieldManages a single data input/output field within a Form -|oCBoolFieldField that manages the input of a boolean value -|oCIntFieldField that manages the input of an integer value -|oCListFieldField that manages selection from a static list of items -|oCTextFieldField that displays a read-only text value -|\CTimeFieldField that manages the display and editing of a time value -oCFormManager for a form containing data input/output fields -oCGHASHImplementation of the GHASH message authenticator -oCHashAbstract base class for cryptographic hash algorithms -|oCBLAKE2bBLAKE2b hash algorithm -|oCBLAKE2sBLAKE2s hash algorithm -|oCSHA1SHA-1 hash algorithm -|oCSHA256SHA-256 hash algorithm -|oCSHA3_256SHA3-256 hash algorithm -|oCSHA3_512SHA3-512 hash algorithm -|\CSHA512SHA-512 hash algorithm -oCI2CMasterAbstract base class for I2C master implementations -|\CSoftI2CBit-banged implementation of an I2C master -oCIRreceiverManages the reception of RC-5 commands from an infrared remote control -oCKeccakCoreKeccak core sponge function -oCLiquidCrystal -|\CLCDEnhanced library for Freetronics 16x2 LCD shields -oCMelodyPlays a melody on a digital output pin using tone() -oCNoiseSourceAbstract base class for random noise sources -|oCRingOscillatorNoiseSourceProcesses the signal from a ring oscillator based noise source -|\CTransistorNoiseSourceProcesses the signal from a transistor-based noise source -oCPoly1305Poly1305 message authenticator -oCRNGClassPseudo random number generator suitable for cryptography -oCRTCBase class for realtime clock handlers -|oCDS1307RTCCommunicates with a DS1307 realtime clock chip via I2C -|oCDS3231RTCCommunicates with a DS3231 realtime clock chip via I2C -|\CDS3232RTCCommunicates with a DS3232 realtime clock chip via I2C -oCRTCAlarmStores alarm information from a realtime clock chip -oCRTCDateStores date information from a realtime clock chip -\CRTCTimeStores time information from a realtime clock chip +oCEd25519Digital signatures based on the elliptic curve modulo 2^255 - 19 +oCEEPROM24Reading and writing EEPROM's from the 24LCXX family +oCFieldManages a single data input/output field within a Form +|oCBoolFieldField that manages the input of a boolean value +|oCIntFieldField that manages the input of an integer value +|oCListFieldField that manages selection from a static list of items +|oCTextFieldField that displays a read-only text value +|\CTimeFieldField that manages the display and editing of a time value +oCFormManager for a form containing data input/output fields +oCGHASHImplementation of the GHASH message authenticator +oCHashAbstract base class for cryptographic hash algorithms +|oCBLAKE2bBLAKE2b hash algorithm +|oCBLAKE2sBLAKE2s hash algorithm +|oCSHA1SHA-1 hash algorithm +|oCSHA256SHA-256 hash algorithm +|oCSHA3_256SHA3-256 hash algorithm +|oCSHA3_512SHA3-512 hash algorithm +|\CSHA512SHA-512 hash algorithm +oCI2CMasterAbstract base class for I2C master implementations +|\CSoftI2CBit-banged implementation of an I2C master +oCIRreceiverManages the reception of RC-5 commands from an infrared remote control +oCKeccakCoreKeccak core sponge function +oCLiquidCrystal +|\CLCDEnhanced library for Freetronics 16x2 LCD shields +oCMelodyPlays a melody on a digital output pin using tone() +oCNoiseSourceAbstract base class for random noise sources +|oCRingOscillatorNoiseSourceProcesses the signal from a ring oscillator based noise source +|\CTransistorNoiseSourceProcesses the signal from a transistor-based noise source +oCPoly1305Poly1305 message authenticator +oCRNGClassPseudo random number generator suitable for cryptography +oCRTCBase class for realtime clock handlers +|oCDS1307RTCCommunicates with a DS1307 realtime clock chip via I2C +|oCDS3231RTCCommunicates with a DS3231 realtime clock chip via I2C +|\CDS3232RTCCommunicates with a DS3232 realtime clock chip via I2C +oCRTCAlarmStores alarm information from a realtime clock chip +oCRTCDateStores date information from a realtime clock chip +\CRTCTimeStores time information from a realtime clock chip diff --git a/index.html b/index.html index 0228df63..d767bd17 100644 --- a/index.html +++ b/index.html @@ -134,7 +134,7 @@ Cryptographic Library
  • Authenticated encryption with associated data (AEAD): ChaChaPoly, GCM
  • Hash algorithms: SHA1, SHA256, SHA512, SHA3_256, SHA3_512, BLAKE2s, BLAKE2b (regular and HMAC modes)
  • Message authenticators: Poly1305, GHASH
  • -
  • Public key algorithms: Curve25519
  • +
  • Public key algorithms: Curve25519, Ed25519
  • Random number generation: RNG, TransistorNoiseSource, RingOscillatorNoiseSource
  • More information can be found on the Cryptographic Library page.

    @@ -154,7 +154,7 @@ Other diff --git a/ir-dumpir_8dox.html b/ir-dumpir_8dox.html index 39d9d723..9b9d4076 100644 --- a/ir-dumpir_8dox.html +++ b/ir-dumpir_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ir-snake_8dox.html b/ir-snake_8dox.html index a4570aa1..a6933790 100644 --- a/ir-snake_8dox.html +++ b/ir-snake_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ir_dumpir.html b/ir_dumpir.html index 393b284c..dfa694d0 100644 --- a/ir_dumpir.html +++ b/ir_dumpir.html @@ -283,7 +283,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ir_snake.html b/ir_snake.html index 89ce494f..883ec07f 100644 --- a/ir_snake.html +++ b/ir_snake.html @@ -273,7 +273,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/lcd-form_8dox.html b/lcd-form_8dox.html index 2e7b61de..0020cb4e 100644 --- a/lcd-form_8dox.html +++ b/lcd-form_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/lcd-helloworld_8dox.html b/lcd-helloworld_8dox.html index 9fe50480..0a6732a2 100644 --- a/lcd-helloworld_8dox.html +++ b/lcd-helloworld_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/lcd_form.html b/lcd_form.html index db5a041e..3ce941d7 100644 --- a/lcd_form.html +++ b/lcd_form.html @@ -216,7 +216,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/lcd_hello_world.html b/lcd_hello_world.html index 01b50ed8..8f2486ed 100644 --- a/lcd_hello_world.html +++ b/lcd_hello_world.html @@ -166,7 +166,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/mainpage_8dox.html b/mainpage_8dox.html index 1acc17b1..b40cb060 100644 --- a/mainpage_8dox.html +++ b/mainpage_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/modules.html b/modules.html index 1f79c9bf..91b260c0 100644 --- a/modules.html +++ b/modules.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/pages.html b/pages.html index 9bd94aa7..0e96926c 100644 --- a/pages.html +++ b/pages.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/search/all_0.js b/search/all_0.js index eecf3ad8..42507794 100644 --- a/search/all_0.js +++ b/search/all_0.js @@ -1,5 +1,7 @@ var searchData= [ + ['add',['add',['../classBigNumberUtil.html#aa6904b2727af6b767fe041b1b7f27414',1,'BigNumberUtil']]], + ['add_5fp',['add_P',['../classBigNumberUtil.html#ab9a9f532fcfc182433adac44d8e4ee20',1,'BigNumberUtil']]], ['addauthdata',['addAuthData',['../classAuthenticatedCipher.html#abdb081bdf0d59c138cbcffd23c044b10',1,'AuthenticatedCipher::addAuthData()'],['../classChaChaPoly.html#a4aa3514d1fb6272da977a7467ae6734b',1,'ChaChaPoly::addAuthData()'],['../classGCMCommon.html#ad926e980ae2d61c10c9bf82813154a25',1,'GCMCommon::addAuthData()']]], ['added',['added',['../classNoiseSource.html#a48d0efabd71ff6e557a0898be79c49ba',1,'NoiseSource']]], ['addfield',['addField',['../classForm.html#a5cb056ace428e75e321610555bfecac7',1,'Form']]], diff --git a/search/all_10.js b/search/all_10.js index be22e5af..16d1064c 100644 --- a/search/all_10.js +++ b/search/all_10.js @@ -3,7 +3,7 @@ var searchData= ['star_20trek_20example',['Star Trek Example',['../blink_startrek.html',1,'']]], ['snake_20video_20game_20using_20an_20infrared_20remote_20control',['Snake Video Game Using an Infrared Remote Control',['../ir_snake.html',1,'']]], ['save',['save',['../classRNGClass.html#a139584fb249148e2058d1d645d090db7',1,'RNGClass']]], - ['screensavermode',['ScreenSaverMode',['../classLCD.html#a264bf94308c95d8598426e13dc8cdb28',1,'LCD::ScreenSaverMode()'],['../classLCD.html#a1917fa285f81f476b4c7cc20d15456b8',1,'LCD::screenSaverMode() const ']]], + ['screensavermode',['screenSaverMode',['../classLCD.html#a1917fa285f81f476b4c7cc20d15456b8',1,'LCD::screenSaverMode() const '],['../classLCD.html#a264bf94308c95d8598426e13dc8cdb28',1,'LCD::ScreenSaverMode()']]], ['scroll',['scroll',['../classBitmap.html#ae08eb6f9086f9923d8dc83a469ae4c4a',1,'Bitmap::scroll(int dx, int dy, Color fillColor=Black)'],['../classBitmap.html#af79ad4432297ff453fddc55625fec485',1,'Bitmap::scroll(int x, int y, int width, int height, int dx, int dy, Color fillColor=Black)']]], ['second',['second',['../structRTCTime.html#a87b7c02e535d808dcba04c77e34abb91',1,'RTCTime::second()'],['../structRTCAlarm.html#ab749e3695ee5c5dd703aec71f72d46a1',1,'RTCAlarm::second()']]], ['seed_5fsize',['SEED_SIZE',['../classRNGClass.html#ae3a013bfc73795fd26ee36e70d89f4c2',1,'RNGClass']]], @@ -51,6 +51,7 @@ var searchData= ['sha3_5f512',['SHA3_512',['../classSHA3__512.html',1,'SHA3_512'],['../classSHA3__512.html#a5f8bc4180e9d19597f499468098a82a4',1,'SHA3_512::SHA3_512()']]], ['sha512',['SHA512',['../classSHA512.html',1,'SHA512'],['../classSHA512.html#a520d966d99c0008e3cc58bd3b77dafcd',1,'SHA512::SHA512()']]], ['show',['show',['../classForm.html#a9e8d718ab55a8034c22c606ccfa90d65',1,'Form']]], + ['sign',['sign',['../classEd25519.html#a36ecf67b4c5d2d39a31888f56af1f8a5',1,'Ed25519']]], ['size',['size',['../classEEPROM24.html#aa544875cef9bd05bf71d6c19be06cf7c',1,'EEPROM24']]], ['sleep_5f120_5fms',['SLEEP_120_MS',['../group__power__save.html#ggabdc6266a040b28c4d79028ddb0ceae36a96fa577b54aa6f2341ea5ddd839aa8bc',1,'PowerSave.h']]], ['sleep_5f15_5fms',['SLEEP_15_MS',['../group__power__save.html#ggabdc6266a040b28c4d79028ddb0ceae36a3d16487a7386c6348f1c1d886564e3c4',1,'PowerSave.h']]], @@ -72,6 +73,8 @@ var searchData= ['stir',['stir',['../classNoiseSource.html#a7ce647815524fe84f562aca5256e12f3',1,'NoiseSource::stir()'],['../classRNGClass.html#ad99535ea23ae2fec55bdebb8c24def02',1,'RNGClass::stir()'],['../classRingOscillatorNoiseSource.html#ad71698b5c92b41eef2f1322999b3eff9',1,'RingOscillatorNoiseSource::stir()'],['../classTransistorNoiseSource.html#add25c6a14b0506bc30ca781f2d923917',1,'TransistorNoiseSource::stir()']]], ['stop',['stop',['../classMelody.html#ac0c552233c41d85f2766d2e4df376b2b',1,'Melody']]], ['stride',['stride',['../classBitmap.html#af30df263729385ea2330effe3c80a1bc',1,'Bitmap']]], + ['sub',['sub',['../classBigNumberUtil.html#a6618e03bfcb3086961df508b40cc1e67',1,'BigNumberUtil']]], + ['sub_5fp',['sub_P',['../classBigNumberUtil.html#af0fa1527647af42b65eda6b0aab982b3',1,'BigNumberUtil']]], ['suffix',['suffix',['../classIntField.html#a1a1de6a1836dfdb820c92b7f188a1b05',1,'IntField']]], ['swapbuffers',['swapBuffers',['../classDMD.html#a80269ccd44b3ef9ee15f0a1009b7a60a',1,'DMD']]], ['swapbuffersandcopy',['swapBuffersAndCopy',['../classDMD.html#a0b1771cf790b2b62eea55e56b02e3736',1,'DMD']]], diff --git a/search/all_13.js b/search/all_13.js index 46d0b7fe..d88e30c6 100644 --- a/search/all_13.js +++ b/search/all_13.js @@ -1,4 +1,5 @@ var searchData= [ - ['value',['value',['../classBoolField.html#a9147826437fbaf9b29eda9dee9e37b39',1,'BoolField::value()'],['../classIntField.html#a2fb650827ce8cb4662253bb6c32acb52',1,'IntField::value()'],['../classListField.html#aab8477757cd89bacd242c85bac2dccb1',1,'ListField::value()'],['../classTextField.html#a124764b6fc7c19aaf683f72cd42636b1',1,'TextField::value()'],['../classTimeField.html#a400aaa72a83b3b872e1de1c3af1a240f',1,'TimeField::value()']]] + ['value',['value',['../classBoolField.html#a9147826437fbaf9b29eda9dee9e37b39',1,'BoolField::value()'],['../classIntField.html#a2fb650827ce8cb4662253bb6c32acb52',1,'IntField::value()'],['../classListField.html#aab8477757cd89bacd242c85bac2dccb1',1,'ListField::value()'],['../classTextField.html#a124764b6fc7c19aaf683f72cd42636b1',1,'TextField::value()'],['../classTimeField.html#a400aaa72a83b3b872e1de1c3af1a240f',1,'TimeField::value()']]], + ['verify',['verify',['../classEd25519.html#ae3e2fc405c9cd8cb1d3ab9b8b452d3e4',1,'Ed25519']]] ]; diff --git a/search/all_3.js b/search/all_3.js index 44b98310..32dda5f6 100644 --- a/search/all_3.js +++ b/search/all_3.js @@ -7,6 +7,7 @@ var searchData= ['decrypt',['decrypt',['../classCBCCommon.html#ab46a2625cae9a654c708e1f31a0e22b6',1,'CBCCommon::decrypt()'],['../classCFBCommon.html#aaaa3d61c5743e30e355207c193c0b0ef',1,'CFBCommon::decrypt()'],['../classChaCha.html#a1f54b2b51b59428010f81a6c4dc4e42c',1,'ChaCha::decrypt()'],['../classChaChaPoly.html#a42f556f202b1166486434ee15b6d95a0',1,'ChaChaPoly::decrypt()'],['../classCipher.html#ac6099d1a0d7f2ff67b0e4ccb4a17eb08',1,'Cipher::decrypt()'],['../classCTRCommon.html#a0943387cf1124258389702e0690740fe',1,'CTRCommon::decrypt()'],['../classGCMCommon.html#a60912d3ab5766aa68dc9b3111ac2c0d7',1,'GCMCommon::decrypt()'],['../classOFBCommon.html#aeb3636d7175b150e2bf16367e51c2e36',1,'OFBCommon::decrypt()']]], ['decryptblock',['decryptBlock',['../classAESCommon.html#a95a806adf42f975765ff62907efdc639',1,'AESCommon::decryptBlock()'],['../classBlockCipher.html#ac3ba2450222aa1ea804ae4881ab6440c',1,'BlockCipher::decryptBlock()']]], ['defaultfield',['defaultField',['../classForm.html#aba75b59f68b31dd77dbbac9ab5c3124b',1,'Form']]], + ['derivepublickey',['derivePublicKey',['../classEd25519.html#ab62bac52ed07f77f76f3ff0fccd71cb2',1,'Ed25519']]], ['destroy',['destroy',['../classRNGClass.html#a9901367d86f2303a59bbc12fe91cad00',1,'RNGClass']]], ['dh1',['dh1',['../classCurve25519.html#a2b6911583d17ea9a36bbbb40d58b3d89',1,'Curve25519']]], ['dh2',['dh2',['../classCurve25519.html#a14022d6ac68ec691ffb0247275078ab9',1,'Curve25519']]], diff --git a/search/all_4.js b/search/all_4.js index ff78ab31..cad97013 100644 --- a/search/all_4.js +++ b/search/all_4.js @@ -1,5 +1,6 @@ var searchData= [ + ['ed25519',['Ed25519',['../classEd25519.html',1,'']]], ['eeprom24',['EEPROM24',['../classEEPROM24.html',1,'EEPROM24'],['../classEEPROM24.html#ae8547f6ff7711496e1959ee24a142995',1,'EEPROM24::EEPROM24()']]], ['enable32khzoutput',['enable32kHzOutput',['../classDS3231RTC.html#a032cf784eb82ccf6ff0a9745b47ac86b',1,'DS3231RTC::enable32kHzOutput()'],['../classDS3232RTC.html#a3966de6f4241d86f198a8b9dd5e7e59a',1,'DS3232RTC::enable32kHzOutput()']]], ['enablealarm',['enableAlarm',['../classDS3231RTC.html#ad0a0614c48d4f809fee6017cd7350372',1,'DS3231RTC']]], diff --git a/search/all_6.js b/search/all_6.js index 72f62f8a..953e5e28 100644 --- a/search/all_6.js +++ b/search/all_6.js @@ -3,6 +3,7 @@ var searchData= ['generating_20random_20numbers',['Generating random numbers',['../crypto_rng.html',1,'']]], ['gcm',['GCM',['../classGCM.html',1,'GCM< T >'],['../classGCM.html#acbef04a5593177aabf19df538ad3def7',1,'GCM::GCM()']]], ['gcmcommon',['GCMCommon',['../classGCMCommon.html',1,'GCMCommon'],['../classGCMCommon.html#a1b05ff393e8c20db30cb991e875aab19',1,'GCMCommon::GCMCommon()']]], + ['generateprivatekey',['generatePrivateKey',['../classEd25519.html#ab8be5115ac5adc8a556dbac7d7e90d2e',1,'Ed25519']]], ['getbutton',['getButton',['../classLCD.html#ac1e80e2603bd1cf0276c36092c416292',1,'LCD']]], ['ghash',['GHASH',['../classGHASH.html',1,'GHASH'],['../classGHASH.html#a3a1abd0f641bccd9b4aa1f40beb8dca3',1,'GHASH::GHASH()']]] ]; diff --git a/search/all_a.js b/search/all_a.js index 151e1cdf..e96e486d 100644 --- a/search/all_a.js +++ b/search/all_a.js @@ -1,7 +1,7 @@ var searchData= [ ['label',['label',['../classField.html#aaa861ef917130c989a955bc75c683afe',1,'Field']]], - ['lcd',['LCD',['../classLCD.html',1,'LCD'],['../classLCD.html#a00bb2db1390721abc7b24ac4b8c276c8',1,'LCD::LCD()'],['../classLCD.html#a067bc741cf27f143aba5d9f147908401',1,'LCD::LCD(uint8_t pin9)'],['../classLCD.html#a203d268bef6c61fa293562dbb0e9f51e',1,'LCD::LCD(uint8_t rs, uint8_t enable, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3)'],['../classField.html#a5cf21bf958a71e51feac9e1bf9f599d1',1,'Field::lcd()']]], + ['lcd',['LCD',['../classLCD.html',1,'LCD'],['../classField.html#a5cf21bf958a71e51feac9e1bf9f599d1',1,'Field::lcd()'],['../classLCD.html#a00bb2db1390721abc7b24ac4b8c276c8',1,'LCD::LCD()'],['../classLCD.html#a067bc741cf27f143aba5d9f147908401',1,'LCD::LCD(uint8_t pin9)'],['../classLCD.html#a203d268bef6c61fa293562dbb0e9f51e',1,'LCD::LCD(uint8_t rs, uint8_t enable, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3)']]], ['lcd_2dform_2edox',['lcd-form.dox',['../lcd-form_8dox.html',1,'']]], ['lcd_2dhelloworld_2edox',['lcd-helloworld.dox',['../lcd-helloworld_8dox.html',1,'']]], ['led',['led',['../classCharlieplex.html#a90fd09f24b62424b0b7b8bcdb0140b9d',1,'Charlieplex']]], diff --git a/search/all_b.js b/search/all_b.js index 8bf258d3..9c3de5c2 100644 --- a/search/all_b.js +++ b/search/all_b.js @@ -7,5 +7,7 @@ var searchData= ['melody',['Melody',['../classMelody.html',1,'Melody'],['../classMelody.html#a9edc4165a49368dd5d78eedf982c38b9',1,'Melody::Melody()']]], ['minute',['minute',['../structRTCTime.html#acf2161ca037080dc4b767e636ad8db84',1,'RTCTime::minute()'],['../structRTCAlarm.html#ad9a75ceb4b4b3474baa66dd5466e62fe',1,'RTCAlarm::minute()']]], ['minvalue',['minValue',['../classIntField.html#af3dab3f2b46d29136d7a93ce46b0b8fb',1,'IntField']]], - ['month',['month',['../structRTCDate.html#a6e6196059b36186041a5312400ea9202',1,'RTCDate']]] + ['month',['month',['../structRTCDate.html#a6e6196059b36186041a5312400ea9202',1,'RTCDate']]], + ['mul',['mul',['../classBigNumberUtil.html#a1c2c5484f2bf440ae292fd3dfd2d594f',1,'BigNumberUtil']]], + ['mul_5fp',['mul_P',['../classBigNumberUtil.html#aacdee1806a239eb9e58753ef1ddb964a',1,'BigNumberUtil']]] ]; diff --git a/search/all_f.js b/search/all_f.js index 919367a1..a94340ad 100644 --- a/search/all_f.js +++ b/search/all_f.js @@ -10,6 +10,8 @@ var searchData= ['readonly',['readOnly',['../classTimeField.html#aa0795c873ba9941c8a1a3bf8c06668f1',1,'TimeField']]], ['readtemperature',['readTemperature',['../classDS3231RTC.html#ad1dcb7897fd14ae745720a19fbe71e37',1,'DS3231RTC::readTemperature()'],['../classDS3232RTC.html#a0faf40c25ab019a326a60f301c2bb41b',1,'DS3232RTC::readTemperature()'],['../classRTC.html#aeca3c8387332e8cabfd09c1806276e5a',1,'RTC::readTemperature()']]], ['readtime',['readTime',['../classDS1307RTC.html#acd9800d6df2244b8e4e790480a1d62a6',1,'DS1307RTC::readTime()'],['../classDS3231RTC.html#a3a2c448b152c401fb598c487ef0ed288',1,'DS3231RTC::readTime()'],['../classDS3232RTC.html#af89e68c68f1c4b7e94286f800b5b2747',1,'DS3232RTC::readTime()'],['../classRTC.html#aaf0a5c1f32f210a49718d148620b5bec',1,'RTC::readTime()']]], + ['reducequick',['reduceQuick',['../classBigNumberUtil.html#a5af5f50c91594183da4e079d76702d34',1,'BigNumberUtil']]], + ['reducequick_5fp',['reduceQuick_P',['../classBigNumberUtil.html#a00c9cde0b626788a60552a6bc9ce058b',1,'BigNumberUtil']]], ['refresh',['refresh',['../classCharlieplex.html#a3c961bfff866e400dad371f0376f096b',1,'Charlieplex::refresh()'],['../classDMD.html#a9e4bf2a9d247312d35c1401ff61261c8',1,'DMD::refresh()']]], ['removefield',['removeField',['../classForm.html#a7abd717029f9b19ee7318470072cd697',1,'Form']]], ['reset',['reset',['../classBLAKE2b.html#a917beae2ca6e9831a35717a526089e8a',1,'BLAKE2b::reset()'],['../classBLAKE2b.html#a9afd8ec05ccfa08a922de74461e45387',1,'BLAKE2b::reset(uint8_t outputLength)'],['../classBLAKE2s.html#a778776d15316c182fdb2df5a89b3ca02',1,'BLAKE2s::reset()'],['../classBLAKE2s.html#a91ba6bc39e42002ac61114ced1d0af6d',1,'BLAKE2s::reset(uint8_t outputLength)'],['../classGHASH.html#a479a3e8c37e320bf99f54b95bf5f4c55',1,'GHASH::reset()'],['../classHash.html#a7b94309acaa5f52386785fb780e5be61',1,'Hash::reset()'],['../classKeccakCore.html#a5a322eb7e3b5c1eaad127c9c6e6a529b',1,'KeccakCore::reset()'],['../classPoly1305.html#a544839403d0a19300c239708bc1e6ed8',1,'Poly1305::reset()'],['../classSHA1.html#ab71aaf39ed956320054861a2fbfa454f',1,'SHA1::reset()'],['../classSHA256.html#ad9d80d8fdccffb15497bd36285afce65',1,'SHA256::reset()'],['../classSHA3__256.html#a57b5f29347a733e04fe47d60621f3202',1,'SHA3_256::reset()'],['../classSHA3__512.html#a435746d5a8b012f7c65050337cc4a23f',1,'SHA3_512::reset()'],['../classSHA512.html#a0d009e8d9157c3f14323e68631c33e97',1,'SHA512::reset()']]], diff --git a/search/classes_4.js b/search/classes_4.js index 10123575..27429b10 100644 --- a/search/classes_4.js +++ b/search/classes_4.js @@ -1,4 +1,5 @@ var searchData= [ + ['ed25519',['Ed25519',['../classEd25519.html',1,'']]], ['eeprom24',['EEPROM24',['../classEEPROM24.html',1,'']]] ]; diff --git a/search/functions_0.js b/search/functions_0.js index f3cac847..5c193b50 100644 --- a/search/functions_0.js +++ b/search/functions_0.js @@ -1,5 +1,7 @@ var searchData= [ + ['add',['add',['../classBigNumberUtil.html#aa6904b2727af6b767fe041b1b7f27414',1,'BigNumberUtil']]], + ['add_5fp',['add_P',['../classBigNumberUtil.html#ab9a9f532fcfc182433adac44d8e4ee20',1,'BigNumberUtil']]], ['addauthdata',['addAuthData',['../classAuthenticatedCipher.html#abdb081bdf0d59c138cbcffd23c044b10',1,'AuthenticatedCipher::addAuthData()'],['../classChaChaPoly.html#a4aa3514d1fb6272da977a7467ae6734b',1,'ChaChaPoly::addAuthData()'],['../classGCMCommon.html#ad926e980ae2d61c10c9bf82813154a25',1,'GCMCommon::addAuthData()']]], ['added',['added',['../classNoiseSource.html#a48d0efabd71ff6e557a0898be79c49ba',1,'NoiseSource']]], ['addfield',['addField',['../classForm.html#a5cb056ace428e75e321610555bfecac7',1,'Form']]], diff --git a/search/functions_10.js b/search/functions_10.js index b4138942..7328b7a2 100644 --- a/search/functions_10.js +++ b/search/functions_10.js @@ -47,6 +47,7 @@ var searchData= ['sha3_5f512',['SHA3_512',['../classSHA3__512.html#a5f8bc4180e9d19597f499468098a82a4',1,'SHA3_512']]], ['sha512',['SHA512',['../classSHA512.html#a520d966d99c0008e3cc58bd3b77dafcd',1,'SHA512']]], ['show',['show',['../classForm.html#a9e8d718ab55a8034c22c606ccfa90d65',1,'Form']]], + ['sign',['sign',['../classEd25519.html#a36ecf67b4c5d2d39a31888f56af1f8a5',1,'Ed25519']]], ['size',['size',['../classEEPROM24.html#aa544875cef9bd05bf71d6c19be06cf7c',1,'EEPROM24']]], ['sleepfor',['sleepFor',['../group__power__save.html#ga95c1666038493a7f95be6768882eebad',1,'sleepFor(SleepDuration duration, uint8_t mode): PowerSave.cpp'],['../group__power__save.html#ga95c1666038493a7f95be6768882eebad',1,'sleepFor(SleepDuration duration, uint8_t mode=0): PowerSave.cpp']]], ['softi2c',['SoftI2C',['../classSoftI2C.html#adb6e00ee3f930f1d32010a18feb5f6cc',1,'SoftI2C']]], @@ -57,6 +58,8 @@ var searchData= ['stir',['stir',['../classNoiseSource.html#a7ce647815524fe84f562aca5256e12f3',1,'NoiseSource::stir()'],['../classRNGClass.html#ad99535ea23ae2fec55bdebb8c24def02',1,'RNGClass::stir()'],['../classRingOscillatorNoiseSource.html#ad71698b5c92b41eef2f1322999b3eff9',1,'RingOscillatorNoiseSource::stir()'],['../classTransistorNoiseSource.html#add25c6a14b0506bc30ca781f2d923917',1,'TransistorNoiseSource::stir()']]], ['stop',['stop',['../classMelody.html#ac0c552233c41d85f2766d2e4df376b2b',1,'Melody']]], ['stride',['stride',['../classBitmap.html#af30df263729385ea2330effe3c80a1bc',1,'Bitmap']]], + ['sub',['sub',['../classBigNumberUtil.html#a6618e03bfcb3086961df508b40cc1e67',1,'BigNumberUtil']]], + ['sub_5fp',['sub_P',['../classBigNumberUtil.html#af0fa1527647af42b65eda6b0aab982b3',1,'BigNumberUtil']]], ['suffix',['suffix',['../classIntField.html#a1a1de6a1836dfdb820c92b7f188a1b05',1,'IntField']]], ['swapbuffers',['swapBuffers',['../classDMD.html#a80269ccd44b3ef9ee15f0a1009b7a60a',1,'DMD']]], ['swapbuffersandcopy',['swapBuffersAndCopy',['../classDMD.html#a0b1771cf790b2b62eea55e56b02e3736',1,'DMD']]], diff --git a/search/functions_13.js b/search/functions_13.js index 46d0b7fe..d88e30c6 100644 --- a/search/functions_13.js +++ b/search/functions_13.js @@ -1,4 +1,5 @@ var searchData= [ - ['value',['value',['../classBoolField.html#a9147826437fbaf9b29eda9dee9e37b39',1,'BoolField::value()'],['../classIntField.html#a2fb650827ce8cb4662253bb6c32acb52',1,'IntField::value()'],['../classListField.html#aab8477757cd89bacd242c85bac2dccb1',1,'ListField::value()'],['../classTextField.html#a124764b6fc7c19aaf683f72cd42636b1',1,'TextField::value()'],['../classTimeField.html#a400aaa72a83b3b872e1de1c3af1a240f',1,'TimeField::value()']]] + ['value',['value',['../classBoolField.html#a9147826437fbaf9b29eda9dee9e37b39',1,'BoolField::value()'],['../classIntField.html#a2fb650827ce8cb4662253bb6c32acb52',1,'IntField::value()'],['../classListField.html#aab8477757cd89bacd242c85bac2dccb1',1,'ListField::value()'],['../classTextField.html#a124764b6fc7c19aaf683f72cd42636b1',1,'TextField::value()'],['../classTimeField.html#a400aaa72a83b3b872e1de1c3af1a240f',1,'TimeField::value()']]], + ['verify',['verify',['../classEd25519.html#ae3e2fc405c9cd8cb1d3ab9b8b452d3e4',1,'Ed25519']]] ]; diff --git a/search/functions_3.js b/search/functions_3.js index eb8ddd0c..12a29a1e 100644 --- a/search/functions_3.js +++ b/search/functions_3.js @@ -5,6 +5,7 @@ var searchData= ['decrypt',['decrypt',['../classCBCCommon.html#ab46a2625cae9a654c708e1f31a0e22b6',1,'CBCCommon::decrypt()'],['../classCFBCommon.html#aaaa3d61c5743e30e355207c193c0b0ef',1,'CFBCommon::decrypt()'],['../classChaCha.html#a1f54b2b51b59428010f81a6c4dc4e42c',1,'ChaCha::decrypt()'],['../classChaChaPoly.html#a42f556f202b1166486434ee15b6d95a0',1,'ChaChaPoly::decrypt()'],['../classCipher.html#ac6099d1a0d7f2ff67b0e4ccb4a17eb08',1,'Cipher::decrypt()'],['../classCTRCommon.html#a0943387cf1124258389702e0690740fe',1,'CTRCommon::decrypt()'],['../classGCMCommon.html#a60912d3ab5766aa68dc9b3111ac2c0d7',1,'GCMCommon::decrypt()'],['../classOFBCommon.html#aeb3636d7175b150e2bf16367e51c2e36',1,'OFBCommon::decrypt()']]], ['decryptblock',['decryptBlock',['../classAESCommon.html#a95a806adf42f975765ff62907efdc639',1,'AESCommon::decryptBlock()'],['../classBlockCipher.html#ac3ba2450222aa1ea804ae4881ab6440c',1,'BlockCipher::decryptBlock()']]], ['defaultfield',['defaultField',['../classForm.html#aba75b59f68b31dd77dbbac9ab5c3124b',1,'Form']]], + ['derivepublickey',['derivePublicKey',['../classEd25519.html#ab62bac52ed07f77f76f3ff0fccd71cb2',1,'Ed25519']]], ['destroy',['destroy',['../classRNGClass.html#a9901367d86f2303a59bbc12fe91cad00',1,'RNGClass']]], ['dh1',['dh1',['../classCurve25519.html#a2b6911583d17ea9a36bbbb40d58b3d89',1,'Curve25519']]], ['dh2',['dh2',['../classCurve25519.html#a14022d6ac68ec691ffb0247275078ab9',1,'Curve25519']]], diff --git a/search/functions_6.js b/search/functions_6.js index 95c47f1c..2749475d 100644 --- a/search/functions_6.js +++ b/search/functions_6.js @@ -2,6 +2,7 @@ var searchData= [ ['gcm',['GCM',['../classGCM.html#acbef04a5593177aabf19df538ad3def7',1,'GCM']]], ['gcmcommon',['GCMCommon',['../classGCMCommon.html#a1b05ff393e8c20db30cb991e875aab19',1,'GCMCommon']]], + ['generateprivatekey',['generatePrivateKey',['../classEd25519.html#ab8be5115ac5adc8a556dbac7d7e90d2e',1,'Ed25519']]], ['getbutton',['getButton',['../classLCD.html#ac1e80e2603bd1cf0276c36092c416292',1,'LCD']]], ['ghash',['GHASH',['../classGHASH.html#a3a1abd0f641bccd9b4aa1f40beb8dca3',1,'GHASH']]] ]; diff --git a/search/functions_a.js b/search/functions_a.js index 9547f241..63e20740 100644 --- a/search/functions_a.js +++ b/search/functions_a.js @@ -1,7 +1,7 @@ var searchData= [ ['label',['label',['../classField.html#aaa861ef917130c989a955bc75c683afe',1,'Field']]], - ['lcd',['LCD',['../classLCD.html#a00bb2db1390721abc7b24ac4b8c276c8',1,'LCD::LCD()'],['../classLCD.html#a067bc741cf27f143aba5d9f147908401',1,'LCD::LCD(uint8_t pin9)'],['../classLCD.html#a203d268bef6c61fa293562dbb0e9f51e',1,'LCD::LCD(uint8_t rs, uint8_t enable, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3)'],['../classField.html#a5cf21bf958a71e51feac9e1bf9f599d1',1,'Field::lcd()']]], + ['lcd',['lcd',['../classField.html#a5cf21bf958a71e51feac9e1bf9f599d1',1,'Field::lcd()'],['../classLCD.html#a00bb2db1390721abc7b24ac4b8c276c8',1,'LCD::LCD()'],['../classLCD.html#a067bc741cf27f143aba5d9f147908401',1,'LCD::LCD(uint8_t pin9)'],['../classLCD.html#a203d268bef6c61fa293562dbb0e9f51e',1,'LCD::LCD(uint8_t rs, uint8_t enable, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3)']]], ['led',['led',['../classCharlieplex.html#a90fd09f24b62424b0b7b8bcdb0140b9d',1,'Charlieplex']]], ['listfield',['ListField',['../classListField.html#a118501da7edb0b0bc6b493734975b4e9',1,'ListField::ListField(const String &label)'],['../classListField.html#aa303898a1f74b52c1c4982653de488b7',1,'ListField::ListField(Form &form, const String &label, ListItems items, int value=0)']]], ['loop',['loop',['../classBlinkLED.html#aeeaf42b94c5392935f00f0f12a58c75e',1,'BlinkLED::loop()'],['../classCharlieplex.html#a8313edeacd8387c428b8299d52584d6a',1,'Charlieplex::loop()'],['../classChaseLEDs.html#a8745fa6b9f33b6c6274a563dd4dea786',1,'ChaseLEDs::loop()'],['../classDMD.html#a2c74a0845ef6080056b972d490648114',1,'DMD::loop()'],['../classRNGClass.html#a8cb91e39f0c4591de5bf98b1e2880b13',1,'RNGClass::loop()']]], diff --git a/search/functions_b.js b/search/functions_b.js index 797abeb7..519c4c46 100644 --- a/search/functions_b.js +++ b/search/functions_b.js @@ -4,5 +4,7 @@ var searchData= ['maxtransfersize',['maxTransferSize',['../classI2CMaster.html#a3cd0cea8169ac4e6dd6f39fd6cfb1926',1,'I2CMaster::maxTransferSize()'],['../classSoftI2C.html#aad488669f28f6a5a4ceaae3de61d38f4',1,'SoftI2C::maxTransferSize()']]], ['maxvalue',['maxValue',['../classIntField.html#aaa0adcb0d16e822e5f176be5cb9ca8ad',1,'IntField']]], ['melody',['Melody',['../classMelody.html#a9edc4165a49368dd5d78eedf982c38b9',1,'Melody']]], - ['minvalue',['minValue',['../classIntField.html#af3dab3f2b46d29136d7a93ce46b0b8fb',1,'IntField']]] + ['minvalue',['minValue',['../classIntField.html#af3dab3f2b46d29136d7a93ce46b0b8fb',1,'IntField']]], + ['mul',['mul',['../classBigNumberUtil.html#a1c2c5484f2bf440ae292fd3dfd2d594f',1,'BigNumberUtil']]], + ['mul_5fp',['mul_P',['../classBigNumberUtil.html#aacdee1806a239eb9e58753ef1ddb964a',1,'BigNumberUtil']]] ]; diff --git a/search/functions_f.js b/search/functions_f.js index 6de19616..9029cac5 100644 --- a/search/functions_f.js +++ b/search/functions_f.js @@ -8,6 +8,8 @@ var searchData= ['readonly',['readOnly',['../classTimeField.html#aa0795c873ba9941c8a1a3bf8c06668f1',1,'TimeField']]], ['readtemperature',['readTemperature',['../classDS3231RTC.html#ad1dcb7897fd14ae745720a19fbe71e37',1,'DS3231RTC::readTemperature()'],['../classDS3232RTC.html#a0faf40c25ab019a326a60f301c2bb41b',1,'DS3232RTC::readTemperature()'],['../classRTC.html#aeca3c8387332e8cabfd09c1806276e5a',1,'RTC::readTemperature()']]], ['readtime',['readTime',['../classDS1307RTC.html#acd9800d6df2244b8e4e790480a1d62a6',1,'DS1307RTC::readTime()'],['../classDS3231RTC.html#a3a2c448b152c401fb598c487ef0ed288',1,'DS3231RTC::readTime()'],['../classDS3232RTC.html#af89e68c68f1c4b7e94286f800b5b2747',1,'DS3232RTC::readTime()'],['../classRTC.html#aaf0a5c1f32f210a49718d148620b5bec',1,'RTC::readTime()']]], + ['reducequick',['reduceQuick',['../classBigNumberUtil.html#a5af5f50c91594183da4e079d76702d34',1,'BigNumberUtil']]], + ['reducequick_5fp',['reduceQuick_P',['../classBigNumberUtil.html#a00c9cde0b626788a60552a6bc9ce058b',1,'BigNumberUtil']]], ['refresh',['refresh',['../classCharlieplex.html#a3c961bfff866e400dad371f0376f096b',1,'Charlieplex::refresh()'],['../classDMD.html#a9e4bf2a9d247312d35c1401ff61261c8',1,'DMD::refresh()']]], ['removefield',['removeField',['../classForm.html#a7abd717029f9b19ee7318470072cd697',1,'Form']]], ['reset',['reset',['../classBLAKE2b.html#a917beae2ca6e9831a35717a526089e8a',1,'BLAKE2b::reset()'],['../classBLAKE2b.html#a9afd8ec05ccfa08a922de74461e45387',1,'BLAKE2b::reset(uint8_t outputLength)'],['../classBLAKE2s.html#a778776d15316c182fdb2df5a89b3ca02',1,'BLAKE2s::reset()'],['../classBLAKE2s.html#a91ba6bc39e42002ac61114ced1d0af6d',1,'BLAKE2s::reset(uint8_t outputLength)'],['../classGHASH.html#a479a3e8c37e320bf99f54b95bf5f4c55',1,'GHASH::reset()'],['../classHash.html#a7b94309acaa5f52386785fb780e5be61',1,'Hash::reset()'],['../classKeccakCore.html#a5a322eb7e3b5c1eaad127c9c6e6a529b',1,'KeccakCore::reset()'],['../classPoly1305.html#a544839403d0a19300c239708bc1e6ed8',1,'Poly1305::reset()'],['../classSHA1.html#ab71aaf39ed956320054861a2fbfa454f',1,'SHA1::reset()'],['../classSHA256.html#ad9d80d8fdccffb15497bd36285afce65',1,'SHA256::reset()'],['../classSHA3__256.html#a57b5f29347a733e04fe47d60621f3202',1,'SHA3_256::reset()'],['../classSHA3__512.html#a435746d5a8b012f7c65050337cc4a23f',1,'SHA3_512::reset()'],['../classSHA512.html#a0d009e8d9157c3f14323e68631c33e97',1,'SHA512::reset()']]], diff --git a/structRTCAlarm.html b/structRTCAlarm.html index 26c04c3a..59b74a18 100644 --- a/structRTCAlarm.html +++ b/structRTCAlarm.html @@ -200,7 +200,7 @@ uint8_t  diff --git a/structRTCDate.html b/structRTCDate.html index b8d6a6dd..c61c27bc 100644 --- a/structRTCDate.html +++ b/structRTCDate.html @@ -123,7 +123,7 @@ uint8_t  diff --git a/structRTCTime.html b/structRTCTime.html index b916b16d..9d801f30 100644 --- a/structRTCTime.html +++ b/structRTCTime.html @@ -123,7 +123,7 @@ uint8_t