| Secure Function Type | +Description | +Remarks | +
|---|---|---|
| xxx_s | +Secure function API of Huawei Secure C library | +It can be used when the Huawei Secure C library is integrated. | +
| xxx_sp | +API of Huawei Secure C library with optimized secure function performance (macro implementation) | ++ If count, destMax, and strSrc are constants, the performance-optimized macro interface displays its effect. If they are variables, the performance optimization effect is not obvious. The macro interface usage policy is as follows: The _s interface is used by default. The _sp interface is restricted in performance-sensitive call sites. The restriction scenarios are as follows: + a) memset_sp and memcpy_sp: destMax and count are constants. + b) strcpy_sp or strcat_sp: destMax is a constant and strSrc is a literal. + c) strncpy_sp or strncat_sp: destMax and count are constants and strSrc is a literal. | +
| Function Type | +Dangerous Function | +Secure Surrogate Function | +
|---|---|---|
| Memory copy | +memcpy or bcopy | +memcpy_s | +
| wmemcpy | +wmemcpy_s | +|
| memmove | +memmove_s | +|
| wmemmove | +wmemmove_s | +|
| String copy | +strcpy | +strcpy_s | +
| wcscpy | +wcscpy_s | +|
| strncpy | +strncpy_s | +|
| wcsncpy | +wcsncpy_s | +|
| Character string concatenation | +strcat | +strcat_s | +
| wcscat | +wcscat_s | +|
| strncat | +strncat_s | +|
| wcsncat | +wcsncat_s | +|
| Format output | +sprintf | +sprintf_s | +
| swprintf | +swprintf_s | +|
| vsprintf | +vsprintf_s | +|
| vswprintf | +vswprintf_s | +|
| snprintf | +snprintf_s or snprintf_truncated_s | +|
| vsnprintf | +vsnprintf_s or vsnprintf_truncated_s | +|
| Format input | +scanf | +scanf_s | +
| wscanf | +wscanf_s | +|
| vscanf | +vscanf_s | +|
| vwscanf | +vwscanf_s | +|
| fscanf | +fscanf_s | +|
| fwscanf | +fwscanf_s | +|
| vfscanf | +vfscanf_s | +|
| vfwscanf | +vfwscanf_s | +|
| sscanf | +sscanf_s | +|
| swscanf | +swscanf_s | +|
| vsscanf | +vsscanf_s | +|
| vswscanf | +vswscanf_s | +|
| Standard input stream input | +gets | +gets_s | +
| Memory initialization | +memset | +memset_s | +