LCOV - differential code coverage report
Current view: top level - src/common - cryptohash_openssl.c (source / functions) Coverage Total Hit UNC UBC GNC CBC EUB ECB
Current: ba12a202ce1b5581dc0ed149cf3f637d7897ad5d vs 2866d8c7dbfc9d882a7d80fef93fbbe763709932 Lines: 62.4 % 141 88 3 50 22 66 3 16
Current Date: 2026-08-27 14:31:44 +0300 Functions: 80.0 % 10 8 2 2 6
Baseline: lcov-20260827-baseline Branches: 46.8 % 62 29 4 29 7 22 2 5
Baseline Date: 2026-08-27 14:31:58 +0300 Line coverage date bins:
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
(7,30] days: 88.0 % 25 22 3 22
(360..) days: 56.9 % 116 66 50 66 3 16
Function coverage date bins:
(360..) days: 80.0 % 10 8 2 2 6
Branch coverage date bins:
(7,30] days: 63.6 % 11 7 4 7
(360..) days: 37.9 % 58 22 29 22 2 5

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : /*-------------------------------------------------------------------------
                                  2                 :                :  *
                                  3                 :                :  * cryptohash_openssl.c
                                  4                 :                :  *    Set of wrapper routines on top of OpenSSL to support cryptographic
                                  5                 :                :  *    hash functions.
                                  6                 :                :  *
                                  7                 :                :  * This should only be used if code is compiled with OpenSSL support.
                                  8                 :                :  *
                                  9                 :                :  * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
                                 10                 :                :  * Portions Copyright (c) 1994, Regents of the University of California
                                 11                 :                :  *
                                 12                 :                :  * IDENTIFICATION
                                 13                 :                :  *        src/common/cryptohash_openssl.c
                                 14                 :                :  *
                                 15                 :                :  *-------------------------------------------------------------------------
                                 16                 :                :  */
                                 17                 :                : 
                                 18                 :                : #ifndef FRONTEND
                                 19                 :                : #include "postgres.h"
                                 20                 :                : #else
                                 21                 :                : #include "postgres_fe.h"
                                 22                 :                : #endif
                                 23                 :                : 
                                 24                 :                : #include <openssl/err.h>
                                 25                 :                : #include <openssl/evp.h>
                                 26                 :                : 
                                 27                 :                : #include "common/cryptohash.h"
                                 28                 :                : #include "common/md5.h"
                                 29                 :                : #include "common/sha1.h"
                                 30                 :                : #include "common/sha2.h"
                                 31                 :                : #ifndef FRONTEND
                                 32                 :                : #include "utils/memutils.h"
                                 33                 :                : #include "utils/resowner.h"
                                 34                 :                : #endif
                                 35                 :                : 
                                 36                 :                : /*
                                 37                 :                :  * In the backend, use an allocation in TopMemoryContext to count for
                                 38                 :                :  * resowner cleanup handling.  In the frontend, use malloc to be able
                                 39                 :                :  * to return a failure status back to the caller.
                                 40                 :                :  */
                                 41                 :                : #ifndef FRONTEND
                                 42                 :                : #define ALLOC(size) MemoryContextAlloc(TopMemoryContext, size)
                                 43                 :                : #define FREE(ptr) pfree(ptr)
                                 44                 :                : #else
                                 45                 :                : #define ALLOC(size) malloc(size)
                                 46                 :                : #define FREE(ptr) free(ptr)
                                 47                 :                : #endif
                                 48                 :                : 
                                 49                 :                : /* Set of error states */
                                 50                 :                : typedef enum pg_cryptohash_errno
                                 51                 :                : {
                                 52                 :                :     PG_CRYPTOHASH_ERROR_NONE = 0,
                                 53                 :                :     PG_CRYPTOHASH_ERROR_DEST_LEN,
                                 54                 :                :     PG_CRYPTOHASH_ERROR_OPENSSL,
                                 55                 :                : } pg_cryptohash_errno;
                                 56                 :                : 
                                 57                 :                : /*
                                 58                 :                :  * Internal pg_cryptohash_ctx structure.
                                 59                 :                :  *
                                 60                 :                :  * This tracks the resource owner associated to each EVP context data
                                 61                 :                :  * for the backend.
                                 62                 :                :  */
                                 63                 :                : struct pg_cryptohash_ctx
                                 64                 :                : {
                                 65                 :                :     pg_cryptohash_type type;
                                 66                 :                :     pg_cryptohash_errno error;
                                 67                 :                :     const char *errreason;
                                 68                 :                : 
                                 69                 :                :     EVP_MD_CTX *evpctx;
                                 70                 :                : #if OPENSSL_VERSION_NUMBER >= 0x30000000L
                                 71                 :                :     EVP_MD     *algo;
                                 72                 :                : #endif
                                 73                 :                : 
                                 74                 :                : #ifndef FRONTEND
                                 75                 :                :     ResourceOwner resowner;
                                 76                 :                : #endif
                                 77                 :                : };
                                 78                 :                : 
                                 79                 :                : /* ResourceOwner callbacks to hold cryptohash contexts */
                                 80                 :                : #ifndef FRONTEND
                                 81                 :                : static void ResOwnerReleaseCryptoHash(Datum res);
                                 82                 :                : 
                                 83                 :                : static const ResourceOwnerDesc cryptohash_resowner_desc =
                                 84                 :                : {
                                 85                 :                :     .name = "OpenSSL cryptohash context",
                                 86                 :                :     .release_phase = RESOURCE_RELEASE_BEFORE_LOCKS,
                                 87                 :                :     .release_priority = RELEASE_PRIO_CRYPTOHASH_CONTEXTS,
                                 88                 :                :     .ReleaseResource = ResOwnerReleaseCryptoHash,
                                 89                 :                :     .DebugPrint = NULL          /* the default message is fine */
                                 90                 :                : };
                                 91                 :                : 
                                 92                 :                : /* Convenience wrappers over ResourceOwnerRemember/Forget */
                                 93                 :                : static inline void
 1023 heikki.linnakangas@i       94                 :CBC      687168 : ResourceOwnerRememberCryptoHash(ResourceOwner owner, pg_cryptohash_ctx *ctx)
                                 95                 :                : {
                                 96                 :         687168 :     ResourceOwnerRemember(owner, PointerGetDatum(ctx), &cryptohash_resowner_desc);
                                 97                 :         687168 : }
                                 98                 :                : static inline void
                                 99                 :         687158 : ResourceOwnerForgetCryptoHash(ResourceOwner owner, pg_cryptohash_ctx *ctx)
                                100                 :                : {
                                101                 :         687158 :     ResourceOwnerForget(owner, PointerGetDatum(ctx), &cryptohash_resowner_desc);
                                102                 :         687158 : }
                                103                 :                : #endif
                                104                 :                : 
                                105                 :                : static const char *
 1689 michael@paquier.xyz       106                 :UBC           0 : SSLerrmessage(unsigned long ecode)
                                107                 :                : {
                                108         [ #  # ]:              0 :     if (ecode == 0)
                                109                 :              0 :         return NULL;
                                110                 :                : 
                                111                 :                :     /*
                                112                 :                :      * This may return NULL, but we would fall back to a default error path if
                                113                 :                :      * that were the case.
                                114                 :                :      */
                                115                 :              0 :     return ERR_reason_error_string(ecode);
                                116                 :                : }
                                117                 :                : 
                                118                 :                : /*
                                119                 :                :  * pg_cryptohash_create
                                120                 :                :  *
                                121                 :                :  * Allocate a hash context.  Returns NULL on failure for an OOM.  The
                                122                 :                :  * backend issues an error, without returning.
                                123                 :                :  */
                                124                 :                : pg_cryptohash_ctx *
 2094 michael@paquier.xyz       125                 :CBC      697657 : pg_cryptohash_create(pg_cryptohash_type type)
                                126                 :                : {
                                127                 :                :     pg_cryptohash_ctx *ctx;
                                128                 :                : 
                                129                 :                :     /*
                                130                 :                :      * Make sure that the resource owner has space to remember this reference.
                                131                 :                :      * This can error out with "out of memory", so do this before any other
                                132                 :                :      * allocation to avoid leaking.
                                133                 :                :      */
                                134                 :                : #ifndef FRONTEND
 1023 heikki.linnakangas@i      135                 :         687168 :     ResourceOwnerEnlarge(CurrentResourceOwner);
                                136                 :                : #endif
                                137                 :                : 
 2094 michael@paquier.xyz       138                 :         697657 :     ctx = ALLOC(sizeof(pg_cryptohash_ctx));
                                139         [ -  + ]:         697657 :     if (ctx == NULL)
 2094 michael@paquier.xyz       140                 :UBC           0 :         return NULL;
 2058 michael@paquier.xyz       141                 :CBC      697657 :     memset(ctx, 0, sizeof(pg_cryptohash_ctx));
 2092                           142                 :         697657 :     ctx->type = type;
 1689                           143                 :         697657 :     ctx->error = PG_CRYPTOHASH_ERROR_NONE;
                                144                 :         697657 :     ctx->errreason = NULL;
                                145                 :                : 
                                146                 :                :     /*
                                147                 :                :      * Initialization takes care of assigning the correct type for OpenSSL.
                                148                 :                :      * Also ensure that there aren't any unconsumed errors in the queue from
                                149                 :                :      * previous runs.
                                150                 :                :      */
 1574 dgustafsson@postgres      151                 :         697657 :     ERR_clear_error();
 2058 michael@paquier.xyz       152                 :         697657 :     ctx->evpctx = EVP_MD_CTX_create();
                                153                 :                : 
                                154         [ -  + ]:         697657 :     if (ctx->evpctx == NULL)
                                155                 :                :     {
 2094 michael@paquier.xyz       156                 :UBC           0 :         explicit_bzero(ctx, sizeof(pg_cryptohash_ctx));
 2058                           157                 :              0 :         FREE(ctx);
                                158                 :                : #ifndef FRONTEND
 2092                           159         [ #  # ]:              0 :         ereport(ERROR,
                                160                 :                :                 (errcode(ERRCODE_OUT_OF_MEMORY),
                                161                 :                :                  errmsg("out of memory")));
                                162                 :                : #else
 2094                           163                 :              0 :         return NULL;
                                164                 :                : #endif
                                165                 :                :     }
                                166                 :                : 
                                167                 :                : #ifndef FRONTEND
 2058 michael@paquier.xyz       168                 :CBC      687168 :     ctx->resowner = CurrentResourceOwner;
 1023 heikki.linnakangas@i      169                 :         687168 :     ResourceOwnerRememberCryptoHash(CurrentResourceOwner, ctx);
                                170                 :                : #endif
                                171                 :                : 
 2094 michael@paquier.xyz       172                 :         697657 :     return ctx;
                                173                 :                : }
                                174                 :                : 
                                175                 :                : /*
                                176                 :                :  * pg_cryptohash_init
                                177                 :                :  *
                                178                 :                :  * Initialize a hash context.  Returns 0 on success, and -1 on failure.
                                179                 :                :  */
                                180                 :                : int
                                181                 :         697657 : pg_cryptohash_init(pg_cryptohash_ctx *ctx)
                                182                 :                : {
                                183                 :         697657 :     int         status = 0;
                                184                 :                : #if OPENSSL_VERSION_NUMBER >= 0x30000000L
   17 michael@paquier.xyz       185                 :GNC      697657 :     const char *name = NULL;
                                186                 :                : #endif
                                187                 :                : 
 2094 michael@paquier.xyz       188         [ -  + ]:CBC      697657 :     if (ctx == NULL)
 2058 michael@paquier.xyz       189                 :UBC           0 :         return -1;
                                190                 :                : 
                                191                 :                : #if OPENSSL_VERSION_NUMBER >= 0x30000000L
                                192                 :                : 
                                193                 :                :     /*
                                194                 :                :      * Fetch the digest implementation so that it is served by the loaded
                                195                 :                :      * provider.
                                196                 :                :      */
   17 michael@paquier.xyz       197   [ +  -  +  +  :GNC      697657 :     switch (ctx->type)
                                           +  +  - ]
                                198                 :                :     {
                                199                 :            124 :         case PG_MD5:
                                200                 :            124 :             name = "MD5";
                                201                 :            124 :             break;
   17 michael@paquier.xyz       202                 :UNC           0 :         case PG_SHA1:
                                203                 :              0 :             name = "SHA1";
                                204                 :              0 :             break;
   17 michael@paquier.xyz       205                 :GNC        6183 :         case PG_SHA224:
                                206                 :           6183 :             name = "SHA224";
                                207                 :           6183 :             break;
                                208                 :         683098 :         case PG_SHA256:
                                209                 :         683098 :             name = "SHA256";
                                210                 :         683098 :             break;
                                211                 :           4126 :         case PG_SHA384:
                                212                 :           4126 :             name = "SHA384";
                                213                 :           4126 :             break;
                                214                 :           4126 :         case PG_SHA512:
                                215                 :           4126 :             name = "SHA512";
                                216                 :           4126 :             break;
                                217                 :                :     }
                                218                 :                : 
                                219                 :                :     /*
                                220                 :                :      * Call EVP_MD_fetch() only once for each context, as provider lookups can
                                221                 :                :      * be expensive.
                                222                 :                :      */
                                223         [ +  - ]:         697657 :     if (ctx->algo == NULL)
                                224                 :         697657 :         ctx->algo = EVP_MD_fetch(NULL, name, NULL);
                                225         [ +  - ]:         697657 :     if (ctx->algo != NULL)
                                226                 :         697657 :         status = EVP_DigestInit_ex(ctx->evpctx, ctx->algo, NULL);
                                227                 :                : #else
 2094 michael@paquier.xyz       228   [ +  -  +  +  :ECB    (697657) :     switch (ctx->type)
                                           +  +  - ]
                                229                 :                :     {
 2086                           230                 :          (124) :         case PG_MD5:
 2058                           231                 :          (124) :             status = EVP_DigestInit_ex(ctx->evpctx, EVP_md5(), NULL);
 2086                           232                 :          (124) :             break;
 2042 michael@paquier.xyz       233                 :EUB             :         case PG_SHA1:
                                234                 :                :             status = EVP_DigestInit_ex(ctx->evpctx, EVP_sha1(), NULL);
                                235                 :                :             break;
 2094 michael@paquier.xyz       236                 :ECB      (6183) :         case PG_SHA224:
 2058                           237                 :         (6183) :             status = EVP_DigestInit_ex(ctx->evpctx, EVP_sha224(), NULL);
 2094                           238                 :         (6183) :             break;
                                239                 :       (683098) :         case PG_SHA256:
 2058                           240                 :       (683098) :             status = EVP_DigestInit_ex(ctx->evpctx, EVP_sha256(), NULL);
 2094                           241                 :       (683098) :             break;
                                242                 :         (4126) :         case PG_SHA384:
 2058                           243                 :         (4126) :             status = EVP_DigestInit_ex(ctx->evpctx, EVP_sha384(), NULL);
 2094                           244                 :         (4126) :             break;
                                245                 :         (4126) :         case PG_SHA512:
 2058                           246                 :         (4126) :             status = EVP_DigestInit_ex(ctx->evpctx, EVP_sha512(), NULL);
 2094                           247                 :         (4126) :             break;
                                248                 :                :     }
                                249                 :                : #endif
                                250                 :                : 
                                251                 :                :     /* OpenSSL internals return 1 on success, 0 on failure */
 2094 michael@paquier.xyz       252         [ -  + ]:CBC      697657 :     if (status <= 0)
                                253                 :                :     {
 1689 michael@paquier.xyz       254                 :UBC           0 :         ctx->errreason = SSLerrmessage(ERR_get_error());
                                255                 :              0 :         ctx->error = PG_CRYPTOHASH_ERROR_OPENSSL;
                                256                 :                : 
                                257                 :                :         /*
                                258                 :                :          * The OpenSSL error queue should normally be empty since we've
                                259                 :                :          * consumed an error, but cipher initialization can in FIPS-enabled
                                260                 :                :          * OpenSSL builds generate two errors so clear the queue here as well.
                                261                 :                :          */
 1574 dgustafsson@postgres      262                 :              0 :         ERR_clear_error();
 2094 michael@paquier.xyz       263                 :              0 :         return -1;
                                264                 :                :     }
 2094 michael@paquier.xyz       265                 :CBC      697657 :     return 0;
                                266                 :                : }
                                267                 :                : 
                                268                 :                : /*
                                269                 :                :  * pg_cryptohash_update
                                270                 :                :  *
                                271                 :                :  * Update a hash context.  Returns 0 on success, and -1 on failure.
                                272                 :                :  */
                                273                 :                : int
                                274                 :         892891 : pg_cryptohash_update(pg_cryptohash_ctx *ctx, const uint8 *data, size_t len)
                                275                 :                : {
                                276                 :         892891 :     int         status = 0;
                                277                 :                : 
                                278         [ -  + ]:         892891 :     if (ctx == NULL)
 2058 michael@paquier.xyz       279                 :UBC           0 :         return -1;
                                280                 :                : 
 2058 michael@paquier.xyz       281                 :CBC      892891 :     status = EVP_DigestUpdate(ctx->evpctx, data, len);
                                282                 :                : 
                                283                 :                :     /* OpenSSL internals return 1 on success, 0 on failure */
 2094                           284         [ -  + ]:         892891 :     if (status <= 0)
                                285                 :                :     {
 1689 michael@paquier.xyz       286                 :UBC           0 :         ctx->errreason = SSLerrmessage(ERR_get_error());
                                287                 :              0 :         ctx->error = PG_CRYPTOHASH_ERROR_OPENSSL;
 2094                           288                 :              0 :         return -1;
                                289                 :                :     }
 2094 michael@paquier.xyz       290                 :CBC      892891 :     return 0;
                                291                 :                : }
                                292                 :                : 
                                293                 :                : /*
                                294                 :                :  * pg_cryptohash_final
                                295                 :                :  *
                                296                 :                :  * Finalize a hash context.  Returns 0 on success, and -1 on failure.
                                297                 :                :  */
                                298                 :                : int
 2019                           299                 :         697649 : pg_cryptohash_final(pg_cryptohash_ctx *ctx, uint8 *dest, size_t len)
                                300                 :                : {
 2094                           301                 :         697649 :     int         status = 0;
                                302                 :                : 
                                303         [ -  + ]:         697649 :     if (ctx == NULL)
 2058 michael@paquier.xyz       304                 :UBC           0 :         return -1;
                                305                 :                : 
 2019 michael@paquier.xyz       306   [ +  -  +  +  :CBC      697649 :     switch (ctx->type)
                                           +  +  - ]
                                307                 :                :     {
                                308                 :            124 :         case PG_MD5:
                                309         [ -  + ]:            124 :             if (len < MD5_DIGEST_LENGTH)
                                310                 :                :             {
 1689 michael@paquier.xyz       311                 :UBC           0 :                 ctx->error = PG_CRYPTOHASH_ERROR_DEST_LEN;
 2019                           312                 :              0 :                 return -1;
                                313                 :                :             }
 2019 michael@paquier.xyz       314                 :CBC         124 :             break;
 2019 michael@paquier.xyz       315                 :UBC           0 :         case PG_SHA1:
                                316         [ #  # ]:              0 :             if (len < SHA1_DIGEST_LENGTH)
                                317                 :                :             {
 1689                           318                 :              0 :                 ctx->error = PG_CRYPTOHASH_ERROR_DEST_LEN;
 2019                           319                 :              0 :                 return -1;
                                320                 :                :             }
                                321                 :              0 :             break;
 2019 michael@paquier.xyz       322                 :CBC        6183 :         case PG_SHA224:
                                323         [ -  + ]:           6183 :             if (len < PG_SHA224_DIGEST_LENGTH)
                                324                 :                :             {
 1689 michael@paquier.xyz       325                 :UBC           0 :                 ctx->error = PG_CRYPTOHASH_ERROR_DEST_LEN;
 2019                           326                 :              0 :                 return -1;
                                327                 :                :             }
 2019 michael@paquier.xyz       328                 :CBC        6183 :             break;
                                329                 :         683090 :         case PG_SHA256:
                                330         [ -  + ]:         683090 :             if (len < PG_SHA256_DIGEST_LENGTH)
                                331                 :                :             {
 1689 michael@paquier.xyz       332                 :UBC           0 :                 ctx->error = PG_CRYPTOHASH_ERROR_DEST_LEN;
 2019                           333                 :              0 :                 return -1;
                                334                 :                :             }
 2019 michael@paquier.xyz       335                 :CBC      683090 :             break;
                                336                 :           4126 :         case PG_SHA384:
                                337         [ -  + ]:           4126 :             if (len < PG_SHA384_DIGEST_LENGTH)
                                338                 :                :             {
 1689 michael@paquier.xyz       339                 :UBC           0 :                 ctx->error = PG_CRYPTOHASH_ERROR_DEST_LEN;
 2019                           340                 :              0 :                 return -1;
                                341                 :                :             }
 2019 michael@paquier.xyz       342                 :CBC        4126 :             break;
                                343                 :           4126 :         case PG_SHA512:
                                344         [ -  + ]:           4126 :             if (len < PG_SHA512_DIGEST_LENGTH)
                                345                 :                :             {
 1689 michael@paquier.xyz       346                 :UBC           0 :                 ctx->error = PG_CRYPTOHASH_ERROR_DEST_LEN;
 2019                           347                 :              0 :                 return -1;
                                348                 :                :             }
 2019 michael@paquier.xyz       349                 :CBC        4126 :             break;
                                350                 :                :     }
                                351                 :                : 
 2058                           352                 :         697649 :     status = EVP_DigestFinal_ex(ctx->evpctx, dest, 0);
                                353                 :                : 
                                354                 :                :     /* OpenSSL internals return 1 on success, 0 on failure */
 2094                           355         [ -  + ]:         697649 :     if (status <= 0)
                                356                 :                :     {
 1689 michael@paquier.xyz       357                 :UBC           0 :         ctx->errreason = SSLerrmessage(ERR_get_error());
                                358                 :              0 :         ctx->error = PG_CRYPTOHASH_ERROR_OPENSSL;
 2094                           359                 :              0 :         return -1;
                                360                 :                :     }
 2094 michael@paquier.xyz       361                 :CBC      697649 :     return 0;
                                362                 :                : }
                                363                 :                : 
                                364                 :                : /*
                                365                 :                :  * pg_cryptohash_free
                                366                 :                :  *
                                367                 :                :  * Free a hash context.
                                368                 :                :  */
                                369                 :                : void
                                370                 :         697654 : pg_cryptohash_free(pg_cryptohash_ctx *ctx)
                                371                 :                : {
                                372         [ +  + ]:         697654 :     if (ctx == NULL)
                                373                 :              1 :         return;
                                374                 :                : 
 2058                           375                 :         697653 :     EVP_MD_CTX_destroy(ctx->evpctx);
                                376                 :                : #if OPENSSL_VERSION_NUMBER >= 0x30000000L
   17 michael@paquier.xyz       377                 :GNC      697653 :     EVP_MD_free(ctx->algo);
                                378                 :                : #endif
                                379                 :                : 
                                380                 :                : #ifndef FRONTEND
 1023 heikki.linnakangas@i      381         [ +  + ]:CBC      687168 :     if (ctx->resowner)
                                382                 :         687158 :         ResourceOwnerForgetCryptoHash(ctx->resowner, ctx);
                                383                 :                : #endif
                                384                 :                : 
 2094 michael@paquier.xyz       385                 :         697653 :     explicit_bzero(ctx, sizeof(pg_cryptohash_ctx));
                                386                 :         697653 :     FREE(ctx);
                                387                 :                : }
                                388                 :                : 
                                389                 :                : /*
                                390                 :                :  * pg_cryptohash_error
                                391                 :                :  *
                                392                 :                :  * Returns a static string providing details about an error that
                                393                 :                :  * happened during a computation.
                                394                 :                :  */
                                395                 :                : const char *
 1689 michael@paquier.xyz       396                 :UBC           0 : pg_cryptohash_error(pg_cryptohash_ctx *ctx)
                                397                 :                : {
                                398                 :                :     /*
                                399                 :                :      * This implementation would never fail because of an out-of-memory error,
                                400                 :                :      * except when creating the context.
                                401                 :                :      */
                                402         [ #  # ]:              0 :     if (ctx == NULL)
                                403                 :              0 :         return _("out of memory");
                                404                 :                : 
                                405                 :                :     /*
                                406                 :                :      * If a reason is provided, rely on it, else fallback to any error code
                                407                 :                :      * set.
                                408                 :                :      */
                                409         [ #  # ]:              0 :     if (ctx->errreason)
                                410                 :              0 :         return ctx->errreason;
                                411                 :                : 
                                412   [ #  #  #  # ]:              0 :     switch (ctx->error)
                                413                 :                :     {
                                414                 :              0 :         case PG_CRYPTOHASH_ERROR_NONE:
                                415                 :              0 :             return _("success");
                                416                 :              0 :         case PG_CRYPTOHASH_ERROR_DEST_LEN:
                                417                 :              0 :             return _("destination buffer too small");
                                418                 :              0 :         case PG_CRYPTOHASH_ERROR_OPENSSL:
                                419                 :              0 :             return _("OpenSSL failure");
                                420                 :                :     }
                                421                 :                : 
                                422                 :              0 :     Assert(false);              /* cannot be reached */
                                423                 :                :     return _("success");
                                424                 :                : }
                                425                 :                : 
                                426                 :                : /* ResourceOwner callbacks */
                                427                 :                : 
                                428                 :                : #ifndef FRONTEND
                                429                 :                : static void
 1023 heikki.linnakangas@i      430                 :CBC          10 : ResOwnerReleaseCryptoHash(Datum res)
                                431                 :                : {
                                432                 :             10 :     pg_cryptohash_ctx *ctx = (pg_cryptohash_ctx *) DatumGetPointer(res);
                                433                 :                : 
                                434                 :             10 :     ctx->resowner = NULL;
                                435                 :             10 :     pg_cryptohash_free(ctx);
                                436                 :             10 : }
                                437                 :                : #endif
        

Generated by: LCOV version 2.0-1