55 lines
1.8 KiB
Diff
55 lines
1.8 KiB
Diff
From cb6c4fbd56f57b01773c8f8d39de5e434f218f87 Mon Sep 17 00:00:00 2001
|
|
From: zhongtao <zhongtao17@huawei.com>
|
|
Date: Tue, 21 Nov 2023 03:48:56 +0000
|
|
Subject: [PATCH 157/181] !2263 use /dev/random to replace /dev/urandom * use
|
|
/dev/random to replace /dev/urandom
|
|
|
|
---
|
|
src/cmd/isulad-shim/common.c | 2 +-
|
|
src/daemon/common/selinux_label.c | 2 +-
|
|
src/utils/cutils/utils.c | 2 +-
|
|
3 files changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/cmd/isulad-shim/common.c b/src/cmd/isulad-shim/common.c
|
|
index c88de736..72da932a 100644
|
|
--- a/src/cmd/isulad-shim/common.c
|
|
+++ b/src/cmd/isulad-shim/common.c
|
|
@@ -214,7 +214,7 @@ int generate_random_str(char *id, size_t len)
|
|
const int m = 256;
|
|
|
|
len = len / 2;
|
|
- fd = open("/dev/urandom", O_RDONLY);
|
|
+ fd = open("/dev/random", O_RDONLY);
|
|
if (fd == -1) {
|
|
return SHIM_ERR;
|
|
}
|
|
diff --git a/src/daemon/common/selinux_label.c b/src/daemon/common/selinux_label.c
|
|
index 7a295250..c1c52714 100644
|
|
--- a/src/daemon/common/selinux_label.c
|
|
+++ b/src/daemon/common/selinux_label.c
|
|
@@ -304,7 +304,7 @@ static int get_random_value(unsigned int range, unsigned int *val)
|
|
{
|
|
int ret = 0;
|
|
int num = 0;
|
|
- int fd = open("/dev/urandom", O_RDONLY);
|
|
+ int fd = open("/dev/random", O_RDONLY);
|
|
if (fd == -1) {
|
|
ERROR("Failed to open urandom device\n");
|
|
return -1;
|
|
diff --git a/src/utils/cutils/utils.c b/src/utils/cutils/utils.c
|
|
index a994731d..7615a94c 100644
|
|
--- a/src/utils/cutils/utils.c
|
|
+++ b/src/utils/cutils/utils.c
|
|
@@ -1284,7 +1284,7 @@ int util_generate_random_str(char *id, size_t len)
|
|
}
|
|
|
|
len = len / 2;
|
|
- fd = open("/dev/urandom", O_RDONLY);
|
|
+ fd = open("/dev/random", O_RDONLY);
|
|
if (fd == -1) {
|
|
ERROR("Failed to open /dev/urandom");
|
|
return -1;
|
|
--
|
|
2.42.0
|
|
|