154568cb3Sopenharmony_ci/*
254568cb3Sopenharmony_ci * Copyright (c) 2009-2022 Huawei Technologies Co., Ltd. All rights reserved.
354568cb3Sopenharmony_ci *
454568cb3Sopenharmony_ci * UniProton is licensed under Mulan PSL v2.
554568cb3Sopenharmony_ci * You can use this software according to the terms and conditions of the Mulan PSL v2.
654568cb3Sopenharmony_ci * You may obtain a copy of Mulan PSL v2 at:
754568cb3Sopenharmony_ci *          http://license.coscl.org.cn/MulanPSL2
854568cb3Sopenharmony_ci * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
954568cb3Sopenharmony_ci * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
1054568cb3Sopenharmony_ci * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
1154568cb3Sopenharmony_ci * See the Mulan PSL v2 for more details.
1254568cb3Sopenharmony_ci * Create: 2009-06-20
1354568cb3Sopenharmony_ci * Description: 随机化功能的C文件。
1454568cb3Sopenharmony_ci */
1554568cb3Sopenharmony_ci#include "prt_sys.h"
1654568cb3Sopenharmony_ci#include "prt_attr_external.h"
1754568cb3Sopenharmony_ci
1854568cb3Sopenharmony_ciOS_SEC_L4_DATA U32 g_memCanaryRdm = 0;
1954568cb3Sopenharmony_ci
2054568cb3Sopenharmony_ciOS_SEC_L4_TEXT U32 PRT_SysSetRndNum(enum SysRndNumType type, U32 rndNum)
2154568cb3Sopenharmony_ci{
2254568cb3Sopenharmony_ci    switch (type) {
2354568cb3Sopenharmony_ci        case OS_SYS_RND_STACK_PROTECT:
2454568cb3Sopenharmony_ci            g_memCanaryRdm = rndNum;
2554568cb3Sopenharmony_ci            break;
2654568cb3Sopenharmony_ci        default:
2754568cb3Sopenharmony_ci            return OS_ERRNO_SYS_RND_PARA_INVALID;
2854568cb3Sopenharmony_ci    }
2954568cb3Sopenharmony_ci    return OS_OK;
3054568cb3Sopenharmony_ci}
31