Re: SHA-2 functions

2018-02-22 Thread Peter Eisentraut
On 2/22/18 01:05, Michael Paquier wrote: > On Wed, Feb 21, 2018 at 03:45:17PM -0500, Peter Eisentraut wrote: >> On 2/20/18 23:04, Michael Paquier wrote: >>> I think that crypto_hash.c or hash_crypt.c would be adapted as well. >>> crypt.c is too much generic, so including both concepts in the name i

Re: SHA-2 functions

2018-02-21 Thread Michael Paquier
On Wed, Feb 21, 2018 at 03:45:17PM -0500, Peter Eisentraut wrote: > On 2/20/18 23:04, Michael Paquier wrote: >> I think that crypto_hash.c or hash_crypt.c would be adapted as well. >> crypt.c is too much generic, so including both concepts in the name is >> the way to go. The name given by Tom her

Re: SHA-2 functions

2018-02-21 Thread Peter Eisentraut
isentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services >From 2debe6cf7eec396e269a2c3d89ee56f5aea711e2 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 6 Feb 2018 21:46:46 -0500 Subject: [PATCH v2 1/2] Add user-callable SHA-

Re: SHA-2 functions

2018-02-20 Thread Michael Paquier
On Tue, Feb 20, 2018 at 05:09:48PM -0500, Tom Lane wrote: > Peter Eisentraut writes: >> On 2/19/18 21:07, Michael Paquier wrote: >>> varlena.c is already large and messy. I would suggest to split into a >>> new file all the user-facing cryptographic functions, including md5 and >>> hex functions,

Re: SHA-2 functions

2018-02-20 Thread Tom Lane
Peter Eisentraut writes: > On 2/19/18 21:07, Michael Paquier wrote: >> varlena.c is already large and messy. I would suggest to split into a >> new file all the user-facing cryptographic functions, including md5 and >> hex functions, say in src/backend/utils/adt/crypt.c. > I had originally start

Re: SHA-2 functions

2018-02-20 Thread Peter Eisentraut
ce, used here to hint for possible line breaks. > + Note that for historic reasons, the function md5 > + returns a hex-encoded value of type text whereas the SHA-2 > + functions return type bytea. Use the functions > + encode and decode to convert > + between the two

Re: SHA-2 functions

2018-02-19 Thread Michael Paquier
toric reasons, the function md5 + returns a hex-encoded value of type text whereas the SHA-2 + functions return type bytea. Use the functions + encode and decode to convert + between the two. Adding an example would be nice. varlena.c is already large and messy. I would suggest to split into

Re: SHA-2 functions

2018-02-19 Thread Michael Paquier
On Mon, Feb 19, 2018 at 03:02:02PM -0500, Peter Eisentraut wrote: > On 2/19/18 09:06, Aleksander Alekseev wrote: >>> So I suggest these patches that expose the new functions sha224(), >>> sha256(), sha384(), sha512(). That allows us to make the SSL and SCRAM >>> tests more robust, and it will allo

Re: SHA-2 functions

2018-02-19 Thread Peter Eisentraut
On 2/19/18 09:06, Aleksander Alekseev wrote: >> So I suggest these patches that expose the new functions sha224(), >> sha256(), sha384(), sha512(). That allows us to make the SSL and SCRAM >> tests more robust, and it will allow them to be used in general purpose >> contexts over md5(). > > Nice

Re: SHA-2 functions

2018-02-19 Thread Joe Conway
On 02/19/2018 08:43 AM, Peter Eisentraut wrote: > I also noticed while working on some SSL code that we have perfectly > good SHA-2 functionality in the server already, but it has no test > coverage outside the SCRAM tests. > > So I suggest these patches that expose the new functions sha224(), > s

Re: SHA-2 functions

2018-02-19 Thread Aleksander Alekseev
Hello Peter, > So I suggest these patches that expose the new functions sha224(), > sha256(), sha384(), sha512(). That allows us to make the SSL and SCRAM > tests more robust, and it will allow them to be used in general purpose > contexts over md5(). Nice patch. I wonder though whether tests sh

SHA-2 functions

2018-02-19 Thread Peter Eisentraut
e DBA, Training & Services From 52edfab8f1175c69ba791139fde26feb9279364a Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 6 Feb 2018 21:46:46 -0500 Subject: [PATCH 1/2] Add user-callable SHA-2 functions Add the user-callable functions sha224, sha256, sha384, sha512. We already had the