1 /* 2 * Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 8 #include "cc_pal_types.h" 9 #include "cc_pal_log.h" 10 11 /* Implementation that should never be optimized out by the compiler */ 12 mbedtls_zeroize_internal(void * v,size_t n)13void mbedtls_zeroize_internal( void *v, size_t n ) 14 { 15 volatile unsigned char *p = NULL; 16 if( NULL == v ) 17 { 18 CC_PAL_LOG_ERR( "input is NULL\n" ); 19 return; 20 } 21 p = (unsigned char*)v; while( n-- ) *p++ = 0; 22 } 23 24