Fix error code and return value.
This commit is contained in:
parent
7352853609
commit
a4818ad3dd
|
@ -55,7 +55,8 @@ rt_err_t rt_hwcrypto_symmetric_crypt(struct rt_hwcrypto_ctx *ctx, hwcrypto_mode
|
||||||
struct hwcrypto_symmetric_info symmetric_info;
|
struct hwcrypto_symmetric_info symmetric_info;
|
||||||
rt_err_t err;
|
rt_err_t err;
|
||||||
|
|
||||||
if (ctx == RT_NULL)
|
if ((ctx == RT_NULL) ||
|
||||||
|
(mode != HWCRYPTO_MODE_ENCRYPT && mode != HWCRYPTO_MODE_DECRYPT))
|
||||||
{
|
{
|
||||||
return -RT_EINVAL;
|
return -RT_EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -64,10 +65,6 @@ rt_err_t rt_hwcrypto_symmetric_crypt(struct rt_hwcrypto_ctx *ctx, hwcrypto_mode
|
||||||
{
|
{
|
||||||
return -RT_ERROR;
|
return -RT_ERROR;
|
||||||
}
|
}
|
||||||
if (mode != HWCRYPTO_MODE_ENCRYPT && mode != HWCRYPTO_MODE_DECRYPT)
|
|
||||||
{
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Input information packaging */
|
/* Input information packaging */
|
||||||
symmetric_info.mode = mode;
|
symmetric_info.mode = mode;
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <sys/errno.h>
|
||||||
|
|
||||||
#include <at_socket.h>
|
#include <at_socket.h>
|
||||||
#include <at_device.h>
|
#include <at_device.h>
|
||||||
|
@ -1100,7 +1101,7 @@ static uint32_t ipstr_to_u32(char *ipstr)
|
||||||
struct hostent *at_gethostbyname(const char *name)
|
struct hostent *at_gethostbyname(const char *name)
|
||||||
{
|
{
|
||||||
struct at_device *device = RT_NULL;
|
struct at_device *device = RT_NULL;
|
||||||
ip_addr_t addr;
|
ip_addr_t addr = {0};
|
||||||
char ipstr[16] = { 0 };
|
char ipstr[16] = { 0 };
|
||||||
/* buffer variables for at_gethostbyname() */
|
/* buffer variables for at_gethostbyname() */
|
||||||
static struct hostent s_hostent;
|
static struct hostent s_hostent;
|
||||||
|
|
Loading…
Reference in New Issue