IoT-SAFE: Minor fixes

- reverted length change in put public operation
- Loading CA from IoT-SAFE file slot in 16bit demo
This commit is contained in:
Daniele Lacamera 2021-11-16 17:23:03 +01:00
parent 2646747f2a
commit 0c0f36d67d
3 changed files with 6 additions and 8 deletions

View File

@ -192,6 +192,8 @@ static int client_loop(void)
}
printf("Loaded Server CA from IoT-Safe, size = %lu\n",
cert_buffer_size);
ret = wolfSSL_CTX_load_verify_buffer(cli_ctx, cert_buffer,
cert_buffer_size, WOLFSSL_FILETYPE_ASN1);
#endif

View File

@ -40,17 +40,13 @@
#define CRT_SERVER_FILE_ID 0x3330
#define PRIVKEY_ID 0x3230 /* pre-provisioned */
#define ECDH_KEYPAIR_ID 0x3330
#define PEER_PUBKEY_ID 0x3430
#define PEER_CERT_ID 0x3530
#define PEER_PUBKEY_ID 0x3530
#define PEER_CERT_ID 0x3430
/* In this version of the demo, the server certificate is
* stored in a buffer, while the CA is read from a file slot in IoT-SAFE
*/
#define SOFT_SERVER_CERT
/* DELME */
#define SOFT_SERVER_CA
#else
#define IOTSAFE_ID_SIZE 1
#define CRT_CLIENT_FILE_ID 0x03 /* pre-provisioned */

View File

@ -627,8 +627,8 @@ static int iotsafe_put_public_key(byte *pubkey_id, unsigned long id_size,
/* Export raw Qx, Qy values */
ret = wc_ecc_export_public_raw(key,
ecc_pub_raw + 4 + id_size, &qxlen,
ecc_pub_raw + 4 + id_size + IOTSAFE_ECC_KSIZE, &qylen);
ecc_pub_raw + 5, &qxlen,
ecc_pub_raw + 5 + IOTSAFE_ECC_KSIZE, &qylen);
if (ret != 0) {
WOLFSSL_MSG("IoT Safe: Could not export public key: Error");
return ret;