]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Replace random_fill_weak with random_fill
authorAki Tuomi <aki.tuomi@dovecot.fi>
Mon, 4 Sep 2017 12:46:39 +0000 (15:46 +0300)
committerTimo Sirainen <tss@dovecot.fi>
Thu, 7 Sep 2017 08:40:31 +0000 (11:40 +0300)
They are now the same thing

src/doveadm/doveadm-sis.c
src/lib-compression/test-compression.c
src/lib-dcrypt/test-stream.c
src/lib-storage/index/mbox/mbox-save.c
src/lib-storage/list/mailbox-list-delete.c
src/lib/randgen.h
src/lib/safe-mkstemp.c
src/lib/test-ostream-buffer.c
src/lib/test-ostream-file.c

index 95e836e9d6b96e752a3b02eb31dbf3d350d2aec9..cbb004c76fd24ce80ca71a35c27dacdc41053023 100644 (file)
@@ -103,7 +103,7 @@ hardlink_replace(const char *src, const char *dest, ino_t src_inode)
        i_assert(p != NULL);
        destdir = t_strdup_until(dest, p);
 
-       random_fill_weak(randbuf, sizeof(randbuf));
+       random_fill(randbuf, sizeof(randbuf));
        tmppath = t_strdup_printf("%s/temp.%s.%s.%s",
                                  destdir, my_hostname, my_pid,
                                  binary_to_hex(randbuf, sizeof(randbuf)));
index 9a4702efce13f3b6b0bbc33a30ccac43cffffc22..8f1d7d209a387673f2f1ce3aa0ba78ddf514d74a 100644 (file)
@@ -45,7 +45,7 @@ static void test_compression_handler(const struct compression_handler *handler)
 
        /* 2) write uncompressible data */
        for (i = 0; i < 1024*128 / sizeof(buf); i++) {
-               random_fill_weak(buf, sizeof(buf));
+               random_fill(buf, sizeof(buf));
                sha1_loop(&sha1, buf, sizeof(buf));
                test_assert(o_stream_send(output, buf, sizeof(buf)) == sizeof(buf));
        }
index 2154f378d3c891571c213480b2b0cf1e02579002..243e5283943a70aa8d50259060ce8ae75cc49a64 100644 (file)
@@ -184,7 +184,7 @@ void test_write_read_v1(void)
        unsigned char payload[IO_BLOCK_SIZE];
        const unsigned char *ptr;
        size_t pos = 0, siz;
-       random_fill_weak(payload, IO_BLOCK_SIZE);
+       random_fill(payload, IO_BLOCK_SIZE);
 
        buffer_t *buf = buffer_create_dynamic(default_pool, sizeof(payload));
        struct ostream *os = o_stream_create_buffer(buf);
@@ -235,7 +235,7 @@ void test_write_read_v1_short(void)
        unsigned char payload[1];
        const unsigned char *ptr;
        size_t pos = 0, siz;
-       random_fill_weak(payload, 1);
+       random_fill(payload, 1);
 
        buffer_t *buf = buffer_create_dynamic(default_pool, 64);
        struct ostream *os = o_stream_create_buffer(buf);
@@ -328,7 +328,7 @@ void test_write_read_v2(void)
        unsigned char payload[IO_BLOCK_SIZE*10];
        const unsigned char *ptr;
        size_t pos = 0, siz;
-       random_fill_weak(payload, IO_BLOCK_SIZE*10);
+       random_fill(payload, IO_BLOCK_SIZE*10);
 
        buffer_t *buf = buffer_create_dynamic(default_pool, sizeof(payload));
        struct ostream *os = o_stream_create_buffer(buf);
@@ -381,7 +381,7 @@ void test_write_read_v2_short(void)
        unsigned char payload[1];
        const unsigned char *ptr;
        size_t pos = 0, siz;
-       random_fill_weak(payload, 1);
+       random_fill(payload, 1);
 
        buffer_t *buf = buffer_create_dynamic(default_pool, 64);
        struct ostream *os = o_stream_create_buffer(buf);
index 1b7a63f39c5b3218927700be86d153317877ecf3..6c6526b427f578710da553d415d2f11fa74de302 100644 (file)
@@ -354,7 +354,7 @@ static void mbox_save_x_delivery_id(struct mbox_save_context *ctx)
                      sizeof(ioloop_timeval.tv_usec));
 
        randbuf = buffer_append_space_unsafe(buf, MBOX_DELIVERY_ID_RAND_BYTES);
-       random_fill_weak(randbuf, MBOX_DELIVERY_ID_RAND_BYTES);
+       random_fill(randbuf, MBOX_DELIVERY_ID_RAND_BYTES);
 
        md5_get_digest(buf->data, buf->used, md5_result);
 
index 54953a9bd6b9d18037b77a9bdda107748085681d..2ce78a69053245be3b500a83848afd50a8a6b95d 100644 (file)
@@ -38,7 +38,7 @@ static const char *unique_fname(void)
 {
        unsigned char randbuf[8];
 
-       random_fill_weak(randbuf, sizeof(randbuf));
+       random_fill(randbuf, sizeof(randbuf));
        return t_strdup_printf("%s.%s.%s", my_hostname, my_pid,
                               binary_to_hex(randbuf, sizeof(randbuf)));
 
index c3b4dedcc81ef5184a41541547b512b96f5e9c32..498613cbde0f36800acaa12d3edd9d4115e8585c 100644 (file)
@@ -3,7 +3,6 @@
 
 /* Fill given buffer with semi-strong randomness */
 void random_fill(void *buf, size_t size);
-#define random_fill_weak(buf,size) random_fill((buf), (size))
 
 /* may be called multiple times,
    and are called by default in lib_init */
index b4340569f93c1d9c64903af94e6e2b52c5e778f6..35b841046377bf48734283c8ed76766057a45217 100644 (file)
@@ -25,7 +25,7 @@ safe_mkstemp_full(string_t *prefix, mode_t mode, uid_t uid, gid_t gid,
        prefix_len = str_len(prefix);
        for (;;) {
                do {
-                       random_fill_weak(randbuf, sizeof(randbuf));
+                       random_fill(randbuf, sizeof(randbuf));
                        str_truncate(prefix, prefix_len);
                        str_append(prefix,
                                   binary_to_hex(randbuf, sizeof(randbuf)));
index cd90a384f467d733980ef5fc79edb652068eb552..c64ab3df454e59fa23a2983406cf98d8b31eccdf 100644 (file)
@@ -24,14 +24,14 @@ static void test_ostream_buffer_random_once(void)
        o_stream_cork(output);
 
        size = (i_rand() % MAX_BUFSIZE) + 1;
-       random_fill_weak(randbuf, size);
+       random_fill(randbuf, size);
        memcpy(buf, randbuf, size);
        test_assert(o_stream_send(output, buf, size) > 0);
 
        for (i = 0; i < 10; i++) {
                offset = i_rand() % (MAX_BUFSIZE*3);
                size = (i_rand() % MAX_BUFSIZE) + 1;
-               random_fill_weak(randbuf, size);
+               random_fill(randbuf, size);
                memcpy(buf + offset, randbuf, size);
                test_assert(o_stream_pwrite(output, randbuf, size, offset) == 0);
                if (i_rand() % 10 == 0)
index 7d520705c85938a52b580161022c78b745a002c8..51f468b3938d125a0351e68b0e62ea006aae207e 100644 (file)
@@ -31,14 +31,14 @@ static void test_ostream_file_random_once(void)
        o_stream_cork(output);
 
        size = (i_rand() % MAX_BUFSIZE) + 1;
-       random_fill_weak(randbuf, size);
+       random_fill(randbuf, size);
        memcpy(buf, randbuf, size);
        test_assert(o_stream_send(output, buf, size) > 0);
 
        for (i = 0; i < 10; i++) {
                offset = i_rand() % (MAX_BUFSIZE*3);
                size = (i_rand() % MAX_BUFSIZE) + 1;
-               random_fill_weak(randbuf, size);
+               random_fill(randbuf, size);
                memcpy(buf + offset, randbuf, size);
                test_assert(o_stream_pwrite(output, randbuf, size, offset) == 0);
                if (i_rand() % 10 == 0)