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

Commit576ac4b

Browse files
committed
Fix initialization bug in pgcrypto openssl code. Marko Kreen
1 parent7e33fae commit576ac4b

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

‎contrib/pgcrypto/expected/3des.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ decode('01 01 01 01 01 01 01 01
1717
select encode(encrypt('', 'foo', '3des'), 'hex');
1818
encode
1919
------------------
20-
9b641a6936249eb4
20+
752111e37a2d7ac3
2121
(1 row)
2222

2323
-- 10 bytes key
2424
select encode(encrypt('foo', '0123456789', '3des'), 'hex');
2525
encode
2626
------------------
27-
6f02b7076a366504
27+
d2fb8baa1717cb02
2828
(1 row)
2929

3030
-- 22 bytes key
@@ -45,10 +45,10 @@ select decrypt(encrypt('foo', '0123456', '3des'), '0123456', '3des');
4545
select encode(encrypt_iv('foo', '0123456', 'abcd', '3des'), 'hex');
4646
encode
4747
------------------
48-
df27c264fb24ed7a
48+
50735067b073bb93
4949
(1 row)
5050

51-
select decrypt_iv(decode('df27c264fb24ed7a', 'hex'), '0123456', 'abcd', '3des');
51+
select decrypt_iv(decode('50735067b073bb93', 'hex'), '0123456', 'abcd', '3des');
5252
decrypt_iv
5353
------------
5454
foo

‎contrib/pgcrypto/openssl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2727
* SUCH DAMAGE.
2828
*
29-
* $PostgreSQL: pgsql/contrib/pgcrypto/openssl.c,v 1.19 2005/07/04 02:02:01 momjian Exp $
29+
* $PostgreSQL: pgsql/contrib/pgcrypto/openssl.c,v 1.20 2005/07/05 18:15:36 tgl Exp $
3030
*/
3131

3232
#include<postgres.h>
@@ -393,7 +393,7 @@ ossl_des3_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
393393

394394
memset(&xkey1,0,sizeof(xkey1));
395395
memset(&xkey2,0,sizeof(xkey2));
396-
memset(&xkey2,0,sizeof(xkey2));
396+
memset(&xkey3,0,sizeof(xkey3));
397397
memcpy(&xkey1,key,klen>8 ?8 :klen);
398398
if (klen>8)
399399
memcpy(&xkey2,key+8, (klen-8)>8 ?8 : (klen-8));

‎contrib/pgcrypto/sql/3des.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ select decrypt(encrypt('foo', '0123456', '3des'), '0123456', '3des');
2222

2323
-- iv
2424
select encode(encrypt_iv('foo','0123456','abcd','3des'),'hex');
25-
select decrypt_iv(decode('df27c264fb24ed7a','hex'),'0123456','abcd','3des');
25+
select decrypt_iv(decode('50735067b073bb93','hex'),'0123456','abcd','3des');
2626

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp