jedisct1 / libsodium

A modern, portable, easy to use crypto library.
https://libsodium.org
Other
12.18k stars 1.73k forks source link

Different types for opslimit #966

Closed jakob closed 4 years ago

jakob commented 4 years ago

The opslimit parameter has type unsigned long long here:

int
crypto_pwhash(unsigned char * const out, unsigned long long outlen,
              const char * const passwd, unsigned long long passwdlen,
              const unsigned char * const salt,
              unsigned long long opslimit, size_t memlimit, int alg);

But the functions that return min/max/interactive values have type size_t

size_t
crypto_pwhash_opslimit_min(void);

size_t
crypto_pwhash_opslimit_max(void);

size_t
crypto_pwhash_opslimit_interactive(void);

This causes issues when importing the library in Swift.

angt commented 4 years ago

Hi, I have no idea about your swift issue. But size_t will always fit in an unsigned long long if that's your concern.

jedisct1 commented 4 years ago

The type has been changed, thanks!

As it would be an ABI change, this is not going to be backported to stable. But as @angt said, you can upcast from size_t to unsigned long long.