2023년 11월 2일 목요일

Windows + libcurl 빌드 (+ openssl)

Download

https://curl.se/download.html


빌드

x64 Native Tools Command Prompt for VS 2022 열기


압축 푼 위치의 winbuild 경로로 이동

  • e.g.) C:\Users\USER1\Downloads\curl-8.4.0\winbuild

 

e.g.) DLL 빌드 & x64

nmake /f Makefile.vc mode=dll MACHINE=x64


e.g.) DLL 빌드 & x64 & SSL

nmake /f Makefile.vc mode=dll WITH_SSL=dll MACHINE=x64 SSL_PATH=c:\openssl

  • openssl 을 빌드하여 필요 파일들을 c:\openssl 에 복사
  • 맨 아래 windows + openssl 빌드 방법 참고

 

결과물

builds 폴더에 build option 별로 폴더명이 생성됨

e.g.) builds 폴더 구조

curl-8.4.0 $ tree -d builds
builds
|-- libcurl-vc-x64-release-dll-ipv6-sspi-schannel
|   |-- bin
|   |-- include
|   |   `-- curl
|   `-- lib
|-- libcurl-vc-x64-release-dll-ipv6-sspi-schannel-obj-curl
|-- libcurl-vc-x64-release-dll-ipv6-sspi-schannel-obj-lib
|   |-- vauth
|   |-- vquic
|   |-- vssh
|   `-- vtls
|-- libcurl-vc-x64-release-dll-ssl-dll-ipv6-sspi
|   |-- bin
|   |-- include
|   |   `-- curl
|   `-- lib
|-- libcurl-vc-x64-release-dll-ssl-dll-ipv6-sspi-obj-curl
`-- libcurl-vc-x64-release-dll-ssl-dll-ipv6-sspi-obj-lib
    |-- vauth
    |-- vquic
    |-- vssh
    `-- vtls

22 directories


테스트

e.g.)

curl-8.4.0\builds\libcurl-vc-x64-release-dll-ssl-dll-ipv6-sspi\bin> .\curl.exe --cacert .\cacert.pem -L https://google.com
*   Trying 142.250.206.206:443...
* Connected to google.com (142.250.206.206) port 443
* ALPN: curl offers http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
*  CAfile: .\cacert.pem
*  CApath: none
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN: server accepted http/1.1
* Server certificate:
*  subject: CN=*.google.com
*  start date: Oct 16 08:02:35 2023 GMT
*  expire date: Jan  8 08:02:34 2024 GMT
*  subjectAltName: host "google.com" matched cert's "google.com"
*  issuer: C=US; O=Google Trust Services LLC; CN=GTS CA 1C3
*  SSL certificate verify ok.
* using HTTP/1.1
> GET / HTTP/1.1
> Host: google.com
> User-Agent: curl/8.4.0
> Accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
< HTTP/1.1 301 Moved Permanently
< Location: https://www.google.com/
< Content-Type: text/html; charset=UTF-8
< Content-Security-Policy-Report-Only: object-src 'none';base-uri 'self';script-src 'nonce-r4dhbNg9feuEwm31xDW-ZA' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp
< Date: Thu, 02 Nov 2023 13:27:56 GMT
< Expires: Sat, 02 Dec 2023 13:27:56 GMT
< Cache-Control: public, max-age=2592000
< Server: gws
< Content-Length: 220
< X-XSS-Protection: 0
< X-Frame-Options: SAMEORIGIN
< Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
<
* Ignoring the response-body
* Connection #0 to host google.com left intact
* Issue another request to this URL: 'https://www.google.com/'
*   Trying 142.250.206.196:443...
* Connected to www.google.com (142.250.206.196) port 443
* ALPN: curl offers http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN: server accepted http/1.1
* Server certificate:
*  subject: CN=www.google.com
*  start date: Oct 16 08:10:46 2023 GMT
*  expire date: Jan  8 08:10:45 2024 GMT
*  subjectAltName: host "www.google.com" matched cert's "www.google.com"
*  issuer: C=US; O=Google Trust Services LLC; CN=GTS CA 1C3
*  SSL certificate verify ok.
* using HTTP/1.1
> GET / HTTP/1.1
> Host: www.google.com
> User-Agent: curl/8.4.0
> Accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
< HTTP/1.1 200 OK
< Date: Thu, 02 Nov 2023 13:27:56 GMT
< Expires: -1
< Cache-Control: private, max-age=0
< Content-Type: text/html; charset=ISO-8859-1
< Content-Security-Policy-Report-Only: object-src 'none';base-uri 'self';script-src 'nonce-XKytH5nmCnUl31HnWlsEkg' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp
< P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."
< Server: gws
< X-XSS-Protection: 0
< X-Frame-Options: SAMEORIGIN
< Set-Cookie: 1P_JAR=2023-11-02-13; expires=Sat, 02-Dec-2023 13:27:57 GMT; path=/; domain=.google.com; Secure
< Set-Cookie: AEC=Ackid1Ql0oIwRxmTk1wu6f0R40nevaPBnR_rMyybe4Y7DkVe9JqUOHnnbA; expires=Tue, 30-Apr-2024 13:27:57 GMT; path=/; domain=.google.com; Secure; HttpOnly; SameSite=lax
< Set-Cookie: NID=511=LDT1PHvO6xgCkyXbxnlVW4XvmBrtZEij8U8772kie340b_Z2gFy_gZDJya8OLHUNFEkJEZWK0cEMnNK2MnERYONnK2ieKMCej9MAWG-rPR1meNKZb9D_s71f10ZIMdNUW-fkrxuzm813NCSOULYBO_k87yHumoP65NLRtRcjGFo; expires=Fri, 03-May-2024 13:27:56 GMT; path=/; domain=.google.com; HttpOnly
< Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
< Accept-Ranges: none
< Vary: Accept-Encoding
< Transfer-Encoding: chunked
<
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="ko"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"><title>Google</title>
...


cacert.pem 다운로드

 

Windows + openssl 빌드

https://github.com/openssl/openssl/blob/master/NOTES-WINDOWS.md

준비물

 

빌드

x64 Native Tools Command Prompt for VS 2022 prompt 열기

 

perl Configure
nmake

 

결과물

  • libcrypto-3-x64.dll
  • libssl-3-x64.dll
  • libcrypto.lib
  • libssl.lib

 

결과물 + include 폴더를 아래 구조로 복사

e.g.) c:\openssl

.
|-- include
|   |-- crypto
|   |-- internal
|   `-- openssl
`-- lib
    |-- libcrypto-3-x64.dll
    |-- libcrypto.lib
    |-- libssl-3-x64.dll
    `-- libssl.lib


댓글 없음:

댓글 쓰기