@@ -93,42 +93,42 @@ pg_checksum_init(pg_checksum_context *context, pg_checksum_type type)
9393 INIT_CRC32C (context -> raw_context .c_crc32c );
9494 break ;
9595 case 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 )
9898 return -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 );
102102 return -1 ;
103103 }
104104 break ;
105105 case 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 )
108108 return -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 );
112112 return -1 ;
113113 }
114114 break ;
115115 case 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 )
118118 return -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 );
122122 return -1 ;
123123 }
124124 break ;
125125 case 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 )
128128 return -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 );
132132 return -1 ;
133133 }
134134 break ;
@@ -154,19 +154,10 @@ pg_checksum_update(pg_checksum_context *context, const uint8 *input,
154154 COMP_CRC32C (context -> raw_context .c_crc32c , input , len );
155155 break ;
156156 case CHECKSUM_TYPE_SHA224 :
157- if (pg_cryptohash_update (context -> raw_context .c_sha224 , input , len ) < 0 )
158- return -1 ;
159- break ;
160157 case CHECKSUM_TYPE_SHA256 :
161- if (pg_cryptohash_update (context -> raw_context .c_sha256 , input , len ) < 0 )
162- return -1 ;
163- break ;
164158 case CHECKSUM_TYPE_SHA384 :
165- if (pg_cryptohash_update (context -> raw_context .c_sha384 , input , len ) < 0 )
166- return -1 ;
167- break ;
168159 case 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 )
170161 return -1 ;
171162 break ;
172163 }
@@ -207,27 +198,27 @@ pg_checksum_final(pg_checksum_context *context, uint8 *output)
207198 memcpy (output , & context -> raw_context .c_crc32c , retval );
208199 break ;
209200 case 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 )
211202 return -1 ;
212- pg_cryptohash_free (context -> raw_context .c_sha224 );
203+ pg_cryptohash_free (context -> raw_context .c_sha2 );
213204 retval = PG_SHA224_DIGEST_LENGTH ;
214205 break ;
215206 case 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 )
217208 return -1 ;
218- pg_cryptohash_free (context -> raw_context .c_sha256 );
209+ pg_cryptohash_free (context -> raw_context .c_sha2 );
219210 retval = PG_SHA224_DIGEST_LENGTH ;
220211 break ;
221212 case 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 )
223214 return -1 ;
224- pg_cryptohash_free (context -> raw_context .c_sha384 );
215+ pg_cryptohash_free (context -> raw_context .c_sha2 );
225216 retval = PG_SHA384_DIGEST_LENGTH ;
226217 break ;
227218 case 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 )
229220 return -1 ;
230- pg_cryptohash_free (context -> raw_context .c_sha512 );
221+ pg_cryptohash_free (context -> raw_context .c_sha2 );
231222 retval = PG_SHA512_DIGEST_LENGTH ;
232223 break ;
233224 }
0 commit comments