Edit

kc3-lang/libressl/patches/windows_headers.patch

Branch :

  • Browse

    Commit

  • Author : Nobuyoshi Nakada
    Date : 2018-07-29 16:17:44
    Hash : 3e95275d
    Message : Suppress "overriding WinCrypt defines" warnings Suppress "overriding WinCrypt defines" from openssl/x509.h by defining `NOCRYPT`. Only this file does not check `__WINCRYPT_H__` macro like other headers, since https://github.com/libressl-portable/portable/commit/5d8a1cf7155130bd8101090d7e1d0c2f90d9b123#diff-74b6370bc092dd2988ab577b2eaa21dcR7

  • patches/windows_headers.patch
  • diff -u include/openssl.orig/dtls1.h include/openssl/dtls1.h
    --- include/openssl.orig/dtls1.h	Mon Dec  7 07:58:32 2015
    +++ include/openssl/dtls1.h	Mon Dec  7 07:56:14 2015
    @@ -60,7 +60,11 @@
     #ifndef HEADER_DTLS1_H
     #define HEADER_DTLS1_H
    
    +#if defined(_WIN32)
    +#include <winsock2.h>
    +#else
     #include <sys/time.h>
    +#endif
    
     #include <stdio.h>
     #include <stdlib.h>
    --- include/openssl/opensslconf.h.orig	Sat Nov  5 08:36:25 2016
    +++ include/openssl/opensslconf.h	Mon Jul 17 06:06:58 2017
    @@ -1,6 +1,10 @@
     #include <openssl/opensslfeatures.h>
     /* crypto/opensslconf.h.in */
    
    +#if defined(_MSC_VER) && !defined(__attribute__)
    +#define __attribute__(a)
    +#endif
    +
     #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
     #define OPENSSLDIR "/etc/ssl"
     #endif
    diff -u include/openssl.orig/ossl_typ.h include/openssl/ossl_typ.h
    --- include/openssl.orig/ossl_typ.h	Mon Dec  7 07:58:32 2015
    +++ include/openssl/ossl_typ.h	Mon Dec  7 07:56:14 2015
    @@ -80,6 +80,22 @@
     typedef struct ASN1_ITEM_st ASN1_ITEM;
     typedef struct asn1_pctx_st ASN1_PCTX;
    
    +#if defined(_WIN32) && defined(__WINCRYPT_H__)
    +#ifndef LIBRESSL_INTERNAL
    +#ifdef _MSC_VER
    +#pragma message("Warning, overriding WinCrypt defines")
    +#else
    +#warning overriding WinCrypt defines
    +#endif
    +#endif
    +#undef X509_NAME
    +#undef X509_CERT_PAIR
    +#undef X509_EXTENSIONS
    +#undef OCSP_REQUEST
    +#undef OCSP_RESPONSE
    +#undef PKCS7_ISSUER_AND_SERIAL
    +#endif
    +
     #ifdef BIGNUM
     #undef BIGNUM
     #endif
    diff -u include/openssl.orig/pkcs7.h include/openssl/pkcs7.h
    --- include/openssl.orig/pkcs7.h	Mon Dec  7 07:58:32 2015
    +++ include/openssl/pkcs7.h	Mon Dec  7 07:56:14 2015
    @@ -69,6 +69,18 @@
     extern "C" {
     #endif
    
    +#if defined(_WIN32) && defined(__WINCRYPT_H__)
    +#ifndef LIBRESSL_INTERNAL
    +#ifdef _MSC_VER
    +#pragma message("Warning, overriding WinCrypt defines")
    +#else
    +#warning overriding WinCrypt defines
    +#endif
    +#endif
    +#undef PKCS7_ISSUER_AND_SERIAL
    +#undef PKCS7_SIGNER_INFO
    +#endif
    +
     /*
     Encryption_ID		DES-CBC
     Digest_ID		MD5
    diff -u include/openssl.orig/x509.h include/openssl/x509.h
    --- include/openssl.orig/x509.h	Mon Dec  7 07:58:32 2015
    +++ include/openssl/x509.h	Mon Dec  7 07:56:14 2015
    @@ -112,6 +112,19 @@
     extern "C" {
     #endif
    
    +#if defined(_WIN32) && defined(__WINCRYPT_H__)
    +#ifndef LIBRESSL_INTERNAL
    +#ifdef _MSC_VER
    +#pragma message("Warning, overriding WinCrypt defines")
    +#else
    +#warning overriding WinCrypt defines
    +#endif
    +#endif
    +#undef X509_NAME
    +#undef X509_CERT_PAIR
    +#undef X509_EXTENSIONS
    +#endif
    +
     #define X509_FILETYPE_PEM	1
     #define X509_FILETYPE_ASN1	2
     #define X509_FILETYPE_DEFAULT	3