summaryrefslogtreecommitdiff
path: root/deps/openssl/openssl/demos
diff options
context:
space:
mode:
Diffstat (limited to 'deps/openssl/openssl/demos')
-rw-r--r--deps/openssl/openssl/demos/easy_tls/easy-tls.c62
-rw-r--r--deps/openssl/openssl/demos/easy_tls/test.c12
-rw-r--r--deps/openssl/openssl/demos/engines/zencod/hw_zencod.c8
-rw-r--r--deps/openssl/openssl/demos/spkigen.c2
-rw-r--r--deps/openssl/openssl/demos/ssl/serv.cpp2
-rw-r--r--deps/openssl/openssl/demos/state_machine/state_machine.c20
6 files changed, 53 insertions, 53 deletions
diff --git a/deps/openssl/openssl/demos/easy_tls/easy-tls.c b/deps/openssl/openssl/demos/easy_tls/easy-tls.c
index 45063a4896..717b81aac1 100644
--- a/deps/openssl/openssl/demos/easy_tls/easy-tls.c
+++ b/deps/openssl/openssl/demos/easy_tls/easy-tls.c
@@ -295,9 +295,9 @@ static void tls_errflush(void *apparg)
if (errbuf_i == 0)
return;
- assert(errbuf_i < sizeof errbuf);
+ assert(errbuf_i < sizeof(errbuf));
assert(errbuf[errbuf_i] == 0);
- if (errbuf_i == sizeof errbuf - 1) {
+ if (errbuf_i == sizeof(errbuf) - 1) {
/* make sure we have a newline, even if string has been truncated */
errbuf[errbuf_i - 1] = '\n';
}
@@ -316,11 +316,11 @@ static void tls_errprintf(int flush, void *apparg, const char *fmt, ...)
va_list args;
int r;
- if (errbuf_i < sizeof errbuf - 1) {
+ if (errbuf_i < sizeof(errbuf) - 1) {
size_t n;
va_start(args, fmt);
- n = (sizeof errbuf) - errbuf_i;
+ n = (sizeof(errbuf)) - errbuf_i;
r = vsnprintf(errbuf + errbuf_i, n, fmt, args);
va_end(args);
if (r >= n)
@@ -328,10 +328,10 @@ static void tls_errprintf(int flush, void *apparg, const char *fmt, ...)
if (r >= 0) {
errbuf_i += r;
} else {
- errbuf_i = sizeof errbuf - 1;
+ errbuf_i = sizeof(errbuf) - 1;
errbuf[errbuf_i] = '\0';
}
- assert(errbuf_i < sizeof errbuf);
+ assert(errbuf_i < sizeof(errbuf));
assert(errbuf[errbuf_i] == 0);
}
#ifndef TLS_CUMULATE_ERRORS
@@ -369,11 +369,11 @@ static char *tls_openssl_errors(const char *app_prefix_1,
default_text = "?" "?" "?";
while ((err = ERR_get_error_line_data(&file, &line, &data, &flags)) != 0) {
- if (reasons_i < sizeof reasons) {
+ if (reasons_i < sizeof(reasons)) {
size_t n;
int r;
- n = (sizeof reasons) - reasons_i;
+ n = (sizeof(reasons)) - reasons_i;
r = snprintf(reasons + reasons_i, n, "%s%s",
(reasons_i > 0 ? ", " : ""),
ERR_reason_error_string(err));
@@ -382,9 +382,9 @@ static char *tls_openssl_errors(const char *app_prefix_1,
if (r >= 0) {
reasons_i += r;
} else {
- reasons_i = sizeof reasons;
+ reasons_i = sizeof(reasons);
}
- assert(reasons_i <= sizeof reasons);
+ assert(reasons_i <= sizeof(reasons));
}
errstring = ERR_error_string(err, NULL);
@@ -397,7 +397,7 @@ static char *tls_openssl_errors(const char *app_prefix_1,
if (!printed_something) {
assert(reasons_i == 0);
- snprintf(reasons, sizeof reasons, "%s", default_text);
+ snprintf(reasons, sizeof(reasons), "%s", default_text);
tls_errprintf(0, apparg, "OpenSSL error%s%s: %s\n", app_prefix_1,
app_prefix_2, default_text);
}
@@ -442,7 +442,7 @@ static void tls_rand_seed_uniquely(void)
data.time = time(NULL);
data.stack = (void *)&data;
- RAND_seed((const void *)&data, sizeof data);
+ RAND_seed((const void *)&data, sizeof(data));
}
void tls_rand_seed(void)
@@ -465,7 +465,7 @@ void tls_rand_seed(void)
data.gid = getgid();
data.egid = getegid();
- RAND_seed((const void *)&data, sizeof data);
+ RAND_seed((const void *)&data, sizeof(data));
tls_rand_seed_uniquely();
}
@@ -543,7 +543,7 @@ tls_get_x509_subject_name_oneline(X509 *cert,
name = X509_get_subject_name(cert); /* does not increment any reference
* counter */
- assert(sizeof namestring->str >= 4); /* "?" or "...", plus 0 */
+ assert(sizeof(namestring->str) >= 4); /* "?" or "...", plus 0 */
if (name == NULL) {
namestring->str[0] = '?';
@@ -551,12 +551,12 @@ tls_get_x509_subject_name_oneline(X509 *cert,
} else {
size_t len;
- X509_NAME_oneline(name, namestring->str, sizeof namestring->str);
+ X509_NAME_oneline(name, namestring->str, sizeof(namestring->str));
len = strlen(namestring->str);
assert(namestring->str[len] == 0);
- assert(len < sizeof namestring->str);
+ assert(len < sizeof(namestring->str));
- if (len + 1 == sizeof namestring->str) {
+ if (len + 1 == sizeof(namestring->str)) {
/*
* (Probably something was cut off.) Does not really work --
* X509_NAME_oneline truncates after name components, we cannot
@@ -617,7 +617,7 @@ void tls_set_dhe1024(int i, void *apparg)
tls_init(apparg);
if (i >= 0) {
- i %= sizeof seed / sizeof seed[0];
+ i %= sizeof(seed) / sizeof(seed[0]);
assert(strlen(seed[i]) == 20);
memcpy(seedbuf, seed[i], 20);
dsaparams =
@@ -711,7 +711,7 @@ SSL_CTX *tls_create_ctx(struct tls_create_ctx_args a, void *apparg)
if ((a.ca_file != NULL) || (a.verify_depth > 0)) {
context_num++;
r = SSL_CTX_set_session_id_context(ret, (const void *)&context_num,
- (unsigned int)sizeof context_num);
+ (unsigned int)sizeof(context_num));
if (!r)
goto err;
@@ -762,7 +762,7 @@ SSL_CTX *tls_create_ctx(struct tls_create_ctx_args a, void *apparg)
if (tls_dhe1024 == NULL) {
int i;
- if (RAND_bytes((unsigned char *)&i, sizeof i) <= 0)
+ if (RAND_bytes((unsigned char *)&i, sizeof(i)) <= 0)
goto err_return;
/*
* make sure that i is non-negative -- pick one of the provided
@@ -955,11 +955,11 @@ static void write_info(SSL *ssl, int *info_fd)
/* should not happen, but make sure */
*strchr(peer.str, '\n') = '\0';
}
- r = snprintf(infobuf, sizeof infobuf, "%c:%s\n%s\n", v_ok,
+ r = snprintf(infobuf, sizeof(infobuf), "%c:%s\n%s\n", v_ok,
X509_verify_cert_error_string(v), peer.str);
DEBUG_MSG2("snprintf", r);
- if (r == -1 || r >= sizeof infobuf)
- r = sizeof infobuf - 1;
+ if (r == -1 || r >= sizeof(infobuf))
+ r = sizeof(infobuf) - 1;
write(*info_fd, infobuf, r);
close(*info_fd);
*info_fd = -1;
@@ -1082,7 +1082,7 @@ tls_proxy(int clear_fd, int tls_fd, int info_fd, SSL_CTX *ctx, int client_p)
if (!closed) {
if (clear_to_tls.offset + clear_to_tls.len <
- sizeof clear_to_tls.buf) {
+ sizeof(clear_to_tls.buf)) {
r = read_attempt(clear_fd, &clear_to_tls, &clear_read_select,
&closed, &progress);
if (r != 0)
@@ -1096,7 +1096,7 @@ tls_proxy(int clear_fd, int tls_fd, int info_fd, SSL_CTX *ctx, int client_p)
if (!closed && !in_handshake) {
if (tls_to_clear.offset + tls_to_clear.len <
- sizeof tls_to_clear.buf) {
+ sizeof(tls_to_clear.buf)) {
r = tls_read_attempt(ssl, &tls_to_clear, &tls_write_select,
&tls_read_select, &closed, &progress,
&err_pref_1);
@@ -1231,13 +1231,13 @@ tls_read_attempt(SSL *ssl, struct tunnelbuf *buf, int *write_select,
DEBUG_MSG("tls_read_attempt");
total = buf->offset + buf->len;
- assert(total < sizeof buf->buf);
- n = SSL_read(ssl, buf->buf + total, (sizeof buf->buf) - total);
+ assert(total < sizeof(buf->buf));
+ n = SSL_read(ssl, buf->buf + total, sizeof(buf->buf) - total);
DEBUG_MSG2("SSL_read", n);
r = tls_get_error(ssl, n, write_select, read_select, closed, progress);
if (n > 0) {
buf->len += n;
- assert(buf->offset + buf->len <= sizeof buf->buf);
+ assert(buf->offset + buf->len <= sizeof(buf->buf));
}
if (r == -1)
*err_pref = " during SSL_read";
@@ -1297,13 +1297,13 @@ read_attempt(int fd, struct tunnelbuf *buf, int *select, int *closed,
DEBUG_MSG("read_attempt");
total = buf->offset + buf->len;
- assert(total < sizeof buf->buf);
- n = read(fd, buf->buf + total, (sizeof buf->buf) - total);
+ assert(total < sizeof(buf->buf));
+ n = read(fd, buf->buf + total, sizeof(buf->buf) - total);
DEBUG_MSG2("read", n);
r = get_error(n, select, closed, progress);
if (n > 0) {
buf->len += n;
- assert(buf->offset + buf->len <= sizeof buf->buf);
+ assert(buf->offset + buf->len <= sizeof(buf->buf));
}
if (r == -1)
tls_errprintf(1, tls_child_apparg, "read error: %s\n",
diff --git a/deps/openssl/openssl/demos/easy_tls/test.c b/deps/openssl/openssl/demos/easy_tls/test.c
index d1dd53d0c5..3877370f5e 100644
--- a/deps/openssl/openssl/demos/easy_tls/test.c
+++ b/deps/openssl/openssl/demos/easy_tls/test.c
@@ -78,7 +78,7 @@ int main(int argc, char *argv[])
if (client_p) {
struct sockaddr_in addr;
- size_t addr_len = sizeof addr;
+ size_t addr_len = sizeof(addr);
addr.sin_family = AF_INET;
assert(argc > 1);
@@ -101,7 +101,7 @@ int main(int argc, char *argv[])
{
int i = 1;
- r = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (void *)&i, sizeof i);
+ r = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (void *)&i, sizeof(i));
if (r == -1) {
perror("setsockopt");
exit(1);
@@ -110,7 +110,7 @@ int main(int argc, char *argv[])
{
struct sockaddr_in addr;
- size_t addr_len = sizeof addr;
+ size_t addr_len = sizeof(addr);
if (argc > 1)
sscanf(argv[1], "%d", &port);
@@ -158,7 +158,7 @@ int main(int argc, char *argv[])
setvbuf(conn_in, NULL, _IOLBF, 256);
setvbuf(conn_out, NULL, _IOLBF, 256);
- while (fgets(buf, sizeof buf, stdin) != NULL) {
+ while (fgets(buf, sizeof(buf), stdin) != NULL) {
if (buf[0] == 'W') {
fprintf(conn_out, "%.*s\r\n", (int)(strlen(buf + 1) - 1),
buf + 1);
@@ -174,7 +174,7 @@ int main(int argc, char *argv[])
sscanf(buf + 1, "%d", &lines);
do {
- if (fgets(buf, sizeof buf, conn_in) == NULL) {
+ if (fgets(buf, sizeof(buf), conn_in) == NULL) {
if (ferror(conn_in)) {
fprintf(stderr, "ERROR\n");
exit(1);
@@ -225,7 +225,7 @@ int main(int argc, char *argv[])
exit(1);
}
- r = read(infofd, infobuf, sizeof infobuf - 1);
+ r = read(infofd, infobuf, sizeof(infobuf) - 1);
if (r > 0) {
const char *info = infobuf;
const char *eol;
diff --git a/deps/openssl/openssl/demos/engines/zencod/hw_zencod.c b/deps/openssl/openssl/demos/engines/zencod/hw_zencod.c
index daf0aef1ef..dfbe7d15bb 100644
--- a/deps/openssl/openssl/demos/engines/zencod/hw_zencod.c
+++ b/deps/openssl/openssl/demos/engines/zencod/hw_zencod.c
@@ -1289,10 +1289,10 @@ static const EVP_MD engine_sha1_md = {
engine_md_cleanup, /* dev_crypto_sha_cleanup */
EVP_PKEY_RSA_method,
SHA_CBLOCK,
- /* sizeof ( EVP_MD * ) + sizeof ( SHA_CTX ) */
+ /* sizeof(EVP_MD *) + sizeof(SHA_CTX) */
sizeof(ZEN_MD_DATA)
/*
- * sizeof ( MD_CTX_DATA ) The message digest data structure ...
+ * sizeof(MD_CTX_DATA) The message digest data structure ...
*/
};
@@ -1315,10 +1315,10 @@ static const EVP_MD engine_md5_md = {
engine_md_cleanup, /* dev_crypto_md5_cleanup */
EVP_PKEY_RSA_method,
MD5_CBLOCK,
- /* sizeof ( EVP_MD * ) + sizeof ( MD5_CTX ) */
+ /* sizeof(EVP_MD *) + sizeof(MD5_CTX) */
sizeof(ZEN_MD_DATA)
/*
- * sizeof ( MD_CTX_DATA ) The message digest data structure ...
+ * sizeof(MD_CTX_DATA) The message digest data structure ...
*/
};
diff --git a/deps/openssl/openssl/demos/spkigen.c b/deps/openssl/openssl/demos/spkigen.c
index c272a8c223..9ccb34a1fa 100644
--- a/deps/openssl/openssl/demos/spkigen.c
+++ b/deps/openssl/openssl/demos/spkigen.c
@@ -73,7 +73,7 @@ char *argv[];
fprintf(stderr, "please enter challenge string:");
fflush(stderr);
buf[0] = '\0';
- fgets(buf, sizeof buf, stdin);
+ fgets(buf, sizeof(buf), stdin);
i = strlen(buf);
if (i > 0)
buf[--i] = '\0';
diff --git a/deps/openssl/openssl/demos/ssl/serv.cpp b/deps/openssl/openssl/demos/ssl/serv.cpp
index b142c758d2..bccce2bd01 100644
--- a/deps/openssl/openssl/demos/ssl/serv.cpp
+++ b/deps/openssl/openssl/demos/ssl/serv.cpp
@@ -87,7 +87,7 @@ void main ()
sa_serv.sin_port = htons (1111); /* Server Port number */
err = bind(listen_sd, (struct sockaddr*) &sa_serv,
- sizeof (sa_serv)); CHK_ERR(err, "bind");
+ sizeof(sa_serv)); CHK_ERR(err, "bind");
/* Receive a TCP connection. */
diff --git a/deps/openssl/openssl/demos/state_machine/state_machine.c b/deps/openssl/openssl/demos/state_machine/state_machine.c
index 2ec196afff..aca9cd83a5 100644
--- a/deps/openssl/openssl/demos/state_machine/state_machine.c
+++ b/deps/openssl/openssl/demos/state_machine/state_machine.c
@@ -106,7 +106,7 @@ void SSLStateMachine_print_error(SSLStateMachine * pMachine,
while ((l = ERR_get_error())) {
char buf[1024];
- ERR_error_string_n(l, buf, sizeof buf);
+ ERR_error_string_n(l, buf, sizeof(buf));
fprintf(stderr, "Error %lx: %s\n", l, buf);
}
}
@@ -114,7 +114,7 @@ void SSLStateMachine_print_error(SSLStateMachine * pMachine,
SSLStateMachine *SSLStateMachine_new(const char *szCertificateFile,
const char *szKeyFile)
{
- SSLStateMachine *pMachine = malloc(sizeof *pMachine);
+ SSLStateMachine *pMachine = malloc(sizeof(*pMachine));
int n;
die_unless(pMachine);
@@ -252,15 +252,15 @@ int OpenSocket(int nPort)
}
if (setsockopt
- (nSocket, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof one) < 0) {
+ (nSocket, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one)) < 0) {
perror("setsockopt");
exit(2);
}
- memset(&saServer, 0, sizeof saServer);
+ memset(&saServer, 0, sizeof(saServer));
saServer.sin_family = AF_INET;
saServer.sin_port = htons(nPort);
- nSize = sizeof saServer;
+ nSize = sizeof(saServer);
if (bind(nSocket, (struct sockaddr *)&saServer, nSize) < 0) {
perror("bind");
exit(3);
@@ -271,7 +271,7 @@ int OpenSocket(int nPort)
exit(4);
}
- nLen = sizeof saClient;
+ nLen = sizeof(saClient);
nFD = accept(nSocket, (struct sockaddr *)&saClient, &nLen);
if (nFD < 0) {
perror("accept");
@@ -343,7 +343,7 @@ int main(int argc, char **argv)
/* Socket is ready for input */
if (FD_ISSET(nFD, &rfds)) {
- n = read(nFD, buf, sizeof buf);
+ n = read(nFD, buf, sizeof(buf));
if (n == 0) {
fprintf(stderr, "Got EOF on socket\n");
exit(0);
@@ -360,7 +360,7 @@ int main(int argc, char **argv)
nrbuf = 0;
n = SSLStateMachine_read_extract(pMachine, buf + 1,
- sizeof buf - 1);
+ sizeof(buf) - 1);
if (n < 0) {
SSLStateMachine_print_error(pMachine, "read extract failed");
break;
@@ -382,7 +382,7 @@ int main(int argc, char **argv)
if (FD_ISSET(nFD, &wfds)) {
int w;
- n = SSLStateMachine_write_extract(pMachine, buf, sizeof buf);
+ n = SSLStateMachine_write_extract(pMachine, buf, sizeof(buf));
assert(n > 0);
w = write(nFD, buf, n);
@@ -392,7 +392,7 @@ int main(int argc, char **argv)
/* Stdin is ready for input */
if (FD_ISSET(0, &rfds)) {
- n = read(0, buf, sizeof buf);
+ n = read(0, buf, sizeof(buf));
if (n == 0) {
fprintf(stderr, "Got EOF on stdin\n");
exit(0);