Coverage Report

Created: 2024-11-21 07:03

/src/trezor-firmware/crypto/blake2_common.h
Line
Count
Source (jump to first uncovered line)
1
2
#include <stdint.h>
3
#include "byte_order.h"
4
5
0
static inline uint32_t load32(const void *src) {
6
0
  uint32_t w;
7
0
  memcpy(&w, src, sizeof w);
8
0
#if BYTE_ORDER == BIG_ENDIAN
9
0
  REVERSE32(w, w);
10
0
#endif
11
0
  return w;
12
0
}
13
14
199k
static inline uint64_t load64(const void *src) {
15
199k
  uint64_t w;
16
199k
  memcpy(&w, src, sizeof w);
17
#if BYTE_ORDER == BIG_ENDIAN
18
  REVERSE64(w, w);
19
#endif
20
199k
  return w;
21
199k
}
22
23
0
static inline void store16(void *dst, uint16_t w) { memcpy(dst, &w, sizeof w); }
24
25
126
static inline void store32(void *dst, uint32_t w) {
26
#if BYTE_ORDER == BIG_ENDIAN
27
  REVERSE32(w, w);
28
#endif
29
126
  memcpy(dst, &w, sizeof w);
30
126
}
31
32
440
static inline void store64(void *dst, uint64_t w) {
33
#if BYTE_ORDER == BIG_ENDIAN
34
  REVERSE64(w, w);
35
#endif
36
440
  memcpy(dst, &w, sizeof w);
37
440
}
38
39
0
static inline uint32_t rotr32(const uint32_t w, const unsigned c) {
40
0
  return (w >> c) | (w << (32 - c));
41
0
}
42
43
4.77M
static inline uint64_t rotr64(const uint64_t w, const unsigned c) {
44
4.77M
  return (w >> c) | (w << (64 - c));
45
4.77M
}