-
Notifications
You must be signed in to change notification settings - Fork 61
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
Adding a C# wrapper; limitted functionality. #203
Conversation
wrapper/CSharp/wolfTPM.cs
Outdated
/* WOLFTPM_API int wolfTPM2_SetKeyAuthPassword(WOLFTPM2_KEY *key, | ||
const byte* auth, int authSz); */ | ||
[DllImport(DLLNAME, EntryPoint="wolfTPM2_SetKeyAuthPassword")] | ||
public static extern int wolfTPM2_SetKeyAuthPassword(IntPtr key, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anhu, string auth
should be byte[] auth
.
wrapper/CSharp/wolfTPM.cs
Outdated
|
||
if (ret == TPM_RC_SUCCESS) { | ||
ret = wolfTPM2_SetKeyAuthPassword(parent_key, | ||
"ThisIsMyStorageKeyAuth", 22); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anhu, It is better to match to pass the password bytes explicity.
string passwd = "ThisIsMYStorageKeyAuth"
byte[] pwbytes = Encoding.ASCII.GetBytes(passwd)
....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This looks like a better approach. Will make the change.
src/tpm2_wrap.c
Outdated
@@ -172,6 +172,249 @@ int wolfTPM2_Init(WOLFTPM2_DEV* dev, TPM2HalIoCb ioCb, void* userCtx) | |||
return rc; | |||
} | |||
|
|||
#ifdef WOLFTPM2_ENABLE_CSHARP | |||
WOLFTPM2_DEV *wolfTPM2_SimpleInit(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's enable support for these API's always (with wrapper). And let's call them wolfTPM2_New
and wolfTPM2_Free
.
src/tpm2_wrap.c
Outdated
return blob; | ||
} | ||
|
||
int wolfTPM2_SimpleOpenExisting(WOLFTPM2_DEV* dev) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no value is adding this API. You should be able to call wolfTPM2_OpenExisting
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want them to be able to set ioCb and userCtx to anything but NULL.
This also reduces the potential for questions like..."Oh...what is the callback for?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then please rename. I don't like "simple". How about wolfTPM2_OpenExistingDev
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. That I can do.
src/tpm2_wrap.c
Outdated
|
||
int wolfTPM2_CleanupKeyBlob(WOLFTPM2_KEYBLOB* blob) | ||
{ | ||
XFREE(blob, NULL, DYNAMIC_TYPE_TMP_BUFFER); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our XFREE does a NULL check, but consider adding one just in case.
src/tpm2_wrap.c
Outdated
return TPM_RC_SUCCESS; | ||
} | ||
|
||
WOLFTPM2_HANDLE* wolfTPM2_GetHandleRefFromKey(WOLFTPM2_KEY* key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any public API should check incoming arg. Please put function brace on new line.
src/tpm2_wrap.c
Outdated
} | ||
|
||
/* Write size marker for the public part */ | ||
memcpy(buffer + sz, &key->pub.size, sizeof(key->pub.size)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use XMEMCPY
src/tpm2_wrap.c
Outdated
return BUFFER_E; | ||
} | ||
|
||
memcpy(&key->pub.size, runner, sizeof(key->pub.size)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
XMEMCPY
src/tpm2_wrap.c
Outdated
} | ||
|
||
|
||
WOLFTPM2_SESSION* wolfTPM2_GetEmptySession(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wolfTPM2_GetNewSession
src/tpm2_wrap.c
Outdated
if (key == NULL) | ||
return BAD_FUNC_ARG; | ||
|
||
if(authSz < 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add space if (
wrapper/CSharp/wolfTPM.cs
Outdated
byte[] priv_buffer; | ||
int exp = 0x10001; | ||
|
||
pub_buffer = File.ReadAllBytes("rsa_public.bin"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think these file are portable or should be committed. Instead you should be creating a key from the TPM and saving these for the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These files are based on kRsaKeyPubModulus
and kRsaKeyPrivQ
in examples/tpm_test.h
:
/* from wolfSSL ./certs/client-key.der */
static const byte kRsaKeyPubModulus[] = {
0xC3, 0x03, 0xD1, 0x2B, 0xFE, 0x39, 0xA4, 0x32, 0x45, 0x3B, 0x53, 0xC8, 0x84,
0x2B, 0x2A, 0x7C, 0x74, 0x9A, 0xBD, 0xAA, 0x2A, 0x52, 0x07, 0x47, 0xD6, 0xA6,
0x36, 0xB2, 0x07, 0x32, 0x8E, 0xD0, 0xBA, 0x69, 0x7B, 0xC6, 0xC3, 0x44, 0x9E,
0xD4, 0x81, 0x48, 0xFD, 0x2D, 0x68, 0xA2, 0x8B, 0x67, 0xBB, 0xA1, 0x75, 0xC8,
0x36, 0x2C, 0x4A, 0xD2, 0x1B, 0xF7, 0x8B, 0xBA, 0xCF, 0x0D, 0xF9, 0xEF, 0xEC,
0xF1, 0x81, 0x1E, 0x7B, 0x9B, 0x03, 0x47, 0x9A, 0xBF, 0x65, 0xCC, 0x7F, 0x65,
0x24, 0x69, 0xA6, 0xE8, 0x14, 0x89, 0x5B, 0xE4, 0x34, 0xF7, 0xC5, 0xB0, 0x14,
0x93, 0xF5, 0x67, 0x7B, 0x3A, 0x7A, 0x78, 0xE1, 0x01, 0x56, 0x56, 0x91, 0xA6,
0x13, 0x42, 0x8D, 0xD2, 0x3C, 0x40, 0x9C, 0x4C, 0xEF, 0xD1, 0x86, 0xDF, 0x37,
0x51, 0x1B, 0x0C, 0xA1, 0x3B, 0xF5, 0xF1, 0xA3, 0x4A, 0x35, 0xE4, 0xE1, 0xCE,
0x96, 0xDF, 0x1B, 0x7E, 0xBF, 0x4E, 0x97, 0xD0, 0x10, 0xE8, 0xA8, 0x08, 0x30,
0x81, 0xAF, 0x20, 0x0B, 0x43, 0x14, 0xC5, 0x74, 0x67, 0xB4, 0x32, 0x82, 0x6F,
0x8D, 0x86, 0xC2, 0x88, 0x40, 0x99, 0x36, 0x83, 0xBA, 0x1E, 0x40, 0x72, 0x22,
0x17, 0xD7, 0x52, 0x65, 0x24, 0x73, 0xB0, 0xCE, 0xEF, 0x19, 0xCD, 0xAE, 0xFF,
0x78, 0x6C, 0x7B, 0xC0, 0x12, 0x03, 0xD4, 0x4E, 0x72, 0x0D, 0x50, 0x6D, 0x3B,
0xA3, 0x3B, 0xA3, 0x99, 0x5E, 0x9D, 0xC8, 0xD9, 0x0C, 0x85, 0xB3, 0xD9, 0x8A,
0xD9, 0x54, 0x26, 0xDB, 0x6D, 0xFA, 0xAC, 0xBB, 0xFF, 0x25, 0x4C, 0xC4, 0xD1,
0x79, 0xF4, 0x71, 0xD3, 0x86, 0x40, 0x18, 0x13, 0xB0, 0x63, 0xB5, 0x72, 0x4E,
0x30, 0xC4, 0x97, 0x84, 0x86, 0x2D, 0x56, 0x2F, 0xD7, 0x15, 0xF7, 0x7F, 0xC0,
0xAE, 0xF5, 0xFC, 0x5B, 0xE5, 0xFB, 0xA1, 0xBA, 0xD3
};
static const word32 kRsaKeyPubExponent = 0x10001; /* {0x01, 0x00, 0x01} */
static const byte kRsaKeyPrivQ[] = {
0xD5, 0x38, 0x1B, 0xC3, 0x8F, 0xC5, 0x93, 0x0C, 0x47, 0x0B, 0x6F, 0x35, 0x92,
0xC5, 0xB0, 0x8D, 0x46, 0xC8, 0x92, 0x18, 0x8F, 0xF5, 0x80, 0x0A, 0xF7, 0xEF,
0xA1, 0xFE, 0x80, 0xB9, 0xB5, 0x2A, 0xBA, 0xCA, 0x18, 0xB0, 0x5D, 0xA5, 0x07,
0xD0, 0x93, 0x8D, 0xD8, 0x9C, 0x04, 0x1C, 0xD4, 0x62, 0x8E, 0xA6, 0x26, 0x81,
0x01, 0xFF, 0xCE, 0x8A, 0x2A, 0x63, 0x34, 0x35, 0x40, 0xAA, 0x6D, 0x80, 0xDE,
0x89, 0x23, 0x6A, 0x57, 0x4D, 0x9E, 0x6E, 0xAD, 0x93, 0x4E, 0x56, 0x90, 0x0B,
0x6D, 0x9D, 0x73, 0x8B, 0x0C, 0xAE, 0x27, 0x3D, 0xDE, 0x4E, 0xF0, 0xAA, 0xC5,
0x6C, 0x78, 0x67, 0x6C, 0x94, 0x52, 0x9C, 0x37, 0x67, 0x6C, 0x2D, 0xEF, 0xBB,
0xAF, 0xDF, 0xA6, 0x90, 0x3C, 0xC4, 0x47, 0xCF, 0x8D, 0x96, 0x9E, 0x98, 0xA9,
0xB4, 0x9F, 0xC5, 0xA6, 0x50, 0xDC, 0xB3, 0xF0, 0xFB, 0x74, 0x17
};
I do create and export and import . However, this is for loading an external key which is a different use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add README.md
in the wrapper/CSharp directory.
Tools mono-mcs
.
cd wrapper/CSharp
mcs ./wolfTPM.cs
LD_LIBRARY_PATH=../../src/.libs/ ./wolfTPM.exe
I'd like to have a Visual Studio solution for this too (at some point).
What is the expected output supposed to look like? Here is what I get:
LD_LIBRARY_PATH=../../src/.libs/ ./wolfTPM.exe
buf: { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, } (256 bytes)
wolfSSL Entering wolfCrypt_Init
buf: { 160, 232, 56, 148, 153, 199, 131, 24, 4, 51, 241, 158, 95, 183, 198, 154, 88, 52, 95, 93, 32, 224, 250, 104, 173, 216, 195, 30, 24, 61, 35, 168, 226, 224, 208, 110, 122, 200, 193, 5, 126, 52, 82, 212, 30, 255, 20, 79, 236, 245, 118, 131, 201, 196, 91, 212, 30, 168, 15, 250, 209, 234, 45, 229, 125, 161, 75, 158, 221, 97, 17, 171, 173, 226, 80, 56, 135, 173, 179, 107, 35, 215, 54, 86, 230, 163, 25, 161, 24, 24, 62, 230, 70, 44, 11, 20, 128, 198, 169, 48, 15, 204, 55, 210, 169, 196, 135, 124, 254, 51, 225, 215, 144, 181, 186, 193, 241, 248, 114, 112, 136, 188, 48, 239, 214, 133, 102, 145, 12, 128, 192, 46, 96, 193, 190, 89, 96, 181, 54, 253, 71, 48, 133, 207, 184, 194, 85, 226, 131, 142, 6, 163, 45, 242, 227, 203, 170, 64, 56, 61, 178, 8, 176, 188, 248, 177, 92, 121, 220, 252, 206, 222, 227, 230, 25, 32, 215, 82, 236, 125, 137, 249, 208, 145, 5, 114, 11, 147, 8, 5, 174, 171, 223, 106, 14, 91, 228, 116, 1, 126, 221, 119, 63, 46, 217, 196, 167, 201, 108, 216, 241, 80, 16, 211, 250, 244, 135, 226, 189, 151, 82, 40, 139, 185, 73, 49, 237, 33, 151, 18, 89, 184, 192, 208, 168, 249, 211, 163, 102, 191, 111, 148, 96, 254, 14, 173, 57, 223, 127, 212, 208, 142, 45, 205, 82, 120, } (256 bytes)
wolfSSL Entering wolfCrypt_Cleanup
Leaving TryFillBufferWithRandom() with ret=0
src/tpm2_wrap.c
Outdated
return &(key->handle); | ||
} | ||
|
||
int wolfTPM2_OpenExistingDev(WOLFTPM2_DEV* dev) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./configure --enable-swtpm CFLAGS="-DWOLFTPM2_NO_HEAP" && make
src/tpm2_wrap.c:299:5: error: no previous prototype for ‘wolfTPM2_OpenExistingDev’ [-Werror=missing-prototypes]
299 | int wolfTPM2_OpenExistingDev(WOLFTPM2_DEV* dev)
| ^~~~~~~~~~~~~~~~~~~~~~~~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch!! 👍 I'll get that fixed up.
I think Jeff is going to do that. I'll check with him. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add include.am so the new files are part of “make dist”. Also please add a readme.md
Ok. Will add include.am and have already started writing the readme.md . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been using a solution to try and test on Windows with mixed results. I think some of it is on my side and plan to spend most of today addressing this.
- We should remove the
.bin
files. - The c# tests should be broken out to a separate file.
I think it makes sense for me to add commits as I test in Windows and add a solution. I'll break out the tests to a separate file. I'm still in favor of trying to shift more of this csharp specific functionality to c# land. I may try to implement that as well and include it in my commits.
wrapper/CSharp/wolfTPM.cs
Outdated
Console.WriteLine(""); | ||
} | ||
|
||
public static void Main(string[] args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @elms . This file should produce a library, not an app. Please move the Main
and "Try" functions to a new .cs and update the build steps. Use libwolfTPM.cs
and wolfTPM.cs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 3 tests that use the bin files, fail from VS but pass from the command line. I'd still like to remove the need for gold files and IO from the tests.
I think I left a few TODO
s as well.
Tested with swtpm (linux and mono) and on Windows (Visual studio project and TBS) Co-authored-by: Anthony Hu <anthony@wolfssl.com>
src/tpm2_wrap.c
Outdated
return TPM_RC_SUCCESS; | ||
} | ||
|
||
WOLFTPM_API TPMT_PUBLIC* wolfTPM2_GetNewPublicTemplate(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to have WOLFTPM_API
in the .c file... only required in the .h,
src/tpm2_wrap.c
Outdated
#endif | ||
|
||
if (bufferSz < done_reading + sizeof(key->pub.size)) { | ||
#ifdef WOLFTPM_DEBUG_VERBOSE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For errors consider using DEBUG_WOLFTPM
.
src/tpm2_wrap.c
Outdated
done_reading += sizeof(key->pub.size); | ||
|
||
if (bufferSz < done_reading + sizeof(UINT16) + key->pub.size) { | ||
#ifdef WOLFTPM_DEBUG_VERBOSE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For errors consider using DEBUG_WOLFTPM
.
src/tpm2_wrap.c
Outdated
} | ||
|
||
if (bufferSz < done_reading + sizeof(key->priv.size)) { | ||
#ifdef WOLFTPM_DEBUG_VERBOSE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For errors consider using DEBUG_WOLFTPM
.
src/tpm2_wrap.c
Outdated
done_reading += sizeof(key->priv.size); | ||
|
||
if (bufferSz < done_reading + key->priv.size) { | ||
#ifdef WOLFTPM_DEBUG_VERBOSE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For errors consider using DEBUG_WOLFTPM
.
wolftpm/tpm2_wrap.h
Outdated
#ifndef WOLFTPM2_NO_HEAP | ||
WOLFTPM_API WOLFTPM2_DEV *wolfTPM2_New(void); | ||
WOLFTPM_API int wolfTPM2_Free(WOLFTPM2_DEV *dev); | ||
WOLFTPM_API WOLFTPM2_KEYBLOB* wolfTPM2_GetNewKeyBlob(void); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the API name's I would prefer wolfTPM2_NewKeyBlob
and wolfTPM2_FreeKeyBlob
. Same pattern for others below.
wrapper/CSharp/README.md
Outdated
This directory contains the CSharp wrapper for the TPM 2.0 API wrapper API. | ||
|
||
|
||
Once you have created the simulator, you can should build wolfssl as described |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"can should"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All builds and runs in Windows Visual Studio and Linux/Mono. Just a couple documentation changes needed.
wrapper/CSharp/README.md
Outdated
You should see something similar to the following output: | ||
|
||
``` | ||
NUnit-Console version 2.6.4.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we omit this header part with copyright and just show the test results?
wrapper/CSharp/README.md
Outdated
Selected test(s): tpm_csharp_test.WolfTPMTest.TryFillBufferWithRandom | ||
.wolfSSL Entering wolfCrypt_Init | ||
wolfSSL Entering wolfCrypt_Cleanup | ||
buf: { 44, 95, 206, 69, 252, 157, 173, 149, 26, 160, 21, 5, 35, 19, 255, 29, 251, 228, 206, 36, 77, 79, 160, 42, 25, 172, 82, 172, 152, 143, 179, 147, 52, 211, 238, 63, 34, 227, 243, 155, 17, 77, 135, 233, 103, 39, 211, 180, 55, 54, 36, 180, 87, 168, 28, 143, 104, 175, 176, 156, 154, 8, 114, 143, 123, 99, 110, 247, 46, 193, 93, 54, 208, 128, 162, 190, 225, 255, 109, 44, 8, 153, 21, 162, 139, 70, 7, 73, 13, 145, 157, 111, 20, 151, 101, 44, 45, 154, 159, 139, 153, 48, 117, 69, 179, 186, 48, 225, 20, 145, 120, 78, 58, 228, 4, 146, 241, 195, 121, 94, 44, 92, 246, 198, 71, 122, 176, 133, 21, 27, 41, 17, 7, 96, 122, 155, 105, 57, 150, 45, 63, 165, 136, 195, 173, 160, 137, 136, 207, 19, 60, 140, 2, 203, 246, 248, 179, 170, 203, 153, 154, 229, 104, 200, 141, 94, 139, 25, 103, 235, 116, 97, 186, 29, 32, 133, 205, 122, 230, 51, 88, 195, 69, 158, 199, 255, 212, 117, 3, 110, 201, 179, 138, 242, 172, 160, 121, 46, 117, 41, 185, 11, 22, 99, 4, 214, 37, 179, 246, 71, 146, 168, 116, 28, 146, 221, 53, 21, 5, 18, 84, 57, 137, 171, 237, 233, 215, 91, 88, 4, 205, 207, 218, 74, 46, 105, 106, 55, 254, 211, 186, 151, 136, 81, 128, 33, 77, 218, 203, 19, 164, 76, 177, 2, 185, 212, } (256 bytes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only shows if the WOLFTPM_DEBUG_VERBOSE
is set.
Mine looks like:
Selected test(s): tpm_csharp_test.WolfTPMTest.TrySelfTest
wolfSSL Entering wolfCrypt_Init
.
Tests run: 1, Errors: 0, Failures: 0, Inconclusive: 0, Time: 0.1530346 seconds
Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0
wolfSSL Entering wolfCrypt_Cleanup
The comment below is not accurate now: If you run this multiple time, you will see the content of the buffer changing for each execution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also if you try and build/run without building wolfTPM with ./configure && make you will get an exception:
Errors and Failures:
1) TearDown Error : tpm_csharp_test.WolfTPMTest.TrySelfTest
SetUp : System.EntryPointNotFoundException : wolfTPM2_NewKey assembly:<unknown assembly> type:<unknown type> member:(null)
TearDown : System.NullReferenceException : Object reference not set to an instance of an object
at (wrapper managed-to-native) wolfTPM.Key.wolfTPM2_NewKey()
at wolfTPM.Key..ctor () [0x00006] in <d5ab42fd203c44a7b899b84155a3367b>:0
at tpm_csharp_test.WolfTPMTest.TestInit () [0x00000] in <d5ab42fd203c44a7b899b84155a3367b>:0
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0007c] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
--TearDown
at wolfTPM.Device.UnloadHandle (wolfTPM.Key key) [0x00000] in <d5ab42fd203c44a7b899b84155a3367b>:0
at tpm_csharp_test.WolfTPMTest.TestCleanup () [0x00002] in <d5ab42fd203c44a7b899b84155a3367b>:0
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0007c] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
Might be helpful to add a comment saying to make sure and build and make wolfTPM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh...used to be there. Must have gotten removed. Will add it back.
wrapper/CSharp/README.md
Outdated
Prerequisites for linux | ||
|
||
``` | ||
apt install mono-tools-devel nunit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also needs nunit-console
Add wrappers, Unit tests, and Windows solution.
Tested on Linux with swtpm.
Tested on Windows.