mimoo / disco-c

A tiny C cryptographic library to encrypt sessions, authenticate messages, sign, hash, etc. based only on SHA-3 and Curve25519
https://embeddeddisco.com/
Apache License 2.0
65 stars 3 forks source link

Replace u8 type with unsigned char #16

Closed dol closed 5 years ago

dol commented 5 years ago

I wanted to use the example code and I was forced to include the tweetX25519.h file that contains the type definition of u8. My guess is that u8 was defined to shorten the script and fit it into multiple tweats.

mimoo commented 5 years ago

Hey @dol , thanks for all the PRs.

exact! I forgot to clean all that up. Before I merge this, I need to figure out what's better. Using uint8_t/uint64_t or do what you did in your PR? I prefer uint8_t-like types because they are explicit about their size. But there might a better portability argument here. Thoughts?

dol commented 5 years ago

I agree with https://stackoverflow.com/a/1725867 . I've just done a search/replace without looking at the certain intent. As an input of the disco* function I would use 'unsigened char'. For the crypto arguments in the crypto functions I would go for uint8_t.

mimoo commented 5 years ago

Yeah that's a good point. Thinking about it, I'm not sure unsigned char makes sense anywhere since we're expecting network bytes. Except for Strobe's protocol_name. Do you want to make the change here? Otherwise I'll do it.

dol commented 5 years ago

I leave the fix/change up to you. You know the innerworking better than me. I only wanted to get rid of the u8 type definition.

mimoo commented 5 years ago

Alright, will push this and credit you. Thanks again.