Browse Source

Do not define be32dec / le32dec on FreeBSD, since they are already defined in sys/endian.h

miguelfreitas
thierry-FreeBSD 11 years ago
parent
commit
e3ce8e18b7
  1. 3
      src/scrypt.cpp
  2. 3
      src/scrypt.h

3
src/scrypt.cpp

@ -34,6 +34,8 @@
#include <string.h> #include <string.h>
#include <openssl/sha.h> #include <openssl/sha.h>
#ifndef __FreeBSD__
/* Allready defined in sys/endian.h */
static inline uint32_t be32dec(const void *pp) static inline uint32_t be32dec(const void *pp)
{ {
const uint8_t *p = (uint8_t const *)pp; const uint8_t *p = (uint8_t const *)pp;
@ -49,6 +51,7 @@ static inline void be32enc(void *pp, uint32_t x)
p[1] = (x >> 16) & 0xff; p[1] = (x >> 16) & 0xff;
p[0] = (x >> 24) & 0xff; p[0] = (x >> 24) & 0xff;
} }
#endif
typedef struct HMAC_SHA256Context { typedef struct HMAC_SHA256Context {
SHA256_CTX ictx; SHA256_CTX ictx;

3
src/scrypt.h

@ -17,6 +17,8 @@ void
PBKDF2_SHA256(const uint8_t *passwd, size_t passwdlen, const uint8_t *salt, PBKDF2_SHA256(const uint8_t *passwd, size_t passwdlen, const uint8_t *salt,
size_t saltlen, uint64_t c, uint8_t *buf, size_t dkLen); size_t saltlen, uint64_t c, uint8_t *buf, size_t dkLen);
# ifndef __FreeBSD__
/* Allready defined in sys/endian.h */
static inline uint32_t le32dec(const void *pp) static inline uint32_t le32dec(const void *pp)
{ {
const uint8_t *p = (uint8_t const *)pp; const uint8_t *p = (uint8_t const *)pp;
@ -33,3 +35,4 @@ static inline void le32enc(void *pp, uint32_t x)
p[3] = (x >> 24) & 0xff; p[3] = (x >> 24) & 0xff;
} }
# endif # endif
#endif

Loading…
Cancel
Save