Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Visual Studio VisualGDB projects for tls examples #298

Closed
wants to merge 11 commits into from

Conversation

gojimmypi
Copy link
Contributor

I've created a bunch of Visual Studio project files, one for each of the wolfSSL tls examples, using the @sysprogs VisualGDB extension.

Solution files are in tls/VisualGDB-tls and each project is in a separate subdirectory.

For convenience, since one would likely want to be running a client and a server concurrently, the client projects are in one solution, and the server projects in another.

These projects were created to work cooperatively with VisualDGB EDP-IDF projects for the ESP32 that I will be working on soon.

There's no new source code here. All project refer to code in the ..\..\tls directory.

See the README.md for examples on creating VisualGDB projects for WSL.

@dgarske dgarske self-assigned this Feb 28, 2022
@dgarske dgarske self-requested a review February 28, 2022 19:24
@gojimmypi
Copy link
Contributor Author

heads up I found a few oddities in the existing .gitignore file last night that prevented some files from being included and are thus missing in this PR. Minor revision coming soon.

@dgarske
Copy link
Contributor

dgarske commented Mar 4, 2022

The diff is large... looks like my request for changes did not save, so putting it here in a comment.

I installed VS 2022 and Visual GDB. Opened the VisualGDB-client-tls.sln solution and got the following error for each project:

Z:\davidgarske\GitHub\wolfssl-examples\tls\VisualGDB-tls\client-tcp\client-tcp.vcxproj : error  : The imported project "C:\Users\David Garske\AppData\Local\VisualGDB\FindComponents.props" was not found. Confirm that the expression in the Import declaration "C:\Users\David Garske\AppData\Local\VisualGDB\FindComponents.props" is correct, and that the file exists on disk.  Z:\davidgarske\GitHub\wolfssl-examples\tls\VisualGDB-tls\client-tcp\client-tcp.vcxproj

The C:\Users\David Garske\AppData\Local\VisualGDB\ directory exists, but not the FindComponents.props and I cannot seem to locate it either?

Also in the README.md please clarify the instructions since you show how to create the projects from new, but also have already created some.

Thanks

@gojimmypi
Copy link
Contributor Author

gojimmypi commented Mar 4, 2022

Curious, the missing file is user specific and not project specific.

fwiw - I'm using VS2019 and not VS2022.

the WSL I have installed:

0 $   lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:        20.04
Codename:       focal

my C:\Users\gojimmypi\AppData\Local\VisualGDB\FindComponents.props contains this:

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
	<PropertyGroup>
		<EFP_BASE>C:\Users\gojimmypi\AppData\Local\VisualGDB\EmbeddedEFPs</EFP_BASE>
		<TESTFW_BASE_LOCAL>C:\Users\gojimmypi\AppData\Local\VisualGDB\TestFrameworks</TESTFW_BASE_LOCAL>
		<TESTFW_BASE>$(TESTFW_BASE_LOCAL)</TESTFW_BASE>
		<VisualGDBProfileVersion>5.6</VisualGDBProfileVersion>
	</PropertyGroup>
	<PropertyGroup>
		<TESTFW_BASE Condition="'$(RemoteBuildHost)' == 'localhost-lxss'">/mnt/c/Users/gojimmypi/AppData/Local/VisualGDB/TestFrameworks</TESTFW_BASE>
		<TESTFW_BASE Condition="'$(RemoteBuildHost)' == 'localhost-lxss-ubuntu'">/mnt/c/Users/gojimmypi/AppData/Local/VisualGDB/TestFrameworks</TESTFW_BASE>
		<TESTFW_BASE Condition="'$(RemoteBuildHost)' == 'localhost-lxss-ubuntu-20.04'">/mnt/c/Users/gojimmypi/AppData/Local/VisualGDB/TestFrameworks</TESTFW_BASE>
	</PropertyGroup>
	<Import Condition="Exists('$(MSBuildThisFileDirectory)FindRemoteHost.props')" Project="$(MSBuildThisFileDirectory)FindRemoteHost.props"/>
	<Import Condition="Exists('$(MSBuildThisFileDirectory)FindToolchain.props')" Project="$(MSBuildThisFileDirectory)FindToolchain.props"/>
	<Import Condition="Exists('$(MSBuildThisFileDirectory)FindBSP.props')" Project="$(MSBuildThisFileDirectory)FindBSP.props"/>
	<PropertyGroup>
		<TOOLCHAIN_ROOT>$(ToolchainDir)</TOOLCHAIN_ROOT>
	</PropertyGroup>
</Project>

edit: I'm using VisualGDB version 5.6R4 Build 4534

@gojimmypi
Copy link
Contributor Author

I'm curious what the result is if you try a manual rebuild from command-line in WSL:

0 $  cd /mnt/c/workspace/wolfssl-examples/tls/VisualGDB-tls/client-tls13
gojimmypi@DESKTOP(WSL): /mnt/c/workspace/wolfssl-examples/tls/VisualGDB-tls/client-tls13 (master * u=) gojimmypi/wolfssl-examples

0 $  make  CONFIG=Debug
clang -ggdb -ffunction-sections -O0   -DDEBUG=1  -c ../../client-tls13.c -o ../..//client-tls13.o -MD -MF ../..//client-tls13.dep
clang++ -o ../..//client-tls13 -Wl,-gc-sections   -Lwolfssl -Wl,--start-group ../..//client-tls13.o -lwolfssl  -Wl,--rpath='$ORIGIN'   -Wl,--end-group
gojimmypi@DESKTOP(WSL): /mnt/c/workspace/wolfssl-examples/tls/VisualGDB-tls/client-tls13 (master * u=) gojimmypi/wolfssl-examples

0 $

I sent a message to sysprog support asking about the missing FindComponents.props

@gojimmypi
Copy link
Contributor Author

I've found another oddity with these project files. Although they build and run just fine, the clean process is not so good. Fortunately the sysprogs folks implemented a circuit breaker to prevent what could have been a disaster:

make  CONFIG=Debug clean
rm -rf ../../
rm: refusing to remove '.' or '..' directory: skipping '../../'
make: *** [Makefile:238: clean] Error 1

I was really hoping to create these projects to be the least intrusive as possible, simply referring to existing source code in the ../../ directory while also not cluttering up that directory with what would be irrelevant files for other platforms.

The problem is with the relative references to KEY / CERT / CA files in the #DEFINEs which are not found from the projects two subdirectories down:

#define CERT_FILE "../certs/client-cert.pem"
#define KEY_FILE  "../certs/client-key.pem"
#define CA_FILE   "../certs/ca-cert.pem"

I'm thinking of perhaps adding a second commandline parameter to all of the client apps to optionally accept a specified directory, otherwise use the ../certs default.

Alternatively, there could be some sort of #IFDEF VISUALGDB .

@dgarske what do you think? If you agree it would be best to recode all the examples, perhaps it would be best to pull back this PR and implement the new projects one at a time?

In the meantime, I have a blog post that shows a walk-through on the client/server TLS13 setup and packet exchange.

@dgarske dgarske removed their assignment Mar 8, 2022
@dgarske
Copy link
Contributor

dgarske commented Mar 8, 2022

@gojimmypi , summary of what we discussed:

  • Attempt to reduce size of PR.
  • Add section in README.md about existing examples.
  • Note the existing examples assume WSL is installed.
  • Add note about the issue I saw with VisualGDB because I had not created a new project, the files expected hadn't been installed.
  • We did test successfully using a remote Linux box... very cool. Might add note on that too.
    Thanks, David Garske, wolfSSL

@gojimmypi
Copy link
Contributor Author

@dgarske yes, agreed. Per our discussion, I'm going to:

  • close this PR
  • address the working directory "make clean" problem
  • determine which project files are actually essential, and which may be auto-generated at load time (and can be excluded here)
  • improve README.md per your suggestions
  • re-open new PR with clean changes.

Regarding the problematic hard-coded paths to the cert files noted above in ../certs/, any preferences? some options:

  • add command-line parameter to each example app
  • IFDEF compile time option in each example app
  • further settings attempts (e.g. try to change working directory for debugged code to find certs)
  • other ideas?

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.

None yet

2 participants