@@ -93,42 +93,42 @@ pg_checksum_init(pg_checksum_context *context, pg_checksum_type type)
9393INIT_CRC32C (context -> raw_context .c_crc32c );
9494break ;
9595case CHECKSUM_TYPE_SHA224 :
96- context -> raw_context .c_sha224 = pg_cryptohash_create (PG_SHA224 );
97- if (context -> raw_context .c_sha224 == NULL )
96+ context -> raw_context .c_sha2 = pg_cryptohash_create (PG_SHA224 );
97+ if (context -> raw_context .c_sha2 == NULL )
9898return -1 ;
99- if (pg_cryptohash_init (context -> raw_context .c_sha224 )< 0 )
99+ if (pg_cryptohash_init (context -> raw_context .c_sha2 )< 0 )
100100{
101- pg_cryptohash_free (context -> raw_context .c_sha224 );
101+ pg_cryptohash_free (context -> raw_context .c_sha2 );
102102return -1 ;
103103}
104104break ;
105105case CHECKSUM_TYPE_SHA256 :
106- context -> raw_context .c_sha256 = pg_cryptohash_create (PG_SHA256 );
107- if (context -> raw_context .c_sha256 == NULL )
106+ context -> raw_context .c_sha2 = pg_cryptohash_create (PG_SHA256 );
107+ if (context -> raw_context .c_sha2 == NULL )
108108return -1 ;
109- if (pg_cryptohash_init (context -> raw_context .c_sha256 )< 0 )
109+ if (pg_cryptohash_init (context -> raw_context .c_sha2 )< 0 )
110110{
111- pg_cryptohash_free (context -> raw_context .c_sha256 );
111+ pg_cryptohash_free (context -> raw_context .c_sha2 );
112112return -1 ;
113113}
114114break ;
115115case CHECKSUM_TYPE_SHA384 :
116- context -> raw_context .c_sha384 = pg_cryptohash_create (PG_SHA384 );
117- if (context -> raw_context .c_sha384 == NULL )
116+ context -> raw_context .c_sha2 = pg_cryptohash_create (PG_SHA384 );
117+ if (context -> raw_context .c_sha2 == NULL )
118118return -1 ;
119- if (pg_cryptohash_init (context -> raw_context .c_sha384 )< 0 )
119+ if (pg_cryptohash_init (context -> raw_context .c_sha2 )< 0 )
120120{
121- pg_cryptohash_free (context -> raw_context .c_sha384 );
121+ pg_cryptohash_free (context -> raw_context .c_sha2 );
122122return -1 ;
123123}
124124break ;
125125case CHECKSUM_TYPE_SHA512 :
126- context -> raw_context .c_sha512 = pg_cryptohash_create (PG_SHA512 );
127- if (context -> raw_context .c_sha512 == NULL )
126+ context -> raw_context .c_sha2 = pg_cryptohash_create (PG_SHA512 );
127+ if (context -> raw_context .c_sha2 == NULL )
128128return -1 ;
129- if (pg_cryptohash_init (context -> raw_context .c_sha512 )< 0 )
129+ if (pg_cryptohash_init (context -> raw_context .c_sha2 )< 0 )
130130{
131- pg_cryptohash_free (context -> raw_context .c_sha512 );
131+ pg_cryptohash_free (context -> raw_context .c_sha2 );
132132return -1 ;
133133}
134134break ;
@@ -154,19 +154,10 @@ pg_checksum_update(pg_checksum_context *context, const uint8 *input,
154154COMP_CRC32C (context -> raw_context .c_crc32c ,input ,len );
155155break ;
156156case CHECKSUM_TYPE_SHA224 :
157- if (pg_cryptohash_update (context -> raw_context .c_sha224 ,input ,len )< 0 )
158- return -1 ;
159- break ;
160157case CHECKSUM_TYPE_SHA256 :
161- if (pg_cryptohash_update (context -> raw_context .c_sha256 ,input ,len )< 0 )
162- return -1 ;
163- break ;
164158case CHECKSUM_TYPE_SHA384 :
165- if (pg_cryptohash_update (context -> raw_context .c_sha384 ,input ,len )< 0 )
166- return -1 ;
167- break ;
168159case CHECKSUM_TYPE_SHA512 :
169- if (pg_cryptohash_update (context -> raw_context .c_sha512 ,input ,len )< 0 )
160+ if (pg_cryptohash_update (context -> raw_context .c_sha2 ,input ,len )< 0 )
170161return -1 ;
171162break ;
172163}
@@ -207,27 +198,27 @@ pg_checksum_final(pg_checksum_context *context, uint8 *output)
207198memcpy (output ,& context -> raw_context .c_crc32c ,retval );
208199break ;
209200case CHECKSUM_TYPE_SHA224 :
210- if (pg_cryptohash_final (context -> raw_context .c_sha224 ,output )< 0 )
201+ if (pg_cryptohash_final (context -> raw_context .c_sha2 ,output )< 0 )
211202return -1 ;
212- pg_cryptohash_free (context -> raw_context .c_sha224 );
203+ pg_cryptohash_free (context -> raw_context .c_sha2 );
213204retval = PG_SHA224_DIGEST_LENGTH ;
214205break ;
215206case CHECKSUM_TYPE_SHA256 :
216- if (pg_cryptohash_final (context -> raw_context .c_sha256 ,output )< 0 )
207+ if (pg_cryptohash_final (context -> raw_context .c_sha2 ,output )< 0 )
217208return -1 ;
218- pg_cryptohash_free (context -> raw_context .c_sha256 );
209+ pg_cryptohash_free (context -> raw_context .c_sha2 );
219210retval = PG_SHA224_DIGEST_LENGTH ;
220211break ;
221212case CHECKSUM_TYPE_SHA384 :
222- if (pg_cryptohash_final (context -> raw_context .c_sha384 ,output )< 0 )
213+ if (pg_cryptohash_final (context -> raw_context .c_sha2 ,output )< 0 )
223214return -1 ;
224- pg_cryptohash_free (context -> raw_context .c_sha384 );
215+ pg_cryptohash_free (context -> raw_context .c_sha2 );
225216retval = PG_SHA384_DIGEST_LENGTH ;
226217break ;
227218case CHECKSUM_TYPE_SHA512 :
228- if (pg_cryptohash_final (context -> raw_context .c_sha512 ,output )< 0 )
219+ if (pg_cryptohash_final (context -> raw_context .c_sha2 ,output )< 0 )
229220return -1 ;
230- pg_cryptohash_free (context -> raw_context .c_sha512 );
221+ pg_cryptohash_free (context -> raw_context .c_sha2 );
231222retval = PG_SHA512_DIGEST_LENGTH ;
232223break ;
233224}