72 lines
2.0 KiB
Diff
72 lines
2.0 KiB
Diff
|
|
From cc51cace064c4a3c459f3c9085006dfb62747525 Mon Sep 17 00:00:00 2001
|
||
|
|
From: David Disseldorp <ddiss@suse.de>
|
||
|
|
Date: Wed, 22 Jul 2020 15:58:19 +0200
|
||
|
|
Subject: [PATCH 2/8] drop unused get_random_bytes()
|
||
|
|
|
||
|
|
openssl's RAND_bytes() is now used instead, so this can be dropped.
|
||
|
|
|
||
|
|
Suggested-by: Marcus Meissner <meissner@suse.de>
|
||
|
|
Signed-off-by: David Disseldorp <ddiss@suse.de>
|
||
|
|
---
|
||
|
|
usr/auth.c | 37 -------------------------------------
|
||
|
|
1 file changed, 37 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/usr/auth.c b/usr/auth.c
|
||
|
|
index a1d99e9..2f7506f 100644
|
||
|
|
--- a/usr/auth.c
|
||
|
|
+++ b/usr/auth.c
|
||
|
|
@@ -48,7 +48,6 @@ static int auth_hash_init(EVP_MD_CTX **context, int chap_alg);
|
||
|
|
static void auth_hash_update(EVP_MD_CTX *context, unsigned char *md, unsigned int);
|
||
|
|
static unsigned int auth_hash_final(unsigned char *, EVP_MD_CTX *context);
|
||
|
|
|
||
|
|
-void get_random_bytes(unsigned char *data, unsigned int length);
|
||
|
|
size_t strlcpy(char *, const char *, size_t);
|
||
|
|
size_t strlcat(char *, const char *, size_t);
|
||
|
|
|
||
|
|
@@ -218,42 +217,6 @@ static unsigned int auth_hash_final(unsigned char *hash, EVP_MD_CTX *context) {
|
||
|
|
return md_len;
|
||
|
|
}
|
||
|
|
|
||
|
|
-void
|
||
|
|
-get_random_bytes(unsigned char *data, unsigned int length)
|
||
|
|
-{
|
||
|
|
-
|
||
|
|
- long r;
|
||
|
|
- unsigned n;
|
||
|
|
- int fd, r_size = sizeof(r);
|
||
|
|
-
|
||
|
|
- fd = open("/dev/urandom", O_RDONLY);
|
||
|
|
- while (length > 0) {
|
||
|
|
-
|
||
|
|
- if (fd == -1 || read(fd, &r, r_size) != r_size)
|
||
|
|
- r = rand();
|
||
|
|
- r = r ^ (r >> 8);
|
||
|
|
- r = r ^ (r >> 4);
|
||
|
|
- n = r & 0x7;
|
||
|
|
-
|
||
|
|
- if (fd == -1 || read(fd, &r, r_size) != r_size)
|
||
|
|
- r = rand();
|
||
|
|
- r = r ^ (r >> 8);
|
||
|
|
- r = r ^ (r >> 5);
|
||
|
|
- n = (n << 3) | (r & 0x7);
|
||
|
|
-
|
||
|
|
- if (fd == -1 || read(fd, &r, r_size) != r_size)
|
||
|
|
- r = rand();
|
||
|
|
- r = r ^ (r >> 8);
|
||
|
|
- r = r ^ (r >> 5);
|
||
|
|
- n = (n << 2) | (r & 0x3);
|
||
|
|
-
|
||
|
|
- *data++ = n;
|
||
|
|
- length--;
|
||
|
|
- }
|
||
|
|
- if (fd)
|
||
|
|
- close(fd);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
static const char acl_none_option_name[] = "None";
|
||
|
|
|
||
|
|
static int
|
||
|
|
--
|
||
|
|
1.8.3.1
|
||
|
|
|