crypto/rand/ossl_rand.c:507: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 313, column 9 is not reachable after line 507, column 5.
Showing all 50 steps of the trace


crypto/rand/ossl_rand.c:264:1: start of procedure rand_bytes()
262.   }
263.   
264. > static int rand_bytes(unsigned char *buf, int num)
265.   {
266.       static volatile int stirred_pool = 0;

crypto/rand/ossl_rand.c:266:5: 
264.   static int rand_bytes(unsigned char *buf, int num)
265.   {
266. >     static volatile int stirred_pool = 0;
267.       int i, j, k;
268.       size_t num_ceil, st_idx, st_num;

crypto/rand/ossl_rand.c:273:5: 
271.       unsigned char local_md[RAND_DIGEST_LENGTH];
272.       EVP_MD_CTX *m;
273. >     OSSL_RAND_STATE *sp = &global_state;
274.   #ifndef GETPID_IS_MEANINGLESS
275.       pid_t curr_pid = getpid();

crypto/rand/ossl_rand.c:275:5: 
273.       OSSL_RAND_STATE *sp = &global_state;
274.   #ifndef GETPID_IS_MEANINGLESS
275. >     pid_t curr_pid = getpid();
276.   #endif
277.       time_t curr_time = time(NULL);

crypto/rand/ossl_rand.c:277:5: 
275.       pid_t curr_pid = getpid();
276.   #endif
277. >     time_t curr_time = time(NULL);
278.       int do_stir_pool = 0;
279.   /* time value for various platforms */

crypto/rand/ossl_rand.c:278:5: 
276.   #endif
277.       time_t curr_time = time(NULL);
278. >     int do_stir_pool = 0;
279.   /* time value for various platforms */
280.   #ifdef OPENSSL_SYS_WIN32

crypto/rand/ossl_rand.c:297:5: 
295.   #else
296.       struct timeval tv;
297. >     gettimeofday(&tv, NULL);
298.   #endif
299.   

crypto/rand/ossl_rand.c:310:9: Taking false branch
308.   #endif
309.   
310.       if (num <= 0)
               ^
311.           return 1;
312.   

crypto/rand/ossl_rand.c:313:5: 
311.           return 1;
312.   
313. >     m = EVP_MD_CTX_new();
314.       if (m == NULL)
315.           goto err_mem;

crypto/evp/digest.c:44:1: start of procedure EVP_MD_CTX_new()
  42.   }
  43.   
  44. > EVP_MD_CTX *EVP_MD_CTX_new(void)
  45.   {
  46.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));

crypto/evp/digest.c:46:5: 
  44.   EVP_MD_CTX *EVP_MD_CTX_new(void)
  45.   {
  46. >     return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  47.   }
  48.   

crypto/mem.c:197:1: start of procedure CRYPTO_zalloc()
    195.   }
    196.   
    197. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    198.   {
    199.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:199:5: 
    197.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    198.   {
    199. >     void *ret = CRYPTO_malloc(num, file, line);
    200.   
    201.       FAILTEST();

crypto/mem.c:169:1: start of procedure CRYPTO_malloc()
      167.   #endif
      168.   
      169. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      170.   {
      171.       void *ret = NULL;

crypto/mem.c:171:5: 
      169.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      170.   {
      171. >     void *ret = NULL;
      172.   
      173.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:173:9: Taking false branch
      171.       void *ret = NULL;
      172.   
      173.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      174.           return malloc_impl(num, file, line);
      175.   

crypto/mem.c:176:9: Taking false branch
      174.           return malloc_impl(num, file, line);
      175.   
      176.       if (num == 0)
                     ^
      177.           return NULL;
      178.   

crypto/mem.c:180:5: 
      178.   
      179.       FAILTEST();
      180. >     allow_customize = 0;
      181.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      182.       if (call_malloc_debug) {

crypto/mem.c:190:5: 
      188.       }
      189.   #else
      190. >     osslargused(file); osslargused(line);
      191.       ret = malloc(num);
      192.   #endif

crypto/mem.c:190:24: 
      188.       }
      189.   #else
      190. >     osslargused(file); osslargused(line);
      191.       ret = malloc(num);
      192.   #endif

crypto/mem.c:191:5: 
      189.   #else
      190.       osslargused(file); osslargused(line);
      191. >     ret = malloc(num);
      192.   #endif
      193.   

crypto/mem.c:194:5: 
      192.   #endif
      193.   
      194. >     return ret;
      195.   }
      196.   

crypto/mem.c:195:1: return from a call to CRYPTO_malloc
      193.   
      194.       return ret;
      195. > }
      196.   
      197.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:202:9: Taking true branch
    200.   
    201.       FAILTEST();
    202.       if (ret != NULL)
                   ^
    203.           memset(ret, 0, num);
    204.       return ret;

crypto/mem.c:203:9: 
    201.       FAILTEST();
    202.       if (ret != NULL)
    203. >         memset(ret, 0, num);
    204.       return ret;
    205.   }

crypto/mem.c:204:5: 
    202.       if (ret != NULL)
    203.           memset(ret, 0, num);
    204. >     return ret;
    205.   }
    206.   

crypto/mem.c:205:1: return from a call to CRYPTO_zalloc
    203.           memset(ret, 0, num);
    204.       return ret;
    205. > }
    206.   
    207.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new
  45.   {
  46.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  47. > }
  48.   
  49.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)

crypto/rand/ossl_rand.c:314:9: Taking false branch
312.   
313.       m = EVP_MD_CTX_new();
314.       if (m == NULL)
               ^
315.           goto err_mem;
316.   

crypto/rand/ossl_rand.c:318:5: 
316.   
317.       /* round upwards to multiple of RAND_DIGEST_LENGTH/2 */
318. >     num_ceil =
319.           (1 + (num - 1) / (RAND_DIGEST_LENGTH / 2)) * (RAND_DIGEST_LENGTH / 2);
320.   

crypto/rand/ossl_rand.c:339:10: 
337.        */
338.   
339. >     if (!RUN_ONCE(&ossl_rand_init, do_ossl_rand_init))
340.           goto err_mem;
341.   

crypto/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once()
  103.   }
  104.   
  105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
  106.   {
  107.       if (pthread_once(once, init) != 0)

crypto/threads_pthread.c:107:9: Taking false branch
  105.   int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
  106.   {
  107.       if (pthread_once(once, init) != 0)
                 ^
  108.           return 0;
  109.   

crypto/threads_pthread.c:110:5: 
  108.           return 0;
  109.   
  110. >     return 1;
  111.   }
  112.   

crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once
  109.   
  110.       return 1;
  111. > }
  112.   
  113.   int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))

crypto/rand/ossl_rand.c:339:10: Condition is true
337.        */
338.   
339.       if (!RUN_ONCE(&ossl_rand_init, do_ossl_rand_init))
                ^
340.           goto err_mem;
341.   

crypto/rand/ossl_rand.c:339:10: Taking true branch
337.        */
338.   
339.       if (!RUN_ONCE(&ossl_rand_init, do_ossl_rand_init))
                ^
340.           goto err_mem;
341.   

crypto/rand/ossl_rand.c:505:2: 
503.       EVP_MD_CTX_free(m);
504.       return 0;
505. >  err_mem:
506.       RANDerr(RAND_F_RAND_BYTES, ERR_R_MALLOC_FAILURE);
507.       EVP_MD_CTX_free(m);

crypto/rand/ossl_rand.c:506:5: Skipping ERR_put_error(): empty list of specs
504.       return 0;
505.    err_mem:
506.       RANDerr(RAND_F_RAND_BYTES, ERR_R_MALLOC_FAILURE);
           ^
507.       EVP_MD_CTX_free(m);
508.       return 0;

crypto/rand/ossl_rand.c:507:5: 
505.    err_mem:
506.       RANDerr(RAND_F_RAND_BYTES, ERR_R_MALLOC_FAILURE);
507. >     EVP_MD_CTX_free(m);
508.       return 0;
509.   

crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_free()
  47.   }
  48.   
  49. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  50.   {
  51.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:51:5: Skipping EVP_MD_CTX_reset(): empty list of specs
  49.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  50.   {
  51.       EVP_MD_CTX_reset(ctx);
            ^
  52.       OPENSSL_free(ctx);
  53.   }

crypto/evp/digest.c:52:5: 
  50.   {
  51.       EVP_MD_CTX_reset(ctx);
  52. >     OPENSSL_free(ctx);
  53.   }
  54.   

crypto/mem.c:264:1: start of procedure CRYPTO_free()
    262.   }
    263.   
    264. > void CRYPTO_free(void *str, const char *file, int line)
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:266:9: Taking true branch
    264.   void CRYPTO_free(void *str, const char *file, int line)
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    267.           free_impl(str, file, line);
    268.           return;

crypto/mem.c:266:30: Taking true branch
    264.   void CRYPTO_free(void *str, const char *file, int line)
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    267.           free_impl(str, file, line);
    268.           return;

crypto/mem.c:267:9: Skipping __function_pointer__(): unresolved function pointer
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    267.           free_impl(str, file, line);
                   ^
    268.           return;
    269.       }

crypto/mem.c:268:9: 
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    267.           free_impl(str, file, line);
    268. >         return;
    269.       }
    270.   

crypto/mem.c:282:1: return from a call to CRYPTO_free
    280.       free(str);
    281.   #endif
    282. > }
    283.   
    284.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:53:1: return from a call to EVP_MD_CTX_free
  51.       EVP_MD_CTX_reset(ctx);
  52.       OPENSSL_free(ctx);
  53. > }
  54.   
  55.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)

static int rand_bytes(unsigned char *buf, int num)
{
    static volatile int stirred_pool = 0;
    int i, j, k;
    size_t num_ceil, st_idx, st_num;
    int ok;
    long md_c[2];
    unsigned char local_md[RAND_DIGEST_LENGTH];
    EVP_MD_CTX *m;
    OSSL_RAND_STATE *sp = &global_state;
#ifndef GETPID_IS_MEANINGLESS
    pid_t curr_pid = getpid();
#endif
    time_t curr_time = time(NULL);
    int do_stir_pool = 0;
#ifdef OPENSSL_SYS_WIN32
    FILETIME tv;
# ifdef _WIN32_WCE
    SYSTEMTIME t;
    GetSystemTime(&t);
    SystemTimeToFileTime(&t, &tv);
# else
    GetSystemTimeAsFileTime(&tv);
# endif
#elif defined(OPENSSL_SYS_VXWORKS)
    struct timespec tv;
    clock_gettime(CLOCK_REALTIME, &ts);
#elif defined(OPENSSL_SYS_DSPBIOS)
    unsigned long long tv, OPENSSL_rdtsc();
    tv = OPENSSL_rdtsc();
#else
    struct timeval tv;
    gettimeofday(&tv, NULL);
#endif
#ifdef PREDICT
    if (rand_predictable) {
        unsigned char val = 1;
        for (i = 0; i < num; i++)
            buf[i] = val++;
        return (1);
    }
#endif
    if (num <= 0)
        return 1;
    m = EVP_MD_CTX_new();
    if (m == NULL)
        goto err_mem;
    num_ceil =
        (1 + (num - 1) / (RAND_DIGEST_LENGTH / 2)) * (RAND_DIGEST_LENGTH / 2);
    if (!RUN_ONCE(&ossl_rand_init, do_ossl_rand_init))
        goto err_mem;
    CRYPTO_THREAD_write_lock(rand_lock);
    ASYNC_block_pause();
    CRYPTO_THREAD_write_lock(rand_tmp_lock);
    locking_threadid = CRYPTO_THREAD_get_current_id();
    CRYPTO_THREAD_unlock(rand_tmp_lock);
    crypto_lock_rand = 1;
    if (!initialized) {
        RAND_poll();
        initialized = 1;
    }
    if (!stirred_pool)
        do_stir_pool = 1;
    ok = (randomness >= RANDOMNESS_NEEDED);
    if (!ok) {
        randomness -= num;
        if (randomness < 0)
            randomness = 0;
    }
    if (do_stir_pool) {
        int n = STATE_SIZE;
        while (n > 0) {
#if RAND_DIGEST_LENGTH > 20
# error "Please adjust DUMMY_SEED."
#endif
#define DUMMY_SEED "...................."
            rand_add(DUMMY_SEED, RAND_DIGEST_LENGTH, 0.0);
            n -= RAND_DIGEST_LENGTH;
        }
        if (ok)
            stirred_pool = 1;
    }
    st_idx = sp->index;
    st_num = sp->num;
    md_c[0] = sp->md_count[0];
    md_c[1] = sp->md_count[1];
    memcpy(local_md, sp->md, sizeof sp->md);
    sp->index += num_ceil;
    if (sp->index > sp->num)
        sp->index %= sp->num;
    sp->md_count[0] += 1;
    crypto_lock_rand = 0;
    ASYNC_unblock_pause();
    CRYPTO_THREAD_unlock(rand_lock);
    while (num > 0) {
        j = (num >= RAND_DIGEST_LENGTH / 2) ? RAND_DIGEST_LENGTH / 2 : num;
        num -= j;
        if (!EVP_DigestInit_ex(m, RAND_DIGEST, NULL))
            goto err;
#ifndef GETPID_IS_MEANINGLESS
        if (curr_pid) {
            if (!EVP_DigestUpdate(m, (unsigned char *)&curr_pid, sizeof curr_pid))
                goto err;
            curr_pid = 0;
        }
#endif
        if (curr_time) {
            if (!EVP_DigestUpdate(m, (unsigned char *)&curr_time, sizeof curr_time))
                goto err;
            if (!EVP_DigestUpdate(m, (unsigned char *)&tv, sizeof tv))
                goto err;
            curr_time = 0;
            if (!rand_hw_seed(m))
                goto err;
        }
        if (!EVP_DigestUpdate(m, local_md, RAND_DIGEST_LENGTH))
            goto err;
        if (!EVP_DigestUpdate(m, (unsigned char *)md_c, sizeof(md_c)))
            goto err;
        k = (st_idx + RAND_DIGEST_LENGTH / 2) - st_num;
        if (k > 0) {
            if (!EVP_DigestUpdate(m, &sp->state[st_idx], RAND_DIGEST_LENGTH / 2 - k))
                goto err;
            if (!EVP_DigestUpdate(m, &sp->state[0], k))
                goto err;
        } else if (!EVP_DigestUpdate(m, &sp->state[st_idx], RAND_DIGEST_LENGTH / 2))
            goto err;
        if (!EVP_DigestFinal_ex(m, local_md, NULL))
            goto err;
        for (i = 0; i < RAND_DIGEST_LENGTH / 2; i++) {
            sp->state[st_idx++] ^= local_md[i];
            if (st_idx >= st_num)
                st_idx = 0;
            if (i < j)
                *(buf++) = local_md[i + RAND_DIGEST_LENGTH / 2];
        }
    }
    if (!EVP_DigestInit_ex(m, RAND_DIGEST, NULL)
        || !EVP_DigestUpdate(m, (unsigned char *)md_c, sizeof(md_c))
        || !EVP_DigestUpdate(m, local_md, RAND_DIGEST_LENGTH))
        goto err;
    CRYPTO_THREAD_write_lock(rand_lock);
    ASYNC_block_pause();
    if (!EVP_DigestUpdate(m, sp->md, sizeof(sp->md))
            || !EVP_DigestFinal_ex(m, sp->md, NULL)) {
        CRYPTO_THREAD_unlock(rand_lock);
        goto err;
    }
    ASYNC_unblock_pause();
    CRYPTO_THREAD_unlock(rand_lock);
    EVP_MD_CTX_free(m);
    if (ok)
        return (1);
    RANDerr(RAND_F_RAND_BYTES, RAND_R_PRNG_NOT_SEEDED);
    ERR_add_error_data(1, "You need to read the OpenSSL FAQ, "
                       "https://www.openssl.org/docs/faq.html");
    return (0);
 err:
    RANDerr(RAND_F_RAND_BYTES, ERR_R_EVP_LIB);
    EVP_MD_CTX_free(m);
    return 0;
 err_mem:
    RANDerr(RAND_F_RAND_BYTES, ERR_R_MALLOC_FAILURE);
    EVP_MD_CTX_free(m);
    return 0;
}
['static int rand_bytes(unsigned char *buf, int num)\n{\n    static volatile int stirred_pool = 0;\n    int i, j, k;\n    size_t num_ceil, st_idx, st_num;\n    int ok;\n    long md_c[2];\n    unsigned char local_md[RAND_DIGEST_LENGTH];\n    EVP_MD_CTX *m;\n    OSSL_RAND_STATE *sp = &global_state;\n#ifndef GETPID_IS_MEANINGLESS\n    pid_t curr_pid = getpid();\n#endif\n    time_t curr_time = time(NULL);\n    int do_stir_pool = 0;\n#ifdef OPENSSL_SYS_WIN32\n    FILETIME tv;\n# ifdef _WIN32_WCE\n    SYSTEMTIME t;\n    GetSystemTime(&t);\n    SystemTimeToFileTime(&t, &tv);\n# else\n    GetSystemTimeAsFileTime(&tv);\n# endif\n#elif defined(OPENSSL_SYS_VXWORKS)\n    struct timespec tv;\n    clock_gettime(CLOCK_REALTIME, &ts);\n#elif defined(OPENSSL_SYS_DSPBIOS)\n    unsigned long long tv, OPENSSL_rdtsc();\n    tv = OPENSSL_rdtsc();\n#else\n    struct timeval tv;\n    gettimeofday(&tv, NULL);\n#endif\n#ifdef PREDICT\n    if (rand_predictable) {\n        unsigned char val = 1;\n        for (i = 0; i < num; i++)\n            buf[i] = val++;\n        return (1);\n    }\n#endif\n    if (num <= 0)\n        return 1;\n    m = EVP_MD_CTX_new();\n    if (m == NULL)\n        goto err_mem;\n    num_ceil =\n        (1 + (num - 1) / (RAND_DIGEST_LENGTH / 2)) * (RAND_DIGEST_LENGTH / 2);\n    if (!RUN_ONCE(&ossl_rand_init, do_ossl_rand_init))\n        goto err_mem;\n    CRYPTO_THREAD_write_lock(rand_lock);\n    ASYNC_block_pause();\n    CRYPTO_THREAD_write_lock(rand_tmp_lock);\n    locking_threadid = CRYPTO_THREAD_get_current_id();\n    CRYPTO_THREAD_unlock(rand_tmp_lock);\n    crypto_lock_rand = 1;\n    if (!initialized) {\n        RAND_poll();\n        initialized = 1;\n    }\n    if (!stirred_pool)\n        do_stir_pool = 1;\n    ok = (randomness >= RANDOMNESS_NEEDED);\n    if (!ok) {\n        randomness -= num;\n        if (randomness < 0)\n            randomness = 0;\n    }\n    if (do_stir_pool) {\n        int n = STATE_SIZE;\n        while (n > 0) {\n#if RAND_DIGEST_LENGTH > 20\n# error "Please adjust DUMMY_SEED."\n#endif\n#define DUMMY_SEED "...................."\n            rand_add(DUMMY_SEED, RAND_DIGEST_LENGTH, 0.0);\n            n -= RAND_DIGEST_LENGTH;\n        }\n        if (ok)\n            stirred_pool = 1;\n    }\n    st_idx = sp->index;\n    st_num = sp->num;\n    md_c[0] = sp->md_count[0];\n    md_c[1] = sp->md_count[1];\n    memcpy(local_md, sp->md, sizeof sp->md);\n    sp->index += num_ceil;\n    if (sp->index > sp->num)\n        sp->index %= sp->num;\n    sp->md_count[0] += 1;\n    crypto_lock_rand = 0;\n    ASYNC_unblock_pause();\n    CRYPTO_THREAD_unlock(rand_lock);\n    while (num > 0) {\n        j = (num >= RAND_DIGEST_LENGTH / 2) ? RAND_DIGEST_LENGTH / 2 : num;\n        num -= j;\n        if (!EVP_DigestInit_ex(m, RAND_DIGEST, NULL))\n            goto err;\n#ifndef GETPID_IS_MEANINGLESS\n        if (curr_pid) {\n            if (!EVP_DigestUpdate(m, (unsigned char *)&curr_pid, sizeof curr_pid))\n                goto err;\n            curr_pid = 0;\n        }\n#endif\n        if (curr_time) {\n            if (!EVP_DigestUpdate(m, (unsigned char *)&curr_time, sizeof curr_time))\n                goto err;\n            if (!EVP_DigestUpdate(m, (unsigned char *)&tv, sizeof tv))\n                goto err;\n            curr_time = 0;\n            if (!rand_hw_seed(m))\n                goto err;\n        }\n        if (!EVP_DigestUpdate(m, local_md, RAND_DIGEST_LENGTH))\n            goto err;\n        if (!EVP_DigestUpdate(m, (unsigned char *)md_c, sizeof(md_c)))\n            goto err;\n        k = (st_idx + RAND_DIGEST_LENGTH / 2) - st_num;\n        if (k > 0) {\n            if (!EVP_DigestUpdate(m, &sp->state[st_idx], RAND_DIGEST_LENGTH / 2 - k))\n                goto err;\n            if (!EVP_DigestUpdate(m, &sp->state[0], k))\n                goto err;\n        } else if (!EVP_DigestUpdate(m, &sp->state[st_idx], RAND_DIGEST_LENGTH / 2))\n            goto err;\n        if (!EVP_DigestFinal_ex(m, local_md, NULL))\n            goto err;\n        for (i = 0; i < RAND_DIGEST_LENGTH / 2; i++) {\n            sp->state[st_idx++] ^= local_md[i];\n            if (st_idx >= st_num)\n                st_idx = 0;\n            if (i < j)\n                *(buf++) = local_md[i + RAND_DIGEST_LENGTH / 2];\n        }\n    }\n    if (!EVP_DigestInit_ex(m, RAND_DIGEST, NULL)\n        || !EVP_DigestUpdate(m, (unsigned char *)md_c, sizeof(md_c))\n        || !EVP_DigestUpdate(m, local_md, RAND_DIGEST_LENGTH))\n        goto err;\n    CRYPTO_THREAD_write_lock(rand_lock);\n    ASYNC_block_pause();\n    if (!EVP_DigestUpdate(m, sp->md, sizeof(sp->md))\n            || !EVP_DigestFinal_ex(m, sp->md, NULL)) {\n        CRYPTO_THREAD_unlock(rand_lock);\n        goto err;\n    }\n    ASYNC_unblock_pause();\n    CRYPTO_THREAD_unlock(rand_lock);\n    EVP_MD_CTX_free(m);\n    if (ok)\n        return (1);\n    RANDerr(RAND_F_RAND_BYTES, RAND_R_PRNG_NOT_SEEDED);\n    ERR_add_error_data(1, "You need to read the OpenSSL FAQ, "\n                       "https://www.openssl.org/docs/faq.html");\n    return (0);\n err:\n    RANDerr(RAND_F_RAND_BYTES, ERR_R_EVP_LIB);\n    EVP_MD_CTX_free(m);\n    return 0;\n err_mem:\n    RANDerr(RAND_F_RAND_BYTES, ERR_R_MALLOC_FAILURE);\n    EVP_MD_CTX_free(m);\n    return 0;\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    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    allow_customize = 0;\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    osslargused(file); osslargused(line);\n    ret = malloc(num);\n#endif\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 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    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}']