nrfxlib API 3.3.99
Loading...
Searching...
No Matches
ocrypto_constant_time.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 - 2025 Nordic Semiconductor ASA
3 * Copyright (c) since 2013 Oberon microsystems AG
4 *
5 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
6 */
7
8
23#ifndef OCRYPTO_CONSTANT_TIME_H
24#define OCRYPTO_CONSTANT_TIME_H
25
26#include <stddef.h>
27#include <string.h>
28
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
45int ocrypto_constant_time_equal(const void *x, const void *y, size_t length);
46
56int ocrypto_constant_time_is_zero(const void *x, size_t length);
57
65// void ocrypto_constant_time_copy(void *x, const void *y, size_t length);
66#define ocrypto_constant_time_copy(x, y, length) memcpy(x, y, length)
67
74// void ocrypto_constant_time_fill_zero(void *x, size_t length);
75#define ocrypto_constant_time_fill_zero(x, length) memset(x, 0, length)
76
84// void ocrypto_constant_time_fill(void *x, uint8_t val, size_t length);
85#define ocrypto_constant_time_fill(x, val, length) memset(x, val, length)
86
97void ocrypto_constant_time_xor(void *r, const void *x, const void *y, size_t length);
98
99#ifdef __cplusplus
100}
101#endif
102
103#endif
104
int ocrypto_constant_time_equal(const void *x, const void *y, size_t length)
int ocrypto_constant_time_is_zero(const void *x, size_t length)
void ocrypto_constant_time_xor(void *r, const void *x, const void *y, size_t length)