memset, memcpy, sizeof consistency fixes
Just as with the OPENSSL_malloc calls, consistently use sizeof(*ptr) for memset and memcpy. Remove needless casts for those functions. For memset, replace alternative forms of zero with 0. Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
parent
12048657a9
commit
16f8d4ebf0
76 changed files with 198 additions and 223 deletions
|
@ -795,7 +795,7 @@ void opt_help(const OPTIONS *list)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pad out prefix */
|
/* Pad out prefix */
|
||||||
memset(start, ' ', sizeof start - 1);
|
memset(start, ' ', sizeof(start) - 1);
|
||||||
start[sizeof start - 1] = '\0';
|
start[sizeof start - 1] = '\0';
|
||||||
|
|
||||||
if (o->name == OPT_MORE_STR) {
|
if (o->name == OPT_MORE_STR) {
|
||||||
|
@ -821,7 +821,7 @@ void opt_help(const OPTIONS *list)
|
||||||
if ((int)(p - start) >= MAX_OPT_HELP_WIDTH) {
|
if ((int)(p - start) >= MAX_OPT_HELP_WIDTH) {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
BIO_printf(bio_err, "%s\n", start);
|
BIO_printf(bio_err, "%s\n", start);
|
||||||
memset(start, ' ', sizeof start);
|
memset(start, ' ', sizeof(start));
|
||||||
}
|
}
|
||||||
start[width] = '\0';
|
start[width] = '\0';
|
||||||
BIO_printf(bio_err, "%s %s\n", start, help);
|
BIO_printf(bio_err, "%s %s\n", start, help);
|
||||||
|
|
|
@ -144,7 +144,7 @@ typedef fd_mask fd_set;
|
||||||
# define FD_SET(n, p) (*(p) |= (1 << ((n) % NFDBITS)))
|
# define FD_SET(n, p) (*(p) |= (1 << ((n) % NFDBITS)))
|
||||||
# define FD_CLR(n, p) (*(p) &= ~(1 << ((n) % NFDBITS)))
|
# define FD_CLR(n, p) (*(p) &= ~(1 << ((n) % NFDBITS)))
|
||||||
# define FD_ISSET(n, p) (*(p) & (1 << ((n) % NFDBITS)))
|
# define FD_ISSET(n, p) (*(p) & (1 << ((n) % NFDBITS)))
|
||||||
# define FD_ZERO(p) memset((char *)(p), 0, sizeof(*(p)))
|
# define FD_ZERO(p) memset((p), 0, sizeof(*(p)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PORT 4433
|
#define PORT 4433
|
||||||
|
|
|
@ -252,7 +252,7 @@ static int init_client_ip(int *sock, const unsigned char ip[4], int port,
|
||||||
if (!ssl_sock_init())
|
if (!ssl_sock_init())
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
memset((char *)&them, 0, sizeof(them));
|
memset(&them, 0, sizeof(them));
|
||||||
them.sin_family = AF_INET;
|
them.sin_family = AF_INET;
|
||||||
them.sin_port = htons((unsigned short)port);
|
them.sin_port = htons((unsigned short)port);
|
||||||
addr = (unsigned long)
|
addr = (unsigned long)
|
||||||
|
@ -308,7 +308,7 @@ int init_client_unix(int *sock, const char *server)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset((char *)&them, 0, sizeof(them));
|
memset(&them, 0, sizeof(them));
|
||||||
them.sun_family = AF_UNIX;
|
them.sun_family = AF_UNIX;
|
||||||
strcpy(them.sun_path, server);
|
strcpy(them.sun_path, server);
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ static int init_server_long(int *sock, int port, char *ip, int type)
|
||||||
if (!ssl_sock_init())
|
if (!ssl_sock_init())
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
memset((char *)&server, 0, sizeof(server));
|
memset(&server, 0, sizeof(server));
|
||||||
server.sin_family = AF_INET;
|
server.sin_family = AF_INET;
|
||||||
server.sin_port = htons((unsigned short)port);
|
server.sin_port = htons((unsigned short)port);
|
||||||
if (ip == NULL)
|
if (ip == NULL)
|
||||||
|
@ -475,7 +475,7 @@ static int init_server_unix(int *sock, const char *path)
|
||||||
if (s == INVALID_SOCKET)
|
if (s == INVALID_SOCKET)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
memset((char *)&server, 0, sizeof(server));
|
memset(&server, 0, sizeof(server));
|
||||||
server.sun_family = AF_UNIX;
|
server.sun_family = AF_UNIX;
|
||||||
strcpy(server.sun_path, path);
|
strcpy(server.sun_path, path);
|
||||||
|
|
||||||
|
@ -518,7 +518,7 @@ static int do_accept(int acc_sock, int *sock, char **host)
|
||||||
redoit:
|
redoit:
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
memset((char *)&from, 0, sizeof(from));
|
memset(&from, 0, sizeof(from));
|
||||||
len = sizeof(from);
|
len = sizeof(from);
|
||||||
/*
|
/*
|
||||||
* Note: under VMS with SOCKETSHR the fourth parameter is currently of
|
* Note: under VMS with SOCKETSHR the fourth parameter is currently of
|
||||||
|
|
|
@ -83,7 +83,7 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
memset(*ctx, '\0', sizeof(**ctx));
|
memset(*ctx, 0, sizeof(**ctx));
|
||||||
|
|
||||||
(*ctx)->dir = opendir(directory);
|
(*ctx)->dir = opendir(directory);
|
||||||
if ((*ctx)->dir == NULL) {
|
if ((*ctx)->dir == NULL) {
|
||||||
|
|
|
@ -109,7 +109,7 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
memset(*ctx, '\0', sizeof(**ctx));
|
memset(*ctx, 0, sizeof(**ctx));
|
||||||
|
|
||||||
strcpy((*ctx)->filespec, directory);
|
strcpy((*ctx)->filespec, directory);
|
||||||
strcat((*ctx)->filespec, "*.*;");
|
strcat((*ctx)->filespec, "*.*;");
|
||||||
|
|
|
@ -74,7 +74,7 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
memset(*ctx, '\0', sizeof(**ctx));
|
memset(*ctx, 0, sizeof(**ctx));
|
||||||
|
|
||||||
if (directory[dirlen - 1] != '*') {
|
if (directory[dirlen - 1] != '*') {
|
||||||
extdirbuf = (char *)malloc(dirlen + 3);
|
extdirbuf = (char *)malloc(dirlen + 3);
|
||||||
|
|
|
@ -77,7 +77,7 @@ int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v)
|
||||||
if (a->length < (int)(sizeof(long) + 1)) {
|
if (a->length < (int)(sizeof(long) + 1)) {
|
||||||
OPENSSL_free(a->data);
|
OPENSSL_free(a->data);
|
||||||
if ((a->data = OPENSSL_malloc(sizeof(long) + 1)) != NULL)
|
if ((a->data = OPENSSL_malloc(sizeof(long) + 1)) != NULL)
|
||||||
memset((char *)a->data, 0, sizeof(long) + 1);
|
memset(a->data, 0, sizeof(long) + 1);
|
||||||
}
|
}
|
||||||
if (a->data == NULL) {
|
if (a->data == NULL) {
|
||||||
ASN1err(ASN1_F_ASN1_ENUMERATED_SET, ERR_R_MALLOC_FAILURE);
|
ASN1err(ASN1_F_ASN1_ENUMERATED_SET, ERR_R_MALLOC_FAILURE);
|
||||||
|
|
|
@ -349,7 +349,7 @@ int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
|
||||||
if (a->length < (int)(sizeof(long) + 1)) {
|
if (a->length < (int)(sizeof(long) + 1)) {
|
||||||
OPENSSL_free(a->data);
|
OPENSSL_free(a->data);
|
||||||
if ((a->data = OPENSSL_malloc(sizeof(long) + 1)) != NULL)
|
if ((a->data = OPENSSL_malloc(sizeof(long) + 1)) != NULL)
|
||||||
memset((char *)a->data, 0, sizeof(long) + 1);
|
memset(a->data, 0, sizeof(long) + 1);
|
||||||
}
|
}
|
||||||
if (a->data == NULL) {
|
if (a->data == NULL) {
|
||||||
ASN1err(ASN1_F_ASN1_INTEGER_SET, ERR_R_MALLOC_FAILURE);
|
ASN1err(ASN1_F_ASN1_INTEGER_SET, ERR_R_MALLOC_FAILURE);
|
||||||
|
|
|
@ -121,11 +121,6 @@ int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *a, ASN1_BIT_STRING *signature,
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* we don't need to zero the 'ctx' because we just checked public
|
|
||||||
* information
|
|
||||||
*/
|
|
||||||
/* memset(&ctx,0,sizeof(ctx)); */
|
|
||||||
ret = 1;
|
ret = 1;
|
||||||
err:
|
err:
|
||||||
EVP_MD_CTX_cleanup(&ctx);
|
EVP_MD_CTX_cleanup(&ctx);
|
||||||
|
@ -221,11 +216,6 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a,
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* we don't need to zero the 'ctx' because we just checked public
|
|
||||||
* information
|
|
||||||
*/
|
|
||||||
/* memset(&ctx,0,sizeof(ctx)); */
|
|
||||||
ret = 1;
|
ret = 1;
|
||||||
err:
|
err:
|
||||||
EVP_MD_CTX_cleanup(&ctx);
|
EVP_MD_CTX_cleanup(&ctx);
|
||||||
|
|
|
@ -288,8 +288,7 @@ EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags,
|
||||||
if (!ameth)
|
if (!ameth)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
memset(ameth, 0, sizeof(EVP_PKEY_ASN1_METHOD));
|
memset(ameth, 0, sizeof(*ameth));
|
||||||
|
|
||||||
ameth->pkey_id = id;
|
ameth->pkey_id = id;
|
||||||
ameth->pkey_base_id = id;
|
ameth->pkey_base_id = id;
|
||||||
ameth->pkey_flags = flags | ASN1_PKEY_DYNAMIC;
|
ameth->pkey_flags = flags | ASN1_PKEY_DYNAMIC;
|
||||||
|
|
|
@ -484,7 +484,7 @@ int BIO_get_accept_socket(char *host, int bind_mode)
|
||||||
if (!BIO_get_port(p, &port))
|
if (!BIO_get_port(p, &port))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
memset((char *)&server, 0, sizeof(server));
|
memset(&server, 0, sizeof(server));
|
||||||
server.sa_in.sin_family = AF_INET;
|
server.sa_in.sin_family = AF_INET;
|
||||||
server.sa_in.sin_port = htons(port);
|
server.sa_in.sin_port = htons(port);
|
||||||
addrlen = sizeof(server.sa_in);
|
addrlen = sizeof(server.sa_in);
|
||||||
|
|
|
@ -140,7 +140,7 @@ static BIO_ACCEPT *BIO_ACCEPT_new(void)
|
||||||
if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
|
if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
memset(ret, 0, sizeof(BIO_ACCEPT));
|
memset(ret, 0, sizeof(*ret));
|
||||||
ret->accept_sock = INVALID_SOCKET;
|
ret->accept_sock = INVALID_SOCKET;
|
||||||
ret->bind_mode = BIO_BIND_NORMAL;
|
ret->bind_mode = BIO_BIND_NORMAL;
|
||||||
return (ret);
|
return (ret);
|
||||||
|
|
|
@ -178,7 +178,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
|
||||||
|
|
||||||
case BIO_CONN_S_CREATE_SOCKET:
|
case BIO_CONN_S_CREATE_SOCKET:
|
||||||
/* now setup address */
|
/* now setup address */
|
||||||
memset((char *)&c->them, 0, sizeof(c->them));
|
memset(&c->them, 0, sizeof(c->them));
|
||||||
c->them.sin_family = AF_INET;
|
c->them.sin_family = AF_INET;
|
||||||
c->them.sin_port = htons((unsigned short)c->port);
|
c->them.sin_port = htons((unsigned short)c->port);
|
||||||
l = (unsigned long)
|
l = (unsigned long)
|
||||||
|
@ -298,7 +298,7 @@ BIO_CONNECT *BIO_CONNECT_new(void)
|
||||||
ret->ip[2] = 0;
|
ret->ip[2] = 0;
|
||||||
ret->ip[3] = 0;
|
ret->ip[3] = 0;
|
||||||
ret->port = 0;
|
ret->port = 0;
|
||||||
memset((char *)&ret->them, 0, sizeof(ret->them));
|
memset(&ret->them, 0, sizeof(ret->them));
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ static int dgram_new(BIO *bi)
|
||||||
data = OPENSSL_malloc(sizeof(*data));
|
data = OPENSSL_malloc(sizeof(*data));
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
memset(data, 0x00, sizeof(bio_dgram_data));
|
memset(data, 0, sizeof(*data));
|
||||||
bi->ptr = data;
|
bi->ptr = data;
|
||||||
|
|
||||||
bi->flags = 0;
|
bi->flags = 0;
|
||||||
|
@ -395,7 +395,7 @@ static int dgram_read(BIO *b, char *out, int outl)
|
||||||
|
|
||||||
if (out != NULL) {
|
if (out != NULL) {
|
||||||
clear_socket_error();
|
clear_socket_error();
|
||||||
memset(&sa.peer, 0x00, sizeof(sa.peer));
|
memset(&sa.peer, 0, sizeof(sa.peer));
|
||||||
dgram_adjust_rcv_timeout(b);
|
dgram_adjust_rcv_timeout(b);
|
||||||
ret = recvfrom(b->num, out, outl, 0, &sa.peer.sa, (void *)&sa.len);
|
ret = recvfrom(b->num, out, outl, 0, &sa.peer.sa, (void *)&sa.len);
|
||||||
if (sizeof(sa.len.i) != sizeof(sa.len.s) && sa.len.i == 0) {
|
if (sizeof(sa.len.i) != sizeof(sa.len.s) && sa.len.i == 0) {
|
||||||
|
@ -569,7 +569,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||||
case BIO_CTRL_DGRAM_MTU_DISCOVER:
|
case BIO_CTRL_DGRAM_MTU_DISCOVER:
|
||||||
# if defined(OPENSSL_SYS_LINUX) && defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO)
|
# if defined(OPENSSL_SYS_LINUX) && defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO)
|
||||||
addr_len = (socklen_t) sizeof(addr);
|
addr_len = (socklen_t) sizeof(addr);
|
||||||
memset((void *)&addr, 0, sizeof(addr));
|
memset(&addr, 0, sizeof(addr));
|
||||||
if (getsockname(b->num, &addr.sa, &addr_len) < 0) {
|
if (getsockname(b->num, &addr.sa, &addr_len) < 0) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -600,7 +600,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||||
case BIO_CTRL_DGRAM_QUERY_MTU:
|
case BIO_CTRL_DGRAM_QUERY_MTU:
|
||||||
# if defined(OPENSSL_SYS_LINUX) && defined(IP_MTU)
|
# if defined(OPENSSL_SYS_LINUX) && defined(IP_MTU)
|
||||||
addr_len = (socklen_t) sizeof(addr);
|
addr_len = (socklen_t) sizeof(addr);
|
||||||
memset((void *)&addr, 0, sizeof(addr));
|
memset(&addr, 0, sizeof(addr));
|
||||||
if (getsockname(b->num, &addr.sa, &addr_len) < 0) {
|
if (getsockname(b->num, &addr.sa, &addr_len) < 0) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -693,7 +693,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
data->connected = 0;
|
data->connected = 0;
|
||||||
memset(&(data->peer), 0x00, sizeof(data->peer));
|
memset(&data->peer, 0, sizeof(data->peer));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BIO_CTRL_DGRAM_GET_PEER:
|
case BIO_CTRL_DGRAM_GET_PEER:
|
||||||
|
@ -1028,7 +1028,7 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
|
||||||
|
|
||||||
# ifdef SCTP_AUTHENTICATION_EVENT
|
# ifdef SCTP_AUTHENTICATION_EVENT
|
||||||
# ifdef SCTP_EVENT
|
# ifdef SCTP_EVENT
|
||||||
memset(&event, 0, sizeof(struct sctp_event));
|
memset(&event, 0, sizeof(event));
|
||||||
event.se_assoc_id = 0;
|
event.se_assoc_id = 0;
|
||||||
event.se_type = SCTP_AUTHENTICATION_EVENT;
|
event.se_type = SCTP_AUTHENTICATION_EVENT;
|
||||||
event.se_on = 1;
|
event.se_on = 1;
|
||||||
|
@ -1088,7 +1088,7 @@ static int dgram_sctp_new(BIO *bi)
|
||||||
data = OPENSSL_malloc(sizeof(*data));
|
data = OPENSSL_malloc(sizeof(*data));
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
memset(data, 0x00, sizeof(bio_dgram_sctp_data));
|
memset(data, 0, sizeof(*data));
|
||||||
# ifdef SCTP_PR_SCTP_NONE
|
# ifdef SCTP_PR_SCTP_NONE
|
||||||
data->prinfo.pr_policy = SCTP_PR_SCTP_NONE;
|
data->prinfo.pr_policy = SCTP_PR_SCTP_NONE;
|
||||||
# endif
|
# endif
|
||||||
|
@ -1149,8 +1149,7 @@ static int dgram_sctp_read(BIO *b, char *out, int outl)
|
||||||
clear_socket_error();
|
clear_socket_error();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
memset(&data->rcvinfo, 0x00,
|
memset(&data->rcvinfo, 0, sizeof(data->rcvinfo));
|
||||||
sizeof(struct bio_dgram_sctp_rcvinfo));
|
|
||||||
iov.iov_base = out;
|
iov.iov_base = out;
|
||||||
iov.iov_len = outl;
|
iov.iov_len = outl;
|
||||||
msg.msg_name = NULL;
|
msg.msg_name = NULL;
|
||||||
|
@ -1229,7 +1228,7 @@ static int dgram_sctp_read(BIO *b, char *out, int outl)
|
||||||
|
|
||||||
/* disable sender dry event */
|
/* disable sender dry event */
|
||||||
# ifdef SCTP_EVENT
|
# ifdef SCTP_EVENT
|
||||||
memset(&event, 0, sizeof(struct sctp_event));
|
memset(&event, 0, sizeof(event));
|
||||||
event.se_assoc_id = 0;
|
event.se_assoc_id = 0;
|
||||||
event.se_type = SCTP_SENDER_DRY_EVENT;
|
event.se_type = SCTP_SENDER_DRY_EVENT;
|
||||||
event.se_on = 0;
|
event.se_on = 0;
|
||||||
|
@ -1393,7 +1392,7 @@ static int dgram_sctp_write(BIO *b, const char *in, int inl)
|
||||||
* parameters and flags.
|
* parameters and flags.
|
||||||
*/
|
*/
|
||||||
if (in[0] != 23) {
|
if (in[0] != 23) {
|
||||||
memset(&handshake_sinfo, 0x00, sizeof(struct bio_dgram_sctp_sndinfo));
|
memset(&handshake_sinfo, 0, sizeof(handshake_sinfo));
|
||||||
# ifdef SCTP_SACK_IMMEDIATELY
|
# ifdef SCTP_SACK_IMMEDIATELY
|
||||||
handshake_sinfo.snd_flags = SCTP_SACK_IMMEDIATELY;
|
handshake_sinfo.snd_flags = SCTP_SACK_IMMEDIATELY;
|
||||||
# endif
|
# endif
|
||||||
|
@ -1433,7 +1432,7 @@ static int dgram_sctp_write(BIO *b, const char *in, int inl)
|
||||||
cmsg->cmsg_type = SCTP_SNDINFO;
|
cmsg->cmsg_type = SCTP_SNDINFO;
|
||||||
cmsg->cmsg_len = CMSG_LEN(sizeof(struct sctp_sndinfo));
|
cmsg->cmsg_len = CMSG_LEN(sizeof(struct sctp_sndinfo));
|
||||||
sndinfo = (struct sctp_sndinfo *)CMSG_DATA(cmsg);
|
sndinfo = (struct sctp_sndinfo *)CMSG_DATA(cmsg);
|
||||||
memset(sndinfo, 0, sizeof(struct sctp_sndinfo));
|
memset(sndinfo, 0, sizeof(*sndinfo));
|
||||||
sndinfo->snd_sid = sinfo->snd_sid;
|
sndinfo->snd_sid = sinfo->snd_sid;
|
||||||
sndinfo->snd_flags = sinfo->snd_flags;
|
sndinfo->snd_flags = sinfo->snd_flags;
|
||||||
sndinfo->snd_ppid = sinfo->snd_ppid;
|
sndinfo->snd_ppid = sinfo->snd_ppid;
|
||||||
|
@ -1446,7 +1445,7 @@ static int dgram_sctp_write(BIO *b, const char *in, int inl)
|
||||||
cmsg->cmsg_type = SCTP_PRINFO;
|
cmsg->cmsg_type = SCTP_PRINFO;
|
||||||
cmsg->cmsg_len = CMSG_LEN(sizeof(struct sctp_prinfo));
|
cmsg->cmsg_len = CMSG_LEN(sizeof(struct sctp_prinfo));
|
||||||
prinfo = (struct sctp_prinfo *)CMSG_DATA(cmsg);
|
prinfo = (struct sctp_prinfo *)CMSG_DATA(cmsg);
|
||||||
memset(prinfo, 0, sizeof(struct sctp_prinfo));
|
memset(prinfo, 0, sizeof(*prinfo));
|
||||||
prinfo->pr_policy = pinfo->pr_policy;
|
prinfo->pr_policy = pinfo->pr_policy;
|
||||||
prinfo->pr_value = pinfo->pr_value;
|
prinfo->pr_value = pinfo->pr_value;
|
||||||
msg.msg_controllen += CMSG_SPACE(sizeof(struct sctp_prinfo));
|
msg.msg_controllen += CMSG_SPACE(sizeof(struct sctp_prinfo));
|
||||||
|
@ -1456,7 +1455,7 @@ static int dgram_sctp_write(BIO *b, const char *in, int inl)
|
||||||
cmsg->cmsg_type = SCTP_SNDRCV;
|
cmsg->cmsg_type = SCTP_SNDRCV;
|
||||||
cmsg->cmsg_len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo));
|
cmsg->cmsg_len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo));
|
||||||
sndrcvinfo = (struct sctp_sndrcvinfo *)CMSG_DATA(cmsg);
|
sndrcvinfo = (struct sctp_sndrcvinfo *)CMSG_DATA(cmsg);
|
||||||
memset(sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
|
memset(sndrcvinfo, 0, sizeof(*sndrcvinfo));
|
||||||
sndrcvinfo->sinfo_stream = sinfo->snd_sid;
|
sndrcvinfo->sinfo_stream = sinfo->snd_sid;
|
||||||
sndrcvinfo->sinfo_flags = sinfo->snd_flags;
|
sndrcvinfo->sinfo_flags = sinfo->snd_flags;
|
||||||
# ifdef __FreeBSD__
|
# ifdef __FreeBSD__
|
||||||
|
@ -1553,7 +1552,7 @@ static long dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
memset(authkey, 0x00, sockopt_len);
|
memset(authkey, 0, sockopt_len);
|
||||||
authkey->sca_keynumber = authkeyid.scact_keynumber + 1;
|
authkey->sca_keynumber = authkeyid.scact_keynumber + 1;
|
||||||
# ifndef __FreeBSD__
|
# ifndef __FreeBSD__
|
||||||
/*
|
/*
|
||||||
|
@ -1750,7 +1749,7 @@ int BIO_dgram_sctp_wait_for_dry(BIO *b)
|
||||||
|
|
||||||
/* set sender dry event */
|
/* set sender dry event */
|
||||||
# ifdef SCTP_EVENT
|
# ifdef SCTP_EVENT
|
||||||
memset(&event, 0, sizeof(struct sctp_event));
|
memset(&event, 0, sizeof(event));
|
||||||
event.se_assoc_id = 0;
|
event.se_assoc_id = 0;
|
||||||
event.se_type = SCTP_SENDER_DRY_EVENT;
|
event.se_type = SCTP_SENDER_DRY_EVENT;
|
||||||
event.se_on = 1;
|
event.se_on = 1;
|
||||||
|
@ -1773,7 +1772,7 @@ int BIO_dgram_sctp_wait_for_dry(BIO *b)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* peek for notification */
|
/* peek for notification */
|
||||||
memset(&snp, 0x00, sizeof(union sctp_notification));
|
memset(&snp, 0, sizeof(snp));
|
||||||
iov.iov_base = (char *)&snp;
|
iov.iov_base = (char *)&snp;
|
||||||
iov.iov_len = sizeof(union sctp_notification);
|
iov.iov_len = sizeof(union sctp_notification);
|
||||||
msg.msg_name = NULL;
|
msg.msg_name = NULL;
|
||||||
|
@ -1795,7 +1794,7 @@ int BIO_dgram_sctp_wait_for_dry(BIO *b)
|
||||||
|
|
||||||
/* if we find a notification, process it and try again if necessary */
|
/* if we find a notification, process it and try again if necessary */
|
||||||
while (msg.msg_flags & MSG_NOTIFICATION) {
|
while (msg.msg_flags & MSG_NOTIFICATION) {
|
||||||
memset(&snp, 0x00, sizeof(union sctp_notification));
|
memset(&snp, 0, sizeof(snp));
|
||||||
iov.iov_base = (char *)&snp;
|
iov.iov_base = (char *)&snp;
|
||||||
iov.iov_len = sizeof(union sctp_notification);
|
iov.iov_len = sizeof(union sctp_notification);
|
||||||
msg.msg_name = NULL;
|
msg.msg_name = NULL;
|
||||||
|
@ -1820,7 +1819,7 @@ int BIO_dgram_sctp_wait_for_dry(BIO *b)
|
||||||
|
|
||||||
/* disable sender dry event */
|
/* disable sender dry event */
|
||||||
# ifdef SCTP_EVENT
|
# ifdef SCTP_EVENT
|
||||||
memset(&event, 0, sizeof(struct sctp_event));
|
memset(&event, 0, sizeof(event));
|
||||||
event.se_assoc_id = 0;
|
event.se_assoc_id = 0;
|
||||||
event.se_type = SCTP_SENDER_DRY_EVENT;
|
event.se_type = SCTP_SENDER_DRY_EVENT;
|
||||||
event.se_on = 0;
|
event.se_on = 0;
|
||||||
|
@ -1854,7 +1853,7 @@ int BIO_dgram_sctp_wait_for_dry(BIO *b)
|
||||||
(void *)&snp);
|
(void *)&snp);
|
||||||
|
|
||||||
/* found notification, peek again */
|
/* found notification, peek again */
|
||||||
memset(&snp, 0x00, sizeof(union sctp_notification));
|
memset(&snp, 0, sizeof(snp));
|
||||||
iov.iov_base = (char *)&snp;
|
iov.iov_base = (char *)&snp;
|
||||||
iov.iov_len = sizeof(union sctp_notification);
|
iov.iov_len = sizeof(union sctp_notification);
|
||||||
msg.msg_name = NULL;
|
msg.msg_name = NULL;
|
||||||
|
@ -1900,7 +1899,7 @@ int BIO_dgram_sctp_msg_waiting(BIO *b)
|
||||||
|
|
||||||
/* Check if there are any messages waiting to be read */
|
/* Check if there are any messages waiting to be read */
|
||||||
do {
|
do {
|
||||||
memset(&snp, 0x00, sizeof(union sctp_notification));
|
memset(&snp, 0, sizeof(snp));
|
||||||
iov.iov_base = (char *)&snp;
|
iov.iov_base = (char *)&snp;
|
||||||
iov.iov_len = sizeof(union sctp_notification);
|
iov.iov_len = sizeof(union sctp_notification);
|
||||||
msg.msg_name = NULL;
|
msg.msg_name = NULL;
|
||||||
|
@ -1923,7 +1922,7 @@ int BIO_dgram_sctp_msg_waiting(BIO *b)
|
||||||
dgram_sctp_handle_auth_free_key_event(b, &snp);
|
dgram_sctp_handle_auth_free_key_event(b, &snp);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
memset(&snp, 0x00, sizeof(union sctp_notification));
|
memset(&snp, 0, sizeof(snp));
|
||||||
iov.iov_base = (char *)&snp;
|
iov.iov_base = (char *)&snp;
|
||||||
iov.iov_len = sizeof(union sctp_notification);
|
iov.iov_len = sizeof(union sctp_notification);
|
||||||
msg.msg_name = NULL;
|
msg.msg_name = NULL;
|
||||||
|
|
|
@ -141,7 +141,7 @@ BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod)
|
||||||
BNerr(BN_F_BN_BLINDING_NEW, ERR_R_MALLOC_FAILURE);
|
BNerr(BN_F_BN_BLINDING_NEW, ERR_R_MALLOC_FAILURE);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
memset(ret, 0, sizeof(BN_BLINDING));
|
memset(ret, 0, sizeof(*ret));
|
||||||
if (A != NULL) {
|
if (A != NULL) {
|
||||||
if ((ret->A = BN_dup(A)) == NULL)
|
if ((ret->A = BN_dup(A)) == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
|
@ -211,8 +211,8 @@ int bn_copy_words(BN_ULONG *out, const BIGNUM *in, int size)
|
||||||
if (in->top > size)
|
if (in->top > size)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
memset(out, 0, sizeof(BN_ULONG) * size);
|
memset(out, 0, sizeof(*out) * size);
|
||||||
memcpy(out, in->d, sizeof(BN_ULONG) * in->top);
|
memcpy(out, in->d, sizeof(*out) * in->top);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -167,10 +167,10 @@ int RAND_pseudo_bytes(unsigned char *buf, int num);
|
||||||
* *genuinely* constant variables that aren't mutable \
|
* *genuinely* constant variables that aren't mutable \
|
||||||
* wouldn't be constructed with top!=dmax. */ \
|
* wouldn't be constructed with top!=dmax. */ \
|
||||||
BN_ULONG *_not_const; \
|
BN_ULONG *_not_const; \
|
||||||
memcpy(&_not_const, &_bnum1->d, sizeof(BN_ULONG*)); \
|
memcpy(&_not_const, &_bnum1->d, sizeof(_not_const)); \
|
||||||
RAND_bytes(&_tmp_char, 1); /* Debug only - safe to ignore error return */\
|
RAND_bytes(&_tmp_char, 1); /* Debug only - safe to ignore error return */\
|
||||||
memset((unsigned char *)(_not_const + _bnum1->top), _tmp_char, \
|
memset(_not_const + _bnum1->top, _tmp_char, \
|
||||||
(_bnum1->dmax - _bnum1->top) * sizeof(BN_ULONG)); \
|
sizeof(*_not_const) * (_bnum1->dmax - _bnum1->top)); \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
# ifdef BN_DEBUG_TRIX
|
# ifdef BN_DEBUG_TRIX
|
||||||
|
|
|
@ -260,7 +260,7 @@ void BN_free(BIGNUM *a)
|
||||||
|
|
||||||
void BN_init(BIGNUM *a)
|
void BN_init(BIGNUM *a)
|
||||||
{
|
{
|
||||||
memset(a, 0, sizeof(BIGNUM));
|
memset(a, 0, sizeof(*a));
|
||||||
bn_check_top(a);
|
bn_check_top(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
|
||||||
* function - what's important is constant time operation (we're not
|
* function - what's important is constant time operation (we're not
|
||||||
* actually going to use the data)
|
* actually going to use the data)
|
||||||
*/
|
*/
|
||||||
memset(a, 0, sizeof(BN_ULONG) * words);
|
memset(a, 0, sizeof(*a) * words);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
@ -355,7 +355,7 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
memset(A, 0, sizeof(BN_ULONG) * words);
|
memset(A, 0, sizeof(*A) * words);
|
||||||
memcpy(A, b->d, sizeof(b->d[0]) * b->top);
|
memcpy(A, b->d, sizeof(b->d[0]) * b->top);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -492,7 +492,7 @@ void BN_clear(BIGNUM *a)
|
||||||
{
|
{
|
||||||
bn_check_top(a);
|
bn_check_top(a);
|
||||||
if (a->d != NULL)
|
if (a->d != NULL)
|
||||||
memset(a->d, 0, a->dmax * sizeof(a->d[0]));
|
memset(a->d, 0, sizeof(*a->d) * a->dmax);
|
||||||
a->top = 0;
|
a->top = 0;
|
||||||
a->neg = 0;
|
a->neg = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,7 +196,7 @@ static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont)
|
||||||
rp = r->d;
|
rp = r->d;
|
||||||
|
|
||||||
/* clear the top words of T */
|
/* clear the top words of T */
|
||||||
memset(&(rp[r->top]), 0, (max - r->top) * sizeof(BN_ULONG));
|
memset(&rp[r->top], 0, sizeof(*rp) * (max - r->top));
|
||||||
|
|
||||||
r->top = max;
|
r->top = max;
|
||||||
n0 = mont->n0[0];
|
n0 = mont->n0[0];
|
||||||
|
|
|
@ -458,7 +458,7 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
|
||||||
if (!zero)
|
if (!zero)
|
||||||
bn_mul_comba4(&(t[n2]), t, &(t[n]));
|
bn_mul_comba4(&(t[n2]), t, &(t[n]));
|
||||||
else
|
else
|
||||||
memset(&(t[n2]), 0, 8 * sizeof(BN_ULONG));
|
memset(&t[n2], 0, sizeof(*t) * 8);
|
||||||
|
|
||||||
bn_mul_comba4(r, a, b);
|
bn_mul_comba4(r, a, b);
|
||||||
bn_mul_comba4(&(r[n2]), &(a[n]), &(b[n]));
|
bn_mul_comba4(&(r[n2]), &(a[n]), &(b[n]));
|
||||||
|
@ -468,7 +468,7 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
|
||||||
if (!zero)
|
if (!zero)
|
||||||
bn_mul_comba8(&(t[n2]), t, &(t[n]));
|
bn_mul_comba8(&(t[n2]), t, &(t[n]));
|
||||||
else
|
else
|
||||||
memset(&(t[n2]), 0, 16 * sizeof(BN_ULONG));
|
memset(&t[n2], 0, sizeof(*t) * 16);
|
||||||
|
|
||||||
bn_mul_comba8(r, a, b);
|
bn_mul_comba8(r, a, b);
|
||||||
bn_mul_comba8(&(r[n2]), &(a[n]), &(b[n]));
|
bn_mul_comba8(&(r[n2]), &(a[n]), &(b[n]));
|
||||||
|
@ -479,7 +479,7 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
|
||||||
if (!zero)
|
if (!zero)
|
||||||
bn_mul_recursive(&(t[n2]), t, &(t[n]), n, 0, 0, p);
|
bn_mul_recursive(&(t[n2]), t, &(t[n]), n, 0, 0, p);
|
||||||
else
|
else
|
||||||
memset(&(t[n2]), 0, n2 * sizeof(BN_ULONG));
|
memset(&t[n2], 0, sizeof(*t) * n2);
|
||||||
bn_mul_recursive(r, a, b, n, 0, 0, p);
|
bn_mul_recursive(r, a, b, n, 0, 0, p);
|
||||||
bn_mul_recursive(&(r[n2]), &(a[n]), &(b[n]), n, dna, dnb, p);
|
bn_mul_recursive(&(r[n2]), &(a[n]), &(b[n]), n, dna, dnb, p);
|
||||||
}
|
}
|
||||||
|
@ -584,14 +584,14 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
|
||||||
bn_mul_comba4(&(t[n2]), t, &(t[n]));
|
bn_mul_comba4(&(t[n2]), t, &(t[n]));
|
||||||
bn_mul_comba4(r, a, b);
|
bn_mul_comba4(r, a, b);
|
||||||
bn_mul_normal(&(r[n2]), &(a[n]), tn, &(b[n]), tn);
|
bn_mul_normal(&(r[n2]), &(a[n]), tn, &(b[n]), tn);
|
||||||
memset(&(r[n2 + tn * 2]), 0, sizeof(BN_ULONG) * (n2 - tn * 2));
|
memset(&r[n2 + tn * 2], 0, sizeof(*r) * (n2 - tn * 2));
|
||||||
} else
|
} else
|
||||||
# endif
|
# endif
|
||||||
if (n == 8) {
|
if (n == 8) {
|
||||||
bn_mul_comba8(&(t[n2]), t, &(t[n]));
|
bn_mul_comba8(&(t[n2]), t, &(t[n]));
|
||||||
bn_mul_comba8(r, a, b);
|
bn_mul_comba8(r, a, b);
|
||||||
bn_mul_normal(&(r[n2]), &(a[n]), tna, &(b[n]), tnb);
|
bn_mul_normal(&(r[n2]), &(a[n]), tna, &(b[n]), tnb);
|
||||||
memset(&(r[n2 + tna + tnb]), 0, sizeof(BN_ULONG) * (n2 - tna - tnb));
|
memset(&r[n2 + tna + tnb], 0, sizeof(*r) * (n2 - tna - tnb));
|
||||||
} else {
|
} else {
|
||||||
p = &(t[n2 * 2]);
|
p = &(t[n2 * 2]);
|
||||||
bn_mul_recursive(&(t[n2]), t, &(t[n]), n, 0, 0, p);
|
bn_mul_recursive(&(t[n2]), t, &(t[n]), n, 0, 0, p);
|
||||||
|
@ -607,7 +607,7 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
bn_mul_recursive(&(r[n2]), &(a[n]), &(b[n]),
|
bn_mul_recursive(&(r[n2]), &(a[n]), &(b[n]),
|
||||||
i, tna - i, tnb - i, p);
|
i, tna - i, tnb - i, p);
|
||||||
memset(&(r[n2 + i * 2]), 0, sizeof(BN_ULONG) * (n2 - i * 2));
|
memset(&r[n2 + i * 2], 0, sizeof(*r) * (n2 - i * 2));
|
||||||
} else if (j > 0) { /* eg, n == 16, i == 8 and tn == 11 */
|
} else if (j > 0) { /* eg, n == 16, i == 8 and tn == 11 */
|
||||||
bn_mul_part_recursive(&(r[n2]), &(a[n]), &(b[n]),
|
bn_mul_part_recursive(&(r[n2]), &(a[n]), &(b[n]),
|
||||||
i, tna - i, tnb - i, p);
|
i, tna - i, tnb - i, p);
|
||||||
|
@ -615,7 +615,7 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
|
||||||
sizeof(BN_ULONG) * (n2 - tna - tnb));
|
sizeof(BN_ULONG) * (n2 - tna - tnb));
|
||||||
} else { /* (j < 0) eg, n == 16, i == 8 and tn == 5 */
|
} else { /* (j < 0) eg, n == 16, i == 8 and tn == 5 */
|
||||||
|
|
||||||
memset(&(r[n2]), 0, sizeof(BN_ULONG) * n2);
|
memset(&r[n2], 0, sizeof(*r) * n2);
|
||||||
if (tna < BN_MUL_RECURSIVE_SIZE_NORMAL
|
if (tna < BN_MUL_RECURSIVE_SIZE_NORMAL
|
||||||
&& tnb < BN_MUL_RECURSIVE_SIZE_NORMAL) {
|
&& tnb < BN_MUL_RECURSIVE_SIZE_NORMAL) {
|
||||||
bn_mul_normal(&(r[n2]), &(a[n]), tna, &(b[n]), tnb);
|
bn_mul_normal(&(r[n2]), &(a[n]), tna, &(b[n]), tnb);
|
||||||
|
|
|
@ -154,10 +154,7 @@ int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
|
||||||
t[nw + i + 1] |= (l >> rb) & BN_MASK2;
|
t[nw + i + 1] |= (l >> rb) & BN_MASK2;
|
||||||
t[nw + i] = (l << lb) & BN_MASK2;
|
t[nw + i] = (l << lb) & BN_MASK2;
|
||||||
}
|
}
|
||||||
memset(t, 0, nw * sizeof(t[0]));
|
memset(t, 0, sizeof(*t) * nw);
|
||||||
/*
|
|
||||||
* for (i=0; i<nw; i++) t[i]=0;
|
|
||||||
*/
|
|
||||||
r->top = a->top + nw + 1;
|
r->top = a->top + nw + 1;
|
||||||
bn_correct_top(r);
|
bn_correct_top(r);
|
||||||
bn_check_top(r);
|
bn_check_top(r);
|
||||||
|
|
|
@ -238,7 +238,7 @@ void bn_sqr_recursive(BN_ULONG *r, const BN_ULONG *a, int n2, BN_ULONG *t)
|
||||||
if (!zero)
|
if (!zero)
|
||||||
bn_sqr_recursive(&(t[n2]), t, n, p);
|
bn_sqr_recursive(&(t[n2]), t, n, p);
|
||||||
else
|
else
|
||||||
memset(&(t[n2]), 0, n2 * sizeof(BN_ULONG));
|
memset(&t[n2], 0, sizeof(*t) * n2);
|
||||||
bn_sqr_recursive(r, a, n, p);
|
bn_sqr_recursive(r, a, n, p);
|
||||||
bn_sqr_recursive(&(r[n2]), &(a[n]), n, p);
|
bn_sqr_recursive(&(r[n2]), &(a[n]), n, p);
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ COMP_CTX *COMP_CTX_new(COMP_METHOD *meth)
|
||||||
/* ZZZZZZZZZZZZZZZZ */
|
/* ZZZZZZZZZZZZZZZZ */
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
memset(ret, 0, sizeof(COMP_CTX));
|
memset(ret, 0, sizeof(*ret));
|
||||||
ret->meth = meth;
|
ret->meth = meth;
|
||||||
if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
|
if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
|
||||||
OPENSSL_free(ret);
|
OPENSSL_free(ret);
|
||||||
|
|
|
@ -109,7 +109,7 @@ DSO *DSO_new_method(DSO_METHOD *meth)
|
||||||
DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE);
|
DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
memset(ret, 0, sizeof(DSO));
|
memset(ret, 0, sizeof(*ret));
|
||||||
ret->meth_data = sk_void_new_null();
|
ret->meth_data = sk_void_new_null();
|
||||||
if (ret->meth_data == NULL) {
|
if (ret->meth_data == NULL) {
|
||||||
/* sk_new doesn't generate any errors so we do */
|
/* sk_new doesn't generate any errors so we do */
|
||||||
|
|
|
@ -310,7 +310,7 @@ static struct file_st *win32_splitter(DSO *dso, const char *filename,
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(result, 0, sizeof(struct file_st));
|
memset(result, 0, sizeof(*result));
|
||||||
position = IN_DEVICE;
|
position = IN_DEVICE;
|
||||||
|
|
||||||
if ((filename[0] == '\\' && filename[1] == '\\')
|
if ((filename[0] == '\\' && filename[1] == '\\')
|
||||||
|
|
|
@ -317,7 +317,7 @@ static int BN_to_felem(felem out, const BIGNUM *bn)
|
||||||
unsigned num_bytes;
|
unsigned num_bytes;
|
||||||
|
|
||||||
/* BN_bn2bin eats leading zeroes */
|
/* BN_bn2bin eats leading zeroes */
|
||||||
memset(b_out, 0, sizeof b_out);
|
memset(b_out, 0, sizeof(b_out));
|
||||||
num_bytes = BN_num_bytes(bn);
|
num_bytes = BN_num_bytes(bn);
|
||||||
if (num_bytes > sizeof b_out) {
|
if (num_bytes > sizeof b_out) {
|
||||||
ECerr(EC_F_BN_TO_FELEM, EC_R_BIGNUM_OUT_OF_RANGE);
|
ECerr(EC_F_BN_TO_FELEM, EC_R_BIGNUM_OUT_OF_RANGE);
|
||||||
|
@ -1069,8 +1069,8 @@ static void select_point(const u64 idx, unsigned int size,
|
||||||
{
|
{
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
limb *outlimbs = &out[0][0];
|
limb *outlimbs = &out[0][0];
|
||||||
memset(outlimbs, 0, 3 * sizeof(felem));
|
|
||||||
|
|
||||||
|
memset(out 0, sizeof(out));
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
const limb *inlimbs = &pre_comp[i][0][0];
|
const limb *inlimbs = &pre_comp[i][0][0];
|
||||||
u64 mask = i ^ idx;
|
u64 mask = i ^ idx;
|
||||||
|
@ -1113,7 +1113,7 @@ static void batch_mul(felem x_out, felem y_out, felem z_out,
|
||||||
u8 sign, digit;
|
u8 sign, digit;
|
||||||
|
|
||||||
/* set nq to the point at infinity */
|
/* set nq to the point at infinity */
|
||||||
memset(nq, 0, 3 * sizeof(felem));
|
memset(nq, 0, sizeof(nq));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loop over all scalars msb-to-lsb, interleaving additions of multiples
|
* Loop over all scalars msb-to-lsb, interleaving additions of multiples
|
||||||
|
@ -1390,7 +1390,7 @@ int ec_GFp_nistp224_points_mul(const EC_GROUP *group, EC_POINT *r,
|
||||||
BIGNUM *x, *y, *z, *tmp_scalar;
|
BIGNUM *x, *y, *z, *tmp_scalar;
|
||||||
felem_bytearray g_secret;
|
felem_bytearray g_secret;
|
||||||
felem_bytearray *secrets = NULL;
|
felem_bytearray *secrets = NULL;
|
||||||
felem(*pre_comp)[17][3] = NULL;
|
felem (*pre_comp)[17][3] = NULL;
|
||||||
felem *tmp_felems = NULL;
|
felem *tmp_felems = NULL;
|
||||||
felem_bytearray tmp;
|
felem_bytearray tmp;
|
||||||
unsigned num_bytes;
|
unsigned num_bytes;
|
||||||
|
@ -1457,11 +1457,11 @@ int ec_GFp_nistp224_points_mul(const EC_GROUP *group, EC_POINT *r,
|
||||||
*/
|
*/
|
||||||
mixed = 1;
|
mixed = 1;
|
||||||
}
|
}
|
||||||
secrets = OPENSSL_malloc(num_points * sizeof(felem_bytearray));
|
secrets = OPENSSL_malloc(sizeof(*secrets) * num_points);
|
||||||
pre_comp = OPENSSL_malloc(num_points * 17 * 3 * sizeof(felem));
|
pre_comp = OPENSSL_malloc(sizeof(*pre_comp) * num_points);
|
||||||
if (mixed)
|
if (mixed)
|
||||||
tmp_felems =
|
tmp_felems =
|
||||||
OPENSSL_malloc((num_points * 17 + 1) * sizeof(felem));
|
OPENSSL_malloc(sizeof(felem) * (num_points * 17 + 1));
|
||||||
if ((secrets == NULL) || (pre_comp == NULL)
|
if ((secrets == NULL) || (pre_comp == NULL)
|
||||||
|| (mixed && (tmp_felems == NULL))) {
|
|| (mixed && (tmp_felems == NULL))) {
|
||||||
ECerr(EC_F_EC_GFP_NISTP224_POINTS_MUL, ERR_R_MALLOC_FAILURE);
|
ECerr(EC_F_EC_GFP_NISTP224_POINTS_MUL, ERR_R_MALLOC_FAILURE);
|
||||||
|
@ -1472,8 +1472,8 @@ int ec_GFp_nistp224_points_mul(const EC_GROUP *group, EC_POINT *r,
|
||||||
* we treat NULL scalars as 0, and NULL points as points at infinity,
|
* we treat NULL scalars as 0, and NULL points as points at infinity,
|
||||||
* i.e., they contribute nothing to the linear combination
|
* i.e., they contribute nothing to the linear combination
|
||||||
*/
|
*/
|
||||||
memset(secrets, 0, num_points * sizeof(felem_bytearray));
|
memset(secrets, 0, sizeof(*secrets) * num_points);
|
||||||
memset(pre_comp, 0, num_points * 17 * 3 * sizeof(felem));
|
memset(pre_comp, 0, sizeof(*pre_comp) * num_points);
|
||||||
for (i = 0; i < num_points; ++i) {
|
for (i = 0; i < num_points; ++i) {
|
||||||
if (i == num)
|
if (i == num)
|
||||||
/* the generator */
|
/* the generator */
|
||||||
|
@ -1533,7 +1533,7 @@ int ec_GFp_nistp224_points_mul(const EC_GROUP *group, EC_POINT *r,
|
||||||
|
|
||||||
/* the scalar for the generator */
|
/* the scalar for the generator */
|
||||||
if ((scalar != NULL) && (have_pre_comp)) {
|
if ((scalar != NULL) && (have_pre_comp)) {
|
||||||
memset(g_secret, 0, sizeof g_secret);
|
memset(g_secret, 0, sizeof(g_secret));
|
||||||
/* reduce scalar to 0 <= scalar < 2^224 */
|
/* reduce scalar to 0 <= scalar < 2^224 */
|
||||||
if ((BN_num_bits(scalar) > 224) || (BN_is_negative(scalar))) {
|
if ((BN_num_bits(scalar) > 224) || (BN_is_negative(scalar))) {
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -156,7 +156,7 @@ static int BN_to_felem(felem out, const BIGNUM *bn)
|
||||||
unsigned num_bytes;
|
unsigned num_bytes;
|
||||||
|
|
||||||
/* BN_bn2bin eats leading zeroes */
|
/* BN_bn2bin eats leading zeroes */
|
||||||
memset(b_out, 0, sizeof b_out);
|
memset(b_out, 0, sizeof(b_out));
|
||||||
num_bytes = BN_num_bytes(bn);
|
num_bytes = BN_num_bytes(bn);
|
||||||
if (num_bytes > sizeof b_out) {
|
if (num_bytes > sizeof b_out) {
|
||||||
ECerr(EC_F_BN_TO_FELEM, EC_R_BIGNUM_OUT_OF_RANGE);
|
ECerr(EC_F_BN_TO_FELEM, EC_R_BIGNUM_OUT_OF_RANGE);
|
||||||
|
@ -1624,7 +1624,8 @@ static void select_point(const u64 idx, unsigned int size,
|
||||||
{
|
{
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
u64 *outlimbs = &out[0][0];
|
u64 *outlimbs = &out[0][0];
|
||||||
memset(outlimbs, 0, 3 * sizeof(smallfelem));
|
|
||||||
|
memset(out, 0, sizeof(out));
|
||||||
|
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
const u64 *inlimbs = (u64 *)&pre_comp[i][0][0];
|
const u64 *inlimbs = (u64 *)&pre_comp[i][0][0];
|
||||||
|
@ -1668,7 +1669,7 @@ static void batch_mul(felem x_out, felem y_out, felem z_out,
|
||||||
u8 sign, digit;
|
u8 sign, digit;
|
||||||
|
|
||||||
/* set nq to the point at infinity */
|
/* set nq to the point at infinity */
|
||||||
memset(nq, 0, 3 * sizeof(felem));
|
memset(nq, 0, sizeof(nq));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loop over all scalars msb-to-lsb, interleaving additions of multiples
|
* Loop over all scalars msb-to-lsb, interleaving additions of multiples
|
||||||
|
@ -2005,7 +2006,7 @@ int ec_GFp_nistp256_points_mul(const EC_GROUP *group, EC_POINT *r,
|
||||||
BIGNUM *x, *y, *z, *tmp_scalar;
|
BIGNUM *x, *y, *z, *tmp_scalar;
|
||||||
felem_bytearray g_secret;
|
felem_bytearray g_secret;
|
||||||
felem_bytearray *secrets = NULL;
|
felem_bytearray *secrets = NULL;
|
||||||
smallfelem(*pre_comp)[17][3] = NULL;
|
smallfelem (*pre_comp)[17][3] = NULL;
|
||||||
smallfelem *tmp_smallfelems = NULL;
|
smallfelem *tmp_smallfelems = NULL;
|
||||||
felem_bytearray tmp;
|
felem_bytearray tmp;
|
||||||
unsigned i, num_bytes;
|
unsigned i, num_bytes;
|
||||||
|
@ -2072,11 +2073,11 @@ int ec_GFp_nistp256_points_mul(const EC_GROUP *group, EC_POINT *r,
|
||||||
*/
|
*/
|
||||||
mixed = 1;
|
mixed = 1;
|
||||||
}
|
}
|
||||||
secrets = OPENSSL_malloc(num_points * sizeof(felem_bytearray));
|
secrets = OPENSSL_malloc(sizeof(*secrets) * num_points);
|
||||||
pre_comp = OPENSSL_malloc(num_points * 17 * 3 * sizeof(smallfelem));
|
pre_comp = OPENSSL_malloc(sizeof(*pre_comp) * num_points);
|
||||||
if (mixed)
|
if (mixed)
|
||||||
tmp_smallfelems =
|
tmp_smallfelems =
|
||||||
OPENSSL_malloc((num_points * 17 + 1) * sizeof(smallfelem));
|
OPENSSL_malloc(sizeof(*tmp_smallfelems) * (num_points * 17 + 1));
|
||||||
if ((secrets == NULL) || (pre_comp == NULL)
|
if ((secrets == NULL) || (pre_comp == NULL)
|
||||||
|| (mixed && (tmp_smallfelems == NULL))) {
|
|| (mixed && (tmp_smallfelems == NULL))) {
|
||||||
ECerr(EC_F_EC_GFP_NISTP256_POINTS_MUL, ERR_R_MALLOC_FAILURE);
|
ECerr(EC_F_EC_GFP_NISTP256_POINTS_MUL, ERR_R_MALLOC_FAILURE);
|
||||||
|
@ -2087,8 +2088,8 @@ int ec_GFp_nistp256_points_mul(const EC_GROUP *group, EC_POINT *r,
|
||||||
* we treat NULL scalars as 0, and NULL points as points at infinity,
|
* we treat NULL scalars as 0, and NULL points as points at infinity,
|
||||||
* i.e., they contribute nothing to the linear combination
|
* i.e., they contribute nothing to the linear combination
|
||||||
*/
|
*/
|
||||||
memset(secrets, 0, num_points * sizeof(felem_bytearray));
|
memset(secrets, 0, sizeof(*secrets) * num_points);
|
||||||
memset(pre_comp, 0, num_points * 17 * 3 * sizeof(smallfelem));
|
memset(pre_comp, 0, sizeof(*pre_comp) * num_points);
|
||||||
for (i = 0; i < num_points; ++i) {
|
for (i = 0; i < num_points; ++i) {
|
||||||
if (i == num)
|
if (i == num)
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -185,7 +185,7 @@ static int BN_to_felem(felem out, const BIGNUM *bn)
|
||||||
unsigned num_bytes;
|
unsigned num_bytes;
|
||||||
|
|
||||||
/* BN_bn2bin eats leading zeroes */
|
/* BN_bn2bin eats leading zeroes */
|
||||||
memset(b_out, 0, sizeof b_out);
|
memset(b_out, 0, sizeof(b_out));
|
||||||
num_bytes = BN_num_bytes(bn);
|
num_bytes = BN_num_bytes(bn);
|
||||||
if (num_bytes > sizeof b_out) {
|
if (num_bytes > sizeof b_out) {
|
||||||
ECerr(EC_F_BN_TO_FELEM, EC_R_BIGNUM_OUT_OF_RANGE);
|
ECerr(EC_F_BN_TO_FELEM, EC_R_BIGNUM_OUT_OF_RANGE);
|
||||||
|
@ -1470,7 +1470,8 @@ static void select_point(const limb idx, unsigned int size,
|
||||||
{
|
{
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
limb *outlimbs = &out[0][0];
|
limb *outlimbs = &out[0][0];
|
||||||
memset(outlimbs, 0, 3 * sizeof(felem));
|
|
||||||
|
memset(out, 0, sizeof(out));
|
||||||
|
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
const limb *inlimbs = &pre_comp[i][0][0];
|
const limb *inlimbs = &pre_comp[i][0][0];
|
||||||
|
@ -1513,7 +1514,7 @@ static void batch_mul(felem x_out, felem y_out, felem z_out,
|
||||||
u8 sign, digit;
|
u8 sign, digit;
|
||||||
|
|
||||||
/* set nq to the point at infinity */
|
/* set nq to the point at infinity */
|
||||||
memset(nq, 0, 3 * sizeof(felem));
|
memset(nq, 0, sizeof(nq));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loop over all scalars msb-to-lsb, interleaving additions of multiples
|
* Loop over all scalars msb-to-lsb, interleaving additions of multiples
|
||||||
|
@ -1834,7 +1835,7 @@ int ec_GFp_nistp521_points_mul(const EC_GROUP *group, EC_POINT *r,
|
||||||
BIGNUM *x, *y, *z, *tmp_scalar;
|
BIGNUM *x, *y, *z, *tmp_scalar;
|
||||||
felem_bytearray g_secret;
|
felem_bytearray g_secret;
|
||||||
felem_bytearray *secrets = NULL;
|
felem_bytearray *secrets = NULL;
|
||||||
felem(*pre_comp)[17][3] = NULL;
|
felem (*pre_comp)[17][3] = NULL;
|
||||||
felem *tmp_felems = NULL;
|
felem *tmp_felems = NULL;
|
||||||
felem_bytearray tmp;
|
felem_bytearray tmp;
|
||||||
unsigned i, num_bytes;
|
unsigned i, num_bytes;
|
||||||
|
@ -1901,11 +1902,11 @@ int ec_GFp_nistp521_points_mul(const EC_GROUP *group, EC_POINT *r,
|
||||||
*/
|
*/
|
||||||
mixed = 1;
|
mixed = 1;
|
||||||
}
|
}
|
||||||
secrets = OPENSSL_malloc(num_points * sizeof(felem_bytearray));
|
secrets = OPENSSL_malloc(sizeof(*secrets) * num_points);
|
||||||
pre_comp = OPENSSL_malloc(num_points * 17 * 3 * sizeof(felem));
|
pre_comp = OPENSSL_malloc(sizeof(*pre_comp) * num_points);
|
||||||
if (mixed)
|
if (mixed)
|
||||||
tmp_felems =
|
tmp_felems =
|
||||||
OPENSSL_malloc((num_points * 17 + 1) * sizeof(felem));
|
OPENSSL_malloc(sizeof(*tmp_felemts) * (num_points * 17 + 1));
|
||||||
if ((secrets == NULL) || (pre_comp == NULL)
|
if ((secrets == NULL) || (pre_comp == NULL)
|
||||||
|| (mixed && (tmp_felems == NULL))) {
|
|| (mixed && (tmp_felems == NULL))) {
|
||||||
ECerr(EC_F_EC_GFP_NISTP521_POINTS_MUL, ERR_R_MALLOC_FAILURE);
|
ECerr(EC_F_EC_GFP_NISTP521_POINTS_MUL, ERR_R_MALLOC_FAILURE);
|
||||||
|
@ -1916,8 +1917,8 @@ int ec_GFp_nistp521_points_mul(const EC_GROUP *group, EC_POINT *r,
|
||||||
* we treat NULL scalars as 0, and NULL points as points at infinity,
|
* we treat NULL scalars as 0, and NULL points as points at infinity,
|
||||||
* i.e., they contribute nothing to the linear combination
|
* i.e., they contribute nothing to the linear combination
|
||||||
*/
|
*/
|
||||||
memset(secrets, 0, num_points * sizeof(felem_bytearray));
|
memset(secrets, 0, sizeof(*secrets) * num_points);
|
||||||
memset(pre_comp, 0, num_points * 17 * 3 * sizeof(felem));
|
memset(pre_comp, 0, sizseof(*pre_comp) * num_points);
|
||||||
for (i = 0; i < num_points; ++i) {
|
for (i = 0; i < num_points; ++i) {
|
||||||
if (i == num)
|
if (i == num)
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -478,7 +478,7 @@ cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(sess, 0, sizeof(struct session_op));
|
memset(sess, 0, sizeof(*sess));
|
||||||
|
|
||||||
if ((state->d_fd = get_dev_crypto()) < 0)
|
if ((state->d_fd = get_dev_crypto()) < 0)
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -770,7 +770,7 @@ static int cryptodev_digest_init(EVP_MD_CTX *ctx)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(state, 0, sizeof(struct dev_crypto_state));
|
memset(state, 0, sizeof(*state));
|
||||||
|
|
||||||
if ((state->d_fd = get_dev_crypto()) < 0) {
|
if ((state->d_fd = get_dev_crypto()) < 0) {
|
||||||
printf("cryptodev_digest_init: Can't get Dev \n");
|
printf("cryptodev_digest_init: Can't get Dev \n");
|
||||||
|
@ -1115,7 +1115,7 @@ cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&kop, 0, sizeof kop);
|
memset(&kop, 0, sizeof(kop));
|
||||||
kop.crk_op = CRK_MOD_EXP;
|
kop.crk_op = CRK_MOD_EXP;
|
||||||
|
|
||||||
/* inputs: a^p % m */
|
/* inputs: a^p % m */
|
||||||
|
@ -1166,7 +1166,7 @@ cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&kop, 0, sizeof kop);
|
memset(&kop, 0, sizeof(kop));
|
||||||
kop.crk_op = CRK_MOD_EXP_CRT;
|
kop.crk_op = CRK_MOD_EXP_CRT;
|
||||||
/* inputs: rsa->p rsa->q I rsa->dmp1 rsa->dmq1 rsa->iqmp */
|
/* inputs: rsa->p rsa->q I rsa->dmp1 rsa->dmq1 rsa->iqmp */
|
||||||
if (bn2crparam(rsa->p, &kop.crk_param[0]))
|
if (bn2crparam(rsa->p, &kop.crk_param[0]))
|
||||||
|
@ -1269,7 +1269,7 @@ static DSA_SIG *cryptodev_dsa_do_sign(const unsigned char *dgst, int dlen,
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&kop, 0, sizeof kop);
|
memset(&kop, 0, sizeof(kop));
|
||||||
kop.crk_op = CRK_DSA_SIGN;
|
kop.crk_op = CRK_DSA_SIGN;
|
||||||
|
|
||||||
/* inputs: dgst dsa->p dsa->q dsa->g dsa->priv_key */
|
/* inputs: dgst dsa->p dsa->q dsa->g dsa->priv_key */
|
||||||
|
@ -1309,7 +1309,7 @@ cryptodev_dsa_verify(const unsigned char *dgst, int dlen,
|
||||||
struct crypt_kop kop;
|
struct crypt_kop kop;
|
||||||
int dsaret = 1;
|
int dsaret = 1;
|
||||||
|
|
||||||
memset(&kop, 0, sizeof kop);
|
memset(&kop, 0, sizeof(kop));
|
||||||
kop.crk_op = CRK_DSA_VERIFY;
|
kop.crk_op = CRK_DSA_VERIFY;
|
||||||
|
|
||||||
/* inputs: dgst dsa->p dsa->q dsa->g dsa->pub_key sig->r sig->s */
|
/* inputs: dgst dsa->p dsa->q dsa->g dsa->pub_key sig->r sig->s */
|
||||||
|
@ -1382,7 +1382,7 @@ cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
|
||||||
|
|
||||||
keylen = BN_num_bits(dh->p);
|
keylen = BN_num_bits(dh->p);
|
||||||
|
|
||||||
memset(&kop, 0, sizeof kop);
|
memset(&kop, 0, sizeof(kop));
|
||||||
kop.crk_op = CRK_DH_COMPUTE_KEY;
|
kop.crk_op = CRK_DH_COMPUTE_KEY;
|
||||||
|
|
||||||
/* inputs: dh->priv_key pub_key dh->p key */
|
/* inputs: dh->priv_key pub_key dh->p key */
|
||||||
|
|
|
@ -208,7 +208,7 @@ static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx)
|
||||||
ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX, ERR_R_MALLOC_FAILURE);
|
ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX, ERR_R_MALLOC_FAILURE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
memset(c, 0, sizeof(dynamic_data_ctx));
|
memset(c, 0, sizeof(*c));
|
||||||
c->dynamic_dso = NULL;
|
c->dynamic_dso = NULL;
|
||||||
c->v_check = NULL;
|
c->v_check = NULL;
|
||||||
c->bind_engine = NULL;
|
c->bind_engine = NULL;
|
||||||
|
|
|
@ -71,7 +71,7 @@ ENGINE *ENGINE_new(void)
|
||||||
ENGINEerr(ENGINE_F_ENGINE_NEW, ERR_R_MALLOC_FAILURE);
|
ENGINEerr(ENGINE_F_ENGINE_NEW, ERR_R_MALLOC_FAILURE);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(ret, 0, sizeof(ENGINE));
|
memset(ret, 0, sizeof(*ret));
|
||||||
ret->struct_ref = 1;
|
ret->struct_ref = 1;
|
||||||
engine_ref_debug(ret, 0, 1)
|
engine_ref_debug(ret, 0, 1)
|
||||||
CRYPTO_new_ex_data(CRYPTO_EX_INDEX_ENGINE, ret, &ret->ex_data);
|
CRYPTO_new_ex_data(CRYPTO_EX_INDEX_ENGINE, ret, &ret->ex_data);
|
||||||
|
|
|
@ -337,8 +337,7 @@ static int ok_write(BIO *b, const char *in, int inl)
|
||||||
n = (inl + ctx->buf_len > OK_BLOCK_SIZE + OK_BLOCK_BLOCK) ?
|
n = (inl + ctx->buf_len > OK_BLOCK_SIZE + OK_BLOCK_BLOCK) ?
|
||||||
(int)(OK_BLOCK_SIZE + OK_BLOCK_BLOCK - ctx->buf_len) : inl;
|
(int)(OK_BLOCK_SIZE + OK_BLOCK_BLOCK - ctx->buf_len) : inl;
|
||||||
|
|
||||||
memcpy((unsigned char *)(&(ctx->buf[ctx->buf_len])),
|
memcpy(&ctx->buf[ctx->buf_len], in, n);
|
||||||
(unsigned char *)in, n);
|
|
||||||
ctx->buf_len += n;
|
ctx->buf_len += n;
|
||||||
inl -= n;
|
inl -= n;
|
||||||
in += n;
|
in += n;
|
||||||
|
|
|
@ -119,7 +119,7 @@
|
||||||
|
|
||||||
void EVP_MD_CTX_init(EVP_MD_CTX *ctx)
|
void EVP_MD_CTX_init(EVP_MD_CTX *ctx)
|
||||||
{
|
{
|
||||||
memset(ctx, '\0', sizeof(*ctx));
|
memset(ctx, 0, sizeof(*ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
EVP_MD_CTX *EVP_MD_CTX_create(void)
|
EVP_MD_CTX *EVP_MD_CTX_create(void)
|
||||||
|
@ -360,7 +360,7 @@ int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx)
|
||||||
*/
|
*/
|
||||||
ENGINE_finish(ctx->engine);
|
ENGINE_finish(ctx->engine);
|
||||||
#endif
|
#endif
|
||||||
memset(ctx, '\0', sizeof(*ctx));
|
memset(ctx, 0, sizeof(*ctx));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,6 @@ const EVP_CIPHER *EVP_enc_null(void)
|
||||||
static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||||
const unsigned char *iv, int enc)
|
const unsigned char *iv, int enc)
|
||||||
{
|
{
|
||||||
/* memset(&(ctx->c),0,sizeof(ctx->c)); */
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,6 +93,6 @@ static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||||
const unsigned char *in, size_t inl)
|
const unsigned char *in, size_t inl)
|
||||||
{
|
{
|
||||||
if (in != out)
|
if (in != out)
|
||||||
memcpy((char *)out, (const char *)in, inl);
|
memcpy(out, in, inl);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,8 +70,7 @@ const char EVP_version[] = "EVP" OPENSSL_VERSION_PTEXT;
|
||||||
|
|
||||||
void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx)
|
void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx)
|
||||||
{
|
{
|
||||||
memset(ctx, 0, sizeof(EVP_CIPHER_CTX));
|
memset(ctx, 0, sizeof(*ctx));
|
||||||
/* ctx->cipher=NULL; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
|
EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
|
||||||
|
@ -546,7 +545,7 @@ int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c)
|
||||||
*/
|
*/
|
||||||
ENGINE_finish(c->engine);
|
ENGINE_finish(c->engine);
|
||||||
#endif
|
#endif
|
||||||
memset(c, 0, sizeof(EVP_CIPHER_CTX));
|
memset(c, 0, sizeof(*c));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags)
|
||||||
if (!pmeth)
|
if (!pmeth)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
memset(pmeth, 0, sizeof(EVP_PKEY_METHOD));
|
memset(pmeth, 0, sizeof(*pmeth));
|
||||||
|
|
||||||
pmeth->pkey_id = id;
|
pmeth->pkey_id = id;
|
||||||
pmeth->flags = flags | EVP_PKEY_FLAG_DYNAMIC;
|
pmeth->flags = flags | EVP_PKEY_FLAG_DYNAMIC;
|
||||||
|
|
|
@ -107,7 +107,7 @@ static void JPAKE_CTX_release(JPAKE_CTX *ctx)
|
||||||
OPENSSL_free(ctx->p.peer_name);
|
OPENSSL_free(ctx->p.peer_name);
|
||||||
OPENSSL_free(ctx->p.name);
|
OPENSSL_free(ctx->p.name);
|
||||||
|
|
||||||
memset(ctx, '\0', sizeof(*ctx));
|
memset(ctx, 0, sizeof(*ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
JPAKE_CTX *JPAKE_CTX_new(const char *name, const char *peer_name,
|
JPAKE_CTX *JPAKE_CTX_new(const char *name, const char *peer_name,
|
||||||
|
|
|
@ -122,9 +122,9 @@ const char *MD2_options(void)
|
||||||
int MD2_Init(MD2_CTX *c)
|
int MD2_Init(MD2_CTX *c)
|
||||||
{
|
{
|
||||||
c->num = 0;
|
c->num = 0;
|
||||||
memset(c->state, 0, sizeof c->state);
|
memset(c->state, 0, sizeof(c->state));
|
||||||
memset(c->cksm, 0, sizeof c->cksm);
|
memset(c->cksm, 0, sizeof(c->cksm));
|
||||||
memset(c->data, 0, sizeof c->data);
|
memset(c->data, 0, sizeof(c->data));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,6 +219,6 @@ int MD2_Final(unsigned char *md, MD2_CTX *c)
|
||||||
|
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
md[i] = (UCHAR) (p1[i] & 0xff);
|
md[i] = (UCHAR) (p1[i] & 0xff);
|
||||||
memset((char *)&c, 0, sizeof(c));
|
memset(&c, 0, sizeof(c));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,9 +226,7 @@ OCB128_CONTEXT *CRYPTO_ocb128_new(void *keyenc, void *keydec,
|
||||||
int CRYPTO_ocb128_init(OCB128_CONTEXT *ctx, void *keyenc, void *keydec,
|
int CRYPTO_ocb128_init(OCB128_CONTEXT *ctx, void *keyenc, void *keydec,
|
||||||
block128_f encrypt, block128_f decrypt)
|
block128_f encrypt, block128_f decrypt)
|
||||||
{
|
{
|
||||||
/* Clear everything to NULLs */
|
|
||||||
memset(ctx, 0, sizeof(*ctx));
|
memset(ctx, 0, sizeof(*ctx));
|
||||||
|
|
||||||
ctx->l_index = 0;
|
ctx->l_index = 0;
|
||||||
ctx->max_l_index = 1;
|
ctx->max_l_index = 1;
|
||||||
ctx->l = OPENSSL_malloc(ctx->max_l_index * 16);
|
ctx->l = OPENSSL_malloc(ctx->max_l_index * 16);
|
||||||
|
@ -374,8 +372,8 @@ int CRYPTO_ocb128_aad(OCB128_CONTEXT *ctx, const unsigned char *aad,
|
||||||
ocb_block16_xor(&ctx->offset_aad, &ctx->l_star, &ctx->offset_aad);
|
ocb_block16_xor(&ctx->offset_aad, &ctx->l_star, &ctx->offset_aad);
|
||||||
|
|
||||||
/* CipherInput = (A_* || 1 || zeros(127-bitlen(A_*))) xor Offset_* */
|
/* CipherInput = (A_* || 1 || zeros(127-bitlen(A_*))) xor Offset_* */
|
||||||
memset((void *)&tmp1, 0, 16);
|
memset(&tmp1, 0, 16);
|
||||||
memcpy((void *)&tmp1, aad + (num_blocks * 16), last_len);
|
memcpy(&tmp1, aad + (num_blocks * 16), last_len);
|
||||||
((unsigned char *)&tmp1)[last_len] = 0x80;
|
((unsigned char *)&tmp1)[last_len] = 0x80;
|
||||||
ocb_block16_xor(&ctx->offset_aad, &tmp1, &tmp2);
|
ocb_block16_xor(&ctx->offset_aad, &tmp1, &tmp2);
|
||||||
|
|
||||||
|
@ -453,8 +451,8 @@ int CRYPTO_ocb128_encrypt(OCB128_CONTEXT *ctx,
|
||||||
out + (num_blocks * 16));
|
out + (num_blocks * 16));
|
||||||
|
|
||||||
/* Checksum_* = Checksum_m xor (P_* || 1 || zeros(127-bitlen(P_*))) */
|
/* Checksum_* = Checksum_m xor (P_* || 1 || zeros(127-bitlen(P_*))) */
|
||||||
memset((void *)&tmp1, 0, 16);
|
memset(&tmp1, 0, 16);
|
||||||
memcpy((void *)&tmp1, in + (len / 16) * 16, last_len);
|
memcpy(&tmp1, in + (len / 16) * 16, last_len);
|
||||||
((unsigned char *)(&tmp1))[last_len] = 0x80;
|
((unsigned char *)(&tmp1))[last_len] = 0x80;
|
||||||
ocb_block16_xor(&ctx->checksum, &tmp1, &ctx->checksum);
|
ocb_block16_xor(&ctx->checksum, &tmp1, &ctx->checksum);
|
||||||
}
|
}
|
||||||
|
@ -526,8 +524,8 @@ int CRYPTO_ocb128_decrypt(OCB128_CONTEXT *ctx,
|
||||||
out + (num_blocks * 16));
|
out + (num_blocks * 16));
|
||||||
|
|
||||||
/* Checksum_* = Checksum_m xor (P_* || 1 || zeros(127-bitlen(P_*))) */
|
/* Checksum_* = Checksum_m xor (P_* || 1 || zeros(127-bitlen(P_*))) */
|
||||||
memset((void *)&tmp1, 0, 16);
|
memset(&tmp1, 0, 16);
|
||||||
memcpy((void *)&tmp1, out + (len / 16) * 16, last_len);
|
memcpy(&tmp1, out + (len / 16) * 16, last_len);
|
||||||
((unsigned char *)(&tmp1))[last_len] = 0x80;
|
((unsigned char *)(&tmp1))[last_len] = 0x80;
|
||||||
ocb_block16_xor(&ctx->checksum, &tmp1, &ctx->checksum);
|
ocb_block16_xor(&ctx->checksum, &tmp1, &ctx->checksum);
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ pqueue_s *pqueue_new()
|
||||||
if (pq == NULL)
|
if (pq == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
memset(pq, 0x00, sizeof(pqueue_s));
|
memset(pq, 0, sizeof(*pq));
|
||||||
return pq;
|
return pq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -293,14 +293,14 @@ int RSA_memory_lock(RSA *r)
|
||||||
RSAerr(RSA_F_RSA_MEMORY_LOCK, ERR_R_MALLOC_FAILURE);
|
RSAerr(RSA_F_RSA_MEMORY_LOCK, ERR_R_MALLOC_FAILURE);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
memset(p, 0, (off + j) * sizeof(BN_ULONG));
|
memset(p, 0, sizeof(*p) * (off + j));
|
||||||
bn = (BIGNUM *)p;
|
bn = (BIGNUM *)p;
|
||||||
ul = (BN_ULONG *)&(p[off]);
|
ul = (BN_ULONG *)&(p[off]);
|
||||||
for (i = 0; i < 6; i++) {
|
for (i = 0; i < 6; i++) {
|
||||||
b = *(t[i]);
|
b = *(t[i]);
|
||||||
*(t[i]) = bn_array_el(bn, i);
|
*(t[i]) = bn_array_el(bn, i);
|
||||||
memcpy((char *)bn_array_el(bn, i), (char *)b, bn_sizeof_BIGNUM());
|
memcpy(bn_array_el(bn, i), b, bn_sizeof_BIGNUM());
|
||||||
memcpy((char *)ul, bn_get_words(b), sizeof(BN_ULONG) * bn_get_top(b));
|
memcpy(ul, bn_get_words(b), sizeof(*ul) * bn_get_top(b));
|
||||||
bn_set_static_words(bn_array_el(bn, i), ul, bn_get_top(b));
|
bn_set_static_words(bn_array_el(bn, i), ul, bn_get_top(b));
|
||||||
ul += bn_get_top(b);
|
ul += bn_get_top(b);
|
||||||
BN_clear_free(b);
|
BN_clear_free(b);
|
||||||
|
|
|
@ -107,9 +107,11 @@ int SHA512_Final(unsigned char *md, SHA512_CTX *c)
|
||||||
|
|
||||||
p[n] = 0x80; /* There always is a room for one */
|
p[n] = 0x80; /* There always is a room for one */
|
||||||
n++;
|
n++;
|
||||||
if (n > (sizeof(c->u) - 16))
|
if (n > (sizeof(c->u) - 16)) {
|
||||||
memset(p + n, 0, sizeof(c->u) - n), n = 0,
|
memset(p + n, 0, sizeof(c->u) - n);
|
||||||
sha512_block_data_order(c, p, 1);
|
n = 0;
|
||||||
|
sha512_block_data_order(c, p, 1);
|
||||||
|
}
|
||||||
|
|
||||||
memset(p + n, 0, sizeof(c->u) - 16 - n);
|
memset(p + n, 0, sizeof(c->u) - 16 - n);
|
||||||
#ifdef B_ENDIAN
|
#ifdef B_ENDIAN
|
||||||
|
|
|
@ -296,7 +296,7 @@ void sk_zero(_STACK *st)
|
||||||
return;
|
return;
|
||||||
if (st->num <= 0)
|
if (st->num <= 0)
|
||||||
return;
|
return;
|
||||||
memset((char *)st->data, 0, sizeof(*st->data) * st->num);
|
memset(st->data, 0, sizeof(*st->data) * st->num);
|
||||||
st->num = 0;
|
st->num = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -252,7 +252,7 @@ static void *mem_list_start(STORE *s, STORE_OBJECT_TYPES type,
|
||||||
STOREerr(STORE_F_MEM_LIST_START, ERR_R_MALLOC_FAILURE);
|
STOREerr(STORE_F_MEM_LIST_START, ERR_R_MALLOC_FAILURE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
memset(context, 0, sizeof(struct mem_ctx_st));
|
memset(context, 0, sizeof(*context));
|
||||||
|
|
||||||
attribute_context = STORE_parse_attrs_start(attributes);
|
attribute_context = STORE_parse_attrs_start(attributes);
|
||||||
if (!attribute_context) {
|
if (!attribute_context) {
|
||||||
|
|
|
@ -173,7 +173,7 @@ TS_RESP_CTX *TS_RESP_CTX_new()
|
||||||
TSerr(TS_F_TS_RESP_CTX_NEW, ERR_R_MALLOC_FAILURE);
|
TSerr(TS_F_TS_RESP_CTX_NEW, ERR_R_MALLOC_FAILURE);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(ctx, 0, sizeof(TS_RESP_CTX));
|
memset(ctx, 0, sizeof(*ctx));
|
||||||
|
|
||||||
/* Setting default callbacks. */
|
/* Setting default callbacks. */
|
||||||
ctx->serial_cb = def_serial_cb;
|
ctx->serial_cb = def_serial_cb;
|
||||||
|
|
|
@ -66,7 +66,7 @@ TS_VERIFY_CTX *TS_VERIFY_CTX_new(void)
|
||||||
TS_VERIFY_CTX *ctx = OPENSSL_malloc(sizeof(*ctx));
|
TS_VERIFY_CTX *ctx = OPENSSL_malloc(sizeof(*ctx));
|
||||||
|
|
||||||
if (ctx)
|
if (ctx)
|
||||||
memset(ctx, 0, sizeof(TS_VERIFY_CTX));
|
memset(ctx, 0, sizeof(*ctx));
|
||||||
else
|
else
|
||||||
TSerr(TS_F_TS_VERIFY_CTX_NEW, ERR_R_MALLOC_FAILURE);
|
TSerr(TS_F_TS_VERIFY_CTX_NEW, ERR_R_MALLOC_FAILURE);
|
||||||
return ctx;
|
return ctx;
|
||||||
|
@ -75,7 +75,7 @@ TS_VERIFY_CTX *TS_VERIFY_CTX_new(void)
|
||||||
void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx)
|
void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx)
|
||||||
{
|
{
|
||||||
OPENSSL_assert(ctx != NULL);
|
OPENSSL_assert(ctx != NULL);
|
||||||
memset(ctx, 0, sizeof(TS_VERIFY_CTX));
|
memset(ctx, 0, sizeof(*ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx)
|
void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx)
|
||||||
|
|
|
@ -585,7 +585,7 @@ static void pushsig(void)
|
||||||
# ifdef SIGACTION
|
# ifdef SIGACTION
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
||||||
memset(&sa, 0, sizeof sa);
|
memset(&sa, 0, sizeof(sa));
|
||||||
sa.sa_handler = recsig;
|
sa.sa_handler = recsig;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|
|
@ -2217,7 +2217,7 @@ X509_STORE_CTX *X509_STORE_CTX_new(void)
|
||||||
X509err(X509_F_X509_STORE_CTX_NEW, ERR_R_MALLOC_FAILURE);
|
X509err(X509_F_X509_STORE_CTX_NEW, ERR_R_MALLOC_FAILURE);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(ctx, 0, sizeof(X509_STORE_CTX));
|
memset(ctx, 0, sizeof(*ctx));
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2337,11 +2337,9 @@ int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,
|
||||||
ctx->check_policy = check_policy;
|
ctx->check_policy = check_policy;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This memset() can't make any sense anyway, so it's removed. As
|
* Since X509_STORE_CTX_cleanup does a proper "free" on the ex_data, we
|
||||||
* X509_STORE_CTX_cleanup does a proper "free" on the ex_data, we put a
|
* put a corresponding "new" here.
|
||||||
* corresponding "new" here and remove this bogus initialisation.
|
|
||||||
*/
|
*/
|
||||||
/* memset(&(ctx->ex_data),0,sizeof(CRYPTO_EX_DATA)); */
|
|
||||||
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE_CTX, ctx,
|
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE_CTX, ctx,
|
||||||
&(ctx->ex_data))) {
|
&(ctx->ex_data))) {
|
||||||
OPENSSL_free(ctx);
|
OPENSSL_free(ctx);
|
||||||
|
@ -2376,7 +2374,7 @@ void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx)
|
||||||
sk_X509_pop_free(ctx->chain, X509_free);
|
sk_X509_pop_free(ctx->chain, X509_free);
|
||||||
ctx->chain = NULL;
|
ctx->chain = NULL;
|
||||||
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509_STORE_CTX, ctx, &(ctx->ex_data));
|
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509_STORE_CTX, ctx, &(ctx->ex_data));
|
||||||
memset(&ctx->ex_data, 0, sizeof(CRYPTO_EX_DATA));
|
memset(&ctx->ex_data, 0, sizeof(ctx->ex_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth)
|
void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth)
|
||||||
|
|
|
@ -235,14 +235,11 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(tree->levels, 0, n * sizeof(X509_POLICY_LEVEL));
|
memset(tree->levels, 0, sizeof(*tree->levels) * n);
|
||||||
|
|
||||||
tree->nlevel = n;
|
tree->nlevel = n;
|
||||||
|
|
||||||
level = tree->levels;
|
level = tree->levels;
|
||||||
|
|
||||||
/* Root data: initialize to anyPolicy */
|
/* Root data: initialize to anyPolicy */
|
||||||
|
|
||||||
data = policy_data_new(NULL, OBJ_nid2obj(NID_any_policy), 0);
|
data = policy_data_new(NULL, OBJ_nid2obj(NID_any_policy), 0);
|
||||||
|
|
||||||
if (!data || !level_add_node(level, data, NULL, tree))
|
if (!data || !level_add_node(level, data, NULL, tree))
|
||||||
|
|
|
@ -506,7 +506,7 @@ static int ibmca_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||||
if (publKey == NULL) {
|
if (publKey == NULL) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
memset(publKey, 0, sizeof(ICA_KEY_RSA_MODEXPO));
|
memset(publKey, 0, sizeof(*publKey));
|
||||||
|
|
||||||
publKey->keyType = CORRECT_ENDIANNESS(ME_KEY_TYPE);
|
publKey->keyType = CORRECT_ENDIANNESS(ME_KEY_TYPE);
|
||||||
publKey->keyLength = CORRECT_ENDIANNESS(sizeof(ICA_KEY_RSA_MODEXPO));
|
publKey->keyLength = CORRECT_ENDIANNESS(sizeof(ICA_KEY_RSA_MODEXPO));
|
||||||
|
@ -670,7 +670,7 @@ static int ibmca_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||||
|
|
||||||
/* end SAB additions */
|
/* end SAB additions */
|
||||||
|
|
||||||
memset(privKey, 0, sizeof(ICA_KEY_RSA_CRT));
|
memset(privKey, 0, sizeof(*privKey));
|
||||||
privKey->keyType = CORRECT_ENDIANNESS(CRT_KEY_TYPE);
|
privKey->keyType = CORRECT_ENDIANNESS(CRT_KEY_TYPE);
|
||||||
privKey->keyLength = CORRECT_ENDIANNESS(sizeof(ICA_KEY_RSA_CRT));
|
privKey->keyLength = CORRECT_ENDIANNESS(sizeof(ICA_KEY_RSA_CRT));
|
||||||
privKey->modulusBitLength = CORRECT_ENDIANNESS(BN_num_bytes(q) * 2 * 8);
|
privKey->modulusBitLength = CORRECT_ENDIANNESS(BN_num_bytes(q) * 2 * 8);
|
||||||
|
|
|
@ -47,7 +47,7 @@ void main ()
|
||||||
|
|
||||||
sd = socket (AF_INET, SOCK_STREAM, 0); CHK_ERR(sd, "socket");
|
sd = socket (AF_INET, SOCK_STREAM, 0); CHK_ERR(sd, "socket");
|
||||||
|
|
||||||
memset (&sa, '\0', sizeof(sa));
|
memset(&sa, 0, sizeof(sa));
|
||||||
sa.sin_family = AF_INET;
|
sa.sin_family = AF_INET;
|
||||||
sa.sin_addr.s_addr = inet_addr ("127.0.0.1"); /* Server IP */
|
sa.sin_addr.s_addr = inet_addr ("127.0.0.1"); /* Server IP */
|
||||||
sa.sin_port = htons (1111); /* Server Port number */
|
sa.sin_port = htons (1111); /* Server Port number */
|
||||||
|
|
|
@ -81,7 +81,7 @@ void main ()
|
||||||
|
|
||||||
listen_sd = socket (AF_INET, SOCK_STREAM, 0); CHK_ERR(listen_sd, "socket");
|
listen_sd = socket (AF_INET, SOCK_STREAM, 0); CHK_ERR(listen_sd, "socket");
|
||||||
|
|
||||||
memset (&sa_serv, '\0', sizeof(sa_serv));
|
memset(&sa_serv, 0, sizeof(sa_serv));
|
||||||
sa_serv.sin_family = AF_INET;
|
sa_serv.sin_family = AF_INET;
|
||||||
sa_serv.sin_addr.s_addr = INADDR_ANY;
|
sa_serv.sin_addr.s_addr = INADDR_ANY;
|
||||||
sa_serv.sin_port = htons (1111); /* Server Port number */
|
sa_serv.sin_port = htons (1111); /* Server Port number */
|
||||||
|
|
|
@ -257,7 +257,7 @@ int OpenSocket(int nPort)
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&saServer, 0, sizeof saServer);
|
memset(&saServer, 0, sizeof(saServer));
|
||||||
saServer.sin_family = AF_INET;
|
saServer.sin_family = AF_INET;
|
||||||
saServer.sin_port = htons(nPort);
|
saServer.sin_port = htons(nPort);
|
||||||
nSize = sizeof saServer;
|
nSize = sizeof saServer;
|
||||||
|
|
|
@ -28,7 +28,7 @@ static int pkey_gost_init(EVP_PKEY_CTX *ctx)
|
||||||
data = OPENSSL_malloc(sizeof(*data));
|
data = OPENSSL_malloc(sizeof(*data));
|
||||||
if (!data)
|
if (!data)
|
||||||
return 0;
|
return 0;
|
||||||
memset(data, 0, sizeof(struct gost_pmeth_data));
|
memset(data, 0, sizeof(*data));
|
||||||
if (pkey && EVP_PKEY_get0(pkey)) {
|
if (pkey && EVP_PKEY_get0(pkey)) {
|
||||||
switch (EVP_PKEY_base_id(pkey)) {
|
switch (EVP_PKEY_base_id(pkey)) {
|
||||||
case NID_id_GostR3410_94:
|
case NID_id_GostR3410_94:
|
||||||
|
@ -411,7 +411,7 @@ static int pkey_gost_mac_init(EVP_PKEY_CTX *ctx)
|
||||||
|
|
||||||
if (!data)
|
if (!data)
|
||||||
return 0;
|
return 0;
|
||||||
memset(data, 0, sizeof(struct gost_mac_pmeth_data));
|
memset(data, 0, sizeof(*data));
|
||||||
EVP_PKEY_CTX_set_data(ctx, data);
|
EVP_PKEY_CTX_set_data(ctx, data);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ static int hash_step(gost_ctx * c, byte * H, const byte * M)
|
||||||
int init_gost_hash_ctx(gost_hash_ctx * ctx,
|
int init_gost_hash_ctx(gost_hash_ctx * ctx,
|
||||||
const gost_subst_block * subst_block)
|
const gost_subst_block * subst_block)
|
||||||
{
|
{
|
||||||
memset(ctx, 0, sizeof(gost_hash_ctx));
|
memset(ctx, 0, sizeof(*ctx));
|
||||||
ctx->cipher_ctx = (gost_ctx *) MYALLOC(sizeof(gost_ctx));
|
ctx->cipher_ctx = (gost_ctx *) MYALLOC(sizeof(gost_ctx));
|
||||||
if (!ctx->cipher_ctx) {
|
if (!ctx->cipher_ctx) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -492,7 +492,7 @@ static int atalla_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
/* Prepare the key-data */
|
/* Prepare the key-data */
|
||||||
memset(&keydata, 0, sizeof keydata);
|
memset(&keydata, 0, sizeof(keydata));
|
||||||
numbytes = BN_num_bytes(m);
|
numbytes = BN_num_bytes(m);
|
||||||
memset(exponent->d, 0, numbytes);
|
memset(exponent->d, 0, numbytes);
|
||||||
memset(modulus->d, 0, numbytes);
|
memset(modulus->d, 0, numbytes);
|
||||||
|
|
|
@ -661,7 +661,7 @@ padlock_aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||||
return 0; /* ERROR */
|
return 0; /* ERROR */
|
||||||
|
|
||||||
cdata = ALIGNED_CIPHER_DATA(ctx);
|
cdata = ALIGNED_CIPHER_DATA(ctx);
|
||||||
memset(cdata, 0, sizeof(struct padlock_cipher_data));
|
memset(cdata, 0, sizeof(*cdata));
|
||||||
|
|
||||||
/* Prepare Control word. */
|
/* Prepare Control word. */
|
||||||
if (mode == EVP_CIPH_OFB_MODE || mode == EVP_CIPH_CTR_MODE)
|
if (mode == EVP_CIPH_OFB_MODE || mode == EVP_CIPH_CTR_MODE)
|
||||||
|
|
|
@ -107,7 +107,7 @@ static int ssl_new(BIO *bi)
|
||||||
BIOerr(BIO_F_SSL_NEW, ERR_R_MALLOC_FAILURE);
|
BIOerr(BIO_F_SSL_NEW, ERR_R_MALLOC_FAILURE);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
memset(bs, 0, sizeof(BIO_SSL));
|
memset(bs, 0, sizeof(*bs));
|
||||||
bi->init = 0;
|
bi->init = 0;
|
||||||
bi->ptr = (char *)bs;
|
bi->ptr = (char *)bs;
|
||||||
bi->flags = 0;
|
bi->flags = 0;
|
||||||
|
|
|
@ -467,7 +467,7 @@ long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok)
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_hdr = &s->d1->r_msg_hdr;
|
msg_hdr = &s->d1->r_msg_hdr;
|
||||||
memset(msg_hdr, 0x00, sizeof(struct hm_header_st));
|
memset(msg_hdr, 0, sizeof(*msg_hdr));
|
||||||
|
|
||||||
again:
|
again:
|
||||||
i = dtls1_get_message_fragment(s, st1, stn, max, ok);
|
i = dtls1_get_message_fragment(s, st1, stn, max, ok);
|
||||||
|
@ -497,7 +497,7 @@ long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok)
|
||||||
s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE,
|
s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE,
|
||||||
p, msg_len, s, s->msg_callback_arg);
|
p, msg_len, s, s->msg_callback_arg);
|
||||||
|
|
||||||
memset(msg_hdr, 0x00, sizeof(struct hm_header_st));
|
memset(msg_hdr, 0, sizeof(*msg_hdr));
|
||||||
|
|
||||||
/* Don't change sequence numbers while listening */
|
/* Don't change sequence numbers while listening */
|
||||||
if (!s->d1->listen)
|
if (!s->d1->listen)
|
||||||
|
@ -1289,7 +1289,7 @@ unsigned int dtls1_min_mtu(SSL *s)
|
||||||
void
|
void
|
||||||
dtls1_get_message_header(unsigned char *data, struct hm_header_st *msg_hdr)
|
dtls1_get_message_header(unsigned char *data, struct hm_header_st *msg_hdr)
|
||||||
{
|
{
|
||||||
memset(msg_hdr, 0x00, sizeof(struct hm_header_st));
|
memset(msg_hdr, 0, sizeof(*msg_hdr));
|
||||||
msg_hdr->type = *(data++);
|
msg_hdr->type = *(data++);
|
||||||
n2l3(data, msg_hdr->msg_len);
|
n2l3(data, msg_hdr->msg_len);
|
||||||
|
|
||||||
|
@ -1300,7 +1300,7 @@ dtls1_get_message_header(unsigned char *data, struct hm_header_st *msg_hdr)
|
||||||
|
|
||||||
void dtls1_get_ccs_header(unsigned char *data, struct ccs_header_st *ccs_hdr)
|
void dtls1_get_ccs_header(unsigned char *data, struct ccs_header_st *ccs_hdr)
|
||||||
{
|
{
|
||||||
memset(ccs_hdr, 0x00, sizeof(struct ccs_header_st));
|
memset(ccs_hdr, 0, sizeof(*ccs_hdr));
|
||||||
|
|
||||||
ccs_hdr->type = *(data++);
|
ccs_hdr->type = *(data++);
|
||||||
}
|
}
|
||||||
|
|
12
ssl/d1_lib.c
12
ssl/d1_lib.c
|
@ -215,7 +215,7 @@ void dtls1_clear(SSL *s)
|
||||||
|
|
||||||
dtls1_clear_queues(s);
|
dtls1_clear_queues(s);
|
||||||
|
|
||||||
memset(s->d1, 0, sizeof(*(s->d1)));
|
memset(s->d1, 0, sizeof(*s->d1));
|
||||||
|
|
||||||
if (s->server) {
|
if (s->server) {
|
||||||
s->d1->cookie_len = sizeof(s->d1->cookie);
|
s->d1->cookie_len = sizeof(s->d1->cookie);
|
||||||
|
@ -324,7 +324,7 @@ void dtls1_start_timer(SSL *s)
|
||||||
#ifndef OPENSSL_NO_SCTP
|
#ifndef OPENSSL_NO_SCTP
|
||||||
/* Disable timer for SCTP */
|
/* Disable timer for SCTP */
|
||||||
if (BIO_dgram_is_sctp(SSL_get_wbio(s))) {
|
if (BIO_dgram_is_sctp(SSL_get_wbio(s))) {
|
||||||
memset(&(s->d1->next_timeout), 0, sizeof(struct timeval));
|
memset(&s->d1->next_timeout, 0, sizeof(s->d1->next_timeout));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -359,7 +359,7 @@ struct timeval *dtls1_get_timeout(SSL *s, struct timeval *timeleft)
|
||||||
if (s->d1->next_timeout.tv_sec < timenow.tv_sec ||
|
if (s->d1->next_timeout.tv_sec < timenow.tv_sec ||
|
||||||
(s->d1->next_timeout.tv_sec == timenow.tv_sec &&
|
(s->d1->next_timeout.tv_sec == timenow.tv_sec &&
|
||||||
s->d1->next_timeout.tv_usec <= timenow.tv_usec)) {
|
s->d1->next_timeout.tv_usec <= timenow.tv_usec)) {
|
||||||
memset(timeleft, 0, sizeof(struct timeval));
|
memset(timeleft, 0, sizeof(*timeleft));
|
||||||
return timeleft;
|
return timeleft;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ struct timeval *dtls1_get_timeout(SSL *s, struct timeval *timeleft)
|
||||||
* because of small devergences with socket timeouts.
|
* because of small devergences with socket timeouts.
|
||||||
*/
|
*/
|
||||||
if (timeleft->tv_sec == 0 && timeleft->tv_usec < 15000) {
|
if (timeleft->tv_sec == 0 && timeleft->tv_usec < 15000) {
|
||||||
memset(timeleft, 0, sizeof(struct timeval));
|
memset(timeleft, 0, sizeof(*timeleft));
|
||||||
}
|
}
|
||||||
|
|
||||||
return timeleft;
|
return timeleft;
|
||||||
|
@ -412,8 +412,8 @@ void dtls1_double_timeout(SSL *s)
|
||||||
void dtls1_stop_timer(SSL *s)
|
void dtls1_stop_timer(SSL *s)
|
||||||
{
|
{
|
||||||
/* Reset everything */
|
/* Reset everything */
|
||||||
memset(&(s->d1->timeout), 0, sizeof(struct dtls1_timeout_st));
|
memset(&s->d1->timeout, 0, sizeof(s->d1->timeout));
|
||||||
memset(&(s->d1->next_timeout), 0, sizeof(struct timeval));
|
memset(&s->d1->next_timeout, 0, sizeof(s->d1->next_timeout));
|
||||||
s->d1->timeout_duration = 1;
|
s->d1->timeout_duration = 1;
|
||||||
BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT, 0,
|
BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT, 0,
|
||||||
&(s->d1->next_timeout));
|
&(s->d1->next_timeout));
|
||||||
|
|
|
@ -161,7 +161,7 @@ int dtls1_dispatch_alert(SSL *s)
|
||||||
|
|
||||||
s->s3->alert_dispatch = 0;
|
s->s3->alert_dispatch = 0;
|
||||||
|
|
||||||
memset(buf, 0x00, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
*ptr++ = s->s3->send_alert[0];
|
*ptr++ = s->s3->send_alert[0];
|
||||||
*ptr++ = s->s3->send_alert[1];
|
*ptr++ = s->s3->send_alert[1];
|
||||||
|
|
||||||
|
|
|
@ -1048,7 +1048,7 @@ krb5_error_code kssl_cget_tkt( /* UPDATE */ KSSL_CTX *kssl_ctx,
|
||||||
krb5_data krb5_app_req;
|
krb5_data krb5_app_req;
|
||||||
|
|
||||||
kssl_err_set(kssl_err, 0, "");
|
kssl_err_set(kssl_err, 0, "");
|
||||||
memset((char *)&krb5creds, 0, sizeof(krb5creds));
|
memset(&krb5creds, 0, sizeof(krb5creds));
|
||||||
|
|
||||||
if (!kssl_ctx) {
|
if (!kssl_ctx) {
|
||||||
kssl_err_set(kssl_err, SSL_R_KRB5_S_INIT, "No kssl_ctx defined.\n");
|
kssl_err_set(kssl_err, SSL_R_KRB5_S_INIT, "No kssl_ctx defined.\n");
|
||||||
|
@ -1797,7 +1797,7 @@ int kssl_tgt_is_available(KSSL_CTX *kssl_ctx)
|
||||||
krb5_creds krb5creds, *krb5credsp = NULL;
|
krb5_creds krb5creds, *krb5credsp = NULL;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
memset((char *)&krb5creds, 0, sizeof(krb5creds));
|
memset(&krb5creds, 0, sizeof(krb5creds));
|
||||||
|
|
||||||
if (!kssl_ctx)
|
if (!kssl_ctx)
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -2072,7 +2072,7 @@ krb5_error_code kssl_check_authent(
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
enc = kssl_map_enc(enctype);
|
enc = kssl_map_enc(enctype);
|
||||||
memset(iv, 0, sizeof iv); /* per RFC 1510 */
|
memset(iv, 0, sizeof(iv)); /* per RFC 1510 */
|
||||||
|
|
||||||
if (enc == NULL) {
|
if (enc == NULL) {
|
||||||
/*
|
/*
|
||||||
|
@ -2126,7 +2126,7 @@ krb5_error_code kssl_check_authent(
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&tm_time, 0, sizeof(struct tm));
|
memset(&tm_time, 0, sizeof(tm_tmime));
|
||||||
if (k_gmtime(auth->ctime, &tm_time) &&
|
if (k_gmtime(auth->ctime, &tm_time) &&
|
||||||
((tr = mktime(&tm_time)) != (time_t)(-1))) {
|
((tr = mktime(&tm_time)) != (time_t)(-1))) {
|
||||||
now = time(&now);
|
now = time(&now);
|
||||||
|
|
|
@ -286,8 +286,8 @@ int dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority)
|
||||||
|
|
||||||
s->rlayer.packet = NULL;
|
s->rlayer.packet = NULL;
|
||||||
s->rlayer.packet_length = 0;
|
s->rlayer.packet_length = 0;
|
||||||
memset(&s->rlayer.rbuf, 0, sizeof(SSL3_BUFFER));
|
memset(&s->rlayer.rbuf, 0, sizeof(s->rlayer.rbuf));
|
||||||
memset(&s->rlayer.rrec, 0, sizeof(SSL3_RECORD));
|
memset(&s->rlayer.rrec, 0, sizeof(s->rlayer.rrec));
|
||||||
|
|
||||||
if (!ssl3_setup_buffers(s)) {
|
if (!ssl3_setup_buffers(s)) {
|
||||||
SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR);
|
SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR);
|
||||||
|
@ -1298,9 +1298,10 @@ void dtls1_reset_seq_numbers(SSL *s, int rw)
|
||||||
if (rw & SSL3_CC_READ) {
|
if (rw & SSL3_CC_READ) {
|
||||||
seq = s->rlayer.read_sequence;
|
seq = s->rlayer.read_sequence;
|
||||||
s->rlayer.d->r_epoch++;
|
s->rlayer.d->r_epoch++;
|
||||||
memcpy(&(s->rlayer.d->bitmap), &(s->rlayer.d->next_bitmap),
|
memcpy(&s->rlayer.d->bitmap, &s->rlayer.d->next_bitmap,
|
||||||
sizeof(DTLS1_BITMAP));
|
sizeof(s->rlayer.d->bitmap));
|
||||||
memset(&(s->rlayer.d->next_bitmap), 0x00, sizeof(DTLS1_BITMAP));
|
memset(&s->rlayer.d->next_bitmap, 0,
|
||||||
|
sizeof(s->rlayer.d->next_bitmap));
|
||||||
} else {
|
} else {
|
||||||
seq = s->rlayer.write_sequence;
|
seq = s->rlayer.write_sequence;
|
||||||
memcpy(s->rlayer.d->last_write_sequence, seq,
|
memcpy(s->rlayer.d->last_write_sequence, seq,
|
||||||
|
@ -1308,5 +1309,5 @@ void dtls1_reset_seq_numbers(SSL *s, int rw)
|
||||||
s->rlayer.d->w_epoch++;
|
s->rlayer.d->w_epoch++;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(seq, 0x00, seq_bytes);
|
memset(seq, 0, seq_bytes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ void RECORD_LAYER_clear(RECORD_LAYER *rl)
|
||||||
rlen = SSL3_BUFFER_get_len(&rl->rbuf);
|
rlen = SSL3_BUFFER_get_len(&rl->rbuf);
|
||||||
wp = SSL3_BUFFER_get_buf(&rl->wbuf);
|
wp = SSL3_BUFFER_get_buf(&rl->wbuf);
|
||||||
wlen = SSL3_BUFFER_get_len(&rl->wbuf);
|
wlen = SSL3_BUFFER_get_len(&rl->wbuf);
|
||||||
memset(rl, 0, sizeof (RECORD_LAYER));
|
memset(rl, 0, sizeof(*rl));
|
||||||
SSL3_BUFFER_set_buf(&rl->rbuf, rp);
|
SSL3_BUFFER_set_buf(&rl->rbuf, rp);
|
||||||
SSL3_BUFFER_set_len(&rl->rbuf, rlen);
|
SSL3_BUFFER_set_len(&rl->rbuf, rlen);
|
||||||
SSL3_BUFFER_set_buf(&rl->wbuf, wp);
|
SSL3_BUFFER_set_buf(&rl->wbuf, wp);
|
||||||
|
|
|
@ -2518,7 +2518,7 @@ int ssl3_send_client_key_exchange(SSL *s)
|
||||||
* EVP_EncryptInit_ex(&ciph_ctx,NULL, key,iv);
|
* EVP_EncryptInit_ex(&ciph_ctx,NULL, key,iv);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
memset(iv, 0, sizeof iv); /* per RFC 1510 */
|
memset(iv, 0, sizeof(iv)); /* per RFC 1510 */
|
||||||
EVP_EncryptInit_ex(&ciph_ctx, enc, NULL, kssl_ctx->key, iv);
|
EVP_EncryptInit_ex(&ciph_ctx, enc, NULL, kssl_ctx->key, iv);
|
||||||
EVP_EncryptUpdate(&ciph_ctx, epms, &outl, pms, pmslen);
|
EVP_EncryptUpdate(&ciph_ctx, epms, &outl, pms, pmslen);
|
||||||
EVP_EncryptFinal_ex(&ciph_ctx, &(epms[outl]), &padl);
|
EVP_EncryptFinal_ex(&ciph_ctx, &(epms[outl]), &padl);
|
||||||
|
@ -2788,7 +2788,7 @@ int ssl3_send_client_key_exchange(SSL *s)
|
||||||
/* Encoded point will be copied here */
|
/* Encoded point will be copied here */
|
||||||
p += 1;
|
p += 1;
|
||||||
/* copy the point */
|
/* copy the point */
|
||||||
memcpy((unsigned char *)p, encodedPoint, n);
|
memcpy(p, encodedPoint, n);
|
||||||
/* increment n to account for length field */
|
/* increment n to account for length field */
|
||||||
n += 1;
|
n += 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -519,12 +519,13 @@ int ssl3_digest_cached_records(SSL *s)
|
||||||
/* Allocate handshake_dgst array */
|
/* Allocate handshake_dgst array */
|
||||||
ssl3_free_digest_list(s);
|
ssl3_free_digest_list(s);
|
||||||
s->s3->handshake_dgst =
|
s->s3->handshake_dgst =
|
||||||
OPENSSL_malloc(SSL_MAX_DIGEST * sizeof(EVP_MD_CTX *));
|
OPENSSL_malloc(sizeof(*s->s3->handshake_dgst) * SSL_MAX_DIGEST);
|
||||||
if (s->s3->handshake_dgst == NULL) {
|
if (s->s3->handshake_dgst == NULL) {
|
||||||
SSLerr(SSL_F_SSL3_DIGEST_CACHED_RECORDS, ERR_R_MALLOC_FAILURE);
|
SSLerr(SSL_F_SSL3_DIGEST_CACHED_RECORDS, ERR_R_MALLOC_FAILURE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
memset(s->s3->handshake_dgst, 0, SSL_MAX_DIGEST * sizeof(EVP_MD_CTX *));
|
memset(s->s3->handshake_dgst, 0,
|
||||||
|
sizeof(*s->s3->handshake_dgst) * SSL_MAX_DIGEST);
|
||||||
hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata);
|
hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata);
|
||||||
if (hdatalen <= 0) {
|
if (hdatalen <= 0) {
|
||||||
SSLerr(SSL_F_SSL3_DIGEST_CACHED_RECORDS, SSL_R_BAD_HANDSHAKE_LENGTH);
|
SSLerr(SSL_F_SSL3_DIGEST_CACHED_RECORDS, SSL_R_BAD_HANDSHAKE_LENGTH);
|
||||||
|
|
|
@ -1935,8 +1935,7 @@ int ssl3_send_server_key_exchange(SSL *s)
|
||||||
p += 1;
|
p += 1;
|
||||||
*p = encodedlen;
|
*p = encodedlen;
|
||||||
p += 1;
|
p += 1;
|
||||||
memcpy((unsigned char *)p,
|
memcpy(p, encodedPoint, encodedlen);
|
||||||
(unsigned char *)encodedPoint, encodedlen);
|
|
||||||
OPENSSL_free(encodedPoint);
|
OPENSSL_free(encodedPoint);
|
||||||
encodedPoint = NULL;
|
encodedPoint = NULL;
|
||||||
p += encodedlen;
|
p += encodedlen;
|
||||||
|
@ -2509,7 +2508,7 @@ int ssl3_get_client_key_exchange(SSL *s)
|
||||||
if (enc == NULL)
|
if (enc == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
memset(iv, 0, sizeof iv); /* per RFC 1510 */
|
memset(iv, 0, sizeof(iv)); /* per RFC 1510 */
|
||||||
|
|
||||||
if (!EVP_DecryptInit_ex(&ciph_ctx, enc, NULL, kssl_ctx->key, iv)) {
|
if (!EVP_DecryptInit_ex(&ciph_ctx, enc, NULL, kssl_ctx->key, iv)) {
|
||||||
SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
|
SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
|
||||||
|
|
|
@ -188,7 +188,7 @@ CERT *ssl_cert_new(void)
|
||||||
SSLerr(SSL_F_SSL_CERT_NEW, ERR_R_MALLOC_FAILURE);
|
SSLerr(SSL_F_SSL_CERT_NEW, ERR_R_MALLOC_FAILURE);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
memset(ret, 0, sizeof(CERT));
|
memset(ret, 0, sizeof(*ret));
|
||||||
|
|
||||||
ret->key = &(ret->pkeys[SSL_PKEY_RSA_ENC]);
|
ret->key = &(ret->pkeys[SSL_PKEY_RSA_ENC]);
|
||||||
ret->references = 1;
|
ret->references = 1;
|
||||||
|
@ -209,14 +209,9 @@ CERT *ssl_cert_dup(CERT *cert)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(ret, 0, sizeof(CERT));
|
memset(ret, 0, sizeof(*ret));
|
||||||
|
|
||||||
ret->key = &ret->pkeys[cert->key - &cert->pkeys[0]];
|
|
||||||
/*
|
|
||||||
* or ret->key = ret->pkeys + (cert->key - cert->pkeys), if you find that
|
|
||||||
* more readable
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
ret->key = &ret->pkeys[cert->key - cert->pkeys];
|
||||||
ret->valid = cert->valid;
|
ret->valid = cert->valid;
|
||||||
ret->mask_k = cert->mask_k;
|
ret->mask_k = cert->mask_k;
|
||||||
ret->mask_a = cert->mask_a;
|
ret->mask_a = cert->mask_a;
|
||||||
|
|
|
@ -1063,12 +1063,12 @@ static int ssl_cipher_strength_sort(CIPHER_ORDER **head_p,
|
||||||
curr = curr->next;
|
curr = curr->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
number_uses = OPENSSL_malloc((max_strength_bits + 1) * sizeof(int));
|
number_uses = OPENSSL_malloc(sizeof(int) * (max_strength_bits + 1));
|
||||||
if (!number_uses) {
|
if (!number_uses) {
|
||||||
SSLerr(SSL_F_SSL_CIPHER_STRENGTH_SORT, ERR_R_MALLOC_FAILURE);
|
SSLerr(SSL_F_SSL_CIPHER_STRENGTH_SORT, ERR_R_MALLOC_FAILURE);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
memset(number_uses, 0, (max_strength_bits + 1) * sizeof(int));
|
memset(number_uses, 0, sizeof(int) * (max_strength_bits + 1));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now find the strength_bits values actually used
|
* Now find the strength_bits values actually used
|
||||||
|
|
|
@ -275,7 +275,7 @@ SSL *SSL_new(SSL_CTX *ctx)
|
||||||
s = OPENSSL_malloc(sizeof(*s));
|
s = OPENSSL_malloc(sizeof(*s));
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
memset(s, 0, sizeof(SSL));
|
memset(s, 0, sizeof(*s));
|
||||||
|
|
||||||
RECORD_LAYER_init(&s->rlayer, s);
|
RECORD_LAYER_init(&s->rlayer, s);
|
||||||
|
|
||||||
|
@ -1848,7 +1848,7 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth)
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
memset(ret, 0, sizeof(SSL_CTX));
|
memset(ret, 0, sizeof(*ret));
|
||||||
|
|
||||||
ret->method = meth;
|
ret->method = meth;
|
||||||
|
|
||||||
|
@ -1866,7 +1866,7 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth)
|
||||||
ret->get_session_cb = 0;
|
ret->get_session_cb = 0;
|
||||||
ret->generate_session_id = 0;
|
ret->generate_session_id = 0;
|
||||||
|
|
||||||
memset((char *)&ret->stats, 0, sizeof(ret->stats));
|
memset(&ret->stats, 0, sizeof(ret->stats));
|
||||||
|
|
||||||
ret->references = 1;
|
ret->references = 1;
|
||||||
ret->quiet_shutdown = 0;
|
ret->quiet_shutdown = 0;
|
||||||
|
|
|
@ -198,7 +198,7 @@ SSL_SESSION *SSL_SESSION_new(void)
|
||||||
SSLerr(SSL_F_SSL_SESSION_NEW, ERR_R_MALLOC_FAILURE);
|
SSLerr(SSL_F_SSL_SESSION_NEW, ERR_R_MALLOC_FAILURE);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
memset(ss, 0, sizeof(SSL_SESSION));
|
memset(ss, 0, sizeof(*ss));
|
||||||
|
|
||||||
ss->verify_result = 1; /* avoid 0 (= X509_V_OK) just in case */
|
ss->verify_result = 1; /* avoid 0 (= X509_V_OK) just in case */
|
||||||
ss->references = 1;
|
ss->references = 1;
|
||||||
|
|
|
@ -232,7 +232,7 @@ static int custom_ext_meth_add(custom_ext_methods *exts,
|
||||||
}
|
}
|
||||||
|
|
||||||
meth = exts->meths + exts->meths_count;
|
meth = exts->meths + exts->meths_count;
|
||||||
memset(meth, 0, sizeof(custom_ext_method));
|
memset(meth, 0, sizeof(*meth));
|
||||||
meth->parse_cb = parse_cb;
|
meth->parse_cb = parse_cb;
|
||||||
meth->add_cb = add_cb;
|
meth->add_cb = add_cb;
|
||||||
meth->free_cb = free_cb;
|
meth->free_cb = free_cb;
|
||||||
|
|
|
@ -461,8 +461,8 @@ static int test(void)
|
||||||
len = strlen(cbc_data) + 1;
|
len = strlen(cbc_data) + 1;
|
||||||
|
|
||||||
BF_set_key(&key, 16, cbc_key);
|
BF_set_key(&key, 16, cbc_key);
|
||||||
memset(cbc_in, 0, sizeof cbc_in);
|
memset(cbc_in, 0, sizeof(cbc_in));
|
||||||
memset(cbc_out, 0, sizeof cbc_out);
|
memset(cbc_out, 0, sizeof(cbc_out));
|
||||||
memcpy(iv, cbc_iv, sizeof iv);
|
memcpy(iv, cbc_iv, sizeof iv);
|
||||||
BF_cbc_encrypt((unsigned char *)cbc_data, cbc_out, len,
|
BF_cbc_encrypt((unsigned char *)cbc_data, cbc_out, len,
|
||||||
&key, iv, BF_ENCRYPT);
|
&key, iv, BF_ENCRYPT);
|
||||||
|
|
|
@ -119,7 +119,7 @@ int main(int argc, char *argv[])
|
||||||
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
|
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
|
|
||||||
memset(block, 0, 512 * sizeof(ENGINE *));
|
memset(block, 0, sizeof(block));
|
||||||
if (((new_h1 = ENGINE_new()) == NULL) ||
|
if (((new_h1 = ENGINE_new()) == NULL) ||
|
||||||
!ENGINE_set_id(new_h1, "test_id0") ||
|
!ENGINE_set_id(new_h1, "test_id0") ||
|
||||||
!ENGINE_set_name(new_h1, "First test item") ||
|
!ENGINE_set_name(new_h1, "First test item") ||
|
||||||
|
|
|
@ -211,7 +211,7 @@ static int execute_heartbeat(HEARTBEAT_TEST_FIXTURE fixture)
|
||||||
* Make a local copy of the request, since it gets overwritten at some
|
* Make a local copy of the request, since it gets overwritten at some
|
||||||
* point
|
* point
|
||||||
*/
|
*/
|
||||||
memcpy((char *)sent_buf, (const char *)payload, sizeof(sent_buf));
|
memcpy(sent_buf, payload, sizeof(sent_buf));
|
||||||
|
|
||||||
return_value = fixture.process_heartbeat(s, s->rlayer.rrec.data,
|
return_value = fixture.process_heartbeat(s, s->rlayer.rrec.data,
|
||||||
s->rlayer.rrec.length);
|
s->rlayer.rrec.length);
|
||||||
|
|
|
@ -129,7 +129,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
for (i = 0; i < 6; i++) {
|
for (i = 0; i < 6; i++) {
|
||||||
RC4_set_key(&key, keys[i][0], &(keys[i][1]));
|
RC4_set_key(&key, keys[i][0], &(keys[i][1]));
|
||||||
memset(obuf, 0x00, sizeof(obuf));
|
memset(obuf, 0, sizeof(obuf));
|
||||||
RC4(&key, data_len[i], &(data[i][0]), obuf);
|
RC4(&key, data_len[i], &(data[i][0]), obuf);
|
||||||
if (memcmp(obuf, output[i], data_len[i] + 1) != 0) {
|
if (memcmp(obuf, output[i], data_len[i] + 1) != 0) {
|
||||||
printf("error calculating RC4\n");
|
printf("error calculating RC4\n");
|
||||||
|
@ -149,7 +149,7 @@ int main(int argc, char *argv[])
|
||||||
printf("test end processing ");
|
printf("test end processing ");
|
||||||
for (i = 0; i < data_len[3]; i++) {
|
for (i = 0; i < data_len[3]; i++) {
|
||||||
RC4_set_key(&key, keys[3][0], &(keys[3][1]));
|
RC4_set_key(&key, keys[3][0], &(keys[3][1]));
|
||||||
memset(obuf, 0x00, sizeof(obuf));
|
memset(obuf, 0, sizeof(obuf));
|
||||||
RC4(&key, i, &(data[3][0]), obuf);
|
RC4(&key, i, &(data[3][0]), obuf);
|
||||||
if ((memcmp(obuf, output[3], i) != 0) || (obuf[i] != 0)) {
|
if ((memcmp(obuf, output[3], i) != 0) || (obuf[i] != 0)) {
|
||||||
printf("error in RC4 length processing\n");
|
printf("error in RC4 length processing\n");
|
||||||
|
@ -172,7 +172,7 @@ int main(int argc, char *argv[])
|
||||||
printf("test multi-call ");
|
printf("test multi-call ");
|
||||||
for (i = 0; i < data_len[3]; i++) {
|
for (i = 0; i < data_len[3]; i++) {
|
||||||
RC4_set_key(&key, keys[3][0], &(keys[3][1]));
|
RC4_set_key(&key, keys[3][0], &(keys[3][1]));
|
||||||
memset(obuf, 0x00, sizeof(obuf));
|
memset(obuf, 0, sizeof(obuf));
|
||||||
RC4(&key, i, &(data[3][0]), obuf);
|
RC4(&key, i, &(data[3][0]), obuf);
|
||||||
RC4(&key, data_len[3] - i, &(data[3][i]), &(obuf[i]));
|
RC4(&key, data_len[3] - i, &(data[3][i]), &(obuf[i]));
|
||||||
if (memcmp(obuf, output[3], data_len[3] + 1) != 0) {
|
if (memcmp(obuf, output[3], data_len[3] + 1) != 0) {
|
||||||
|
@ -203,7 +203,7 @@ int main(int argc, char *argv[])
|
||||||
};
|
};
|
||||||
|
|
||||||
RC4_set_key(&key, keys[0][0], &(keys[3][1]));
|
RC4_set_key(&key, keys[0][0], &(keys[3][1]));
|
||||||
memset(buf, '\0', sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
SHA1_Init(&c);
|
SHA1_Init(&c);
|
||||||
for (i = 0; i < 2571; i++) {
|
for (i = 0; i < 2571; i++) {
|
||||||
RC4(&key, sizeof(buf), buf, buf);
|
RC4(&key, sizeof(buf), buf, buf);
|
||||||
|
|
Loading…
Reference in a new issue