~aleteoryx/muditaos

ref: 2620191e73c1dd04d3822fa2fad7ef9a478079d6 muditaos/module-bsp/board/linux/trng/trng.cpp -rw-r--r-- 412 bytes
2620191e — Lefucjusz [MOS-238] Use on-chip hardware TRNG as an entropy source 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "bsp/trng/trng.hpp"
#include <random>
#include <memory>

namespace bsp::trng
{
    std::uint32_t getRandomValue()
    {
        const auto trueRandomSource = std::make_unique<std::random_device>();
        return (*trueRandomSource)();
    }
} // namespace bsp::trng