@@ -93,42 +93,42 @@ pg_checksum_init(pg_checksum_context *context, pg_checksum_type type)
93
93
INIT_CRC32C (context -> raw_context .c_crc32c );
94
94
break ;
95
95
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 )
98
98
return -1 ;
99
- if (pg_cryptohash_init (context -> raw_context .c_sha224 ) < 0 )
99
+ if (pg_cryptohash_init (context -> raw_context .c_sha2 ) < 0 )
100
100
{
101
- pg_cryptohash_free (context -> raw_context .c_sha224 );
101
+ pg_cryptohash_free (context -> raw_context .c_sha2 );
102
102
return -1 ;
103
103
}
104
104
break ;
105
105
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 )
108
108
return -1 ;
109
- if (pg_cryptohash_init (context -> raw_context .c_sha256 ) < 0 )
109
+ if (pg_cryptohash_init (context -> raw_context .c_sha2 ) < 0 )
110
110
{
111
- pg_cryptohash_free (context -> raw_context .c_sha256 );
111
+ pg_cryptohash_free (context -> raw_context .c_sha2 );
112
112
return -1 ;
113
113
}
114
114
break ;
115
115
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 )
118
118
return -1 ;
119
- if (pg_cryptohash_init (context -> raw_context .c_sha384 ) < 0 )
119
+ if (pg_cryptohash_init (context -> raw_context .c_sha2 ) < 0 )
120
120
{
121
- pg_cryptohash_free (context -> raw_context .c_sha384 );
121
+ pg_cryptohash_free (context -> raw_context .c_sha2 );
122
122
return -1 ;
123
123
}
124
124
break ;
125
125
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 )
128
128
return -1 ;
129
- if (pg_cryptohash_init (context -> raw_context .c_sha512 ) < 0 )
129
+ if (pg_cryptohash_init (context -> raw_context .c_sha2 ) < 0 )
130
130
{
131
- pg_cryptohash_free (context -> raw_context .c_sha512 );
131
+ pg_cryptohash_free (context -> raw_context .c_sha2 );
132
132
return -1 ;
133
133
}
134
134
break ;
@@ -154,19 +154,10 @@ pg_checksum_update(pg_checksum_context *context, const uint8 *input,
154
154
COMP_CRC32C (context -> raw_context .c_crc32c , input , len );
155
155
break ;
156
156
case CHECKSUM_TYPE_SHA224 :
157
- if (pg_cryptohash_update (context -> raw_context .c_sha224 , input , len ) < 0 )
158
- return -1 ;
159
- break ;
160
157
case CHECKSUM_TYPE_SHA256 :
161
- if (pg_cryptohash_update (context -> raw_context .c_sha256 , input , len ) < 0 )
162
- return -1 ;
163
- break ;
164
158
case CHECKSUM_TYPE_SHA384 :
165
- if (pg_cryptohash_update (context -> raw_context .c_sha384 , input , len ) < 0 )
166
- return -1 ;
167
- break ;
168
159
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 )
170
161
return -1 ;
171
162
break ;
172
163
}
@@ -207,27 +198,27 @@ pg_checksum_final(pg_checksum_context *context, uint8 *output)
207
198
memcpy (output , & context -> raw_context .c_crc32c , retval );
208
199
break ;
209
200
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 )
211
202
return -1 ;
212
- pg_cryptohash_free (context -> raw_context .c_sha224 );
203
+ pg_cryptohash_free (context -> raw_context .c_sha2 );
213
204
retval = PG_SHA224_DIGEST_LENGTH ;
214
205
break ;
215
206
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 )
217
208
return -1 ;
218
- pg_cryptohash_free (context -> raw_context .c_sha256 );
209
+ pg_cryptohash_free (context -> raw_context .c_sha2 );
219
210
retval = PG_SHA224_DIGEST_LENGTH ;
220
211
break ;
221
212
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 )
223
214
return -1 ;
224
- pg_cryptohash_free (context -> raw_context .c_sha384 );
215
+ pg_cryptohash_free (context -> raw_context .c_sha2 );
225
216
retval = PG_SHA384_DIGEST_LENGTH ;
226
217
break ;
227
218
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 )
229
220
return -1 ;
230
- pg_cryptohash_free (context -> raw_context .c_sha512 );
221
+ pg_cryptohash_free (context -> raw_context .c_sha2 );
231
222
retval = PG_SHA512_DIGEST_LENGTH ;
232
223
break ;
233
224
}
0 commit comments