Blame SOURCES/0018-Use-SHA-2-instead-of-SHA-1.patch

b9d005
From ec1b147076345478636de763ce5d4e8daa69afd6 Mon Sep 17 00:00:00 2001
5b70e6
From: Petr Lautrbach <plautrba@redhat.com>
5b70e6
Date: Fri, 30 Jul 2021 14:14:37 +0200
5b70e6
Subject: [PATCH] Use SHA-2 instead of SHA-1
5b70e6
5b70e6
The use of SHA-1 in RHEL9 is deprecated
5b70e6
---
5b70e6
 policycoreutils/setfiles/restorecon.8          | 10 +++++-----
5b70e6
 policycoreutils/setfiles/restorecon_xattr.8    |  8 ++++----
5b70e6
 policycoreutils/setfiles/restorecon_xattr.c    | 12 ++++++------
5b70e6
 policycoreutils/setfiles/ru/restorecon.8       |  8 ++++----
5b70e6
 policycoreutils/setfiles/ru/restorecon_xattr.8 | 10 +++++-----
5b70e6
 policycoreutils/setfiles/ru/setfiles.8         |  8 ++++----
5b70e6
 policycoreutils/setfiles/setfiles.8            | 10 +++++-----
5b70e6
 7 files changed, 33 insertions(+), 33 deletions(-)
5b70e6
5b70e6
diff --git a/policycoreutils/setfiles/restorecon.8 b/policycoreutils/setfiles/restorecon.8
5b70e6
index 668486f66113..a8900f02b3f3 100644
5b70e6
--- a/policycoreutils/setfiles/restorecon.8
5b70e6
+++ b/policycoreutils/setfiles/restorecon.8
5b70e6
@@ -93,14 +93,14 @@ display usage information and exit.
5b70e6
 ignore files that do not exist.
5b70e6
 .TP
5b70e6
 .B \-I
5b70e6
-ignore digest to force checking of labels even if the stored SHA1 digest
5b70e6
-matches the specfiles SHA1 digest. The digest will then be updated provided
5b70e6
+ignore digest to force checking of labels even if the stored SHA256 digest
5b70e6
+matches the specfiles SHA256 digest. The digest will then be updated provided
5b70e6
 there are no errors. See the
5b70e6
 .B NOTES
5b70e6
 section for further details.
5b70e6
 .TP
5b70e6
 .B \-D
5b70e6
-Set or update any directory SHA1 digests. Use this option to
5b70e6
+Set or update any directory SHA256 digests. Use this option to
5b70e6
 enable usage of the
5b70e6
 .IR security.sehash
5b70e6
 extended attribute.
5b70e6
@@ -191,7 +191,7 @@ the
5b70e6
 .B \-D
5b70e6
 option to
5b70e6
 .B restorecon
5b70e6
-will cause it to store a SHA1 digest of the default specfiles set in an extended
5b70e6
+will cause it to store a SHA256 digest of the default specfiles set in an extended
5b70e6
 attribute named
5b70e6
 .IR security.sehash
5b70e6
 on each directory specified in
5b70e6
@@ -208,7 +208,7 @@ for further details.
5b70e6
 .sp
5b70e6
 The
5b70e6
 .B \-I
5b70e6
-option will ignore the SHA1 digest from each directory specified in
5b70e6
+option will ignore the SHA256 digest from each directory specified in
5b70e6
 .IR pathname \ ...
5b70e6
 and provided the
5b70e6
 .B \-n
5b70e6
diff --git a/policycoreutils/setfiles/restorecon_xattr.8 b/policycoreutils/setfiles/restorecon_xattr.8
5b70e6
index e04528e60824..4b1ce304d995 100644
5b70e6
--- a/policycoreutils/setfiles/restorecon_xattr.8
5b70e6
+++ b/policycoreutils/setfiles/restorecon_xattr.8
5b70e6
@@ -23,7 +23,7 @@ or
5b70e6
 
5b70e6
 .SH "DESCRIPTION"
5b70e6
 .B restorecon_xattr
5b70e6
-will display the SHA1 digests added to extended attributes
5b70e6
+will display the SHA256 digests added to extended attributes
5b70e6
 .I security.sehash
5b70e6
 or delete the attribute completely. These attributes are set by
5b70e6
 .BR restorecon (8)
5b70e6
@@ -48,12 +48,12 @@ extended attribute and are automatically excluded from searches.
5b70e6
 .sp
5b70e6
 By default
5b70e6
 .B restorecon_xattr
5b70e6
-will display the SHA1 digests with "Match" appended if they match the default
5b70e6
+will display the SHA256 digests with "Match" appended if they match the default
5b70e6
 specfile set or the
5b70e6
 .I specfile
5b70e6
 set used with the
5b70e6
 .B \-f
5b70e6
-option. Non-matching SHA1 digests will be displayed with "No Match" appended.
5b70e6
+option. Non-matching SHA256 digests will be displayed with "No Match" appended.
5b70e6
 This feature can be disabled by the
5b70e6
 .B \-n
5b70e6
 option.
5b70e6
@@ -87,7 +87,7 @@ Do not append "Match" or "No Match" to displayed digests.
5b70e6
 recursively descend directories.
5b70e6
 .TP
5b70e6
 .B \-v
5b70e6
-display SHA1 digest generated by specfile set (Note that this digest is not
5b70e6
+display SHA256 digest generated by specfile set (Note that this digest is not
5b70e6
 used to match the
5b70e6
 .I security.sehash
5b70e6
 directory digest entries, and is shown for reference only).
5b70e6
diff --git a/policycoreutils/setfiles/restorecon_xattr.c b/policycoreutils/setfiles/restorecon_xattr.c
5b70e6
index 31fb82fd2099..bc22d3fd4560 100644
5b70e6
--- a/policycoreutils/setfiles/restorecon_xattr.c
5b70e6
+++ b/policycoreutils/setfiles/restorecon_xattr.c
5b70e6
@@ -38,7 +38,7 @@ int main(int argc, char **argv)
5b70e6
 	unsigned int xattr_flags = 0, delete_digest = 0, recurse = 0;
5b70e6
 	unsigned int delete_all_digests = 0, ignore_mounts = 0;
5b70e6
 	bool display_digest = false;
5b70e6
-	char *sha1_buf, **specfiles, *fc_file = NULL, *pathname = NULL;
5b70e6
+	char *sha256_buf, **specfiles, *fc_file = NULL, *pathname = NULL;
5b70e6
 	unsigned char *fc_digest = NULL;
5b70e6
 	size_t i, fc_digest_len = 0, num_specfiles;
5b70e6
 
5b70e6
@@ -133,8 +133,8 @@ int main(int argc, char **argv)
5b70e6
 			exit(-1);
5b70e6
 		}
5b70e6
 
5b70e6
-		sha1_buf = malloc(fc_digest_len * 2 + 1);
5b70e6
-		if (!sha1_buf) {
5b70e6
+		sha256_buf = malloc(fc_digest_len * 2 + 1);
5b70e6
+		if (!sha256_buf) {
5b70e6
 			fprintf(stderr,
5b70e6
 				"Error allocating digest buffer: %s\n",
5b70e6
 							    strerror(errno));
5b70e6
@@ -143,16 +143,16 @@ int main(int argc, char **argv)
5b70e6
 		}
5b70e6
 
5b70e6
 		for (i = 0; i < fc_digest_len; i++)
5b70e6
-			sprintf((&sha1_buf[i * 2]), "%02x", fc_digest[i]);
5b70e6
+			sprintf((&sha256_buf[i * 2]), "%02x", fc_digest[i]);
5b70e6
 
5b70e6
-		printf("specfiles SHA1 digest: %s\n", sha1_buf);
5b70e6
+		printf("specfiles SHA256 digest: %s\n", sha256_buf);
5b70e6
 
5b70e6
 		printf("calculated using the following specfile(s):\n");
5b70e6
 		if (specfiles) {
5b70e6
 			for (i = 0; i < num_specfiles; i++)
5b70e6
 				printf("%s\n", specfiles[i]);
5b70e6
 		}
5b70e6
-		free(sha1_buf);
5b70e6
+		free(sha256_buf);
5b70e6
 		printf("\n");
5b70e6
 	}
5b70e6
 
5b70e6
diff --git a/policycoreutils/setfiles/ru/restorecon.8 b/policycoreutils/setfiles/ru/restorecon.8
5b70e6
index 9be3a63db356..745135020f4b 100644
5b70e6
--- a/policycoreutils/setfiles/ru/restorecon.8
5b70e6
+++ b/policycoreutils/setfiles/ru/restorecon.8
5b70e6
@@ -82,11 +82,11 @@ restorecon \- восстановить SELinux-контексты безопас
5b70e6
 игнорировать файлы, которые не существуют.
5b70e6
 .TP
5b70e6
 .B \-I
5b70e6
-игнорировать дайджест, чтобы принудительно проверить метки, даже если хранимый дайджест SHA1 соответствует дайджесту SHA1 файлов спецификации. Затем (при условии отсутствия ошибок) дайджест будет обновлён. Более подробные сведения доступны в разделе
5b70e6
+игнорировать дайджест, чтобы принудительно проверить метки, даже если хранимый дайджест SHA256 соответствует дайджесту SHA256 файлов спецификации. Затем (при условии отсутствия ошибок) дайджест будет обновлён. Более подробные сведения доступны в разделе
5b70e6
 .B ПРИМЕЧАНИЯ.
5b70e6
 .TP
5b70e6
 .B \-D
5b70e6
-установить или обновить дайджесты SHA1 для любых каталогов. Используйте этот параметр, чтобы включить использование расширенного атрибута
5b70e6
+установить или обновить дайджесты SHA256 для любых каталогов. Используйте этот параметр, чтобы включить использование расширенного атрибута
5b70e6
 .IR security.restorecon_last.
5b70e6
 .TP
5b70e6
 .B \-m
5b70e6
@@ -159,7 +159,7 @@ GNU
5b70e6
 .B \-D
5b70e6
 команды
5b70e6
 .B restorecon
5b70e6
-обеспечит сохранение дайджеста SHA1 файлов спецификации по умолчанию в расширенном атрибуте с именем
5b70e6
+обеспечит сохранение дайджеста SHA256 файлов спецификации по умолчанию в расширенном атрибуте с именем
5b70e6
 .IR security.restorecon_last
5b70e6
 для каталогов, указанных в соответствующих путях
5b70e6
 .IR pathname \ ...
5b70e6
@@ -173,7 +173,7 @@ GNU
5b70e6
 .sp
5b70e6
 Параметр
5b70e6
 .B \-I
5b70e6
-позволяет игнорировать дайджест SHA1 из каждого каталога, указанного в 
5b70e6
+позволяет игнорировать дайджест SHA256 из каждого каталога, указанного в
5b70e6
 .IR pathname \ ...
5b70e6
 , и, при условии, что НЕ установлен параметр
5b70e6
 .B \-n
5b70e6
diff --git a/policycoreutils/setfiles/ru/restorecon_xattr.8 b/policycoreutils/setfiles/ru/restorecon_xattr.8
5b70e6
index 41c441b8c5c2..25c4c3033334 100644
5b70e6
--- a/policycoreutils/setfiles/ru/restorecon_xattr.8
5b70e6
+++ b/policycoreutils/setfiles/ru/restorecon_xattr.8
5b70e6
@@ -23,7 +23,7 @@ restorecon_xattr \- управление записями расширенных
5b70e6
 
5b70e6
 .SH "ОПИСАНИЕ"
5b70e6
 .B restorecon_xattr
5b70e6
-покажет дайджесты SHA1, добавленные в расширенные атрибуты
5b70e6
+покажет дайджесты SHA256, добавленные в расширенные атрибуты
5b70e6
 .I security.restorecon_last,
5b70e6
 или полностью удалит эти атрибуты. Эти атрибуты устанавливаются командой
5b70e6
 .BR restorecon (8)
5b70e6
@@ -47,11 +47,11 @@ restorecon_xattr \- управление записями расширенных
5b70e6
 .sp
5b70e6
 По умолчанию
5b70e6
 .B restorecon_xattr
5b70e6
-показывает дайджесты SHA1, добавляя в конце "Match", если они соответствуют установленному по умолчанию файлу спецификации или файлу спецификации
5b70e6
+показывает дайджесты SHA256, добавляя в конце "Match", если они соответствуют установленному по умолчанию файлу спецификации или файлу спецификации
5b70e6
 .I specfile,
5b70e6
 который установлен с помощью параметра
5b70e6
 .B \-f.
5b70e6
-Несоответствующие дайджесты SHA1 будут показаны с добавлением "No Match" в конце.
5b70e6
+Несоответствующие дайджесты SHA256 будут показаны с добавлением "No Match" в конце.
5b70e6
 Эту возможность можно отключить с помощью параметра
5b70e6
 .B \-n.
5b70e6
 
5b70e6
@@ -81,7 +81,7 @@ restorecon_xattr \- управление записями расширенных
5b70e6
 рекурсивно спускаться по каталогам.
5b70e6
 .TP
5b70e6
 .B \-v
5b70e6
-показать дайджест SHA1, созданный установленным файлом спецификации.
5b70e6
+показать дайджест SHA256, созданный установленным файлом спецификации.
5b70e6
 .TP
5b70e6
 .B \-e
5b70e6
 .I directory
5b70e6
@@ -97,7 +97,7 @@ restorecon_xattr \- управление записями расширенных
5b70e6
 .BR file_contexts (5).
5b70e6
 Он будет использоваться
5b70e6
 .BR selabel_open (3)
5b70e6
-для получения набора записей меток; получение дайджеста SHA1 выполняется с помощью
5b70e6
+для получения набора записей меток; получение дайджеста SHA256 выполняется с помощью
5b70e6
 .BR selabel_digest (3).
5b70e6
 Если этот параметр не указан, будет использоваться файл file_contexts по умолчанию.
5b70e6
 
5b70e6
diff --git a/policycoreutils/setfiles/ru/setfiles.8 b/policycoreutils/setfiles/ru/setfiles.8
5b70e6
index 910101452625..7f2daa09191b 100644
5b70e6
--- a/policycoreutils/setfiles/ru/setfiles.8
5b70e6
+++ b/policycoreutils/setfiles/ru/setfiles.8
5b70e6
@@ -69,11 +69,11 @@ setfiles \- установить SELinux-контексты безопаснос
5b70e6
 игнорировать файлы, которые не существуют.
5b70e6
 .TP
5b70e6
 .B \-I
5b70e6
-игнорировать дайджест, чтобы принудительно проверить метки, даже если хранимый дайджест SHA1 соответствует дайджесту SHA1 файлов спецификации. Затем (при условии отсутствия ошибок) дайджест будет обновлён. Более подробные сведения доступны в разделе
5b70e6
+игнорировать дайджест, чтобы принудительно проверить метки, даже если хранимый дайджест SHA256 соответствует дайджесту SHA256 файлов спецификации. Затем (при условии отсутствия ошибок) дайджест будет обновлён. Более подробные сведения доступны в разделе
5b70e6
 .B ПРИМЕЧАНИЯ.
5b70e6
 .TP
5b70e6
 .B \-D
5b70e6
-установить или обновить дайджесты SHA1 для любых каталогов. Используйте этот параметр, чтобы включить использование расширенного атрибута
5b70e6
+установить или обновить дайджесты SHA256 для любых каталогов. Используйте этот параметр, чтобы включить использование расширенного атрибута
5b70e6
 .IR security.restorecon_last.
5b70e6
 .TP
5b70e6
 .B \-l
5b70e6
@@ -186,7 +186,7 @@ GNU
5b70e6
 .B \-D
5b70e6
 команды
5b70e6
 .B setfiles .
5b70e6
-Он обеспечивает сохранение дайджеста SHA1 файла спецификации
5b70e6
+Он обеспечивает сохранение дайджеста SHA256 файла спецификации
5b70e6
 .B spec_file 
5b70e6
 в расширенном атрибуте с именем
5b70e6
 .IR security.restorecon_last
5b70e6
@@ -204,7 +204,7 @@ GNU
5b70e6
 .sp
5b70e6
 Параметр
5b70e6
 .B \-I
5b70e6
-позволяет игнорировать дайджест SHA1 из каждого каталога, указанного в 
5b70e6
+позволяет игнорировать дайджест SHA256 из каждого каталога, указанного в
5b70e6
 .IR pathname \ ...
5b70e6
 , и, при условии, что НЕ установлен параметр
5b70e6
 .B \-n
5b70e6
diff --git a/policycoreutils/setfiles/setfiles.8 b/policycoreutils/setfiles/setfiles.8
5b70e6
index 8e6c4ab94841..0692121f2f4d 100644
5b70e6
--- a/policycoreutils/setfiles/setfiles.8
5b70e6
+++ b/policycoreutils/setfiles/setfiles.8
5b70e6
@@ -85,14 +85,14 @@ display usage information and exit.
5b70e6
 ignore files that do not exist.
5b70e6
 .TP
5b70e6
 .B \-I
5b70e6
-ignore digest to force checking of labels even if the stored SHA1 digest
5b70e6
-matches the specfiles SHA1 digest. The digest will then be updated provided
5b70e6
+ignore digest to force checking of labels even if the stored SHA256 digest
5b70e6
+matches the specfiles SHA256 digest. The digest will then be updated provided
5b70e6
 there are no errors. See the
5b70e6
 .B NOTES
5b70e6
 section for further details.
5b70e6
 .TP
5b70e6
 .B \-D
5b70e6
-Set or update any directory SHA1 digests. Use this option to
5b70e6
+Set or update any directory SHA256 digests. Use this option to
5b70e6
 enable usage of the
5b70e6
 .IR security.sehash
5b70e6
 extended attribute.
5b70e6
@@ -230,7 +230,7 @@ the
5b70e6
 .B \-D
5b70e6
 option to
5b70e6
 .B setfiles
5b70e6
-will cause it to store a SHA1 digest of the
5b70e6
+will cause it to store a SHA256 digest of the
5b70e6
 .B spec_file
5b70e6
 set in an extended attribute named
5b70e6
 .IR security.sehash
5b70e6
@@ -251,7 +251,7 @@ for further details.
5b70e6
 .sp
5b70e6
 The
5b70e6
 .B \-I
5b70e6
-option will ignore the SHA1 digest from each directory specified in
5b70e6
+option will ignore the SHA256 digest from each directory specified in
5b70e6
 .IR pathname \ ...
5b70e6
 and provided the
5b70e6
 .B \-n
5b70e6
-- 
5b70e6
2.32.0
5b70e6