Improve/correct comments
Change comments for pg_cryptohash_init(), pg_cryptohash_update(), pg_cryptohash_final() in cryptohash.c to match cryptohash_openssl.c. In particular, the claim that these functions were "designed" to never fail was incorrect, since by design callers need to be prepared to handle failures, for compatibility with the cryptohash_openssl.c versions. Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Discussion: https://www.postgresql.org/message-id/301F4EDD-27B9-460F-B462-B9DB2BDE4ACF@yesql.se
This commit is contained in:
parent
544b452a5a
commit
36ea345f8f
@ -94,8 +94,7 @@ pg_cryptohash_create(pg_cryptohash_type type)
|
|||||||
/*
|
/*
|
||||||
* pg_cryptohash_init
|
* pg_cryptohash_init
|
||||||
*
|
*
|
||||||
* Initialize a hash context. Note that this implementation is designed
|
* Initialize a hash context. Returns 0 on success, and -1 on failure.
|
||||||
* to never fail, so this always returns 0.
|
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pg_cryptohash_init(pg_cryptohash_ctx *ctx)
|
pg_cryptohash_init(pg_cryptohash_ctx *ctx)
|
||||||
@ -131,9 +130,7 @@ pg_cryptohash_init(pg_cryptohash_ctx *ctx)
|
|||||||
/*
|
/*
|
||||||
* pg_cryptohash_update
|
* pg_cryptohash_update
|
||||||
*
|
*
|
||||||
* Update a hash context. Note that this implementation is designed
|
* Update a hash context. Returns 0 on success, and -1 on failure.
|
||||||
* to never fail, so this always returns 0 except if the caller has
|
|
||||||
* given a NULL context.
|
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pg_cryptohash_update(pg_cryptohash_ctx *ctx, const uint8 *data, size_t len)
|
pg_cryptohash_update(pg_cryptohash_ctx *ctx, const uint8 *data, size_t len)
|
||||||
@ -169,9 +166,7 @@ pg_cryptohash_update(pg_cryptohash_ctx *ctx, const uint8 *data, size_t len)
|
|||||||
/*
|
/*
|
||||||
* pg_cryptohash_final
|
* pg_cryptohash_final
|
||||||
*
|
*
|
||||||
* Finalize a hash context. Note that this implementation is designed to
|
* Finalize a hash context. Returns 0 on success, and -1 on failure.
|
||||||
* never fail, so this always returns 0 except if the destination buffer
|
|
||||||
* is not large enough.
|
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pg_cryptohash_final(pg_cryptohash_ctx *ctx, uint8 *dest, size_t len)
|
pg_cryptohash_final(pg_cryptohash_ctx *ctx, uint8 *dest, size_t len)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user