glibc/crypt_blowfish-const.patch

47 lines
1.6 KiB
Diff
Raw Normal View History

Index: crypt_blowfish-1.2/crypt_blowfish.c
===================================================================
--- crypt_blowfish-1.2.orig/crypt_blowfish.c
+++ crypt_blowfish-1.2/crypt_blowfish.c
@@ -81,7 +81,7 @@ typedef struct {
* Magic IV for 64 Blowfish encryptions that we do at the end.
* The string is "OrpheanBeholderScryDoubt" on big-endian.
*/
-static BF_word BF_magic_w[6] = {
+static const BF_word BF_magic_w[6] = {
0x4F727068, 0x65616E42, 0x65686F6C,
0x64657253, 0x63727944, 0x6F756274
};
@@ -89,7 +89,7 @@ static BF_word BF_magic_w[6] = {
/*
* P-box and S-box tables initialized with digits of Pi.
*/
-static BF_ctx BF_init_state = {
+static const BF_ctx BF_init_state = {
{
{
0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7,
@@ -361,10 +361,10 @@ static BF_ctx BF_init_state = {
}
};
-static unsigned char BF_itoa64[64 + 1] =
+static const unsigned char BF_itoa64[64 + 1] =
"./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-static unsigned char BF_atoi64[0x60] = {
+static const unsigned char BF_atoi64[0x60] = {
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, 1,
54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 64, 64, 64, 64, 64,
64, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
@@ -440,8 +440,8 @@ static void BF_encode(char *dst, const B
static void BF_swap(BF_word *x, int count)
{
- static int endianness_check = 1;
- char *is_little_endian = (char *)&endianness_check;
+ static const int endianness_check = 1;
+ const char *is_little_endian = (const char *)&endianness_check;
BF_word tmp;
if (*is_little_endian)