Includes library modifications to allow access to AIN_4 (AIN_0 / 5)

Committer:
bryantaylor
Date:
Tue Sep 20 21:26:12 2016 +0000
Revision:
0:eafc3fd41f75
hackathon

Who changed what in which revision?

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