Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit507e07e

Browse files
committed
There is a signedness bug in Openwall gen_salt code that pgcrypto uses.
This makes the salt space for md5 and xdes algorithms a lot smaller thanit should be.Marko Kreen
1 parent9259526 commit507e07e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

‎contrib/pgcrypto/crypt-gensalt.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ _crypt_gensalt_extended_rn(unsigned long count,
6262
output[2]=_crypt_itoa64[(count >>6)&0x3f];
6363
output[3]=_crypt_itoa64[(count >>12)&0x3f];
6464
output[4]=_crypt_itoa64[(count >>18)&0x3f];
65-
value= (unsigned long)input[0] |
66-
((unsigned long)input[1] <<8) |
67-
((unsigned long)input[2] <<16);
65+
value= (unsigned long)(unsignedchar)input[0] |
66+
((unsigned long)(unsignedchar)input[1] <<8) |
67+
((unsigned long)(unsignedchar)input[2] <<16);
6868
output[5]=_crypt_itoa64[value&0x3f];
6969
output[6]=_crypt_itoa64[(value >>6)&0x3f];
7070
output[7]=_crypt_itoa64[(value >>12)&0x3f];
@@ -90,9 +90,9 @@ _crypt_gensalt_md5_rn(unsigned long count,
9090
output[0]='$';
9191
output[1]='1';
9292
output[2]='$';
93-
value= (unsigned long)input[0] |
94-
((unsigned long)input[1] <<8) |
95-
((unsigned long)input[2] <<16);
93+
value= (unsigned long)(unsignedchar)input[0] |
94+
((unsigned long)(unsignedchar)input[1] <<8) |
95+
((unsigned long)(unsignedchar)input[2] <<16);
9696
output[3]=_crypt_itoa64[value&0x3f];
9797
output[4]=_crypt_itoa64[(value >>6)&0x3f];
9898
output[5]=_crypt_itoa64[(value >>12)&0x3f];
@@ -101,9 +101,9 @@ _crypt_gensalt_md5_rn(unsigned long count,
101101

102102
if (size >=6&&output_size >=3+4+4+1)
103103
{
104-
value= (unsigned long)input[3] |
105-
((unsigned long)input[4] <<8) |
106-
((unsigned long)input[5] <<16);
104+
value= (unsigned long)(unsignedchar)input[3] |
105+
((unsigned long)(unsignedchar)input[4] <<8) |
106+
((unsigned long)(unsignedchar)input[5] <<16);
107107
output[7]=_crypt_itoa64[value&0x3f];
108108
output[8]=_crypt_itoa64[(value >>6)&0x3f];
109109
output[9]=_crypt_itoa64[(value >>12)&0x3f];

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp