Skip to content
This repository was archived by the owner on Jul 22, 2023. It is now read-only.

Conversation

@fredrec
Copy link
Contributor

@fredrec fredrec commented Feb 20, 2019

No description provided.

Copy link
Contributor

@atigyi atigyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, some comments though.

const char* iotc_publish_message;
const char* iotc_private_key_filename;

#ifdef ENABLE_CRYPTOAUTHLIB
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if cryptoauthlib is enabled, then private_key_filename is not necessary. So we could go with the ugly:

#ifdef XXX
#else 
#endif

pattern with all places.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we handle this with slack? Use all variables and all commandline arguments for each configuration. Although this won't be full correct: since one could ask "Why do you allow to pass both a private key filename and a slotid at the same time?" The answer is because of code simplicity. And we trust our users know what they do.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we go with the slack version then most of the #ifdef can be removed easing the reader's job, keeping code simpler, easier to maintain.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g. all #ifdefs can go away in this file if we decide so.

*
* Used to sign tokens using the private key stored in a secure element.
*/
int init_cryptoauthlib();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you'd call this init_example_dependencies (+1 abstraction layer and not being specific) then 2 more #ifdefs could be removed. One here and one in the example since the example could call it all the way.

For more information, please see the iotc_crypto_key_data_t
documentation in include/iotc_types.h. */

#ifndef ENABLE_CRYPTOAUTHLIB
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed too if we decide to branch at runtime: if we have private_key_filename, then load it, if there is no filename given, try to use the slotid (if available). If neither is available, then it is a parametrization issue, report an error message.

int init_cryptoauthlib() {
ATCA_STATUS atca_status;
if ((atca_status = atcab_init(&cfg_ateccx08a_kithid_default)) != ATCA_SUCCESS) {
printf("Unable to initialize interface, status: %x\n", atca_status);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the only #ifdef is required here (and the #include "cryptoauthlib.h")

#include <portable.h>

void* iotc_bsp_mem_alloc(size_t byte_count) {
// workaround: FreeRTOS's pvPortMalloc crashes if 0 size
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should merge development->feature_cytpoauthlib->feature_cryptoauthlib_example to remove these

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls do it since it makes review harder to fish out relevant changes, thx

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's weird. I don't get it, especially since the PR is set to merge into feature_cytpoauthlib.

I must have messed up something, will figure this out tomorrow on my desktop.

fredrec and others added 3 commits February 20, 2019 22:20
…m/iot-device-sdk-embedded-c into feature_cryptoauthlib_example
* Bump Cryptoauthlib version to 20190304
* Enable new option to build lib as static
@sheindel
Copy link
Contributor

sheindel commented Dec 4, 2019

@fredrec would love to get this in for those using CryptoAuthLib, would you still like to merge this? I don't have much experience with it personally, just want to see if we can get some PRs cleaned up.

@galz10
Copy link
Contributor

galz10 commented Jun 18, 2020

Hi @fredrec would still like to merge this PR, if so can you please submit a commit so Travis CI could run it's tests, if not i'll close the PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants