technion/libscrypt

libscrypt_scrypt returns binary, yet libscrypt_mcf expects base64

kinnison opened this issue · 3 comments

Previously I could access the b64 encode functionality from libscrypt. You seem to have hidden this functionality and thus made it impossible to use libscrypt_crypt and libscrypt_mcf as far as I can tell.

Could you please tell me how to use those functions now that the b64_encode is no longer exposed?

Thanks,

Daniel.

The recommended hashing method us to use the higher level API:

int libscrypt_hash(char *dst, char *passphrase, uint32_t N, uint8_t r, uint8_t p);

This returns BASE64 data. Which you can then test against by using the check function:

retval = libscrypt_check(mcf, "pleasefailme");

There shouldn't generally be a need to access the internal functions.

For test suite reasons I need to be able to control the salt. It seems odd to expose the crypt and mcf functions where you then need to link another b64 implementation in to use that pair

Sent from my Android device with K-9 Mail. Please excuse my brevity.

I understand your situation. The problem was that nearly every deployment I saw linked with another library that, in practice, deployed its own Base64 library.

For your situation, your test suite may be able to use the same routine mine does:

  • include b64.h in your tests

  • Build without the export limiting LDFLAG. This should do it:

    LDFLAGS?=-Wl,-z,now -Wl,-z,relro -Wl,-soname,libscrypt.so.0 make