OPENSSL_free(out);
return NULL;
}
- out[start] = i - start;
+ out[start] = (unsigned char)(i - start);
start = i + 1;
} else {
out[i + 1] = in[i];
unsigned char ext_buf[4 + 65536];
/* Reconstruct the type/len fields prior to extension data */
- ext_buf[0] = ext_type >> 8;
- ext_buf[1] = ext_type & 0xFF;
- ext_buf[2] = inlen >> 8;
- ext_buf[3] = inlen & 0xFF;
+ inlen &= 0xffff; /* for formal memcmpy correctness */
+ ext_buf[0] = (unsigned char)(ext_type >> 8);
+ ext_buf[1] = (unsigned char)(ext_type);
+ ext_buf[2] = (unsigned char)(inlen >> 8);
+ ext_buf[3] = (unsigned char)(inlen);
memcpy(ext_buf + 4, in, inlen);
BIO_snprintf(pem_name, sizeof(pem_name), "SERVERINFO FOR EXTENSION %d",
RAND_bytes(out, 16);
len += 16;
- aad[11] = len >> 8;
- aad[12] = len;
+ aad[11] = (unsigned char)(len >> 8);
+ aad[12] = (unsigned char)(len);
pad = EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_TLS1_AAD,
EVP_AEAD_TLS1_AAD_LEN, aad);
EVP_Cipher(ctx, out, inp, len + pad);
if (endp != service && *endp == '\0'
&& portnum > 0 && portnum < 65536) {
- se_fallback.s_port = htons(portnum);
+ se_fallback.s_port = htons((unsigned short)portnum);
se_fallback.s_proto = proto;
se = &se_fallback;
} else if (endp == service) {
#include <stdio.h>
#include <string.h>
+#include "internal/cryptlib.h"
#include "internal/ctype.h"
#include "internal/numbers.h"
-#include "internal/cryptlib.h"
#include <openssl/bio.h>
/*
*/
int BIO_connect(int sock, const BIO_ADDR *addr, int options)
{
- int on = 1;
+ const int on = 1;
if (sock == -1) {
BIOerr(BIO_F_BIO_CONNECT, BIO_R_INVALID_SOCKET);
return 0;
if (options & BIO_SOCK_KEEPALIVE) {
- if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on)) != 0) {
+ if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
+ (const void *)&on, sizeof(on)) != 0) {
SYSerr(SYS_F_SETSOCKOPT, get_last_socket_error());
BIOerr(BIO_F_BIO_CONNECT, BIO_R_UNABLE_TO_KEEPALIVE);
return 0;
}
if (options & BIO_SOCK_NODELAY) {
- if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) != 0) {
+ if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
+ (const void *)&on, sizeof(on)) != 0) {
SYSerr(SYS_F_SETSOCKOPT, get_last_socket_error());
BIOerr(BIO_F_BIO_CONNECT, BIO_R_UNABLE_TO_NODELAY);
return 0;
return 0;
}
- if (getsockopt(sock, SOL_SOCKET, SO_TYPE, &socktype, &socktype_len) != 0
+ if (getsockopt(sock, SOL_SOCKET, SO_TYPE,
+ (void *)&socktype, &socktype_len) != 0
|| socktype_len != sizeof(socktype)) {
SYSerr(SYS_F_GETSOCKOPT, get_last_socket_error());
BIOerr(BIO_F_BIO_LISTEN, BIO_R_GETTING_SOCKTYPE);
/* SO_REUSEADDR has different behavior on Windows than on
* other operating systems, don't set it there. */
if (options & BIO_SOCK_REUSEADDR) {
- if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) != 0) {
+ if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
+ (const void *)&on, sizeof(on)) != 0) {
SYSerr(SYS_F_SETSOCKOPT, get_last_socket_error());
BIOerr(BIO_F_BIO_LISTEN, BIO_R_UNABLE_TO_REUSEADDR);
return 0;
# endif
if (options & BIO_SOCK_KEEPALIVE) {
- if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on)) != 0) {
+ if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
+ (const void *)&on, sizeof(on)) != 0) {
SYSerr(SYS_F_SETSOCKOPT, get_last_socket_error());
BIOerr(BIO_F_BIO_LISTEN, BIO_R_UNABLE_TO_KEEPALIVE);
return 0;
}
if (options & BIO_SOCK_NODELAY) {
- if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) != 0) {
+ if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
+ (const void *)&on, sizeof(on)) != 0) {
SYSerr(SYS_F_SETSOCKOPT, get_last_socket_error());
BIOerr(BIO_F_BIO_LISTEN, BIO_R_UNABLE_TO_NODELAY);
return 0;
# ifdef IPV6_V6ONLY
if ((options & BIO_SOCK_V6_ONLY) && BIO_ADDR_family(addr) == AF_INET6) {
- if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) != 0) {
+ if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY,
+ (const void *)&on, sizeof(on)) != 0) {
SYSerr(SYS_F_SETSOCKOPT, get_last_socket_error());
BIOerr(BIO_F_BIO_LISTEN, BIO_R_LISTEN_V6_ONLY);
return 0;
#include <openssl/asn1.h>
#include <openssl/engine.h>
+#ifdef _WIN32
+# define strdup _strdup
+#endif
+
/*
* This is the automatic configuration loader: it is called automatically by
* OpenSSL when any of a number of standard initialisation functions are
carry6 = h6 + (1 << 25); h7 += carry6 >> 26; h6 -= carry6 & kTop38Bits;
carry8 = h8 + (1 << 25); h9 += carry8 >> 26; h8 -= carry8 & kTop38Bits;
- h[0] = h0;
- h[1] = h1;
- h[2] = h2;
- h[3] = h3;
- h[4] = h4;
- h[5] = h5;
- h[6] = h6;
- h[7] = h7;
- h[8] = h8;
- h[9] = h9;
+ h[0] = (int32_t)h0;
+ h[1] = (int32_t)h1;
+ h[2] = (int32_t)h2;
+ h[3] = (int32_t)h3;
+ h[4] = (int32_t)h4;
+ h[5] = (int32_t)h5;
+ h[6] = (int32_t)h6;
+ h[7] = (int32_t)h7;
+ h[8] = (int32_t)h8;
+ h[9] = (int32_t)h9;
}
/* Preconditions:
/* |h0| <= 2^25; from now on fits into int32 unchanged */
/* |h1| <= 1.01*2^24 */
- h[0] = h0;
- h[1] = h1;
- h[2] = h2;
- h[3] = h3;
- h[4] = h4;
- h[5] = h5;
- h[6] = h6;
- h[7] = h7;
- h[8] = h8;
- h[9] = h9;
+ h[0] = (int32_t)h0;
+ h[1] = (int32_t)h1;
+ h[2] = (int32_t)h2;
+ h[3] = (int32_t)h3;
+ h[4] = (int32_t)h4;
+ h[5] = (int32_t)h5;
+ h[6] = (int32_t)h6;
+ h[7] = (int32_t)h7;
+ h[8] = (int32_t)h8;
+ h[9] = (int32_t)h9;
}
/* h = f * f
carry0 = h0 + (1 << 25); h1 += carry0 >> 26; h0 -= carry0 & kTop38Bits;
- h[0] = h0;
- h[1] = h1;
- h[2] = h2;
- h[3] = h3;
- h[4] = h4;
- h[5] = h5;
- h[6] = h6;
- h[7] = h7;
- h[8] = h8;
- h[9] = h9;
+ h[0] = (int32_t)h0;
+ h[1] = (int32_t)h1;
+ h[2] = (int32_t)h2;
+ h[3] = (int32_t)h3;
+ h[4] = (int32_t)h4;
+ h[5] = (int32_t)h5;
+ h[6] = (int32_t)h6;
+ h[7] = (int32_t)h7;
+ h[8] = (int32_t)h8;
+ h[9] = (int32_t)h9;
}
static void fe_invert(fe out, const fe z) {
carry0 = h0 + (1 << 25); h1 += carry0 >> 26; h0 -= carry0 & kTop38Bits;
- h[0] = h0;
- h[1] = h1;
- h[2] = h2;
- h[3] = h3;
- h[4] = h4;
- h[5] = h5;
- h[6] = h6;
- h[7] = h7;
- h[8] = h8;
- h[9] = h9;
+ h[0] = (int32_t)h0;
+ h[1] = (int32_t)h1;
+ h[2] = (int32_t)h2;
+ h[3] = (int32_t)h3;
+ h[4] = (int32_t)h4;
+ h[5] = (int32_t)h5;
+ h[6] = (int32_t)h6;
+ h[7] = (int32_t)h7;
+ h[8] = (int32_t)h8;
+ h[9] = (int32_t)h9;
}
static void fe_pow22523(fe out, const fe z) {
carry6 = h6 + (1 << 25); h7 += carry6 >> 26; h6 -= carry6 & kTop38Bits;
carry8 = h8 + (1 << 25); h9 += carry8 >> 26; h8 -= carry8 & kTop38Bits;
- h[0] = h0;
- h[1] = h1;
- h[2] = h2;
- h[3] = h3;
- h[4] = h4;
- h[5] = h5;
- h[6] = h6;
- h[7] = h7;
- h[8] = h8;
- h[9] = h9;
+ h[0] = (int32_t)h0;
+ h[1] = (int32_t)h1;
+ h[2] = (int32_t)h2;
+ h[3] = (int32_t)h3;
+ h[4] = (int32_t)h4;
+ h[5] = (int32_t)h5;
+ h[6] = (int32_t)h6;
+ h[7] = (int32_t)h7;
+ h[8] = (int32_t)h8;
+ h[9] = (int32_t)h9;
}
static void x25519_scalar_mult_generic(uint8_t out[32],
s11 += carry10;
s10 -= carry10 * (1 << 21);
- s[0] = s0 >> 0;
- s[1] = s0 >> 8;
- s[2] = (s0 >> 16) | (s1 << 5);
- s[3] = s1 >> 3;
- s[4] = s1 >> 11;
- s[5] = (s1 >> 19) | (s2 << 2);
- s[6] = s2 >> 6;
- s[7] = (s2 >> 14) | (s3 << 7);
- s[8] = s3 >> 1;
- s[9] = s3 >> 9;
- s[10] = (s3 >> 17) | (s4 << 4);
- s[11] = s4 >> 4;
- s[12] = s4 >> 12;
- s[13] = (s4 >> 20) | (s5 << 1);
- s[14] = s5 >> 7;
- s[15] = (s5 >> 15) | (s6 << 6);
- s[16] = s6 >> 2;
- s[17] = s6 >> 10;
- s[18] = (s6 >> 18) | (s7 << 3);
- s[19] = s7 >> 5;
- s[20] = s7 >> 13;
- s[21] = s8 >> 0;
- s[22] = s8 >> 8;
- s[23] = (s8 >> 16) | (s9 << 5);
- s[24] = s9 >> 3;
- s[25] = s9 >> 11;
- s[26] = (s9 >> 19) | (s10 << 2);
- s[27] = s10 >> 6;
- s[28] = (s10 >> 14) | (s11 << 7);
- s[29] = s11 >> 1;
- s[30] = s11 >> 9;
- s[31] = s11 >> 17;
+ s[0] = (uint8_t)(s0 >> 0);
+ s[1] = (uint8_t)(s0 >> 8);
+ s[2] = (uint8_t)((s0 >> 16) | (s1 << 5));
+ s[3] = (uint8_t)(s1 >> 3);
+ s[4] = (uint8_t)(s1 >> 11);
+ s[5] = (uint8_t)((s1 >> 19) | (s2 << 2));
+ s[6] = (uint8_t)(s2 >> 6);
+ s[7] = (uint8_t)((s2 >> 14) | (s3 << 7));
+ s[8] = (uint8_t)(s3 >> 1);
+ s[9] = (uint8_t)(s3 >> 9);
+ s[10] = (uint8_t)((s3 >> 17) | (s4 << 4));
+ s[11] = (uint8_t)(s4 >> 4);
+ s[12] = (uint8_t)(s4 >> 12);
+ s[13] = (uint8_t)((s4 >> 20) | (s5 << 1));
+ s[14] = (uint8_t)(s5 >> 7);
+ s[15] = (uint8_t)((s5 >> 15) | (s6 << 6));
+ s[16] = (uint8_t)(s6 >> 2);
+ s[17] = (uint8_t)(s6 >> 10);
+ s[18] = (uint8_t)((s6 >> 18) | (s7 << 3));
+ s[19] = (uint8_t)(s7 >> 5);
+ s[20] = (uint8_t)(s7 >> 13);
+ s[21] = (uint8_t)(s8 >> 0);
+ s[22] = (uint8_t)(s8 >> 8);
+ s[23] = (uint8_t)((s8 >> 16) | (s9 << 5));
+ s[24] = (uint8_t)(s9 >> 3);
+ s[25] = (uint8_t)(s9 >> 11);
+ s[26] = (uint8_t)((s9 >> 19) | (s10 << 2));
+ s[27] = (uint8_t)(s10 >> 6);
+ s[28] = (uint8_t)((s10 >> 14) | (s11 << 7));
+ s[29] = (uint8_t)(s11 >> 1);
+ s[30] = (uint8_t)(s11 >> 9);
+ s[31] = (uint8_t)(s11 >> 17);
}
/* Input:
s11 += carry10;
s10 -= carry10 * (1 << 21);
- s[0] = s0 >> 0;
- s[1] = s0 >> 8;
- s[2] = (s0 >> 16) | (s1 << 5);
- s[3] = s1 >> 3;
- s[4] = s1 >> 11;
- s[5] = (s1 >> 19) | (s2 << 2);
- s[6] = s2 >> 6;
- s[7] = (s2 >> 14) | (s3 << 7);
- s[8] = s3 >> 1;
- s[9] = s3 >> 9;
- s[10] = (s3 >> 17) | (s4 << 4);
- s[11] = s4 >> 4;
- s[12] = s4 >> 12;
- s[13] = (s4 >> 20) | (s5 << 1);
- s[14] = s5 >> 7;
- s[15] = (s5 >> 15) | (s6 << 6);
- s[16] = s6 >> 2;
- s[17] = s6 >> 10;
- s[18] = (s6 >> 18) | (s7 << 3);
- s[19] = s7 >> 5;
- s[20] = s7 >> 13;
- s[21] = s8 >> 0;
- s[22] = s8 >> 8;
- s[23] = (s8 >> 16) | (s9 << 5);
- s[24] = s9 >> 3;
- s[25] = s9 >> 11;
- s[26] = (s9 >> 19) | (s10 << 2);
- s[27] = s10 >> 6;
- s[28] = (s10 >> 14) | (s11 << 7);
- s[29] = s11 >> 1;
- s[30] = s11 >> 9;
- s[31] = s11 >> 17;
+ s[0] = (uint8_t)(s0 >> 0);
+ s[1] = (uint8_t)(s0 >> 8);
+ s[2] = (uint8_t)((s0 >> 16) | (s1 << 5));
+ s[3] = (uint8_t)(s1 >> 3);
+ s[4] = (uint8_t)(s1 >> 11);
+ s[5] = (uint8_t)((s1 >> 19) | (s2 << 2));
+ s[6] = (uint8_t)(s2 >> 6);
+ s[7] = (uint8_t)((s2 >> 14) | (s3 << 7));
+ s[8] = (uint8_t)(s3 >> 1);
+ s[9] = (uint8_t)(s3 >> 9);
+ s[10] = (uint8_t)((s3 >> 17) | (s4 << 4));
+ s[11] = (uint8_t)(s4 >> 4);
+ s[12] = (uint8_t)(s4 >> 12);
+ s[13] = (uint8_t)((s4 >> 20) | (s5 << 1));
+ s[14] = (uint8_t)(s5 >> 7);
+ s[15] = (uint8_t)((s5 >> 15) | (s6 << 6));
+ s[16] = (uint8_t)(s6 >> 2);
+ s[17] = (uint8_t)(s6 >> 10);
+ s[18] = (uint8_t)((s6 >> 18) | (s7 << 3));
+ s[19] = (uint8_t)(s7 >> 5);
+ s[20] = (uint8_t)(s7 >> 13);
+ s[21] = (uint8_t)(s8 >> 0);
+ s[22] = (uint8_t)(s8 >> 8);
+ s[23] = (uint8_t)((s8 >> 16) | (s9 << 5));
+ s[24] = (uint8_t)(s9 >> 3);
+ s[25] = (uint8_t)(s9 >> 11);
+ s[26] = (uint8_t)((s9 >> 19) | (s10 << 2));
+ s[27] = (uint8_t)(s10 >> 6);
+ s[28] = (uint8_t)((s10 >> 14) | (s11 << 7));
+ s[29] = (uint8_t)(s11 >> 1);
+ s[30] = (uint8_t)(s11 >> 9);
+ s[31] = (uint8_t)(s11 >> 17);
}
int ED25519_sign(uint8_t *out_sig, const uint8_t *message, size_t message_len,
#ifndef OPENSSL_NO_POSIX_IO
# include <sys/stat.h>
# include <fcntl.h>
+# ifdef _WIN32
+# include <io.h>
+# endif
#endif
/*
memcpy(dest + *dest_len,
SSL3_RECORD_get_data(rr) + SSL3_RECORD_get_off(rr), n);
SSL3_RECORD_add_off(rr, n);
- SSL3_RECORD_add_length(rr, -n);
+ SSL3_RECORD_sub_length(rr, n);
*dest_len += n;
if (SSL3_RECORD_get_length(rr) == 0)
SSL3_RECORD_set_read(rr);
OPENSSL_free(s->ext.scts);
s->ext.scts = NULL;
- s->ext.scts_len = size;
+ s->ext.scts_len = (uint16_t)size;
if (size > 0) {
s->ext.scts = OPENSSL_malloc(size);
if (s->ext.scts == NULL
/* Inject the synthetic message_hash message */
msghdr[0] = SSL3_MT_MESSAGE_HASH;
- msghdr[SSL3_HM_HEADER_LENGTH - 1] = hashlen;
+ msghdr[SSL3_HM_HEADER_LENGTH - 1] = (unsigned char)hashlen;
if (!ssl3_finish_mac(s, msghdr, SSL3_HM_HEADER_LENGTH)
|| !ssl3_finish_mac(s, hashval, hashlen)) {
SSLerr(SSL_F_CREATE_SYNTHETIC_MESSAGE_HASH, ERR_R_INTERNAL_ERROR);
size_t i;
for (i = 0; i < OSSL_NELEM(nid_list); i++) {
if (nid_list[i].nid == nid)
- return i + 1;
+ return (uint16_t)(i + 1);
}
return 0;
}
if (pp != NULL) {
if (lenbytes == 1) {
- *(*pp)++ = len;
+ *(*pp)++ = (unsigned char)len;
} else {
- *(*pp)++ = lenbytes - 1;
+ *(*pp)++ = (unsigned char)(lenbytes - 1);
if (lenbytes == 2) {
- *(*pp)++ = 0x80 | len;
+ *(*pp)++ = (unsigned char)(0x80 | len);
} else {
- *(*pp)++ = 0x80 | (len >> 8);
- *(*pp)++ = len & 0xff;
+ *(*pp)++ = (unsigned char)(0x80 | (len >> 8));
+ *(*pp)++ = (unsigned char)(len);
}
}
}
/* ASSUMES SIGNED TIME_T */
static struct testdata tbl_testdata_neg[] = {
- { "19011213204552Z", V_ASN1_GENERALIZEDTIME, V_ASN1_GENERALIZEDTIME, 1, -2147483648, -1, 0, },
+ { "19011213204552Z", V_ASN1_GENERALIZEDTIME, V_ASN1_GENERALIZEDTIME, 1, INT_MIN, -1, 0, },
{ "691006121456Z", V_ASN1_UTCTIME, V_ASN1_UTCTIME, 1, -7472704, -1, 1, },
{ "19691006121456Z", V_ASN1_GENERALIZEDTIME, V_ASN1_UTCTIME, 1, -7472704, -1, 1, },
};
+/* explicit casts to time_t short warnings on systems with 32-bit time_t */
static struct testdata tbl_testdata_pos_64bit[] = {
- { "20380119031408Z", V_ASN1_GENERALIZEDTIME, V_ASN1_UTCTIME, 1, 0x80000000, 1, 1, },
- { "20380119031409Z", V_ASN1_GENERALIZEDTIME, V_ASN1_UTCTIME, 1, 0x80000001, 1, 1, },
- { "380119031408Z", V_ASN1_UTCTIME, V_ASN1_UTCTIME, 1, 0x80000000, 1, 1, },
- { "20500101120000Z", V_ASN1_GENERALIZEDTIME, V_ASN1_GENERALIZEDTIME, 1, 2524651200, 1, 0, },
+ { "20380119031408Z", V_ASN1_GENERALIZEDTIME, V_ASN1_UTCTIME, 1, (time_t)0x80000000, 1, 1, },
+ { "20380119031409Z", V_ASN1_GENERALIZEDTIME, V_ASN1_UTCTIME, 1, (time_t)0x80000001, 1, 1, },
+ { "380119031408Z", V_ASN1_UTCTIME, V_ASN1_UTCTIME, 1, (time_t)0x80000000, 1, 1, },
+ { "20500101120000Z", V_ASN1_GENERALIZEDTIME, V_ASN1_GENERALIZEDTIME, 1, (time_t)2524651200, 1, 0, },
};
/* ASSUMES SIGNED TIME_T */
static struct testdata tbl_testdata_neg_64bit[] = {
- { "19011213204551Z", V_ASN1_GENERALIZEDTIME, V_ASN1_GENERALIZEDTIME, 1, -2147483649, -1, 0, },
- { "19000101120000Z", V_ASN1_GENERALIZEDTIME, V_ASN1_GENERALIZEDTIME, 1, -2208945600, -1, 0, },
+ { "19011213204551Z", V_ASN1_GENERALIZEDTIME, V_ASN1_GENERALIZEDTIME, 1, (time_t)-2147483649LL, -1, 0, },
+ { "19000101120000Z", V_ASN1_GENERALIZEDTIME, V_ASN1_GENERALIZEDTIME, 1, (time_t)-2208945600LL, -1, 0, },
};
/* A baseline time to compare to */
HMAC_Update(ctx, seq, 6);
HMAC_Update(ctx, &type, 1);
HMAC_Update(ctx, ver, 2); /* Version */
- lenbytes[0] = len >> 8;
- lenbytes[1] = len & 0xff;
+ lenbytes[0] = (unsigned char)(len >> 8);
+ lenbytes[1] = (unsigned char)(len);
HMAC_Update(ctx, lenbytes, 2); /* Length */
HMAC_Update(ctx, enc, len); /* Finally the data itself */
HMAC_Final(ctx, enc + len, NULL);
BIO_write(rbio, ver, 2);
BIO_write(rbio, epoch, 2);
BIO_write(rbio, seq, 6);
- lenbytes[0] = (len + sizeof(iv)) >> 8;
- lenbytes[1] = (len + sizeof(iv)) & 0xff;
+ lenbytes[0] = (unsigned char)((len + sizeof(iv)) >> 8);
+ lenbytes[1] = (unsigned char)(len + sizeof(iv));
BIO_write(rbio, lenbytes, 2);
BIO_write(rbio, iv, sizeof(iv));
* We reset the creation time so that we don't discard the session as
* too old.
*/
- if (!TEST_true(SSL_SESSION_set_time(sess, time(NULL)))
+ if (!TEST_true(SSL_SESSION_set_time(sess, (long)time(NULL)))
|| !TEST_true(SSL_set_session(con, sess)))
goto end;
}
X509_STORE_CTX_set0_trusted_stack(ctx, roots);
X509_STORE_CTX_set0_crls(ctx, crls);
X509_VERIFY_PARAM_set_time(param, PARAM_TIME);
- if (!TEST_long_eq(X509_VERIFY_PARAM_get_time(param), PARAM_TIME))
+ if (!TEST_long_eq((long)X509_VERIFY_PARAM_get_time(param), PARAM_TIME))
goto err;
X509_VERIFY_PARAM_set_depth(param, 16);
if (flags)
int success = 0;
CT_POLICY_EVAL_CTX *ct_policy_ctx = CT_POLICY_EVAL_CTX_new();
const time_t default_time = CT_POLICY_EVAL_CTX_get_time(ct_policy_ctx) /
- 1000;
+ 1000;
const time_t time_tolerance = 600; /* 10 minutes */
- if (!TEST_uint_le(fabs(difftime(time(NULL), default_time)), time_tolerance))
+ if (!TEST_uint_le((unsigned int)fabs(difftime(time(NULL), default_time)),
+ (unsigned int)time_tolerance))
goto end;
success = 1;
if ((*out)[i] == ',') {
if (!TEST_int_gt(i - 1, prefix))
goto err;
- (*out)[prefix] = i - 1 - prefix;
+ (*out)[prefix] = (unsigned char)(i - 1 - prefix);
prefix = i;
}
i++;
}
if (!TEST_int_gt(len, prefix))
goto err;
- (*out)[prefix] = len - prefix;
+ (*out)[prefix] = (unsigned char)(len - prefix);
return 1;
err:
unsigned int i;
PACKET pkt, short_pkt, subpkt = {0};
- buf1[0] = len;
+ buf1[0] = (unsigned char)len;
for (i = 1; i < BUF_LEN; i++)
buf1[i] = (i * 2) & 0xff;
unsigned int i;
PACKET pkt, exact_pkt, subpkt = {0};
- buf1[0] = len;
+ buf1[0] = (unsigned char)len;
for (i = 1; i < BUF_LEN; i++)
buf1[i] = (i * 2) & 0xff;
*/
#include <string.h>
-#include "internal/numbers.h"
-
#include "testutil.h"
+#include "internal/numbers.h"
static int test_sanity_null_zero(void)
{
OPENSSL_free(out);
return NULL;
}
- out[start] = i - start;
+ out[start] = (unsigned char)(i - start);
start = i + 1;
} else
out[i + 1] = in[i];
#include "internal/nelem.h"
#include <openssl/bio.h>
+#ifdef _WIN32
+# define strdup _strdup
+#endif
+
/*
* Declares the structures needed to register each test case function.
*/