M5Unit-NFC 0.1.0 git rev:93745b5
Loading...
Searching...
No Matches
secure_zero.hpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
3 *
4 * SPDX-License-Identifier: MIT
5 */
10#pragma once
11
12#include <cstddef>
13
14namespace m5 {
15namespace nfc {
16namespace crypto {
17
23inline void secure_zero(void* p, const size_t n)
24{
25 if (!p || n == 0) {
26 return;
27 }
28 volatile unsigned char* v = reinterpret_cast<volatile unsigned char*>(p);
29 for (size_t i = 0; i < n; ++i) {
30 v[i] = 0;
31 }
32}
33
34} // namespace crypto
35} // namespace nfc
36} // namespace m5
Top level namespace of M5Stack.
NFC related definitions.
NFC-V definitions.
void secure_zero(void *p, const size_t n)
Securely wipe a memory region (volatile-safe; not optimized away)
Definition secure_zero.hpp:23