Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

loadstor.h
Go to the documentation of this file.
1 /*
2 * Load/Store Operators
3 * (C) 1999-2007,2015 Jack Lloyd
4 * 2007 Yves Jerschow
5 *
6 * Botan is released under the Simplified BSD License (see license.txt)
7 */
8
9 #ifndef BOTAN_LOAD_STORE_H__
10 #define BOTAN_LOAD_STORE_H__
11
12 #include <botan/types.h>
13 #include <botan/bswap.h>
14 #include <botan/mem_ops.h>
15 #include <vector>
16
17 #if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
18
19 #if defined(BOTAN_TARGET_CPU_IS_BIG_ENDIAN)
20
21 #define BOTAN_ENDIAN_N2B(x) (x)
22 #define BOTAN_ENDIAN_B2N(x) (x)
23
24 #define BOTAN_ENDIAN_N2L(x) reverse_bytes(x)
25 #define BOTAN_ENDIAN_L2N(x) reverse_bytes(x)
26
27 #elif defined(BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN)
28
29 #define BOTAN_ENDIAN_N2L(x) (x)
30 #define BOTAN_ENDIAN_L2N(x) (x)
31
32 #define BOTAN_ENDIAN_N2B(x) reverse_bytes(x)
33 #define BOTAN_ENDIAN_B2N(x) reverse_bytes(x)
34
35 #endif
36
37 #endif
38
39 namespace Botan {
40
41 /**
42 * Byte extraction
43 * @param byte_num which byte to extract, 0 == highest byte
44 * @param input the value to extract from
45 * @return byte byte_num of input
46 */
47 template<typename T> inline uint8_t get_byte(size_t byte_num, T input)
48 {
49 return static_cast<uint8_t>(
50 input >> (((~byte_num)&(sizeof(T)-1)) << 3)
51 );
52 }
53
54 /**
55 * Make a uint16_t from two bytes
56 * @param i0 the first byte
57 * @param i1 the second byte
58 * @return i0 || i1
59 */
60 inline uint16_t make_uint16(uint8_t i0, uint8_t i1)
61 {
62 return ((static_cast<uint16_t>(i0) << 8) | i1);
63 }
64
65 /**
66 * Make a uint32_t from four bytes
67 * @param i0 the first byte
68 * @param i1 the second byte
69 * @param i2 the third byte
70 * @param i3 the fourth byte
71 * @return i0 || i1 || i2 || i3
72 */
73 inline uint32_t make_uint32(uint8_t i0, uint8_t i1, uint8_t i2, uint8_t i3)
74 {
75 return ((static_cast<uint32_t>(i0) << 24) |
76 (static_cast<uint32_t>(i1) << 16) |
77 (static_cast<uint32_t>(i2) << 8) |
78 (static_cast<uint32_t>(i3)));
79 }
80
81 /**
82 * Make a uint32_t from eight bytes
83 * @param i0 the first byte
84 * @param i1 the second byte
85 * @param i2 the third byte
86 * @param i3 the fourth byte
87 * @param i4 the fifth byte
88 * @param i5 the sixth byte
89 * @param i6 the seventh byte
90 * @param i7 the eighth byte
91 * @return i0 || i1 || i2 || i3 || i4 || i5 || i6 || i7
92 */
93 inline uint64_t make_uint64(uint8_t i0, uint8_t i1, uint8_t i2, uint8_t i3,
94 uint8_t i4, uint8_t i5, uint8_t i6, uint8_t i7)
95 {
96 return ((static_cast<uint64_t>(i0) << 56) |
97 (static_cast<uint64_t>(i1) << 48) |
98 (static_cast<uint64_t>(i2) << 40) |
99 (static_cast<uint64_t>(i3) << 32) |
100 (static_cast<uint64_t>(i4) << 24) |
101 (static_cast<uint64_t>(i5) << 16) |
102 (static_cast<uint64_t>(i6) << 8) |
103 (static_cast<uint64_t>(i7)));
104 }
105
106 /**
107 * Load a big-endian word
108 * @param in a pointer to some bytes
109 * @param off an offset into the array
110 * @return off'th T of in, as a big-endian value
111 */
112 template<typename T>
113 inline T load_be(const uint8_t in[], size_t off)
114 {
115 in += off * sizeof(T);
116 T out = 0;
117 for(size_t i = 0; i != sizeof(T); ++i)
118 out = (out << 8) | in[i];
119 return out;
120 }
121
122 /**
123 * Load a little-endian word
124 * @param in a pointer to some bytes
125 * @param off an offset into the array
126 * @return off'th T of in, as a litte-endian value
127 */
128 template<typename T>
129 inline T load_le(const uint8_t in[], size_t off)
130 {
131 in += off * sizeof(T);
132 T out = 0;
133 for(size_t i = 0; i != sizeof(T); ++i)
134 out = (out << 8) | in[sizeof(T)-1-i];
135 return out;
136 }
137
138 /**
139 * Load a big-endian uint16_t
140 * @param in a pointer to some bytes
141 * @param off an offset into the array
142 * @return off'th uint16_t of in, as a big-endian value
143 */
144 template<>
145 inline uint16_t load_be<uint16_t>(const uint8_t in[], size_t off)
146 {
147 in += off * sizeof(uint16_t);
148
149 #if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
150 uint16_t x;
151 std::memcpy(&x, in, sizeof(x));
152 return BOTAN_ENDIAN_N2B(x);
153 #else
154 return make_uint16(in[0], in[1]);
155 #endif
156 }
157
158 /**
159 * Load a little-endian uint16_t
160 * @param in a pointer to some bytes
161 * @param off an offset into the array
162 * @return off'th uint16_t of in, as a little-endian value
163 */
164 template<>
165 inline uint16_t load_le<uint16_t>(const uint8_t in[], size_t off)
166 {
167 in += off * sizeof(uint16_t);
168
169 #if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
170 uint16_t x;
171 std::memcpy(&x, in, sizeof(x));
172 return BOTAN_ENDIAN_N2L(x);
173 #else
174 return make_uint16(in[1], in[0]);
175 #endif
176 }
177
178 /**
179 * Load a big-endian uint32_t
180 * @param in a pointer to some bytes
181 * @param off an offset into the array
182 * @return off'th uint32_t of in, as a big-endian value
183 */
184 template<>
185 inline uint32_t load_be<uint32_t>(const uint8_t in[], size_t off)
186 {
187 in += off * sizeof(uint32_t);
188 #if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
189 uint32_t x;
190 std::memcpy(&x, in, sizeof(x));
191 return BOTAN_ENDIAN_N2B(x);
192 #else
193 return make_uint32(in[0], in[1], in[2], in[3]);
194 #endif
195 }
196
197 /**
198 * Load a little-endian uint32_t
199 * @param in a pointer to some bytes
200 * @param off an offset into the array
201 * @return off'th uint32_t of in, as a little-endian value
202 */
203 template<>
204 inline uint32_t load_le<uint32_t>(const uint8_t in[], size_t off)
205 {
206 in += off * sizeof(uint32_t);
207 #if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
208 uint32_t x;
209 std::memcpy(&x, in, sizeof(x));
210 return BOTAN_ENDIAN_N2L(x);
211 #else
212 return make_uint32(in[3], in[2], in[1], in[0]);
213 #endif
214 }
215
216 /**
217 * Load a big-endian uint64_t
218 * @param in a pointer to some bytes
219 * @param off an offset into the array
220 * @return off'th uint64_t of in, as a big-endian value
221 */
222 template<>
223 inline uint64_t load_be<uint64_t>(const uint8_t in[], size_t off)
224 {
225 in += off * sizeof(uint64_t);
226 #if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
227 uint64_t x;
228 std::memcpy(&x, in, sizeof(x));
229 return BOTAN_ENDIAN_N2B(x);
230 #else
231 return make_uint64(in[0], in[1], in[2], in[3],
232 in[4], in[5], in[6], in[7]);
233 #endif
234 }
235
236 /**
237 * Load a little-endian uint64_t
238 * @param in a pointer to some bytes
239 * @param off an offset into the array
240 * @return off'th uint64_t of in, as a little-endian value
241 */
242 template<>
243 inline uint64_t load_le<uint64_t>(const uint8_t in[], size_t off)
244 {
245 in += off * sizeof(uint64_t);
246 #if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
247 uint64_t x;
248 std::memcpy(&x, in, sizeof(x));
249 return BOTAN_ENDIAN_N2L(x);
250 #else
251 return make_uint64(in[7], in[6], in[5], in[4],
252 in[3], in[2], in[1], in[0]);
253 #endif
254 }
255
256 /**
257 * Load two little-endian words
258 * @param in a pointer to some bytes
259 * @param x0 where the first word will be written
260 * @param x1 where the second word will be written
261 */
262 template<typename T>
263 inline void load_le(const uint8_t in[], T& x0, T& x1)
264 {
265 x0 = load_le<T>(in, 0);
266 x1 = load_le<T>(in, 1);
267 }
268
269 /**
270 * Load four little-endian words
271 * @param in a pointer to some bytes
272 * @param x0 where the first word will be written
273 * @param x1 where the second word will be written
274 * @param x2 where the third word will be written
275 * @param x3 where the fourth word will be written
276 */
277 template<typename T>
278 inline void load_le(const uint8_t in[],
279 T& x0, T& x1, T& x2, T& x3)
280 {
281 x0 = load_le<T>(in, 0);
282 x1 = load_le<T>(in, 1);
283 x2 = load_le<T>(in, 2);
284 x3 = load_le<T>(in, 3);
285 }
286
287 /**
288 * Load eight little-endian words
289 * @param in a pointer to some bytes
290 * @param x0 where the first word will be written
291 * @param x1 where the second word will be written
292 * @param x2 where the third word will be written
293 * @param x3 where the fourth word will be written
294 * @param x4 where the fifth word will be written
295 * @param x5 where the sixth word will be written
296 * @param x6 where the seventh word will be written
297 * @param x7 where the eighth word will be written
298 */
299 template<typename T>
300 inline void load_le(const uint8_t in[],
301 T& x0, T& x1, T& x2, T& x3,
302 T& x4, T& x5, T& x6, T& x7)
303 {
304 x0 = load_le<T>(in, 0);
305 x1 = load_le<T>(in, 1);
306 x2 = load_le<T>(in, 2);
307 x3 = load_le<T>(in, 3);
308 x4 = load_le<T>(in, 4);
309 x5 = load_le<T>(in, 5);
310 x6 = load_le<T>(in, 6);
311 x7 = load_le<T>(in, 7);
312 }
313
314 /**
315 * Load a variable number of little-endian words
316 * @param out the output array of words
317 * @param in the input array of bytes
318 * @param count how many words are in in
319 */
320 template<typename T>
321 inline void load_le(T out[],
322 const uint8_t in[],
323 size_t count)
324 {
325 if(count > 0)
326 {
327 #if defined(BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN)
328 std::memcpy(out, in, sizeof(T)*count);
329 #elif defined(BOTAN_TARGET_CPU_IS_BIG_ENDIAN)
330 std::memcpy(out, in, sizeof(T)*count);
331 const size_t blocks = count - (count % 4);
332 const size_t left = count - blocks;
333
334 for(size_t i = 0; i != blocks; i += 4)
335 bswap_4(out + i);
336
337 for(size_t i = 0; i != left; ++i)
338 out[blocks+i] = reverse_bytes(out[blocks+i]);
339 #else
340 for(size_t i = 0; i != count; ++i)
341 out[i] = load_le<T>(in, i);
342 #endif
343 }
344 }
345
346 /**
347 * Load two big-endian words
348 * @param in a pointer to some bytes
349 * @param x0 where the first word will be written
350 * @param x1 where the second word will be written
351 */
352 template<typename T>
353 inline void load_be(const uint8_t in[], T& x0, T& x1)
354 {
355 x0 = load_be<T>(in, 0);
356 x1 = load_be<T>(in, 1);
357 }
358
359 /**
360 * Load four big-endian words
361 * @param in a pointer to some bytes
362 * @param x0 where the first word will be written
363 * @param x1 where the second word will be written
364 * @param x2 where the third word will be written
365 * @param x3 where the fourth word will be written
366 */
367 template<typename T>
368 inline void load_be(const uint8_t in[],
369 T& x0, T& x1, T& x2, T& x3)
370 {
371 x0 = load_be<T>(in, 0);
372 x1 = load_be<T>(in, 1);
373 x2 = load_be<T>(in, 2);
374 x3 = load_be<T>(in, 3);
375 }
376
377 /**
378 * Load eight big-endian words
379 * @param in a pointer to some bytes
380 * @param x0 where the first word will be written
381 * @param x1 where the second word will be written
382 * @param x2 where the third word will be written
383 * @param x3 where the fourth word will be written
384 * @param x4 where the fifth word will be written
385 * @param x5 where the sixth word will be written
386 * @param x6 where the seventh word will be written
387 * @param x7 where the eighth word will be written
388 */
389 template<typename T>
390 inline void load_be(const uint8_t in[],
391 T& x0, T& x1, T& x2, T& x3,
392 T& x4, T& x5, T& x6, T& x7)
393 {
394 x0 = load_be<T>(in, 0);
395 x1 = load_be<T>(in, 1);
396 x2 = load_be<T>(in, 2);
397 x3 = load_be<T>(in, 3);
398 x4 = load_be<T>(in, 4);
399 x5 = load_be<T>(in, 5);
400 x6 = load_be<T>(in, 6);
401 x7 = load_be<T>(in, 7);
402 }
403
404 /**
405 * Load a variable number of big-endian words
406 * @param out the output array of words
407 * @param in the input array of bytes
408 * @param count how many words are in in
409 */
410 template<typename T>
411 inline void load_be(T out[],
412 const uint8_t in[],
413 size_t count)
414 {
415 if(count > 0)
416 {
417 #if defined(BOTAN_TARGET_CPU_IS_BIG_ENDIAN)
418 std::memcpy(out, in, sizeof(T)*count);
419 #elif defined(BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN)
420 std::memcpy(out, in, sizeof(T)*count);
421 const size_t blocks = count - (count % 4);
422 const size_t left = count - blocks;
423
424 for(size_t i = 0; i != blocks; i += 4)
425 bswap_4(out + i);
426
427 for(size_t i = 0; i != left; ++i)
428 out[blocks+i] = reverse_bytes(out[blocks+i]);
429 #else
430 for(size_t i = 0; i != count; ++i)
431 out[i] = load_be<T>(in, i);
432 #endif
433 }
434 }
435
436 /**
437 * Store a big-endian uint16_t
438 * @param in the input uint16_t
439 * @param out the byte array to write to
440 */
441 inline void store_be(uint16_t in, uint8_t out[2])
442 {
443 #if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
444 uint16_t o = BOTAN_ENDIAN_N2B(in);
445 std::memcpy(out, &o, sizeof(o));
446 #else
447 out[0] = get_byte(0, in);
448 out[1] = get_byte(1, in);
449 #endif
450 }
451
452 /**
453 * Store a little-endian uint16_t
454 * @param in the input uint16_t
455 * @param out the byte array to write to
456 */
457 inline void store_le(uint16_t in, uint8_t out[2])
458 {
459 #if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
460 uint16_t o = BOTAN_ENDIAN_N2L(in);
461 std::memcpy(out, &o, sizeof(o));
462 #else
463 out[0] = get_byte(1, in);
464 out[1] = get_byte(0, in);
465 #endif
466 }
467
468 /**
469 * Store a big-endian uint32_t
470 * @param in the input uint32_t
471 * @param out the byte array to write to
472 */
473 inline void store_be(uint32_t in, uint8_t out[4])
474 {
475 #if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
476 uint32_t o = BOTAN_ENDIAN_B2N(in);
477 std::memcpy(out, &o, sizeof(o));
478 #else
479 out[0] = get_byte(0, in);
480 out[1] = get_byte(1, in);
481 out[2] = get_byte(2, in);
482 out[3] = get_byte(3, in);
483 #endif
484 }
485
486 /**
487 * Store a little-endian uint32_t
488 * @param in the input uint32_t
489 * @param out the byte array to write to
490 */
491 inline void store_le(uint32_t in, uint8_t out[4])
492 {
493 #if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
494 uint32_t o = BOTAN_ENDIAN_L2N(in);
495 std::memcpy(out, &o, sizeof(o));
496 #else
497 out[0] = get_byte(3, in);
498 out[1] = get_byte(2, in);
499 out[2] = get_byte(1, in);
500 out[3] = get_byte(0, in);
501 #endif
502 }
503
504 /**
505 * Store a big-endian uint64_t
506 * @param in the input uint64_t
507 * @param out the byte array to write to
508 */
509 inline void store_be(uint64_t in, uint8_t out[8])
510 {
511 #if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
512 uint64_t o = BOTAN_ENDIAN_B2N(in);
513 std::memcpy(out, &o, sizeof(o));
514 #else
515 out[0] = get_byte(0, in);
516 out[1] = get_byte(1, in);
517 out[2] = get_byte(2, in);
518 out[3] = get_byte(3, in);
519 out[4] = get_byte(4, in);
520 out[5] = get_byte(5, in);
521 out[6] = get_byte(6, in);
522 out[7] = get_byte(7, in);
523 #endif
524 }
525
526 /**
527 * Store a little-endian uint64_t
528 * @param in the input uint64_t
529 * @param out the byte array to write to
530 */
531 inline void store_le(uint64_t in, uint8_t out[8])
532 {
533 #if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
534 uint64_t o = BOTAN_ENDIAN_L2N(in);
535 std::memcpy(out, &o, sizeof(o));
536 #else
537 out[0] = get_byte(7, in);
538 out[1] = get_byte(6, in);
539 out[2] = get_byte(5, in);
540 out[3] = get_byte(4, in);
541 out[4] = get_byte(3, in);
542 out[5] = get_byte(2, in);
543 out[6] = get_byte(1, in);
544 out[7] = get_byte(0, in);
545 #endif
546 }
547
548 /**
549 * Store two little-endian words
550 * @param out the output byte array
551 * @param x0 the first word
552 * @param x1 the second word
553 */
554 template<typename T>
555 inline void store_le(uint8_t out[], T x0, T x1)
556 {
557 store_le(x0, out + (0 * sizeof(T)));
558 store_le(x1, out + (1 * sizeof(T)));
559 }
560
561 /**
562 * Store two big-endian words
563 * @param out the output byte array
564 * @param x0 the first word
565 * @param x1 the second word
566 */
567 template<typename T>
568 inline void store_be(uint8_t out[], T x0, T x1)
569 {
570 store_be(x0, out + (0 * sizeof(T)));
571 store_be(x1, out + (1 * sizeof(T)));
572 }
573
574 /**
575 * Store four little-endian words
576 * @param out the output byte array
577 * @param x0 the first word
578 * @param x1 the second word
579 * @param x2 the third word
580 * @param x3 the fourth word
581 */
582 template<typename T>
583 inline void store_le(uint8_t out[], T x0, T x1, T x2, T x3)
584 {
585 store_le(x0, out + (0 * sizeof(T)));
586 store_le(x1, out + (1 * sizeof(T)));
587 store_le(x2, out + (2 * sizeof(T)));
588 store_le(x3, out + (3 * sizeof(T)));
589 }
590
591 /**
592 * Store four big-endian words
593 * @param out the output byte array
594 * @param x0 the first word
595 * @param x1 the second word
596 * @param x2 the third word
597 * @param x3 the fourth word
598 */
599 template<typename T>
600 inline void store_be(uint8_t out[], T x0, T x1, T x2, T x3)
601 {
602 store_be(x0, out + (0 * sizeof(T)));
603 store_be(x1, out + (1 * sizeof(T)));
604 store_be(x2, out + (2 * sizeof(T)));
605 store_be(x3, out + (3 * sizeof(T)));
606 }
607
608 /**
609 * Store eight little-endian words
610 * @param out the output byte array
611 * @param x0 the first word
612 * @param x1 the second word
613 * @param x2 the third word
614 * @param x3 the fourth word
615 * @param x4 the fifth word
616 * @param x5 the sixth word
617 * @param x6 the seventh word
618 * @param x7 the eighth word
619 */
620 template<typename T>
621 inline void store_le(uint8_t out[], T x0, T x1, T x2, T x3,
622 T x4, T x5, T x6, T x7)
623 {
624 store_le(x0, out + (0 * sizeof(T)));
625 store_le(x1, out + (1 * sizeof(T)));
626 store_le(x2, out + (2 * sizeof(T)));
627 store_le(x3, out + (3 * sizeof(T)));
628 store_le(x4, out + (4 * sizeof(T)));
629 store_le(x5, out + (5 * sizeof(T)));
630 store_le(x6, out + (6 * sizeof(T)));
631 store_le(x7, out + (7 * sizeof(T)));
632 }
633
634 /**
635 * Store eight big-endian words
636 * @param out the output byte array
637 * @param x0 the first word
638 * @param x1 the second word
639 * @param x2 the third word
640 * @param x3 the fourth word
641 * @param x4 the fifth word
642 * @param x5 the sixth word
643 * @param x6 the seventh word
644 * @param x7 the eighth word
645 */
646 template<typename T>
647 inline void store_be(uint8_t out[], T x0, T x1, T x2, T x3,
648 T x4, T x5, T x6, T x7)
649 {
650 store_be(x0, out + (0 * sizeof(T)));
651 store_be(x1, out + (1 * sizeof(T)));
652 store_be(x2, out + (2 * sizeof(T)));
653 store_be(x3, out + (3 * sizeof(T)));
654 store_be(x4, out + (4 * sizeof(T)));
655 store_be(x5, out + (5 * sizeof(T)));
656 store_be(x6, out + (6 * sizeof(T)));
657 store_be(x7, out + (7 * sizeof(T)));
658 }
659
660 template<typename T>
661 void copy_out_be(uint8_t out[], size_t out_bytes, const T in[])
662 {
663 while(out_bytes >= sizeof(T))
664 {
665 store_be(in[0], out);
666 out += sizeof(T);
667 out_bytes -= sizeof(T);
668 in += 1;
669 }
670
671 for(size_t i = 0; i != out_bytes; ++i)
672 out[i] = get_byte(i%8, in[0]);
673 }
674
675 template<typename T, typename Alloc>
676 void copy_out_vec_be(uint8_t out[], size_t out_bytes, const std::vector<T, Alloc>& in)
677 {
678 copy_out_be(out, out_bytes, in.data());
679 }
680
681 template<typename T>
682 void copy_out_le(uint8_t out[], size_t out_bytes, const T in[])
683 {
684 while(out_bytes >= sizeof(T))
685 {
686 store_le(in[0], out);
687 out += sizeof(T);
688 out_bytes -= sizeof(T);
689 in += 1;
690 }
691
692 for(size_t i = 0; i != out_bytes; ++i)
693 out[i] = get_byte(sizeof(T) - 1 - (i % 8), in[0]);
694 }
695
696 template<typename T, typename Alloc>
697 void copy_out_vec_le(uint8_t out[], size_t out_bytes, const std::vector<T, Alloc>& in)
698 {
699 copy_out_le(out, out_bytes, in.data());
700 }
701
702 }
703
704 #endif
Botan::copy_out_vec_be
void copy_out_vec_be(uint8_t out[], size_t out_bytes, const std::vector< T, Alloc > &in)
Definition: loadstor.h:676
Botan::load_le< uint16_t >
uint16_t load_le< uint16_t >(const uint8_t in[], size_t off)
Definition: loadstor.h:165
Botan::store_be
void store_be(uint16_t in, uint8_t out[2])
Definition: loadstor.h:441
Botan::copy_out_le
void copy_out_le(uint8_t out[], size_t out_bytes, const T in[])
Definition: loadstor.h:682
Botan::load_be< uint16_t >
uint16_t load_be< uint16_t >(const uint8_t in[], size_t off)
Definition: loadstor.h:145
Botan::load_be< uint32_t >
uint32_t load_be< uint32_t >(const uint8_t in[], size_t off)
Definition: loadstor.h:185
Botan::load_le< uint32_t >
uint32_t load_le< uint32_t >(const uint8_t in[], size_t off)
Definition: loadstor.h:204
Botan::load_be< uint64_t >
uint64_t load_be< uint64_t >(const uint8_t in[], size_t off)
Definition: loadstor.h:223
Botan::load_be
T load_be(const uint8_t in[], size_t off)
Definition: loadstor.h:113
Botan::load_le< uint64_t >
uint64_t load_le< uint64_t >(const uint8_t in[], size_t off)
Definition: loadstor.h:243
Botan::load_le
T load_le(const uint8_t in[], size_t off)
Definition: loadstor.h:129
Botan
Definition: alg_id.cpp:13
Botan::bswap_4
void bswap_4(T x[4])
Definition: bswap.h:112
Botan::reverse_bytes
uint16_t reverse_bytes(uint16_t val)
Definition: bswap.h:24
Botan::make_uint64
uint64_t make_uint64(uint8_t i0, uint8_t i1, uint8_t i2, uint8_t i3, uint8_t i4, uint8_t i5, uint8_t i6, uint8_t i7)
Definition: loadstor.h:93
Botan::make_uint16
uint16_t make_uint16(uint8_t i0, uint8_t i1)
Definition: loadstor.h:60
Botan::get_byte
uint8_t get_byte(size_t byte_num, T input)
Definition: loadstor.h:47
Botan::make_uint32
uint32_t make_uint32(uint8_t i0, uint8_t i1, uint8_t i2, uint8_t i3)
Definition: loadstor.h:73
Botan::copy_out_be
void copy_out_be(uint8_t out[], size_t out_bytes, const T in[])
Definition: loadstor.h:661
Botan::store_le
void store_le(uint16_t in, uint8_t out[2])
Definition: loadstor.h:457
Botan::copy_out_vec_le
void copy_out_vec_le(uint8_t out[], size_t out_bytes, const std::vector< T, Alloc > &in)
Definition: loadstor.h:697