Rtos API example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers arm_hal_random.c Source File

arm_hal_random.c

00001 /*
00002  * Copyright (c) 2015 ARM Limited. All rights reserved.
00003  * SPDX-License-Identifier: Apache-2.0
00004  * Licensed under the Apache License, Version 2.0 (the License); you may
00005  * not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
00012  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #include "ns_types.h"
00017 #include "arm_hal_random.h"
00018 
00019 #include "mbedtls/entropy_poll.h"
00020 
00021 void arm_random_module_init(void)
00022 {
00023 }
00024 
00025 uint32_t arm_random_seed_get(void)
00026 {
00027     uint32_t result = 0;
00028 #ifdef MBEDTLS_ENTROPY_HARDWARE_ALT
00029     /* Grab a seed from a function we provide for mbedtls */
00030     size_t len;
00031     mbedtls_hardware_poll(NULL, (uint8_t *) &result, sizeof result, &len);
00032 #endif
00033     return result;
00034 }