mirror of https://github.com/wolfSSL/wolfssh.git
Used port.h macros
parent
77c8db6cc2
commit
69e266178f
|
@ -85,22 +85,23 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
# Generate key with default password
|
# Generate key with default password
|
||||||
cd wolftpm
|
cd wolftpm
|
||||||
./examples/keygen/keygen keyblob.bin -rsa -t -pem -eh
|
./examples/keygen/keygen keyblob1.bin -rsa -t -pem -eh
|
||||||
|
cp key.pem key1.pem # Save the key for first test
|
||||||
|
|
||||||
# Convert key to SSH format
|
# Convert key to SSH format
|
||||||
ssh-keygen -f key.pem -i -m PKCS8 > ../wolfssh/key.ssh
|
ssh-keygen -f key1.pem -i -m PKCS8 > ../wolfssh/key1.ssh
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
# Start echoserver and wait for it to be ready
|
# Start echoserver and wait for it to be ready
|
||||||
cd wolfssh
|
cd wolfssh
|
||||||
./examples/echoserver/echoserver -1 -s key.ssh &
|
./examples/echoserver/echoserver -1 -s key1.ssh &
|
||||||
echo "Echoserver started with PID: $!"
|
echo "Echoserver started with PID: $!"
|
||||||
sleep 2
|
sleep 2
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
# Test client connection with default password
|
# Test client connection with default password
|
||||||
cd wolfssh
|
cd wolfssh
|
||||||
./examples/client/client -i ../wolftpm/keyblob.bin -u hansel -K ThisIsMyKeyAuth
|
./examples/client/client -i ../wolftpm/keyblob1.bin -u hansel -K ThisIsMyKeyAuth
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
# Test the TPM SSH Custom Password
|
# Test the TPM SSH Custom Password
|
||||||
|
@ -109,14 +110,15 @@ jobs:
|
||||||
# Test with custom password
|
# Test with custom password
|
||||||
cd wolftpm
|
cd wolftpm
|
||||||
./examples/keygen/keygen keyblob2.bin -rsa -t -pem -eh -auth=custompassword
|
./examples/keygen/keygen keyblob2.bin -rsa -t -pem -eh -auth=custompassword
|
||||||
|
cp key.pem key2.pem # Save the key for second test
|
||||||
|
|
||||||
# Convert key to SSH format
|
# Convert key to SSH format
|
||||||
ssh-keygen -f key.pem -i -m PKCS8 > ../wolfssh/key.ssh
|
ssh-keygen -f key2.pem -i -m PKCS8 > ../wolfssh/key2.ssh
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
# Start echoserver and wait for it to be ready
|
# Start echoserver and wait for it to be ready
|
||||||
cd wolfssh
|
cd wolfssh
|
||||||
./examples/echoserver/echoserver -1 -s key.ssh &
|
./examples/echoserver/echoserver -1 -s key2.ssh &
|
||||||
echo "Echoserver started with PID: $!"
|
echo "Echoserver started with PID: $!"
|
||||||
sleep 2
|
sleep 2
|
||||||
cd ..
|
cd ..
|
||||||
|
@ -126,10 +128,6 @@ jobs:
|
||||||
./examples/client/client -i ../wolftpm/keyblob2.bin -u hansel -K custompassword
|
./examples/client/client -i ../wolftpm/keyblob2.bin -u hansel -K custompassword
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
# Cleanup
|
|
||||||
pkill -f tpm_server
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
# Archive artifacts for debugging
|
# Archive artifacts for debugging
|
||||||
- name: Archive test artifacts
|
- name: Archive test artifacts
|
||||||
if: always()
|
if: always()
|
||||||
|
@ -137,7 +135,9 @@ jobs:
|
||||||
with:
|
with:
|
||||||
name: test-artifacts
|
name: test-artifacts
|
||||||
path: |
|
path: |
|
||||||
wolftpm/keyblob.bin
|
wolftpm/keyblob1.bin
|
||||||
wolftpm/keyblob2.bin
|
wolftpm/keyblob2.bin
|
||||||
wolftpm/key.pem
|
wolftpm/key1.pem
|
||||||
wolfssh/key.ssh
|
wolftpm/key2.pem
|
||||||
|
wolfssh/key1.ssh
|
||||||
|
wolfssh/key2.ssh
|
|
@ -41,6 +41,7 @@
|
||||||
#include <wolfssh/internal.h>
|
#include <wolfssh/internal.h>
|
||||||
#include <wolfssh/wolfsftp.h>
|
#include <wolfssh/wolfsftp.h>
|
||||||
#include <wolfssh/agent.h>
|
#include <wolfssh/agent.h>
|
||||||
|
#include <wolfssh/port.h>
|
||||||
#include <wolfssh/test.h>
|
#include <wolfssh/test.h>
|
||||||
#include <wolfssl/wolfcrypt/ecc.h>
|
#include <wolfssl/wolfcrypt/ecc.h>
|
||||||
#include <wolfssl/wolfcrypt/logging.h>
|
#include <wolfssl/wolfcrypt/logging.h>
|
||||||
|
@ -2101,25 +2102,24 @@ static int LoadPubKeyList(StrList* strList, int format, PwMapList* mapList)
|
||||||
#ifdef WOLFSSH_TPM
|
#ifdef WOLFSSH_TPM
|
||||||
static char* LoadTpmSshKey(const char* keyFile)
|
static char* LoadTpmSshKey(const char* keyFile)
|
||||||
{
|
{
|
||||||
FILE* file;
|
WFILE* file = NULL;
|
||||||
char* buffer = NULL;
|
char* buffer = NULL;
|
||||||
char* ret = NULL;
|
char* ret = NULL;
|
||||||
long length;
|
long length;
|
||||||
|
|
||||||
file = fopen(keyFile, "rb");
|
if (WFOPEN(NULL, &file, keyFile, "rb") != 0) {
|
||||||
if (!file) {
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Failed to open TPM key file: %s\n", keyFile);
|
"Failed to open TPM key file: %s\n", keyFile);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
fseek(file, 0, SEEK_END);
|
WFSEEK(NULL, file, 0, SEEK_END);
|
||||||
length = ftell(file);
|
length = WFTELL(NULL, file);
|
||||||
fseek(file, 0, SEEK_SET);
|
WFSEEK(NULL, file, 0, SEEK_SET);
|
||||||
|
|
||||||
buffer = (char*)WMALLOC(length + 8 + 1, NULL, DYNTYPE_BUFFER);
|
buffer = (char*)WMALLOC(length + 8 + 1, NULL, DYNTYPE_BUFFER);
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
if (fread(buffer, 1, length, file) == (size_t)length) {
|
if (WFREAD(NULL, buffer, 1, length, file) == (size_t)length) {
|
||||||
while (length > 0 && (buffer[length-1] == '\n' ||
|
while (length > 0 && (buffer[length-1] == '\n' ||
|
||||||
buffer[length-1] == '\r')) {
|
buffer[length-1] == '\r')) {
|
||||||
length--;
|
length--;
|
||||||
|
@ -2133,7 +2133,7 @@ static char* LoadTpmSshKey(const char* keyFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(file);
|
WFCLOSE(NULL, file);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue