I prefer using size_t for all string and data sizes, if for no other reason that it is what the C and POSIX standards uses.
/Simon
nisse@lysator.liu.se skrev:
nisse@lysator.liu.se (Niels Möller) writes:
I think it would make some sense to adopt the principle that key
sizes
use unsigned (since keys by definition are small objects), and
message
sizes use size_t.
I'm now leaning towards using size_t also for all function arguments which are key sizes. There should be no performance penalty in most cases, and very small penalty also when arguments are passed on the stack. And it may reduce warnings about truncation to smaller type if one passes, e.g, the output of strlen. I'll stick to unsigned in struct nettle_cipher and some of the internal functions, though.
I created the branch size_t-changes, now available also in the public repo. I think I have converted everything except the unfinished openpgp code.
Regards, /Niels
-- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance.