1 // Copyright 2016 The Fuchsia Authors 2 // Copyright (c) 2016, Google, Inc. All rights reserved 3 // 4 // Use of this source code is governed by a MIT-style 5 // license that can be found in the LICENSE file or at 6 // https://opensource.org/licenses/MIT 7 8 #pragma once 9 10 #include <assert.h> 11 #include <zircon/compiler.h> 12 #include <debug.h> 13 #include <err.h> 14 #include <sys/types.h> 15 16 __BEGIN_CDECLS 17 18 size_t hw_rng_get_entropy(void* buf, size_t len, bool block); 19 hw_rng_get_u32(void)20static inline uint32_t hw_rng_get_u32(void) { 21 uint32_t ret; 22 __UNUSED size_t fetched; 23 24 fetched = hw_rng_get_entropy(&ret, sizeof(ret), true); 25 DEBUG_ASSERT(fetched == sizeof(ret)); 26 return ret; 27 } 28 29 __END_CDECLS 30