eduardsui / tlse

Single C file TLS 1.2/1.3 implementation, using tomcrypt as crypto library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build instruction for Windows

RealYukiSan opened this issue · comments

Is there any instruction guide on how to build the client example in windows platform? I try the instruction from README with GCC from MinGW and got error, here's the log:

~/tlse/examples $ gcc tlsclienthello.c -o tlshello -DTLS_AMALGAMATION
In file included from ../tlse.c:56,
                 from tlsclienthello.c:12:
../libtomcrypt.c: In function 'der_encode_setof':
../libtomcrypt.c:21340:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
21340 |     hdrlen = ((unsigned long)ptr) - ((unsigned long)buf);
      |               ^
../libtomcrypt.c:21340:38: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
21340 |     hdrlen = ((unsigned long)ptr) - ((unsigned long)buf);
      |                                      ^
../libtomcrypt.c: At top level:
../libtomcrypt.c:28267: warning: "_WIN32_WINNT" redefined
28267 |  #define _WIN32_WINNT    0x0400
      |
In file included from C:/msys64/mingw64/include/corecrt.h:10,
                 from C:/msys64/mingw64/include/corecrt_stdio_config.h:10,
                 from C:/msys64/mingw64/include/stdio.h:9,
                 from tlsclienthello.c:1:
C:/msys64/mingw64/include/_mingw.h:232: note: this is the location of the previous definition
  232 | #define _WIN32_WINNT 0x601
      |
tlsclienthello.c: In function 'main':
tlsclienthello.c:124:45: warning: passing argument 2 of 'tls_make_ktls' makes integer from pointer without a cast [-Wint-conversion]
  124 |                 if (!tls_make_ktls(context, socket)) {
      |                                             ^~~~~~
      |                                             |
      |                                             SOCKET (*)(int,  int,  int) {aka long long unsigned int (*)(int,  int,  int)}
../tlse.c:10194:51: note: expected 'int' but argument is of type 'SOCKET (*)(int,  int,  int)' {aka 'long long unsigned int (*)(int,  int,  int)'}
10194 | int tls_make_ktls(struct TLSContext *context, int socket) {
      |                                               ~~~~^~~~~~
C:\Users\Gate\AppData\Local\Temp\ccreKuYl.s: Assembler messages:
C:\Users\Gate\AppData\Local\Temp\ccreKuYl.s:17325: Error: incorrect register `%eax' used with `q' suffix

SOLVED
It seems compiler generate incorrect register based on:

 # 13896 "./../libtomcrypt.c" 1
  rorq %cl,%rax