Skip to content

Commit

Permalink
Fixes for build errors without tpm enabled updated readme with cleare…
Browse files Browse the repository at this point in the history
…r steps
  • Loading branch information
aidangarske committed Dec 16, 2024
1 parent 644b98b commit 3abdba7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ fred-cert.der would be:
TPM
===

wolfSSH now supports TPM support with client key authentication.
wolfSSH now supports TPM public key authentication.

When using TPM for client side public key authentication wolfSSH has dependencies
on wolfCrypt and wolfTPM. Youll also need to have a tpm simulator
Expand Down Expand Up @@ -565,8 +565,10 @@ using:

$ ./examples/keygen/keygen keyblob.bin -rsa -t -pem

Take key.pem and convert the TPM public key to the ssh-rsa BASE64 username format:
`ssh-keygen -f key.pem -i -m PKCS8`. Update echoserver.c user "hansel"'s public key.
This will produce a key.pem TPM public key which needs to be converted the to
the ssh-rsa BASE64 username format using this command: `ssh-keygen -f key.pem -i -m PKCS8`
Take this BASE64 encoded public key and update the `samplePublicKeyRsaBuffer`
in `echoserver.c` with it. Make sure to the user is "hansel"'s public key.

The directory `examples` contains an echoserver that any client should
be able to connect to. From wolfSSH open two terminal instances and run the
Expand Down
1 change: 1 addition & 0 deletions examples/echoserver/echoserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <wolfssh/agent.h>
#include <wolfssh/test.h>
#include <wolfssl/wolfcrypt/ecc.h>
#include <wolfssl/wolfcrypt/logging.h>

#include "examples/echoserver/echoserver.h"

Expand Down
6 changes: 5 additions & 1 deletion src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,8 @@ static int GetOpenSshKeyEd25519(ed25519_key* key,
}
#endif

#ifdef WOLFSSH_TPM

#ifndef WOLFSSH_NO_ECDSA
static int GetOpenSshPublicKeyEcc(ecc_key* key, const byte* buf, word32 len,
word32* idx)
Expand Down Expand Up @@ -1631,6 +1633,8 @@ static int GetOpenSshPublicKey(WS_KeySignature *key,
return ret;
}

#endif /* WOLFSSH_TPM */

/*
* Decodes an OpenSSH format key.
*/
Expand Down Expand Up @@ -12947,9 +12951,9 @@ static int BuildUserAuthRequestRsa(WOLFSSH* ssh,
ret = WS_CRYPTO_FAILED;
}
else {
int sigSz;
WLOG(WS_LOG_INFO, "Signing hash with RSA.");
#ifdef WOLFSSH_TPM
int sigSz;
sigSz = keySig->sigSz;
if (ssh->ctx->tpmDev && ssh->ctx->tpmKey) {
ret = wc_RsaPad_ex(encDigest, encDigestSz, output+begin,
Expand Down

0 comments on commit 3abdba7

Please sign in to comment.