XenevaOS
Loading...
Searching...
No Matches
ctr.h
Go to the documentation of this file.
1
10#ifndef MBEDTLS_CTR_H
11#define MBEDTLS_CTR_H
12
13#include "common.h"
14
21static inline void mbedtls_ctr_increment_counter(uint8_t n[16])
22{
23 // The 32-bit version seems to perform about the same as a 64-bit version
24 // on 64-bit architectures, so no need to define a 64-bit version.
25 for (int i = 3;; i--) {
26 uint32_t x = MBEDTLS_GET_UINT32_BE(n, i << 2);
27 x += 1;
28 MBEDTLS_PUT_UINT32_BE(x, n, i << 2);
29 if (x != 0 || i == 0) {
30 break;
31 }
32 }
33}
34
35#endif /* MBEDTLS_CTR_H */
unsigned int uint32_t
Definition acefiex.h:163
unsigned char uint8_t
Definition acefiex.h:161
#define MBEDTLS_PUT_UINT32_BE(n, data, offset)
Definition alignment.h:427
#define MBEDTLS_GET_UINT32_BE(data, offset)
Definition alignment.h:412
Utility macros for internal use in the library.
int x
Definition layout.c:118