-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed Windows / Cygwin / MinGW compile
- Loading branch information
1 parent
4ef0e54
commit e72a193
Showing
1 changed file
with
24 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
OpenSSL based Authenticode signing for PE/MSI/Java CAB files. | ||
Copyright (C) 2005-2014 Per Allansson <[email protected]> | ||
Copyright (C) 2005-2015 Per Allansson <[email protected]> | ||
This program is free software: you can redistribute it and/or modify | ||
|
@@ -61,30 +61,37 @@ static const char *rcsid = "$Id: osslsigncode.c,v 1.7.1 2014/07/11 14:14:14 mfiv | |
*/ | ||
|
||
#ifdef HAVE_CONFIG_H | ||
#include <config.h> | ||
#include "config.h" | ||
#endif | ||
|
||
#ifdef HAVE_WINDOWS_H | ||
#define NOCRYPT | ||
#define WIN32_LEAN_AND_MEAN | ||
#include <windows.h> | ||
typedef unsigned char u_char; | ||
#endif | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#ifndef _WIN32 | ||
#include <unistd.h> | ||
#endif | ||
#include <string.h> | ||
#include <time.h> | ||
#include <ctype.h> | ||
#include <sys/types.h> | ||
#include <sys/stat.h> | ||
#include <fcntl.h> | ||
|
||
#ifndef _WIN32 | ||
#ifdef HAVE_SYS_MMAN_H | ||
#include <sys/mman.h> | ||
#endif | ||
|
||
#ifdef HAVE_TERMIOS_H | ||
#include <termios.h> | ||
#endif | ||
#endif | ||
|
||
#ifdef WITH_GSF | ||
#include <gsf/gsf-infile-msole.h> | ||
|
@@ -110,6 +117,11 @@ static const char *rcsid = "$Id: osslsigncode.c,v 1.7.1 2014/07/11 14:14:14 mfiv | |
#endif | ||
|
||
#ifdef ENABLE_CURL | ||
#ifdef __CYGWIN__ | ||
#ifndef SOCKET | ||
#define SOCKET UINT_PTR | ||
#endif | ||
#endif | ||
#include <curl/curl.h> | ||
|
||
#define MAX_TS_SERVERS 256 | ||
|
@@ -2289,8 +2301,15 @@ static STACK_OF(X509) *PEM_read_certs(BIO *bin, char *certpass) | |
|
||
static off_t get_file_size(const char *infile) | ||
{ | ||
int ret; | ||
#ifdef _WIN32 | ||
struct _stat st; | ||
ret = _stat(infile, &st); | ||
#else | ||
struct stat st; | ||
if (stat(infile, &st)) | ||
ret = stat(infile, &st); | ||
#endif | ||
if (ret) | ||
{ | ||
fprintf(stderr, "Failed to open file: %s\n", infile); | ||
return 0; | ||
|
@@ -2631,7 +2650,7 @@ int main(int argc, char **argv) | |
int passfd = open(readpass, O_RDONLY); | ||
if (passfd < 0) | ||
DO_EXIT_1("Failed to open password file: %s\n", readpass); | ||
ssize_t passlen = read(passfd, passbuf, sizeof(passbuf)-1); | ||
int passlen = read(passfd, passbuf, sizeof(passbuf)-1); | ||
close(passfd); | ||
if (passlen <= 0) | ||
DO_EXIT_1("Failed to read password from file: %s\n", readpass); | ||
|
@@ -3100,7 +3119,7 @@ int main(int argc, char **argv) | |
} | ||
else if (type == FILE_TYPE_MSI) { | ||
#ifdef WITH_GSF | ||
const unsigned char *p = insigdata; | ||
const unsigned char *p = (unsigned char*)insigdata; | ||
sig = d2i_PKCS7(NULL, &p, sigfilesize); | ||
#else | ||
DO_EXIT_1("libgsf is not available, msi support is disabled: %s\n", infile); | ||
|