The WDCInterface is is a drop-in replacement for an EthernetInterface class that allows the user to connect to the Internet with a Wistron NeWeb Corporation (WNC) M14A2A Series data module using the standard network Socket API's. This interface class is used in the AT&T Cellular IoT Starter Kit which is sold by Avnet (http://cloudconnectkits.org/product/att-cellular-iot-starter-kit).
Dependencies: WncControllerK64F
Dependents: WNCProximityMqtt Pubnub_ATT_IoT_SK_WNC_sync BluemixDemo BluemixQS ... more
See the WNCInterface README in the Wiki tab for detailed information on this library.
mbedtls/source/platform.c@12:0071cb144c7a, 2016-11-01 (annotated)
- Committer:
- JMF
- Date:
- Tue Nov 01 14:22:56 2016 +0000
- Revision:
- 12:0071cb144c7a
Adding mbedtls files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JMF | 12:0071cb144c7a | 1 | /* |
JMF | 12:0071cb144c7a | 2 | * Platform abstraction layer |
JMF | 12:0071cb144c7a | 3 | * |
JMF | 12:0071cb144c7a | 4 | * Copyright (C) 2006-2016, ARM Limited, All Rights Reserved |
JMF | 12:0071cb144c7a | 5 | * SPDX-License-Identifier: Apache-2.0 |
JMF | 12:0071cb144c7a | 6 | * |
JMF | 12:0071cb144c7a | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
JMF | 12:0071cb144c7a | 8 | * not use this file except in compliance with the License. |
JMF | 12:0071cb144c7a | 9 | * You may obtain a copy of the License at |
JMF | 12:0071cb144c7a | 10 | * |
JMF | 12:0071cb144c7a | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
JMF | 12:0071cb144c7a | 12 | * |
JMF | 12:0071cb144c7a | 13 | * Unless required by applicable law or agreed to in writing, software |
JMF | 12:0071cb144c7a | 14 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
JMF | 12:0071cb144c7a | 15 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
JMF | 12:0071cb144c7a | 16 | * See the License for the specific language governing permissions and |
JMF | 12:0071cb144c7a | 17 | * limitations under the License. |
JMF | 12:0071cb144c7a | 18 | * |
JMF | 12:0071cb144c7a | 19 | * This file is part of mbed TLS (https://tls.mbed.org) |
JMF | 12:0071cb144c7a | 20 | */ |
JMF | 12:0071cb144c7a | 21 | |
JMF | 12:0071cb144c7a | 22 | #if !defined(MBEDTLS_CONFIG_FILE) |
JMF | 12:0071cb144c7a | 23 | #include "mbedtls/config.h" |
JMF | 12:0071cb144c7a | 24 | #else |
JMF | 12:0071cb144c7a | 25 | #include MBEDTLS_CONFIG_FILE |
JMF | 12:0071cb144c7a | 26 | #endif |
JMF | 12:0071cb144c7a | 27 | |
JMF | 12:0071cb144c7a | 28 | #if defined(MBEDTLS_PLATFORM_C) |
JMF | 12:0071cb144c7a | 29 | |
JMF | 12:0071cb144c7a | 30 | #include "mbedtls/platform.h" |
JMF | 12:0071cb144c7a | 31 | |
JMF | 12:0071cb144c7a | 32 | #if defined(MBEDTLS_PLATFORM_MEMORY) |
JMF | 12:0071cb144c7a | 33 | #if !defined(MBEDTLS_PLATFORM_STD_CALLOC) |
JMF | 12:0071cb144c7a | 34 | static void *platform_calloc_uninit( size_t n, size_t size ) |
JMF | 12:0071cb144c7a | 35 | { |
JMF | 12:0071cb144c7a | 36 | ((void) n); |
JMF | 12:0071cb144c7a | 37 | ((void) size); |
JMF | 12:0071cb144c7a | 38 | return( NULL ); |
JMF | 12:0071cb144c7a | 39 | } |
JMF | 12:0071cb144c7a | 40 | |
JMF | 12:0071cb144c7a | 41 | #define MBEDTLS_PLATFORM_STD_CALLOC platform_calloc_uninit |
JMF | 12:0071cb144c7a | 42 | #endif /* !MBEDTLS_PLATFORM_STD_CALLOC */ |
JMF | 12:0071cb144c7a | 43 | |
JMF | 12:0071cb144c7a | 44 | #if !defined(MBEDTLS_PLATFORM_STD_FREE) |
JMF | 12:0071cb144c7a | 45 | static void platform_free_uninit( void *ptr ) |
JMF | 12:0071cb144c7a | 46 | { |
JMF | 12:0071cb144c7a | 47 | ((void) ptr); |
JMF | 12:0071cb144c7a | 48 | } |
JMF | 12:0071cb144c7a | 49 | |
JMF | 12:0071cb144c7a | 50 | #define MBEDTLS_PLATFORM_STD_FREE platform_free_uninit |
JMF | 12:0071cb144c7a | 51 | #endif /* !MBEDTLS_PLATFORM_STD_FREE */ |
JMF | 12:0071cb144c7a | 52 | |
JMF | 12:0071cb144c7a | 53 | void * (*mbedtls_calloc)( size_t, size_t ) = MBEDTLS_PLATFORM_STD_CALLOC; |
JMF | 12:0071cb144c7a | 54 | void (*mbedtls_free)( void * ) = MBEDTLS_PLATFORM_STD_FREE; |
JMF | 12:0071cb144c7a | 55 | |
JMF | 12:0071cb144c7a | 56 | int mbedtls_platform_set_calloc_free( void * (*calloc_func)( size_t, size_t ), |
JMF | 12:0071cb144c7a | 57 | void (*free_func)( void * ) ) |
JMF | 12:0071cb144c7a | 58 | { |
JMF | 12:0071cb144c7a | 59 | mbedtls_calloc = calloc_func; |
JMF | 12:0071cb144c7a | 60 | mbedtls_free = free_func; |
JMF | 12:0071cb144c7a | 61 | return( 0 ); |
JMF | 12:0071cb144c7a | 62 | } |
JMF | 12:0071cb144c7a | 63 | #endif /* MBEDTLS_PLATFORM_MEMORY */ |
JMF | 12:0071cb144c7a | 64 | |
JMF | 12:0071cb144c7a | 65 | #if defined(_WIN32) |
JMF | 12:0071cb144c7a | 66 | #include <stdarg.h> |
JMF | 12:0071cb144c7a | 67 | int mbedtls_platform_win32_snprintf( char *s, size_t n, const char *fmt, ... ) |
JMF | 12:0071cb144c7a | 68 | { |
JMF | 12:0071cb144c7a | 69 | int ret; |
JMF | 12:0071cb144c7a | 70 | va_list argp; |
JMF | 12:0071cb144c7a | 71 | |
JMF | 12:0071cb144c7a | 72 | /* Avoid calling the invalid parameter handler by checking ourselves */ |
JMF | 12:0071cb144c7a | 73 | if( s == NULL || n == 0 || fmt == NULL ) |
JMF | 12:0071cb144c7a | 74 | return( -1 ); |
JMF | 12:0071cb144c7a | 75 | |
JMF | 12:0071cb144c7a | 76 | va_start( argp, fmt ); |
JMF | 12:0071cb144c7a | 77 | #if defined(_TRUNCATE) |
JMF | 12:0071cb144c7a | 78 | ret = _vsnprintf_s( s, n, _TRUNCATE, fmt, argp ); |
JMF | 12:0071cb144c7a | 79 | #else |
JMF | 12:0071cb144c7a | 80 | ret = _vsnprintf( s, n, fmt, argp ); |
JMF | 12:0071cb144c7a | 81 | if( ret < 0 || (size_t) ret == n ) |
JMF | 12:0071cb144c7a | 82 | { |
JMF | 12:0071cb144c7a | 83 | s[n-1] = '\0'; |
JMF | 12:0071cb144c7a | 84 | ret = -1; |
JMF | 12:0071cb144c7a | 85 | } |
JMF | 12:0071cb144c7a | 86 | #endif |
JMF | 12:0071cb144c7a | 87 | va_end( argp ); |
JMF | 12:0071cb144c7a | 88 | |
JMF | 12:0071cb144c7a | 89 | return( ret ); |
JMF | 12:0071cb144c7a | 90 | } |
JMF | 12:0071cb144c7a | 91 | #endif |
JMF | 12:0071cb144c7a | 92 | |
JMF | 12:0071cb144c7a | 93 | #if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) |
JMF | 12:0071cb144c7a | 94 | #if !defined(MBEDTLS_PLATFORM_STD_SNPRINTF) |
JMF | 12:0071cb144c7a | 95 | /* |
JMF | 12:0071cb144c7a | 96 | * Make dummy function to prevent NULL pointer dereferences |
JMF | 12:0071cb144c7a | 97 | */ |
JMF | 12:0071cb144c7a | 98 | static int platform_snprintf_uninit( char * s, size_t n, |
JMF | 12:0071cb144c7a | 99 | const char * format, ... ) |
JMF | 12:0071cb144c7a | 100 | { |
JMF | 12:0071cb144c7a | 101 | ((void) s); |
JMF | 12:0071cb144c7a | 102 | ((void) n); |
JMF | 12:0071cb144c7a | 103 | ((void) format); |
JMF | 12:0071cb144c7a | 104 | return( 0 ); |
JMF | 12:0071cb144c7a | 105 | } |
JMF | 12:0071cb144c7a | 106 | |
JMF | 12:0071cb144c7a | 107 | #define MBEDTLS_PLATFORM_STD_SNPRINTF platform_snprintf_uninit |
JMF | 12:0071cb144c7a | 108 | #endif /* !MBEDTLS_PLATFORM_STD_SNPRINTF */ |
JMF | 12:0071cb144c7a | 109 | |
JMF | 12:0071cb144c7a | 110 | int (*mbedtls_snprintf)( char * s, size_t n, |
JMF | 12:0071cb144c7a | 111 | const char * format, |
JMF | 12:0071cb144c7a | 112 | ... ) = MBEDTLS_PLATFORM_STD_SNPRINTF; |
JMF | 12:0071cb144c7a | 113 | |
JMF | 12:0071cb144c7a | 114 | int mbedtls_platform_set_snprintf( int (*snprintf_func)( char * s, size_t n, |
JMF | 12:0071cb144c7a | 115 | const char * format, |
JMF | 12:0071cb144c7a | 116 | ... ) ) |
JMF | 12:0071cb144c7a | 117 | { |
JMF | 12:0071cb144c7a | 118 | mbedtls_snprintf = snprintf_func; |
JMF | 12:0071cb144c7a | 119 | return( 0 ); |
JMF | 12:0071cb144c7a | 120 | } |
JMF | 12:0071cb144c7a | 121 | #endif /* MBEDTLS_PLATFORM_SNPRINTF_ALT */ |
JMF | 12:0071cb144c7a | 122 | |
JMF | 12:0071cb144c7a | 123 | #if defined(MBEDTLS_PLATFORM_PRINTF_ALT) |
JMF | 12:0071cb144c7a | 124 | #if !defined(MBEDTLS_PLATFORM_STD_PRINTF) |
JMF | 12:0071cb144c7a | 125 | /* |
JMF | 12:0071cb144c7a | 126 | * Make dummy function to prevent NULL pointer dereferences |
JMF | 12:0071cb144c7a | 127 | */ |
JMF | 12:0071cb144c7a | 128 | static int platform_printf_uninit( const char *format, ... ) |
JMF | 12:0071cb144c7a | 129 | { |
JMF | 12:0071cb144c7a | 130 | ((void) format); |
JMF | 12:0071cb144c7a | 131 | return( 0 ); |
JMF | 12:0071cb144c7a | 132 | } |
JMF | 12:0071cb144c7a | 133 | |
JMF | 12:0071cb144c7a | 134 | #define MBEDTLS_PLATFORM_STD_PRINTF platform_printf_uninit |
JMF | 12:0071cb144c7a | 135 | #endif /* !MBEDTLS_PLATFORM_STD_PRINTF */ |
JMF | 12:0071cb144c7a | 136 | |
JMF | 12:0071cb144c7a | 137 | int (*mbedtls_printf)( const char *, ... ) = MBEDTLS_PLATFORM_STD_PRINTF; |
JMF | 12:0071cb144c7a | 138 | |
JMF | 12:0071cb144c7a | 139 | int mbedtls_platform_set_printf( int (*printf_func)( const char *, ... ) ) |
JMF | 12:0071cb144c7a | 140 | { |
JMF | 12:0071cb144c7a | 141 | mbedtls_printf = printf_func; |
JMF | 12:0071cb144c7a | 142 | return( 0 ); |
JMF | 12:0071cb144c7a | 143 | } |
JMF | 12:0071cb144c7a | 144 | #endif /* MBEDTLS_PLATFORM_PRINTF_ALT */ |
JMF | 12:0071cb144c7a | 145 | |
JMF | 12:0071cb144c7a | 146 | #if defined(MBEDTLS_PLATFORM_FPRINTF_ALT) |
JMF | 12:0071cb144c7a | 147 | #if !defined(MBEDTLS_PLATFORM_STD_FPRINTF) |
JMF | 12:0071cb144c7a | 148 | /* |
JMF | 12:0071cb144c7a | 149 | * Make dummy function to prevent NULL pointer dereferences |
JMF | 12:0071cb144c7a | 150 | */ |
JMF | 12:0071cb144c7a | 151 | static int platform_fprintf_uninit( FILE *stream, const char *format, ... ) |
JMF | 12:0071cb144c7a | 152 | { |
JMF | 12:0071cb144c7a | 153 | ((void) stream); |
JMF | 12:0071cb144c7a | 154 | ((void) format); |
JMF | 12:0071cb144c7a | 155 | return( 0 ); |
JMF | 12:0071cb144c7a | 156 | } |
JMF | 12:0071cb144c7a | 157 | |
JMF | 12:0071cb144c7a | 158 | #define MBEDTLS_PLATFORM_STD_FPRINTF platform_fprintf_uninit |
JMF | 12:0071cb144c7a | 159 | #endif /* !MBEDTLS_PLATFORM_STD_FPRINTF */ |
JMF | 12:0071cb144c7a | 160 | |
JMF | 12:0071cb144c7a | 161 | int (*mbedtls_fprintf)( FILE *, const char *, ... ) = |
JMF | 12:0071cb144c7a | 162 | MBEDTLS_PLATFORM_STD_FPRINTF; |
JMF | 12:0071cb144c7a | 163 | |
JMF | 12:0071cb144c7a | 164 | int mbedtls_platform_set_fprintf( int (*fprintf_func)( FILE *, const char *, ... ) ) |
JMF | 12:0071cb144c7a | 165 | { |
JMF | 12:0071cb144c7a | 166 | mbedtls_fprintf = fprintf_func; |
JMF | 12:0071cb144c7a | 167 | return( 0 ); |
JMF | 12:0071cb144c7a | 168 | } |
JMF | 12:0071cb144c7a | 169 | #endif /* MBEDTLS_PLATFORM_FPRINTF_ALT */ |
JMF | 12:0071cb144c7a | 170 | |
JMF | 12:0071cb144c7a | 171 | #if defined(MBEDTLS_PLATFORM_EXIT_ALT) |
JMF | 12:0071cb144c7a | 172 | #if !defined(MBEDTLS_PLATFORM_STD_EXIT) |
JMF | 12:0071cb144c7a | 173 | /* |
JMF | 12:0071cb144c7a | 174 | * Make dummy function to prevent NULL pointer dereferences |
JMF | 12:0071cb144c7a | 175 | */ |
JMF | 12:0071cb144c7a | 176 | static void platform_exit_uninit( int status ) |
JMF | 12:0071cb144c7a | 177 | { |
JMF | 12:0071cb144c7a | 178 | ((void) status); |
JMF | 12:0071cb144c7a | 179 | } |
JMF | 12:0071cb144c7a | 180 | |
JMF | 12:0071cb144c7a | 181 | #define MBEDTLS_PLATFORM_STD_EXIT platform_exit_uninit |
JMF | 12:0071cb144c7a | 182 | #endif /* !MBEDTLS_PLATFORM_STD_EXIT */ |
JMF | 12:0071cb144c7a | 183 | |
JMF | 12:0071cb144c7a | 184 | void (*mbedtls_exit)( int status ) = MBEDTLS_PLATFORM_STD_EXIT; |
JMF | 12:0071cb144c7a | 185 | |
JMF | 12:0071cb144c7a | 186 | int mbedtls_platform_set_exit( void (*exit_func)( int status ) ) |
JMF | 12:0071cb144c7a | 187 | { |
JMF | 12:0071cb144c7a | 188 | mbedtls_exit = exit_func; |
JMF | 12:0071cb144c7a | 189 | return( 0 ); |
JMF | 12:0071cb144c7a | 190 | } |
JMF | 12:0071cb144c7a | 191 | #endif /* MBEDTLS_PLATFORM_EXIT_ALT */ |
JMF | 12:0071cb144c7a | 192 | |
JMF | 12:0071cb144c7a | 193 | #if defined(MBEDTLS_HAVE_TIME) |
JMF | 12:0071cb144c7a | 194 | |
JMF | 12:0071cb144c7a | 195 | #if defined(MBEDTLS_PLATFORM_TIME_ALT) |
JMF | 12:0071cb144c7a | 196 | #if !defined(MBEDTLS_PLATFORM_STD_TIME) |
JMF | 12:0071cb144c7a | 197 | /* |
JMF | 12:0071cb144c7a | 198 | * Make dummy function to prevent NULL pointer dereferences |
JMF | 12:0071cb144c7a | 199 | */ |
JMF | 12:0071cb144c7a | 200 | static mbedtls_time_t platform_time_uninit( mbedtls_time_t* timer ) |
JMF | 12:0071cb144c7a | 201 | { |
JMF | 12:0071cb144c7a | 202 | ((void) timer); |
JMF | 12:0071cb144c7a | 203 | return( 0 ); |
JMF | 12:0071cb144c7a | 204 | } |
JMF | 12:0071cb144c7a | 205 | |
JMF | 12:0071cb144c7a | 206 | #define MBEDTLS_PLATFORM_STD_TIME platform_time_uninit |
JMF | 12:0071cb144c7a | 207 | #endif /* !MBEDTLS_PLATFORM_STD_TIME */ |
JMF | 12:0071cb144c7a | 208 | |
JMF | 12:0071cb144c7a | 209 | mbedtls_time_t (*mbedtls_time)( mbedtls_time_t* timer ) = MBEDTLS_PLATFORM_STD_TIME; |
JMF | 12:0071cb144c7a | 210 | |
JMF | 12:0071cb144c7a | 211 | int mbedtls_platform_set_time( mbedtls_time_t (*time_func)( mbedtls_time_t* timer ) ) |
JMF | 12:0071cb144c7a | 212 | { |
JMF | 12:0071cb144c7a | 213 | mbedtls_time = time_func; |
JMF | 12:0071cb144c7a | 214 | return( 0 ); |
JMF | 12:0071cb144c7a | 215 | } |
JMF | 12:0071cb144c7a | 216 | #endif /* MBEDTLS_PLATFORM_TIME_ALT */ |
JMF | 12:0071cb144c7a | 217 | |
JMF | 12:0071cb144c7a | 218 | #endif /* MBEDTLS_HAVE_TIME */ |
JMF | 12:0071cb144c7a | 219 | |
JMF | 12:0071cb144c7a | 220 | #if defined(MBEDTLS_ENTROPY_NV_SEED) |
JMF | 12:0071cb144c7a | 221 | #if !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS) && defined(MBEDTLS_FS_IO) |
JMF | 12:0071cb144c7a | 222 | /* Default implementations for the platform independent seed functions use |
JMF | 12:0071cb144c7a | 223 | * standard libc file functions to read from and write to a pre-defined filename |
JMF | 12:0071cb144c7a | 224 | */ |
JMF | 12:0071cb144c7a | 225 | int mbedtls_platform_std_nv_seed_read( unsigned char *buf, size_t buf_len ) |
JMF | 12:0071cb144c7a | 226 | { |
JMF | 12:0071cb144c7a | 227 | FILE *file; |
JMF | 12:0071cb144c7a | 228 | size_t n; |
JMF | 12:0071cb144c7a | 229 | |
JMF | 12:0071cb144c7a | 230 | if( ( file = fopen( MBEDTLS_PLATFORM_STD_NV_SEED_FILE, "rb" ) ) == NULL ) |
JMF | 12:0071cb144c7a | 231 | return -1; |
JMF | 12:0071cb144c7a | 232 | |
JMF | 12:0071cb144c7a | 233 | if( ( n = fread( buf, 1, buf_len, file ) ) != buf_len ) |
JMF | 12:0071cb144c7a | 234 | { |
JMF | 12:0071cb144c7a | 235 | fclose( file ); |
JMF | 12:0071cb144c7a | 236 | return -1; |
JMF | 12:0071cb144c7a | 237 | } |
JMF | 12:0071cb144c7a | 238 | |
JMF | 12:0071cb144c7a | 239 | fclose( file ); |
JMF | 12:0071cb144c7a | 240 | return( n ); |
JMF | 12:0071cb144c7a | 241 | } |
JMF | 12:0071cb144c7a | 242 | |
JMF | 12:0071cb144c7a | 243 | int mbedtls_platform_std_nv_seed_write( unsigned char *buf, size_t buf_len ) |
JMF | 12:0071cb144c7a | 244 | { |
JMF | 12:0071cb144c7a | 245 | FILE *file; |
JMF | 12:0071cb144c7a | 246 | size_t n; |
JMF | 12:0071cb144c7a | 247 | |
JMF | 12:0071cb144c7a | 248 | if( ( file = fopen( MBEDTLS_PLATFORM_STD_NV_SEED_FILE, "w" ) ) == NULL ) |
JMF | 12:0071cb144c7a | 249 | return -1; |
JMF | 12:0071cb144c7a | 250 | |
JMF | 12:0071cb144c7a | 251 | if( ( n = fwrite( buf, 1, buf_len, file ) ) != buf_len ) |
JMF | 12:0071cb144c7a | 252 | { |
JMF | 12:0071cb144c7a | 253 | fclose( file ); |
JMF | 12:0071cb144c7a | 254 | return -1; |
JMF | 12:0071cb144c7a | 255 | } |
JMF | 12:0071cb144c7a | 256 | |
JMF | 12:0071cb144c7a | 257 | fclose( file ); |
JMF | 12:0071cb144c7a | 258 | return( n ); |
JMF | 12:0071cb144c7a | 259 | } |
JMF | 12:0071cb144c7a | 260 | #endif /* MBEDTLS_PLATFORM_NO_STD_FUNCTIONS */ |
JMF | 12:0071cb144c7a | 261 | |
JMF | 12:0071cb144c7a | 262 | #if defined(MBEDTLS_PLATFORM_NV_SEED_ALT) |
JMF | 12:0071cb144c7a | 263 | #if !defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) |
JMF | 12:0071cb144c7a | 264 | /* |
JMF | 12:0071cb144c7a | 265 | * Make dummy function to prevent NULL pointer dereferences |
JMF | 12:0071cb144c7a | 266 | */ |
JMF | 12:0071cb144c7a | 267 | static int platform_nv_seed_read_uninit( unsigned char *buf, size_t buf_len ) |
JMF | 12:0071cb144c7a | 268 | { |
JMF | 12:0071cb144c7a | 269 | ((void) buf); |
JMF | 12:0071cb144c7a | 270 | ((void) buf_len); |
JMF | 12:0071cb144c7a | 271 | return( -1 ); |
JMF | 12:0071cb144c7a | 272 | } |
JMF | 12:0071cb144c7a | 273 | |
JMF | 12:0071cb144c7a | 274 | #define MBEDTLS_PLATFORM_STD_NV_SEED_READ platform_nv_seed_read_uninit |
JMF | 12:0071cb144c7a | 275 | #endif /* !MBEDTLS_PLATFORM_STD_NV_SEED_READ */ |
JMF | 12:0071cb144c7a | 276 | |
JMF | 12:0071cb144c7a | 277 | #if !defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) |
JMF | 12:0071cb144c7a | 278 | /* |
JMF | 12:0071cb144c7a | 279 | * Make dummy function to prevent NULL pointer dereferences |
JMF | 12:0071cb144c7a | 280 | */ |
JMF | 12:0071cb144c7a | 281 | static int platform_nv_seed_write_uninit( unsigned char *buf, size_t buf_len ) |
JMF | 12:0071cb144c7a | 282 | { |
JMF | 12:0071cb144c7a | 283 | ((void) buf); |
JMF | 12:0071cb144c7a | 284 | ((void) buf_len); |
JMF | 12:0071cb144c7a | 285 | return( -1 ); |
JMF | 12:0071cb144c7a | 286 | } |
JMF | 12:0071cb144c7a | 287 | |
JMF | 12:0071cb144c7a | 288 | #define MBEDTLS_PLATFORM_STD_NV_SEED_WRITE platform_nv_seed_write_uninit |
JMF | 12:0071cb144c7a | 289 | #endif /* !MBEDTLS_PLATFORM_STD_NV_SEED_WRITE */ |
JMF | 12:0071cb144c7a | 290 | |
JMF | 12:0071cb144c7a | 291 | int (*mbedtls_nv_seed_read)( unsigned char *buf, size_t buf_len ) = |
JMF | 12:0071cb144c7a | 292 | MBEDTLS_PLATFORM_STD_NV_SEED_READ; |
JMF | 12:0071cb144c7a | 293 | int (*mbedtls_nv_seed_write)( unsigned char *buf, size_t buf_len ) = |
JMF | 12:0071cb144c7a | 294 | MBEDTLS_PLATFORM_STD_NV_SEED_WRITE; |
JMF | 12:0071cb144c7a | 295 | |
JMF | 12:0071cb144c7a | 296 | int mbedtls_platform_set_nv_seed( |
JMF | 12:0071cb144c7a | 297 | int (*nv_seed_read_func)( unsigned char *buf, size_t buf_len ), |
JMF | 12:0071cb144c7a | 298 | int (*nv_seed_write_func)( unsigned char *buf, size_t buf_len ) ) |
JMF | 12:0071cb144c7a | 299 | { |
JMF | 12:0071cb144c7a | 300 | mbedtls_nv_seed_read = nv_seed_read_func; |
JMF | 12:0071cb144c7a | 301 | mbedtls_nv_seed_write = nv_seed_write_func; |
JMF | 12:0071cb144c7a | 302 | return( 0 ); |
JMF | 12:0071cb144c7a | 303 | } |
JMF | 12:0071cb144c7a | 304 | #endif /* MBEDTLS_PLATFORM_NV_SEED_ALT */ |
JMF | 12:0071cb144c7a | 305 | #endif /* MBEDTLS_ENTROPY_NV_SEED */ |
JMF | 12:0071cb144c7a | 306 | |
JMF | 12:0071cb144c7a | 307 | #endif /* MBEDTLS_PLATFORM_C */ |