musl: improve crypt() size hack
[oweals/openwrt.git] / toolchain / musl / patches / 901-crypt_size_hack.patch
1 --- a/src/crypt/crypt_sha512.c
2 +++ b/src/crypt/crypt_sha512.c
3 @@ -13,6 +13,17 @@
4  #include <string.h>
5  #include <stdint.h>
6  
7 +#ifdef CRYPT_SIZE_HACK
8 +#include <errno.h>
9 +
10 +char *__crypt_sha512(const char *key, const char *setting, char *output)
11 +{
12 +       errno = ENOSYS;
13 +       return NULL;
14 +}
15 +
16 +#else
17 +
18  /* public domain sha512 implementation based on fips180-3 */
19  /* >=2^64 bits messages are not supported (about 2000 peta bytes) */
20  
21 @@ -369,3 +380,4 @@ char *__crypt_sha512(const char *key, co
22                 return "*";
23         return p;
24  }
25 +#endif
26 --- a/src/crypt/crypt_blowfish.c
27 +++ b/src/crypt/crypt_blowfish.c
28 @@ -50,6 +50,17 @@
29  #include <string.h>
30  #include <stdint.h>
31  
32 +#ifdef CRYPT_SIZE_HACK
33 +#include <errno.h>
34 +
35 +char *__crypt_blowfish(const char *key, const char *setting, char *output)
36 +{
37 +       errno = ENOSYS;
38 +       return NULL;
39 +}
40 +
41 +#else
42 +
43  typedef uint32_t BF_word;
44  typedef int32_t BF_word_signed;
45  
46 @@ -796,3 +807,4 @@ char *__crypt_blowfish(const char *key,
47  
48         return "*";
49  }
50 +#endif
51 --- a/src/crypt/crypt_sha256.c
52 +++ b/src/crypt/crypt_sha256.c
53 @@ -13,6 +13,17 @@
54  #include <string.h>
55  #include <stdint.h>
56  
57 +#ifdef CRYPT_SIZE_HACK
58 +#include <errno.h>
59 +
60 +char *__crypt_sha256(const char *key, const char *setting, char *output)
61 +{
62 +       errno = ENOSYS;
63 +       return NULL;
64 +}
65 +
66 +#else
67 +
68  /* public domain sha256 implementation based on fips180-3 */
69  
70  struct sha256 {
71 @@ -320,3 +331,4 @@ char *__crypt_sha256(const char *key, co
72                 return "*";
73         return p;
74  }
75 +#endif