0
0
mirror of https://github.com/OpenVPN/openvpn.git synced 2024-09-20 12:02:28 +02:00

Use correct types for OpenSSL and Windows APIs

The error code of OpenSSL is a long. On most Unics systems
(mac, Linux...) this happens to be the same as size_t. But on Windows
as LP64, long is a 32 bit type and size_t is a 64 bit type. So use the
same type as OpenSSL.

When calling the Windows API use DWORD for the functions that want a
DWORD.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210324222330.455-4-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg21803.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
Arne Schwabe 2021-03-24 23:23:30 +01:00 committed by Gert Doering
parent e756e12adb
commit 467b16dc65
3 changed files with 5 additions and 8 deletions

View File

@ -199,7 +199,7 @@ crypto_clear_error(void)
void
crypto_print_openssl_errors(const unsigned int flags)
{
size_t err = 0;
unsigned long err = 0;
while ((err = ERR_get_error()))
{

View File

@ -997,7 +997,7 @@ pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
}
msg(D_LOW, "cryptoapicert: calling priv_enc_CNG with alg = %ls", alg);
*siglen = priv_enc_CNG(cd, alg, tbs, (int)tbslen, sig, *siglen,
*siglen = priv_enc_CNG(cd, alg, tbs, (int)tbslen, sig, (int)*siglen,
cng_padding_type(padding), (DWORD)saltlen);
return (*siglen == 0) ? 0 : 1;

View File

@ -2701,12 +2701,11 @@ get_default_gateway_row(const MIB_IPFORWARDTABLE *routes)
struct gc_arena gc = gc_new();
DWORD lowest_metric = MAXDWORD;
const MIB_IPFORWARDROW *ret = NULL;
int i;
int best = -1;
if (routes)
{
for (i = 0; i < routes->dwNumEntries; ++i)
for (DWORD i = 0; i < routes->dwNumEntries; ++i)
{
const MIB_IPFORWARDROW *row = &routes->table[i];
const in_addr_t net = ntohl(row->dwForwardDest);
@ -3167,14 +3166,13 @@ void
show_routes(int msglev)
{
struct gc_arena gc = gc_new();
int i;
const MIB_IPFORWARDTABLE *rt = get_windows_routing_table(&gc);
msg(msglev, "SYSTEM ROUTING TABLE");
if (rt)
{
for (i = 0; i < rt->dwNumEntries; ++i)
for (DWORD i = 0; i < rt->dwNumEntries; ++i)
{
msg(msglev, "%s", format_route_entry(&rt->table[i], &gc));
}
@ -4023,8 +4021,7 @@ test_local_addr(const in_addr_t addr, const struct route_gateway_info *rgi)
const MIB_IPFORWARDTABLE *rt = get_windows_routing_table(&gc);
if (rt)
{
int i;
for (i = 0; i < rt->dwNumEntries; ++i)
for (DWORD i = 0; i < rt->dwNumEntries; ++i)
{
const MIB_IPFORWARDROW *row = &rt->table[i];
const in_addr_t net = ntohl(row->dwForwardDest);