Overview
Comment: | macros.h: Add of_random()
This does *NOT* provide cryptographically secure randomness! |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
a2a06d372a4152385069e1c842105e03 |
User & Date: | js on 2018-07-28 16:48:55 |
Other Links: | manifest | tags |
Context
2018-07-28
| ||
17:38 | Rename of_{udp_ -> }socket_address check-in: b16f2b9e25 user: js tags: trunk | |
16:48 | macros.h: Add of_random() check-in: a2a06d372a user: js tags: trunk | |
14:33 | OFDNSResolver: Add resolv.conf path for MorphOS check-in: d0099ed8c9 user: js tags: trunk | |
Changes
Modified configure.ac from [1c10342f65] to [4986935f1d].
︙ | |||
861 862 863 864 865 866 867 | 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 | + + + - + + + + | ]) AS_IF([test x"$enable_static" = x"yes" -o x"$enable_shared" = x"no"], [ AC_SUBST(ENCODINGS_A, "encodings.a") AC_SUBST(ENCODINGS_ENCODINGS_A, "encodings/encodings.a") ]) ]) AC_CHECK_FUNC(arc4random, [ AC_DEFINE(OF_HAVE_ARC4RANDOM, 1, [Whether we have arc4random()]) ], [ |
︙ |
Modified src/OFMapTable.m from [bcee3b5d39] to [021ca59238].
︙ | |||
161 162 163 164 165 166 167 | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | - - - - + - - - | if (_capacity < MIN_CAPACITY) _capacity = MIN_CAPACITY; _buckets = [self allocZeroedMemoryWithSize: sizeof(*_buckets) count: _capacity]; if (of_hash_seed != 0) |
︙ | |||
534 535 536 537 538 539 540 | 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | - - - - + - - - | count: _capacity]; /* * Get a new random value for _rotate, so that it is not less secure * than creating a new hash map. */ if (of_hash_seed != 0) |
︙ |
Modified src/OFObject.m from [f0155ad158] to [c2001431e3].
︙ | |||
248 249 250 251 252 253 254 | 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | + - - + + - - - - - - - - - - - - - - - | (void *)&of_forward_stret); #else objc_setForwardHandler((IMP)&of_forward, (IMP)&of_forward_stret); #endif objc_setEnumerationMutationHandler(enumerationMutationHandler); do { |
︙ |
Modified src/macros.h from [9420a38fbf] to [3f9a87cf9e].
︙ | |||
844 845 846 847 848 849 850 | 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 | + + + + + + + + + + + + + + + + + + + + | } static OF_INLINE char of_ascii_tolower(char c) { return (c >= 'A' && c <= 'Z' ? 'a' + (c - 'A') : c); } /* This does *NOT* provide cryptographically secure randomness! */ static OF_INLINE uint32_t of_random(void) { #if defined(OF_HAVE_ARC4RANDOM) return arc4random(); #elif defined(OF_HAVE_RANDOM) struct timeval tv; gettimeofday(&tv, NULL); srandom((unsigned)(tv.tv_sec ^ tv.tv_usec)); return (((uint32_t)(random()) << 16) | ((uint32_t)(random()) & 0xFFFF); #else struct timeval tv; gettimeofday(&tv, NULL); srand((unsigned)(t.tv_sec ^ t.tv_usec)); return (((uint32_t)(rand()) << 16) | ((uint32_t)(rand()) & 0xFFFF); #endif } |
Modified src/objfw-defs.h.in from [558f07b729] to [0dc3c9abbb].
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | + | #undef INFINITY #undef LLONG_MAX #undef LLONG_MIN #undef OF_APPLE_RUNTIME #undef OF_BIG_ENDIAN #undef OF_FLOAT_BIG_ENDIAN #undef OF_HAVE_ARC4RANDOM #undef OF_HAVE_ATOMIC_BUILTINS #undef OF_HAVE_ATOMIC_OPS #undef OF_HAVE_BUILTIN_BSWAP16 #undef OF_HAVE_BUILTIN_BSWAP32 #undef OF_HAVE_BUILTIN_BSWAP64 #undef OF_HAVE_CHMOD #undef OF_HAVE_CHOWN |
︙ | |||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | + | #undef OF_HAVE_OSATOMIC_64 #undef OF_HAVE_PIPE #undef OF_HAVE_PLEDGE #undef OF_HAVE_PLUGINS #undef OF_HAVE_PROCESSES #undef OF_HAVE_PTHREADS #undef OF_HAVE_PTHREAD_SPINLOCKS #undef OF_HAVE_RANDOM #undef OF_HAVE_RECURSIVE_PTHREAD_MUTEXES #undef OF_HAVE_SCHED_YIELD #undef OF_HAVE_SOCKETS #undef OF_HAVE_STDNORETURN #undef OF_HAVE_SYMLINK #undef OF_HAVE_SYNC_BUILTINS #undef OF_HAVE_SYS_SOCKET_H |
︙ |