nrfxlib API 2.7.99
Loading...
Searching...
No Matches
ocrypto_constant_time.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 - 2024 Nordic Semiconductor ASA
3 * Copyright (c) since 2013 Oberon microsystems AG
4 *
5 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
6 */
7
8
16#ifndef OCRYPTO_CONSTANT_TIME_H
17#define OCRYPTO_CONSTANT_TIME_H
18
19#include <stddef.h>
20#include <string.h>
21
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27
38int ocrypto_constant_time_equal(const void *x, const void *y, size_t length);
39
49int ocrypto_constant_time_is_zero(const void *x, size_t length);
50
58// void ocrypto_constant_time_copy(void *x, const void *y, size_t length);
59#define ocrypto_constant_time_copy(x, y, length) memcpy(x, y, length)
60
67// void ocrypto_constant_time_fill_zero(void *x, size_t length);
68#define ocrypto_constant_time_fill_zero(x, length) memset(x, 0, length)
69
77// void ocrypto_constant_time_fill(void *x, uint8_t val, size_t length);
78#define ocrypto_constant_time_fill(x, val, length) memset(x, val, length)
79
90void ocrypto_constant_time_xor(void *r, const void *x, const void *y, size_t length);
91
92#ifdef __cplusplus
93}
94#endif
95
96#endif
97
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)