Skip to content
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

Unable to run tiny-ECDH-c on Contiki OS #3

Closed
varsharaghav23 opened this issue Jan 31, 2018 · 23 comments
Closed

Unable to run tiny-ECDH-c on Contiki OS #3

varsharaghav23 opened this issue Jan 31, 2018 · 23 comments

Comments

@varsharaghav23
Copy link

I tried running the code on Contiki -2.7.. unable to run getting error related to assert.Please help me I am new to this..

@kokke
Copy link
Owner

kokke commented Jan 31, 2018

Hi @varsharaghav23 and thanks for trying out this project :)

I need more information from you in order to be able to help.
Which assertion is failing?

It should not make a difference whether or not the code is running on contiki or directly on the metal.

@varsharaghav23
Copy link
Author

varsharaghav23 commented Feb 3, 2018 via email

@kokke
Copy link
Owner

kokke commented Feb 4, 2018

Hi @varsharaghav23 - you cannot attach files to me via Github.

You need to upload your file somewhere and send a link to it instead.

@varsharaghav23
Copy link
Author

varsharaghav23 commented Feb 5, 2018 via email

@kokke
Copy link
Owner

kokke commented Feb 5, 2018

From the look of it, you are experiencing a linker error. It looks like you are only compiling 'ecdh_example.c' and you need to add 'ecdh.c' as well.

The errors occur because the example file is calling functions that are defined in 'ecdh.c'. You need to include all the code to be able to build the project :)

@varsharaghav23
Copy link
Author

varsharaghav23 commented Feb 5, 2018 via email

@kokke
Copy link
Owner

kokke commented Feb 5, 2018

I don't know the Contiki project and its Makefiles well enough to tell what is needed to add files to the project.

I am however 100% certain that your problem is that ecdh.c is not being compiled along with the rest of the code, because you are getting linker errors.

@varsharaghav23
Copy link
Author

varsharaghav23 commented Feb 5, 2018 via email

@kokke
Copy link
Owner

kokke commented Feb 5, 2018

uint32_t is defined in <stdint.h>.

It is a typedef for a 32 bit unsigned integer.

You may be able to replace with "unsigned int" or "unsigned long int" depending on your system.

If we call the type you select for T, just ensure that T is unsigned and that sizeof(T) == 4.

@kokke
Copy link
Owner

kokke commented Feb 5, 2018

@varsharaghav23

Another thing: assert() is a function that makes the program crash if its input is 0.
It is used to check the code while it is running and make the program crash if something is not as expected.

You can disable assertions by defining the macro DISABLE_ASSERT in ecdh.c - but I will advise against that until the code is working.

@varsharaghav23
Copy link
Author

varsharaghav23 commented Feb 6, 2018 via email

@kokke
Copy link
Owner

kokke commented Feb 6, 2018

The macros ECC_PUB_KEY_SIZE and ECC_PRV_KEY_SIZE are defined in ecdh.h.

@kokke
Copy link
Owner

kokke commented Feb 8, 2018

Hi @varsharaghav23 - did you get the code to compile successfully? :)

I am closing this issue, because it doesn't seem to revolve around a problem with the code, rather it seems to be related to a non-C99 compatible compiler (A Turbo C compiler?).

Feel free to keep asking questions, regardless that the issue is closed.

@kokke kokke closed this as completed Feb 8, 2018
@varsharaghav23
Copy link
Author

varsharaghav23 commented Feb 9, 2018 via email

@varsharaghav23
Copy link
Author

varsharaghav23 commented Feb 12, 2018 via email

@kokke
Copy link
Owner

kokke commented Feb 13, 2018

Hi @varsharaghav23

You are compiling a modified version of the code in this project, so I would need to read your code to be able to help you.

@varsharaghav23
Copy link
Author

varsharaghav23 commented Feb 13, 2018 via email

@kokke
Copy link
Owner

kokke commented Feb 13, 2018

Hi @varsharaghav23

I would need to see the code itself, not the output from compiling and running it.

It seems something is not done correctly when trying to create the shared secret, since the assertion error occurs there.

@varsharaghav23
Copy link
Author

varsharaghav23 commented Feb 13, 2018 via email

@kokke
Copy link
Owner

kokke commented Feb 13, 2018

Okay then I would need to see your build script to be able to replicate the issue or be able to guess what is wrong,

@varsharaghav23
Copy link
Author

varsharaghav23 commented Feb 14, 2018 via email

@kokke
Copy link
Owner

kokke commented Feb 19, 2018

No I cannot do that, because that depends on which curve you have selected, what your private key is etc. I cannot guess what you are doing before you show it to me.

I need to see the code and the build-script to have any chance of helping you. If you are not willing to provide that, I can't help you.

@varsharaghav23
Copy link
Author

varsharaghav23 commented Feb 21, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants