Refactor rand
* Removed dependency from internal headers in rand.h. xmpp_rand interface can be public in the future; * xmpp_rand functions accept xmpp_rand_t object instead of xmpp_ctx_t.
This commit is contained in:
@@ -28,14 +28,14 @@
|
||||
*/
|
||||
static void crypto_uuid_gen(xmpp_ctx_t *ctx, char *uuid)
|
||||
{
|
||||
uint8_t buf[16];
|
||||
unsigned char buf[16];
|
||||
int i = 0; /* uuid iterator */
|
||||
int j = 0; /* buf iterator */
|
||||
|
||||
static const char hex[] = {'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
|
||||
xmpp_rand_bytes(ctx, buf, sizeof(buf));
|
||||
xmpp_rand_bytes(ctx->rand, buf, sizeof(buf));
|
||||
buf[8] &= 0x3f;
|
||||
buf[8] |= 0x80;
|
||||
buf[6] &= 0x0f;
|
||||
|
||||
Reference in New Issue
Block a user