-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
402 additions
and
23 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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
platform "windowsfips-2016-x64" do |plat| | ||
plat.vmpooler_template 'win-2016-fips-x86_64' | ||
|
||
plat.servicetype 'windows' | ||
visual_studio_version = '2017' | ||
visual_studio_sdk_version = 'win8.1' | ||
|
||
# We need to ensure we install chocolatey prior to adding any nuget repos. Otherwise, everything will fall over | ||
plat.add_build_repository "https://artifactory.delivery.puppetlabs.net/artifactory/generic/buildsources/windows/chocolatey/install-chocolatey-1.4.0.ps1" | ||
plat.provision_with "C:/ProgramData/chocolatey/bin/choco.exe feature enable -n useFipsCompliantChecksums" | ||
|
||
plat.add_build_repository "https://artifactory.delivery.puppetlabs.net/artifactory/api/nuget/nuget" | ||
|
||
# C:\tools is likely added by mingw, however because we also want to use that | ||
# dir for vsdevcmd.bat we create it for safety | ||
plat.provision_with "mkdir -p C:/tools" | ||
# We don't want to install any packages from the chocolatey repo by accident | ||
plat.provision_with "C:/ProgramData/chocolatey/bin/choco.exe sources remove -name chocolatey" | ||
|
||
packages = [ | ||
"cmake", | ||
"pl-gdbm-#{self._platform.architecture}", | ||
"pl-iconv-#{self._platform.architecture}", | ||
"pl-libffi-#{self._platform.architecture}", | ||
"pl-pdcurses-#{self._platform.architecture}", | ||
"pl-toolchain-#{self._platform.architecture}", | ||
"pl-zlib-#{self._platform.architecture}", | ||
"mingw-w64 -version 5.2.0 -debug", | ||
] | ||
|
||
packages.each do |name| | ||
plat.provision_with("C:/ProgramData/chocolatey/bin/choco.exe install -y --no-progress #{name}") | ||
end | ||
# We use cache-location in the following install because msvc has several long paths | ||
# if we do not update the cache location choco will fail because paths get too long | ||
plat.provision_with "C:/ProgramData/chocolatey/bin/choco.exe install msvc.#{visual_studio_version}-#{visual_studio_sdk_version}.sdk.en-us -y --cache-location=\"C:\\msvc\" --no-progress" | ||
# The following creates a batch file that will execute the vsdevcmd batch file located within visual studio. | ||
# We create the following batch file under C:\tools\vsdevcmd.bat so we can avoid using both the %ProgramFiles(x86)% | ||
# evironment var, as well as any spaces in the path when executing things with cygwin. This makes command execution | ||
# through cygwin much easier. | ||
# | ||
# Note that the unruly \'s in the following string escape the following sequence to literal chars: "\" and then \"" | ||
plat.provision_with "touch C:/tools/vsdevcmd.bat && echo \"\\\"%ProgramFiles(x86)%\\Microsoft Visual Studio\\#{visual_studio_version}\\BuildTools\\Common7\\Tools\\vsdevcmd\\\"\" >> C:/tools/vsdevcmd.bat" | ||
|
||
plat.install_build_dependencies_with "C:/ProgramData/chocolatey/bin/choco.exe install -y --no-progress" | ||
|
||
plat.make "/usr/bin/make" | ||
plat.patch "TMP=/var/tmp /usr/bin/patch.exe --binary" | ||
|
||
plat.platform_triple "x86_64-w64-mingw32" | ||
|
||
plat.package_type "archive" | ||
plat.output_dir "windows" | ||
end |
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
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
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
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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
diff --git a/lib/vtls/x509asn1.c b/lib/vtls/x509asn1.c | ||
index 39e4fb33b..7e2e3d724 100644 | ||
--- a/lib/vtls/x509asn1.c | ||
+++ b/lib/vtls/x509asn1.c | ||
@@ -566,28 +566,40 @@ static const char *GTime2str(const char *beg, const char *end) | ||
tzp = fracp; | ||
fracl = 0; | ||
if(fracp < end && (*fracp == '.' || *fracp == ',')) { | ||
- fracp++; | ||
- do | ||
+ /* Have fractional seconds, e.g. "[.,]\d+". How many? */ | ||
+ fracp++; /* should be a digit char or BAD ARGUMENT */ | ||
+ tzp = fracp; | ||
+ while(tzp < end && ISDIGIT(*tzp)) | ||
tzp++; | ||
- while(tzp < end && *tzp >= '0' && *tzp <= '9'); | ||
- /* Strip leading zeroes in fractional seconds. */ | ||
- for(fracl = tzp - fracp - 1; fracl && fracp[fracl - 1] == '0'; fracl--) | ||
- ; | ||
+ if(tzp == fracp) /* never looped, no digit after [.,] */ | ||
+ return CURLE_BAD_FUNCTION_ARGUMENT; | ||
+ fracl = tzp - fracp; /* number of fractional sec digits */ | ||
+ DEBUGASSERT(fracl > 0); | ||
+ /* Strip trailing zeroes in fractional seconds. | ||
+ * May reduce fracl to 0 if only '0's are present. */ | ||
+ while(fracl && fracp[fracl - 1] == '0') | ||
+ fracl--; | ||
} | ||
|
||
/* Process timezone. */ | ||
- if(tzp >= end) | ||
- ; /* Nothing to do. */ | ||
+ if(tzp >= end) { | ||
+ sep = " "; | ||
+ tzp = "GMT"; | ||
+ tzl = 3; | ||
+ } | ||
+ else if((*tzp == '+') || (*tzp == '-')) { | ||
+ sep = " UTC"; | ||
+ tzl = end - tzp; | ||
+ } /* Nothing to do. */ | ||
else if(*tzp == 'Z') { | ||
tzp = " GMT"; | ||
end = tzp + 4; | ||
} | ||
else { | ||
sep = " "; | ||
- tzp++; | ||
+ tzl = end - tzp; | ||
} | ||
|
||
- tzl = end - tzp; | ||
return curl_maprintf("%.4s-%.2s-%.2s %.2s:%.2s:%c%c%s%.*s%s%.*s", | ||
beg, beg + 4, beg + 6, | ||
beg + 8, beg + 10, sec1, sec2, | ||
@@ -595,6 +607,15 @@ static const char *GTime2str(const char *beg, const char *end) | ||
sep, (int)tzl, tzp); | ||
} | ||
|
||
+#ifdef UNITTESTS | ||
+/* used by unit1656.c */ | ||
+CURLcode Curl_x509_GTime2str(struct dynbuf *store, | ||
+ const char *beg, const char *end) | ||
+{ | ||
+ return GTime2str(store, beg, end); | ||
+} | ||
+#endif | ||
+ | ||
/* | ||
* Convert an ASN.1 UTC time to a printable string. | ||
* Return the dynamically allocated string, or NULL if an error occurs. | ||
diff --git a/lib/vtls/x509asn1.h b/lib/vtls/x509asn1.h | ||
index 5496de40e..93925718c 100644 | ||
--- a/lib/vtls/x509asn1.h | ||
+++ b/lib/vtls/x509asn1.h | ||
@@ -76,6 +76,17 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data, int certnum, | ||
const char *beg, const char *end); | ||
CURLcode Curl_verifyhost(struct Curl_cfilter *cf, struct Curl_easy *data, | ||
const char *beg, const char *end); | ||
+ | ||
+#ifdef UNITTESTS | ||
+#if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_SECTRANSP) || \ | ||
+ defined(USE_MBEDTLS) | ||
+ | ||
+/* used by unit1656.c */ | ||
+CURLcode Curl_x509_GTime2str(struct dynbuf *store, | ||
+ const char *beg, const char *end); | ||
+#endif | ||
+#endif | ||
+ | ||
#endif /* USE_GSKIT or USE_NSS or USE_GNUTLS or USE_WOLFSSL or USE_SCHANNEL | ||
* or USE_SECTRANSP */ | ||
#endif /* HEADER_CURL_X509ASN1_H */ |
Oops, something went wrong.