Botan 2.19.5 Crypto and TLS for C&

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