Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lateralusX
Copy link
Member

@lateralusX lateralusX commented Oct 18, 2018

Add support for BTLS assembler build on Windows (cygwin/msvc). Building BTLS with assembler support on Windows requires several additional build tools (except cmake) for both cygwin/msvc builds.
On cygwin, perl and yasm will be needed and on msvc, ninja, perl and yasm. On msvc builds BTLS doesn’t support Visual Studio generator when building with assembler support, so this commit adds support for ninja build system covering that scenario. This commit adds support for auto detection of needed build tools and enable assembler builds if all needed tools have been identified as available. Commit also fixes the execution of msbuild on CI to just use the original PATH variable instead of the cygwin PATH to make sure correct version of identified build tools gets used (Windows version of git, ninja, perl and yasm). Both cygwin and msvc build will use nasm compiler (through use of yasm) since generated assembler won’t compile with mingw’s gcc version.

PR also include fix for BTLS password encoding on Windows that cause test failures when running on CI.

Building BTLS with assembler support on Windows requires several
additional build tools (except cmake) for both cygwin/msvc builds.
On cygwin, perl and yasm will be needed and on msvc, ninja, perl
and yasm. On msvc builds BTLS doesn’t support Visual Studio generator
when building with assembler support, so this commit adds support for
ninja build system covering that scenario. This commit adds support for
auto detection of needed build tools and enable assembler builds if all
needed tools have been identified as available. Commit also fixes the
execution of msbuild on CI to just use the original PATH variable instead
of the cygwin PATH to make sure correct version of identified build tools
gets used (Windows version of git, ninja, perl and yasm). Both cygwin and
msvc build will use nasm compiler (through use of yasm) since generated
assembler won’t compile with mingw’s gcc version.
Mono BTLS library assumes all passwords are ANSI encoded strings since
SafePasswordHandle gets passed directly through pinvokes. This is only true for
SafePasswordHandle implemented on Unix:es. On Windows, SafePasswordHandle stores
passwords as Unicode, most likely due to Windows Crypto API accepting Unicode
passwords. When using BTLS on Windows this difference submerged since passwords
passed to BTLS will be Unicode encoded failing the decryption of PCKS12 structure.

Keeping the pattern already in place, passing SafePasswordHandler all the way
through pinvokes, the needed conversion will be done just before calling into OpenSSL
library as part of mono's BTLS library adapter.
@lateralusX
Copy link
Member Author

All tests pass on CI using BTLS on Windows using BTLS build without assembler optimization.

@lateralusX lateralusX force-pushed the lateralusX/windows-btls-asm-support branch from 8e3eae2 to 14c786b Compare October 19, 2018 11:53
@lateralusX lateralusX changed the title WIP: Windows BTLS assembler build support (cygwin/msvc). Windows BTLS assembler build support (cygwin/msvc). Oct 22, 2018
@lateralusX
Copy link
Member Author

@baulig approve/merge?

@baulig baulig merged commit f2d67cd into mono:master Oct 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants