Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
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 #ifdef MBED_CONF_NANOSTACK_CONFIGURATION 00020 #include "driverRFPhy.h" 00021 #endif 00022 #include "mbedtls/entropy_poll.h" 00023 00024 void arm_random_module_init(void) 00025 { 00026 } 00027 00028 uint32_t arm_random_seed_get(void) 00029 { 00030 uint32_t result = 0; 00031 #ifdef MBEDTLS_ENTROPY_HARDWARE_ALT 00032 /* Grab a seed from a function we provide for mbedtls */ 00033 size_t len; 00034 mbedtls_hardware_poll(NULL, (uint8_t *) &result, sizeof result, &len); 00035 #endif 00036 #ifdef MBED_CONF_NANOSTACK_CONFIGURATION 00037 uint8_t mac[8]; 00038 rf_read_mac_address(mac); 00039 for (int i = 0; i <= 7; i++) { 00040 result ^= (uint32_t) mac[i] << ((i % 4) * 8); 00041 } 00042 result ^= rf_read_random(); 00043 #endif 00044 return result; 00045 }
Generated on Tue Jul 12 2022 12:28:24 by
1.7.2
