-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fix demos to work with new wolfHSM API #17
Changes from all commits
6d9cd1f
a536940
b56dd6c
598576b
4d80df8
dab2887
12b67e0
1dc3bf7
8083713
1f8bce9
c28eb2f
5dd9c52
915784a
31e375e
ccf65a8
0c13583
f362f3d
312b72d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.DS_Store | ||
Build/ | ||
demo/certs/*.pem | ||
|
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
# ECC Keys | ||
openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:prime256v1 -out alice-ecc256-key.pem | ||
openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:prime256v1 -out bob-ecc256-key.pem | ||
openssl ec -in alice-ecc256-key.pem -outform DER -out alice-ecc256-key.der | ||
openssl ec -in bob-ecc256-key.pem -outform DER -out bob-ecc256-key.der | ||
|
||
# RSA Key | ||
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out rsa-2048-key.pem | ||
openssl rsa -in rsa-2048-key.pem -outform DER -out rsa-2048-key.der | ||
|
||
# TODO: Curve25519 Keys | ||
# Either need to modify examples to split out public/private operations, or modify wolfHSM to be able to recove public keys on deserialization of private only. | ||
#openssl genpkey -algorithm X25519 -out alice-curve25519-key.pem | ||
#openssl genpkey -algorithm X25519 -out bob-curve25519-key.pem | ||
#openssl pkey -in alice-curve25519-key.pem -outform DER -out alice-curve25519-key.der | ||
#openssl pkey -in bob-curve25519-key.pem -outform DER -out bob-curve25519-key.der |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,12 +37,15 @@ int wh_DemoClient_All(whClientContext* clientContext) | |
if (rc != 0) { | ||
return rc; | ||
} | ||
#ifndef NO_AES | ||
rc = wh_DemoClient_KeystoreAes(clientContext); | ||
if (rc != 0) { | ||
return rc; | ||
} | ||
#endif | ||
|
||
/* Crypto demos */ | ||
/**Crypto demos */ | ||
#ifndef NO_RSA | ||
rc = wh_DemoClient_CryptoRsa(clientContext); | ||
if (rc != 0) { | ||
return rc; | ||
|
@@ -52,7 +55,9 @@ int wh_DemoClient_All(whClientContext* clientContext) | |
if (rc != 0) { | ||
return rc; | ||
} | ||
#endif /* !NO_RSA */ | ||
|
||
#ifdef HAVE_CURVE25519 | ||
rc = wh_DemoClient_CryptoCurve25519(clientContext); | ||
if (rc != 0) { | ||
return rc; | ||
|
@@ -62,7 +67,9 @@ int wh_DemoClient_All(whClientContext* clientContext) | |
if (rc != 0) { | ||
return rc; | ||
} | ||
#endif /* HAVE_CURVE25519 */ | ||
|
||
#ifdef HAVE_ECC | ||
rc = wh_DemoClient_CryptoEcc(clientContext); | ||
if (rc != 0) { | ||
return rc; | ||
|
@@ -72,7 +79,9 @@ int wh_DemoClient_All(whClientContext* clientContext) | |
if (rc != 0) { | ||
return rc; | ||
} | ||
#endif /* HAVE_ECC */ | ||
|
||
#if !defined(NO_AES) && defined(HAVE_AES_CBC) | ||
rc = wh_DemoClient_CryptoAesCbc(clientContext); | ||
if (rc != 0) { | ||
return rc; | ||
|
@@ -82,7 +91,9 @@ int wh_DemoClient_All(whClientContext* clientContext) | |
if (rc != 0) { | ||
return rc; | ||
} | ||
#endif /* !NO_AES && HAVE_AES_CBC */ | ||
|
||
#if !defined(NO_AES) && defined(HAVE_AESGCM) | ||
rc = wh_DemoClient_CryptoAesGcm(clientContext); | ||
if (rc != 0) { | ||
return rc; | ||
|
@@ -92,7 +103,9 @@ int wh_DemoClient_All(whClientContext* clientContext) | |
if (rc != 0) { | ||
return rc; | ||
} | ||
#endif /* !NO_AES && HAVE_AESGCM */ | ||
|
||
#if defined(WOLFSSL_CMAC) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we have additional constraints on CMAC like !NO_AES and WOLFSSL_AES_DIRECT. Do you capture these in the lower level? I'd love to simplify this compile-time logic to exactly what you have written here. |
||
rc = wh_DemoClient_CryptoCmac(clientContext); | ||
if (rc != 0) { | ||
return rc; | ||
|
@@ -107,6 +120,7 @@ int wh_DemoClient_All(whClientContext* clientContext) | |
if (rc != 0) { | ||
return rc; | ||
} | ||
#endif /* WOLFSSL_CMAC */ | ||
|
||
return rc; | ||
} |
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.
Grumble. Hate relying on openssl. Maybe we should leave some pregenerated keys in PEM format in the repo as well in case they don't have openssl available? No change recommended at this point. Just a thought.