1 /* 2 * Copyright (c) 2009-2022 Huawei Technologies Co., Ltd. All rights reserved. 3 * 4 * UniProton is licensed under Mulan PSL v2. 5 * You can use this software according to the terms and conditions of the Mulan PSL v2. 6 * You may obtain a copy of Mulan PSL v2 at: 7 * http://license.coscl.org.cn/MulanPSL2 8 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 9 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 10 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 11 * See the Mulan PSL v2 for more details. 12 * Create: 2009-06-20 13 * Description: 随机化功能的C文件。 14 */ 15 #include "prt_sys.h" 16 #include "prt_attr_external.h" 17 18 OS_SEC_L4_DATA U32 g_memCanaryRdm = 0; 19 PRT_SysSetRndNum(enum SysRndNumType type,U32 rndNum)20OS_SEC_L4_TEXT U32 PRT_SysSetRndNum(enum SysRndNumType type, U32 rndNum) 21 { 22 switch (type) { 23 case OS_SYS_RND_STACK_PROTECT: 24 g_memCanaryRdm = rndNum; 25 break; 26 default: 27 return OS_ERRNO_SYS_RND_PARA_INVALID; 28 } 29 return OS_OK; 30 } 31