Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Windows compatibility #471

Merged
merged 5 commits into from
May 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/soter/ed25519/fe_cmov.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "fe.h"

#include <limits.h>

/*
Replace (f,g) with (g,g) if b == 1;
replace (f,g) with (f,g) if b == 0.
Expand Down Expand Up @@ -39,7 +41,7 @@ void fe_cmov(fe f,const fe g,unsigned int b)
crypto_int32 x7 = f7 ^ g7;
crypto_int32 x8 = f8 ^ g8;
crypto_int32 x9 = f9 ^ g9;
b = -b;
b = UINT_MAX - b + 1;
x0 &= b;
x1 &= b;
x2 &= b;
Expand Down
14 changes: 14 additions & 0 deletions src/themis/secure_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,21 @@
#ifndef THEMIS_SECURE_SESSION_H
#define THEMIS_SECURE_SESSION_H

/*
* ssize_t is POSIX-specific (as is <sys/types.h>).
* Explicitly define ssize_t as signed counterpart of size_t on Windows.
*/
#if _WIN32
#include <stddef.h>
#include <stdint.h>
#ifdef _WIN64
typedef signed __int64 ssize_t;
#else
typedef signed int ssize_t;
#endif
#else
#include <sys/types.h>
#endif

#include <soter/soter.h>

Expand Down
3 changes: 2 additions & 1 deletion tests/soter/soter_rand_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@

#include <stdio.h>
#include <string.h>
#include <unistd.h>

#ifndef NIST_STS_EXE_PATH
#define NO_NIST_STS 1
#endif

#ifndef NO_NIST_STS

#include <unistd.h>

#define _TO_STRING_(_X_) (#_X_)
#define TO_STRING(_X_) _TO_STRING_(_X_)

Expand Down
16 changes: 14 additions & 2 deletions tests/themis/themis_secure_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ static client_info_t client = {
client_pub,
sizeof(client_pub),
NULL,
{},
{
NULL,
NULL,
NULL,
NULL,
NULL,
},
};
static client_info_t server = {
"server",
Expand All @@ -81,7 +87,13 @@ static client_info_t server = {
server_pub,
sizeof(server_pub),
NULL,
{},
{
NULL,
NULL,
NULL,
NULL,
NULL,
},
};

/* Peers will communicate using shared memory */
Expand Down