ObjFW  Diff

Differences From Artifact [89cb21ae56]:

  • File src/OFObject.h — part of check-in [c1fe4b2b77] at 2020-07-12 09:49:35 on branch trunk — Make of_random() a function

    When arc4random() is unavailable, either random() or rand() is used and
    both need to be seeded. If of_random() is a macro, it needs to be
    (re)seeded every time, as it's unknown whether it has already been
    seeded. As it is seeded with gettimeofday() due to the lack of a better
    initial seed, this means every call returns the first state for the
    current time, which is very predictable. random() and rand() are both
    not cryptographic, but this should at least make it a little bit better
    now. (user: js, size: 39571) [annotate] [blame] [check-ins using]

To Artifact [f46ea6f043]:


1314
1315
1316
1317
1318
1319
1320
1321

1322

1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
extern void *_Null_unspecified objc_autoreleasePoolPush(void);
extern void objc_autoreleasePoolPop(void *_Null_unspecified pool);
#endif
extern id of_alloc_object(Class class_, size_t extraSize,
    size_t extraAlignment, void *_Nullable *_Nullable extra);
extern void OF_NO_RETURN_FUNC of_method_not_found(id self, SEL _cmd);
extern uint32_t of_hash_seed;
/* This does *NOT* provide cryptographically secure randomness! */

extern uint32_t of_random(void);

#ifdef __cplusplus
}
#endif

OF_ASSUME_NONNULL_END

#ifdef __OBJC__
# import "OFObject+KeyValueCoding.h"
# import "OFObject+Serialization.h"
#endif

#endif







|
>
|
>












1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
extern void *_Null_unspecified objc_autoreleasePoolPush(void);
extern void objc_autoreleasePoolPop(void *_Null_unspecified pool);
#endif
extern id of_alloc_object(Class class_, size_t extraSize,
    size_t extraAlignment, void *_Nullable *_Nullable extra);
extern void OF_NO_RETURN_FUNC of_method_not_found(id self, SEL _cmd);
extern uint32_t of_hash_seed;
/* These do *NOT* provide cryptographically secure randomness! */
extern uint16_t of_random16(void);
extern uint32_t of_random32(void);
extern uint64_t of_random64(void);
#ifdef __cplusplus
}
#endif

OF_ASSUME_NONNULL_END

#ifdef __OBJC__
# import "OFObject+KeyValueCoding.h"
# import "OFObject+Serialization.h"
#endif

#endif