ssl/s3_enc.c:462: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 430, column 11 is not reachable after line 462, column 5.
Showing all 77 steps of the trace


ssl/s3_enc.c:413:1: start of procedure ssl3_final_finish_mac()
411.   }
412.   
413. > size_t ssl3_final_finish_mac(SSL *s, const char *sender, size_t len,
414.                                unsigned char *p)
415.   {

ssl/s3_enc.c:417:5: 
415.   {
416.       int ret;
417. >     EVP_MD_CTX *ctx = NULL;
418.   
419.       if (!ssl3_digest_cached_records(s, 0)) {

ssl/s3_enc.c:419:10: 
417.       EVP_MD_CTX *ctx = NULL;
418.   
419. >     if (!ssl3_digest_cached_records(s, 0)) {
420.           /* SSLfatal() already called */
421.           return 0;

test/tls13secretstest.c:129:1: start of procedure ssl3_digest_cached_records()
  127.   
  128.   /* Mocked out implementations of various functions */
  129. > int ssl3_digest_cached_records(SSL *s, int keep)
  130.   {
  131.       return 1;

test/tls13secretstest.c:131:5: 
  129.   int ssl3_digest_cached_records(SSL *s, int keep)
  130.   {
  131. >     return 1;
  132.   }
  133.   

test/tls13secretstest.c:132:1: return from a call to ssl3_digest_cached_records
  130.   {
  131.       return 1;
  132. > }
  133.   
  134.   static int full_hash = 0;

ssl/s3_enc.c:419:10: Taking false branch
417.       EVP_MD_CTX *ctx = NULL;
418.   
419.       if (!ssl3_digest_cached_records(s, 0)) {
                ^
420.           /* SSLfatal() already called */
421.           return 0;

ssl/s3_enc.c:424:9: 
422.       }
423.   
424. >     if (EVP_MD_CTX_type(s->s3->handshake_dgst) != NID_md5_sha1) {
425.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,
426.                    SSL_R_NO_REQUIRED_DIGEST);

crypto/evp/evp_lib.c:451:1: start of procedure EVP_MD_CTX_md()
  449.   }
  450.   
  451. > const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)
  452.   {
  453.       if (!ctx)

crypto/evp/evp_lib.c:453:10: Taking false branch
  451.   const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)
  452.   {
  453.       if (!ctx)
                  ^
  454.           return NULL;
  455.       return ctx->digest;

crypto/evp/evp_lib.c:455:5: 
  453.       if (!ctx)
  454.           return NULL;
  455. >     return ctx->digest;
  456.   }
  457.   

crypto/evp/evp_lib.c:456:1: return from a call to EVP_MD_CTX_md
  454.           return NULL;
  455.       return ctx->digest;
  456. > }
  457.   
  458.   EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx)

crypto/evp/evp_lib.c:303:1: start of procedure EVP_MD_type()
  301.   }
  302.   
  303. > int EVP_MD_type(const EVP_MD *md)
  304.   {
  305.       return md->type;

crypto/evp/evp_lib.c:305:5: 
  303.   int EVP_MD_type(const EVP_MD *md)
  304.   {
  305. >     return md->type;
  306.   }
  307.   

crypto/evp/evp_lib.c:306:1: return from a call to EVP_MD_type
  304.   {
  305.       return md->type;
  306. > }
  307.   
  308.   int EVP_MD_pkey_type(const EVP_MD *md)

ssl/s3_enc.c:424:9: Taking false branch
422.       }
423.   
424.       if (EVP_MD_CTX_type(s->s3->handshake_dgst) != NID_md5_sha1) {
               ^
425.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,
426.                    SSL_R_NO_REQUIRED_DIGEST);

ssl/s3_enc.c:430:5: 
428.       }
429.   
430. >     ctx = EVP_MD_CTX_new();
431.       if (ctx == NULL) {
432.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,

crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_new()
  47.   }
  48.   
  49. > EVP_MD_CTX *EVP_MD_CTX_new(void)
  50.   {
  51.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));

crypto/evp/digest.c:51:5: 
  49.   EVP_MD_CTX *EVP_MD_CTX_new(void)
  50.   {
  51. >     return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  52.   }
  53.   

crypto/mem.c:228:1: start of procedure CRYPTO_zalloc()
    226.   }
    227.   
    228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:230:5: 
    228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230. >     void *ret = CRYPTO_malloc(num, file, line);
    231.   
    232.       FAILTEST();

crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
      190.   #endif
      191.   
      192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      193.   {
      194.       void *ret = NULL;

crypto/mem.c:194:5: 
      192.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      193.   {
      194. >     void *ret = NULL;
      195.   
      196.       INCREMENT(malloc_count);

crypto/mem.c:197:9: Taking false branch
      195.   
      196.       INCREMENT(malloc_count);
      197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      198.           return malloc_impl(num, file, line);
      199.   

crypto/mem.c:200:9: Taking false branch
      198.           return malloc_impl(num, file, line);
      199.   
      200.       if (num == 0)
                     ^
      201.           return NULL;
      202.   

crypto/mem.c:204:9: Taking true branch
      202.   
      203.       FAILTEST();
      204.       if (allow_customize) {
                     ^
      205.           /*
      206.            * Disallow customization after the first allocation. We only set this

crypto/mem.c:210:9: 
      208.            * allocation.
      209.            */
      210. >         allow_customize = 0;
      211.       }
      212.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:221:5: 
      219.       }
      220.   #else
      221. >     (void)(file); (void)(line);
      222.       ret = malloc(num);
      223.   #endif

crypto/mem.c:221:19: 
      219.       }
      220.   #else
      221. >     (void)(file); (void)(line);
      222.       ret = malloc(num);
      223.   #endif

crypto/mem.c:222:5: 
      220.   #else
      221.       (void)(file); (void)(line);
      222. >     ret = malloc(num);
      223.   #endif
      224.   

crypto/mem.c:225:5: 
      223.   #endif
      224.   
      225. >     return ret;
      226.   }
      227.   

crypto/mem.c:226:1: return from a call to CRYPTO_malloc
      224.   
      225.       return ret;
      226. > }
      227.   
      228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:233:9: Taking true branch
    231.   
    232.       FAILTEST();
    233.       if (ret != NULL)
                   ^
    234.           memset(ret, 0, num);
    235.       return ret;

crypto/mem.c:234:9: 
    232.       FAILTEST();
    233.       if (ret != NULL)
    234. >         memset(ret, 0, num);
    235.       return ret;
    236.   }

crypto/mem.c:235:5: 
    233.       if (ret != NULL)
    234.           memset(ret, 0, num);
    235. >     return ret;
    236.   }
    237.   

crypto/mem.c:236:1: return from a call to CRYPTO_zalloc
    234.           memset(ret, 0, num);
    235.       return ret;
    236. > }
    237.   
    238.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:52:1: return from a call to EVP_MD_CTX_new
  50.   {
  51.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  52. > }
  53.   
  54.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)

ssl/s3_enc.c:431:9: Taking false branch
429.   
430.       ctx = EVP_MD_CTX_new();
431.       if (ctx == NULL) {
               ^
432.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,
433.                    ERR_R_MALLOC_FAILURE);

ssl/s3_enc.c:436:10: 
434.           return 0;
435.       }
436. >     if (!EVP_MD_CTX_copy_ex(ctx, s->s3->handshake_dgst)) {
437.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,
438.                    ERR_R_INTERNAL_ERROR);

crypto/evp/digest.c:209:1: start of procedure EVP_MD_CTX_copy_ex()
  207.   }
  208.   
  209. > int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in)
  210.   {
  211.       unsigned char *tmp_buf;

crypto/evp/digest.c:212:10: Taking false branch
  210.   {
  211.       unsigned char *tmp_buf;
  212.       if ((in == NULL) || (in->digest == NULL)) {
                  ^
  213.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, EVP_R_INPUT_NOT_INITIALIZED);
  214.           return 0;

crypto/evp/digest.c:212:26: Taking false branch
  210.   {
  211.       unsigned char *tmp_buf;
  212.       if ((in == NULL) || (in->digest == NULL)) {
                                  ^
  213.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, EVP_R_INPUT_NOT_INITIALIZED);
  214.           return 0;

crypto/evp/digest.c:218:9: Taking true branch
  216.   #ifndef OPENSSL_NO_ENGINE
  217.       /* Make sure it's safe to copy a digest context using an ENGINE */
  218.       if (in->engine && !ENGINE_init(in->engine)) {
                 ^
  219.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
  220.           return 0;

crypto/evp/digest.c:218:24: 
  216.   #ifndef OPENSSL_NO_ENGINE
  217.       /* Make sure it's safe to copy a digest context using an ENGINE */
  218. >     if (in->engine && !ENGINE_init(in->engine)) {
  219.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
  220.           return 0;

crypto/engine/eng_init.c:77:1: start of procedure ENGINE_init()
    75.   
    76.   /* The API (locked) version of "init" */
    77. > int ENGINE_init(ENGINE *e)
    78.   {
    79.       int ret;

crypto/engine/eng_init.c:80:9: Taking false branch
    78.   {
    79.       int ret;
    80.       if (e == NULL) {
                  ^
    81.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_PASSED_NULL_PARAMETER);
    82.           return 0;

crypto/engine/eng_init.c:84:10: 
    82.           return 0;
    83.       }
    84. >     if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
    85.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
    86.           return 0;

crypto/threads_pthread.c:111:1: start of procedure CRYPTO_THREAD_run_once()
      109.   }
      110.   
      111. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
      112.   {
      113.       if (pthread_once(once, init) != 0)

crypto/threads_pthread.c:113:9: Taking true branch
      111.   int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
      112.   {
      113.       if (pthread_once(once, init) != 0)
                     ^
      114.           return 0;
      115.   

crypto/threads_pthread.c:114:9: 
      112.   {
      113.       if (pthread_once(once, init) != 0)
      114. >         return 0;
      115.   
      116.       return 1;

crypto/threads_pthread.c:117:1: return from a call to CRYPTO_THREAD_run_once
      115.   
      116.       return 1;
      117. > }
      118.   
      119.   int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))

crypto/engine/eng_init.c:84:10: Condition is false
    82.           return 0;
    83.       }
    84.       if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
                   ^
    85.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
    86.           return 0;

crypto/engine/eng_init.c:84:10: Taking true branch
    82.           return 0;
    83.       }
    84.       if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
                   ^
    85.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
    86.           return 0;

crypto/engine/eng_init.c:85:9: Skipping ERR_put_error(): empty list of specs
    83.       }
    84.       if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
    85.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
                  ^
    86.           return 0;
    87.       }

crypto/engine/eng_init.c:86:9: 
    84.       if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
    85.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
    86. >         return 0;
    87.       }
    88.       CRYPTO_THREAD_write_lock(global_engine_lock);

crypto/engine/eng_init.c:92:1: return from a call to ENGINE_init
    90.       CRYPTO_THREAD_unlock(global_engine_lock);
    91.       return ret;
    92. > }
    93.   
    94.   /* The API (locked) version of "finish" */

crypto/evp/digest.c:218:24: Taking true branch
  216.   #ifndef OPENSSL_NO_ENGINE
  217.       /* Make sure it's safe to copy a digest context using an ENGINE */
  218.       if (in->engine && !ENGINE_init(in->engine)) {
                                ^
  219.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
  220.           return 0;

crypto/evp/digest.c:219:9: Skipping ERR_put_error(): empty list of specs
  217.       /* Make sure it's safe to copy a digest context using an ENGINE */
  218.       if (in->engine && !ENGINE_init(in->engine)) {
  219.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
                 ^
  220.           return 0;
  221.       }

crypto/evp/digest.c:220:9: 
  218.       if (in->engine && !ENGINE_init(in->engine)) {
  219.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
  220. >         return 0;
  221.       }
  222.   #endif

crypto/evp/digest.c:269:1: return from a call to EVP_MD_CTX_copy_ex
  267.   
  268.       return 1;
  269. > }
  270.   
  271.   int EVP_Digest(const void *data, size_t count,

ssl/s3_enc.c:436:10: Taking true branch
434.           return 0;
435.       }
436.       if (!EVP_MD_CTX_copy_ex(ctx, s->s3->handshake_dgst)) {
                ^
437.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,
438.                    ERR_R_INTERNAL_ERROR);

ssl/s3_enc.c:437:9: 
435.       }
436.       if (!EVP_MD_CTX_copy_ex(ctx, s->s3->handshake_dgst)) {
437. >         SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,
438.                    ERR_R_INTERNAL_ERROR);
439.           ret = 0;

test/tls13secretstest.c:194:1: start of procedure ossl_statem_fatal()
  192.   }
  193.   
  194. > void ossl_statem_fatal(SSL *s, int al, int func, int reason, const char *file,
  195.                              int line)
  196.   {

test/tls13secretstest.c:197:1: return from a call to ossl_statem_fatal
  195.                              int line)
  196.   {
  197. > }
  198.   
  199.   int ossl_statem_export_allowed(SSL *s)

ssl/s3_enc.c:439:9: 
437.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,
438.                    ERR_R_INTERNAL_ERROR);
439. >         ret = 0;
440.           goto err;
441.       }

ssl/s3_enc.c:461:2: 
459.       }
460.   
461. >  err:
462.       EVP_MD_CTX_free(ctx);
463.   

ssl/s3_enc.c:462:5: 
460.   
461.    err:
462. >     EVP_MD_CTX_free(ctx);
463.   
464.       return ret;

crypto/evp/digest.c:54:1: start of procedure EVP_MD_CTX_free()
  52.   }
  53.   
  54. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  55.   {
  56.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:56:5: Skipping EVP_MD_CTX_reset(): empty list of specs
  54.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  55.   {
  56.       EVP_MD_CTX_reset(ctx);
            ^
  57.       OPENSSL_free(ctx);
  58.   }

crypto/evp/digest.c:57:5: 
  55.   {
  56.       EVP_MD_CTX_reset(ctx);
  57. >     OPENSSL_free(ctx);
  58.   }
  59.   

crypto/mem.c:295:1: start of procedure CRYPTO_free()
    293.   }
    294.   
    295. > void CRYPTO_free(void *str, const char *file, int line)
    296.   {
    297.       INCREMENT(free_count);

crypto/mem.c:298:9: Taking true branch
    296.   {
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    299.           free_impl(str, file, line);
    300.           return;

crypto/mem.c:298:30: Taking true branch
    296.   {
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    299.           free_impl(str, file, line);
    300.           return;

crypto/mem.c:299:9: Skipping __function_pointer__(): unresolved function pointer
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    299.           free_impl(str, file, line);
                   ^
    300.           return;
    301.       }

crypto/mem.c:300:9: 
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    299.           free_impl(str, file, line);
    300. >         return;
    301.       }
    302.   

crypto/mem.c:314:1: return from a call to CRYPTO_free
    312.       free(str);
    313.   #endif
    314. > }
    315.   
    316.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:58:1: return from a call to EVP_MD_CTX_free
  56.       EVP_MD_CTX_reset(ctx);
  57.       OPENSSL_free(ctx);
  58. > }
  59.   
  60.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)

size_t ssl3_final_finish_mac(SSL *s, const char *sender, size_t len,
                             unsigned char *p)
{
    int ret;
    EVP_MD_CTX *ctx = NULL;
    if (!ssl3_digest_cached_records(s, 0)) {
        return 0;
    }
    if (EVP_MD_CTX_type(s->s3->handshake_dgst) != NID_md5_sha1) {
        SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,
                 SSL_R_NO_REQUIRED_DIGEST);
        return 0;
    }
    ctx = EVP_MD_CTX_new();
    if (ctx == NULL) {
        SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,
                 ERR_R_MALLOC_FAILURE);
        return 0;
    }
    if (!EVP_MD_CTX_copy_ex(ctx, s->s3->handshake_dgst)) {
        SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,
                 ERR_R_INTERNAL_ERROR);
        ret = 0;
        goto err;
    }
    ret = EVP_MD_CTX_size(ctx);
    if (ret < 0) {
        SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,
                 ERR_R_INTERNAL_ERROR);
        ret = 0;
        goto err;
    }
    if ((sender != NULL && EVP_DigestUpdate(ctx, sender, len) <= 0)
        || EVP_MD_CTX_ctrl(ctx, EVP_CTRL_SSL3_MASTER_SECRET,
                           (int)s->session->master_key_length,
                           s->session->master_key) <= 0
        || EVP_DigestFinal_ex(ctx, p, NULL) <= 0) {
        SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,
                 ERR_R_INTERNAL_ERROR);
        ret = 0;
    }
 err:
    EVP_MD_CTX_free(ctx);
    return ret;
}
['size_t ssl3_final_finish_mac(SSL *s, const char *sender, size_t len,\n                             unsigned char *p)\n{\n    int ret;\n    EVP_MD_CTX *ctx = NULL;\n    if (!ssl3_digest_cached_records(s, 0)) {\n        return 0;\n    }\n    if (EVP_MD_CTX_type(s->s3->handshake_dgst) != NID_md5_sha1) {\n        SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,\n                 SSL_R_NO_REQUIRED_DIGEST);\n        return 0;\n    }\n    ctx = EVP_MD_CTX_new();\n    if (ctx == NULL) {\n        SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,\n                 ERR_R_MALLOC_FAILURE);\n        return 0;\n    }\n    if (!EVP_MD_CTX_copy_ex(ctx, s->s3->handshake_dgst)) {\n        SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,\n                 ERR_R_INTERNAL_ERROR);\n        ret = 0;\n        goto err;\n    }\n    ret = EVP_MD_CTX_size(ctx);\n    if (ret < 0) {\n        SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,\n                 ERR_R_INTERNAL_ERROR);\n        ret = 0;\n        goto err;\n    }\n    if ((sender != NULL && EVP_DigestUpdate(ctx, sender, len) <= 0)\n        || EVP_MD_CTX_ctrl(ctx, EVP_CTRL_SSL3_MASTER_SECRET,\n                           (int)s->session->master_key_length,\n                           s->session->master_key) <= 0\n        || EVP_DigestFinal_ex(ctx, p, NULL) <= 0) {\n        SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,\n                 ERR_R_INTERNAL_ERROR);\n        ret = 0;\n    }\n err:\n    EVP_MD_CTX_free(ctx);\n    return ret;\n}', 'int ssl3_digest_cached_records(SSL *s, int keep)\n{\n    return 1;\n}', 'const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)\n{\n    if (!ctx)\n        return NULL;\n    return ctx->digest;\n}', 'int EVP_MD_type(const EVP_MD *md)\n{\n    return md->type;\n}', 'EVP_MD_CTX *EVP_MD_CTX_new(void)\n{\n    return OPENSSL_zalloc(sizeof(EVP_MD_CTX));\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    FAILTEST();\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    INCREMENT(malloc_count);\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num == 0)\n        return NULL;\n    FAILTEST();\n    if (allow_customize) {\n        allow_customize = 0;\n    }\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)(file); (void)(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}', 'int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in)\n{\n    unsigned char *tmp_buf;\n    if ((in == NULL) || (in->digest == NULL)) {\n        EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, EVP_R_INPUT_NOT_INITIALIZED);\n        return 0;\n    }\n#ifndef OPENSSL_NO_ENGINE\n    if (in->engine && !ENGINE_init(in->engine)) {\n        EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);\n        return 0;\n    }\n#endif\n    if (out->digest == in->digest) {\n        tmp_buf = out->md_data;\n        EVP_MD_CTX_set_flags(out, EVP_MD_CTX_FLAG_REUSE);\n    } else\n        tmp_buf = NULL;\n    EVP_MD_CTX_reset(out);\n    memcpy(out, in, sizeof(*out));\n    EVP_MD_CTX_clear_flags(out, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX);\n    out->md_data = NULL;\n    out->pctx = NULL;\n    if (in->md_data && out->digest->ctx_size) {\n        if (tmp_buf)\n            out->md_data = tmp_buf;\n        else {\n            out->md_data = OPENSSL_malloc(out->digest->ctx_size);\n            if (out->md_data == NULL) {\n                EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_MALLOC_FAILURE);\n                return 0;\n            }\n        }\n        memcpy(out->md_data, in->md_data, out->digest->ctx_size);\n    }\n    out->update = in->update;\n    if (in->pctx) {\n        out->pctx = EVP_PKEY_CTX_dup(in->pctx);\n        if (!out->pctx) {\n            EVP_MD_CTX_reset(out);\n            return 0;\n        }\n    }\n    if (out->digest->copy)\n        return out->digest->copy(out, in);\n    return 1;\n}', 'int ENGINE_init(ENGINE *e)\n{\n    int ret;\n    if (e == NULL) {\n        ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_PASSED_NULL_PARAMETER);\n        return 0;\n    }\n    if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {\n        ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);\n        return 0;\n    }\n    CRYPTO_THREAD_write_lock(global_engine_lock);\n    ret = engine_unlocked_init(e);\n    CRYPTO_THREAD_unlock(global_engine_lock);\n    return ret;\n}', 'int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))\n{\n    if (pthread_once(once, init) != 0)\n        return 0;\n    return 1;\n}', 'void ossl_statem_fatal(SSL *s, int al, int func, int reason, const char *file,\n                           int line)\n{\n}', 'void EVP_MD_CTX_free(EVP_MD_CTX *ctx)\n{\n    EVP_MD_CTX_reset(ctx);\n    OPENSSL_free(ctx);\n}', 'void CRYPTO_free(void *str, const char *file, int line)\n{\n    INCREMENT(free_count);\n    if (free_impl != NULL && free_impl != &CRYPTO_free) {\n        free_impl(str, file, line);\n        return;\n    }\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_free(str, 0, file, line);\n        free(str);\n        CRYPTO_mem_debug_free(str, 1, file, line);\n    } else {\n        free(str);\n    }\n#else\n    free(str);\n#endif\n}']