1 /* 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * Description: 系统适配层标准输出接口(此文件为DEMO,需集成方适配修改) 15 */ 16 #ifndef HILINK_STDIO_ADAPTER_H 17 #define HILINK_STDIO_ADAPTER_H 18 19 #include <stdarg.h> 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 /* 26 * 描述: 将数据格式化打印到流 27 * 参数: format,可包含格式化符号的待打印字符串 28 * ap, 可变参数,根据格式化符号插入字符串中 29 * 返回: 0成功,其他失败 30 */ 31 int HILINK_Vprintf(const char *format, va_list ap); 32 33 /* 34 * 描述: 将数据格式化打印到流 35 * 参数: format,可包含格式化符号的待打印字符串 36 * ..., 可变参数列表,根据格式化符号插入字符串中 37 * 返回: 0成功,其他失败 38 */ 39 int HILINK_Printf(const char *format, ...); 40 41 /* 42 * 功能: 随机数生成 43 * 参数: 1) input,出入参,随机数缓冲区 44 * 2) len,随机数字节长度 45 * 返回: 0获取成功 -1获取失败 46 * 注意: 该接口不可用于安全用途 47 */ 48 int HILINK_Rand(unsigned char *input, unsigned int len); 49 50 /* 51 * 功能: 真随机数生成 52 * 参数: 1) input,出入参,随机数缓冲区 53 * 2) len,随机数字节长度 54 * 返回: 0获取成功 -1获取失败 55 * 注意: 对于无安全随机数能力的平台,该接口直接返回-1 56 * 该接口仅用作生成安全随机数熵源,HiLink SDK不直接使用 57 */ 58 int HILINK_Trng(unsigned char *input, unsigned int len); 59 60 #ifdef __cplusplus 61 } 62 #endif 63 64 #endif /* HILINK_STDIO_ADAPTER_H */