iSulad/0160-2265-use-dev-urandom-to-replace-dev-random.patch
openeuler-sync-bot 955d185c18 !645 [sync] PR-641: upgrade from upstream
* upgrade from upstream
2023-12-22 01:09:39 +00:00

55 lines
1.8 KiB
Diff

From 3720938ccd86495bf8391e9d9cdd0ac597c57c14 Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Tue, 21 Nov 2023 13:46:14 +0000
Subject: [PATCH 160/181] !2265 use /dev/urandom to replace /dev/random * use
/dev/urandom to replace /dev/random
---
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 72da932a..c88de736 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/random", O_RDONLY);
+ fd = open("/dev/urandom", 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 c1c52714..7a295250 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/random", O_RDONLY);
+ int fd = open("/dev/urandom", 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 7615a94c..a994731d 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/random", O_RDONLY);
+ fd = open("/dev/urandom", O_RDONLY);
if (fd == -1) {
ERROR("Failed to open /dev/urandom");
return -1;
--
2.42.0