]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/corecrypto/cc/src/cc_clear.c
a163e900de070a356308cfa16298e513846208d8
5 * Created on 05/21/2014
7 * Copyright (c) 2014,2015 Apple Inc. All rights reserved.
11 #include <corecrypto/cc.h>
13 //rdar://problem/26986552
15 #if ( CC_HAS_MEMSET_S == 1 ) && (defined( __STDC_WANT_LIB_EXT1__ ) && ( __STDC_WANT_LIB_EXT1__ == 1 ) )
16 void cc_clear(size_t len
, void *dst
)
18 memset_s(dst
,len
,0,len
);
20 #elif defined(_WIN32) && !defined(__clang__) //Clang with Microsoft CodeGen, doesn't support SecureZeroMemory
22 static void cc_clear(size_t len
, void *dst
)
24 SecureZeroMemory(dst
, len
);
27 void cc_clear(size_t len
, void *dst
)
29 volatile char *vptr
= (volatile char *)dst
;
35 /* This is an altarnative for clang that should work
36 void cc_clear(size_t len, void *dst) __attribute__ ((optnone))