crypto/evp/scrypt.c:245: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_malloc()` at line 227, column 9 is not reachable after line 245, column 5.
Showing all 98 steps of the trace


crypto/evp/scrypt.c:158:1: start of procedure EVP_PBE_scrypt()
156.   #endif
157.   
158. > int EVP_PBE_scrypt(const char *pass, size_t passlen,
159.                      const unsigned char *salt, size_t saltlen,
160.                      uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem,

crypto/evp/scrypt.c:163:5: 
161.                      unsigned char *key, size_t keylen)
162.   {
163. >     int rv = 0;
164.       unsigned char *B;
165.       uint32_t *X, *V, *T;

crypto/evp/scrypt.c:171:9: Taking false branch
169.       /* Sanity check parameters */
170.       /* initial check, r,p must be non zero, N >= 2 and a power of 2 */
171.       if (r == 0 || p == 0 || N < 2 || (N & (N - 1)))
               ^
172.           return 0;
173.       /* Check p * r < SCRYPT_PR_MAX avoiding overflow */

crypto/evp/scrypt.c:171:19: Taking false branch
169.       /* Sanity check parameters */
170.       /* initial check, r,p must be non zero, N >= 2 and a power of 2 */
171.       if (r == 0 || p == 0 || N < 2 || (N & (N - 1)))
                         ^
172.           return 0;
173.       /* Check p * r < SCRYPT_PR_MAX avoiding overflow */

crypto/evp/scrypt.c:171:29: Taking false branch
169.       /* Sanity check parameters */
170.       /* initial check, r,p must be non zero, N >= 2 and a power of 2 */
171.       if (r == 0 || p == 0 || N < 2 || (N & (N - 1)))
                                   ^
172.           return 0;
173.       /* Check p * r < SCRYPT_PR_MAX avoiding overflow */

crypto/evp/scrypt.c:171:39: Taking false branch
169.       /* Sanity check parameters */
170.       /* initial check, r,p must be non zero, N >= 2 and a power of 2 */
171.       if (r == 0 || p == 0 || N < 2 || (N & (N - 1)))
                                             ^
172.           return 0;
173.       /* Check p * r < SCRYPT_PR_MAX avoiding overflow */

crypto/evp/scrypt.c:174:9: Taking false branch
172.           return 0;
173.       /* Check p * r < SCRYPT_PR_MAX avoiding overflow */
174.       if (p > SCRYPT_PR_MAX / r)
               ^
175.           return 0;
176.   

crypto/evp/scrypt.c:182:9: Taking false branch
180.        */
181.   
182.       if (16 * r <= LOG2_UINT64_MAX) {
               ^
183.           if (N >= (((uint64_t)1) << (16 * r)))
184.               return 0;

crypto/evp/scrypt.c:194:5: 
192.        * p * r < SCRYPT_PR_MAX
193.        */
194. >     Blen = p * 128 * r;
195.   
196.       /*

crypto/evp/scrypt.c:201:5: 
199.        * This is combined size V, X and T (section 4)
200.        */
201. >     i = UINT64_MAX / (32 * sizeof(uint32_t));
202.       if (N + 2 > i / r)
203.           return 0;

crypto/evp/scrypt.c:202:9: Taking false branch
200.        */
201.       i = UINT64_MAX / (32 * sizeof(uint32_t));
202.       if (N + 2 > i / r)
               ^
203.           return 0;
204.       Vlen = 32 * r * (N + 2) * sizeof(uint32_t);

crypto/evp/scrypt.c:204:5: 
202.       if (N + 2 > i / r)
203.           return 0;
204. >     Vlen = 32 * r * (N + 2) * sizeof(uint32_t);
205.   
206.       /* check total allocated size fits in uint64_t */

crypto/evp/scrypt.c:207:9: Taking false branch
205.   
206.       /* check total allocated size fits in uint64_t */
207.       if (Blen > UINT64_MAX - Vlen)
               ^
208.           return 0;
209.       /* check total allocated size fits in size_t */

crypto/evp/scrypt.c:210:9: Taking false branch
208.           return 0;
209.       /* check total allocated size fits in size_t */
210.       if (Blen > SIZE_MAX - Vlen)
               ^
211.           return 0;
212.   

crypto/evp/scrypt.c:213:5: 
211.           return 0;
212.   
213. >     allocsize = (size_t)(Blen + Vlen);
214.   
215.       if (maxmem == 0)

crypto/evp/scrypt.c:215:9: Taking false branch
213.       allocsize = (size_t)(Blen + Vlen);
214.   
215.       if (maxmem == 0)
               ^
216.           maxmem = SCRYPT_MAX_MEM;
217.   

crypto/evp/scrypt.c:218:9: Taking false branch
216.           maxmem = SCRYPT_MAX_MEM;
217.   
218.       if (allocsize > maxmem) {
               ^
219.           EVPerr(EVP_F_EVP_PBE_SCRYPT, EVP_R_MEMORY_LIMIT_EXCEEDED);
220.           return 0;

crypto/evp/scrypt.c:224:9: Taking false branch
222.   
223.       /* If no key return to indicate parameters are OK */
224.       if (key == NULL)
               ^
225.           return 1;
226.   

crypto/evp/scrypt.c:227:5: 
225.           return 1;
226.   
227. >     B = OPENSSL_malloc(allocsize);
228.       if (B == NULL)
229.           return 0;

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/evp/scrypt.c:228:9: Taking false branch
226.   
227.       B = OPENSSL_malloc(allocsize);
228.       if (B == NULL)
               ^
229.           return 0;
230.       X = (uint32_t *)(B + Blen);

crypto/evp/scrypt.c:230:5: 
228.       if (B == NULL)
229.           return 0;
230. >     X = (uint32_t *)(B + Blen);
231.       T = X + 32 * r;
232.       V = T + 32 * r;

crypto/evp/scrypt.c:231:5: 
229.           return 0;
230.       X = (uint32_t *)(B + Blen);
231. >     T = X + 32 * r;
232.       V = T + 32 * r;
233.       if (PKCS5_PBKDF2_HMAC(pass, passlen, salt, saltlen, 1, EVP_sha256(),

crypto/evp/scrypt.c:232:5: 
230.       X = (uint32_t *)(B + Blen);
231.       T = X + 32 * r;
232. >     V = T + 32 * r;
233.       if (PKCS5_PBKDF2_HMAC(pass, passlen, salt, saltlen, 1, EVP_sha256(),
234.                             Blen, B) == 0)

crypto/evp/scrypt.c:233:9: 
231.       T = X + 32 * r;
232.       V = T + 32 * r;
233. >     if (PKCS5_PBKDF2_HMAC(pass, passlen, salt, saltlen, 1, EVP_sha256(),
234.                             Blen, B) == 0)
235.           goto err;

crypto/evp/m_sha1.c:171:1: start of procedure EVP_sha256()
  169.   };
  170.   
  171. > const EVP_MD *EVP_sha256(void)
  172.   {
  173.       return (&sha256_md);

crypto/evp/m_sha1.c:173:5: 
  171.   const EVP_MD *EVP_sha256(void)
  172.   {
  173. >     return (&sha256_md);
  174.   }
  175.   

crypto/evp/m_sha1.c:174:1: return from a call to EVP_sha256
  172.   {
  173.       return (&sha256_md);
  174. > }
  175.   
  176.   static int init384(EVP_MD_CTX *ctx)

crypto/evp/p5_crpt2.c:32:1: start of procedure PKCS5_PBKDF2_HMAC()
  30.    */
  31.   
  32. > int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
  33.                         const unsigned char *salt, int saltlen, int iter,
  34.                         const EVP_MD *digest, int keylen, unsigned char *out)

crypto/evp/p5_crpt2.c:36:5: 
  34.                         const EVP_MD *digest, int keylen, unsigned char *out)
  35.   {
  36. >     const char *empty = "";
  37.       unsigned char digtmp[EVP_MAX_MD_SIZE], *p, itmp[4];
  38.       int cplen, j, k, tkeylen, mdlen;

crypto/evp/p5_crpt2.c:39:5: 
  37.       unsigned char digtmp[EVP_MAX_MD_SIZE], *p, itmp[4];
  38.       int cplen, j, k, tkeylen, mdlen;
  39. >     unsigned long i = 1;
  40.       HMAC_CTX *hctx_tpl = NULL, *hctx = NULL;
  41.   

crypto/evp/p5_crpt2.c:40:5: 
  38.       int cplen, j, k, tkeylen, mdlen;
  39.       unsigned long i = 1;
  40. >     HMAC_CTX *hctx_tpl = NULL, *hctx = NULL;
  41.   
  42.       mdlen = EVP_MD_size(digest);

crypto/evp/p5_crpt2.c:42:5: 
  40.       HMAC_CTX *hctx_tpl = NULL, *hctx = NULL;
  41.   
  42. >     mdlen = EVP_MD_size(digest);
  43.       if (mdlen < 0)
  44.           return 0;

crypto/evp/evp_lib.c:301:1: start of procedure EVP_MD_size()
    299.   }
    300.   
    301. > int EVP_MD_size(const EVP_MD *md)
    302.   {
    303.       if (!md) {

crypto/evp/evp_lib.c:303:10: Taking false branch
    301.   int EVP_MD_size(const EVP_MD *md)
    302.   {
    303.       if (!md) {
                    ^
    304.           EVPerr(EVP_F_EVP_MD_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL);
    305.           return -1;

crypto/evp/evp_lib.c:307:5: 
    305.           return -1;
    306.       }
    307. >     return md->md_size;
    308.   }
    309.   

crypto/evp/evp_lib.c:308:1: return from a call to EVP_MD_size
    306.       }
    307.       return md->md_size;
    308. > }
    309.   
    310.   unsigned long EVP_MD_flags(const EVP_MD *md)

crypto/evp/p5_crpt2.c:43:9: Taking false branch
  41.   
  42.       mdlen = EVP_MD_size(digest);
  43.       if (mdlen < 0)
                ^
  44.           return 0;
  45.   

crypto/evp/p5_crpt2.c:46:5: Skipping HMAC_CTX_new(): empty list of specs
  44.           return 0;
  45.   
  46.       hctx_tpl = HMAC_CTX_new();
            ^
  47.       if (hctx_tpl == NULL)
  48.           return 0;

crypto/evp/p5_crpt2.c:47:9: Taking false branch
  45.   
  46.       hctx_tpl = HMAC_CTX_new();
  47.       if (hctx_tpl == NULL)
                ^
  48.           return 0;
  49.       p = out;

crypto/evp/p5_crpt2.c:49:5: 
  47.       if (hctx_tpl == NULL)
  48.           return 0;
  49. >     p = out;
  50.       tkeylen = keylen;
  51.       if (pass == NULL) {

crypto/evp/p5_crpt2.c:50:5: 
  48.           return 0;
  49.       p = out;
  50. >     tkeylen = keylen;
  51.       if (pass == NULL) {
  52.           pass = empty;

crypto/evp/p5_crpt2.c:51:9: Taking false branch
  49.       p = out;
  50.       tkeylen = keylen;
  51.       if (pass == NULL) {
                ^
  52.           pass = empty;
  53.           passlen = 0;

crypto/evp/p5_crpt2.c:54:16: Taking false branch
  52.           pass = empty;
  53.           passlen = 0;
  54.       } else if (passlen == -1) {
                       ^
  55.           passlen = strlen(pass);
  56.       }

crypto/evp/p5_crpt2.c:57:10: Taking false branch
  55.           passlen = strlen(pass);
  56.       }
  57.       if (!HMAC_Init_ex(hctx_tpl, pass, passlen, digest, NULL)) {
                 ^
  58.           HMAC_CTX_free(hctx_tpl);
  59.           return 0;

crypto/evp/p5_crpt2.c:61:5: Skipping HMAC_CTX_new(): empty list of specs
  59.           return 0;
  60.       }
  61.       hctx = HMAC_CTX_new();
            ^
  62.       if (hctx == NULL) {
  63.           HMAC_CTX_free(hctx_tpl);

crypto/evp/p5_crpt2.c:62:9: Taking false branch
  60.       }
  61.       hctx = HMAC_CTX_new();
  62.       if (hctx == NULL) {
                ^
  63.           HMAC_CTX_free(hctx_tpl);
  64.           return 0;

crypto/evp/p5_crpt2.c:66:12: Loop condition is true. Entering loop body
  64.           return 0;
  65.       }
  66.       while (tkeylen) {
                   ^
  67.           if (tkeylen > mdlen)
  68.               cplen = mdlen;

crypto/evp/p5_crpt2.c:67:13: Taking false branch
  65.       }
  66.       while (tkeylen) {
  67.           if (tkeylen > mdlen)
                    ^
  68.               cplen = mdlen;
  69.           else

crypto/evp/p5_crpt2.c:70:13: 
  68.               cplen = mdlen;
  69.           else
  70. >             cplen = tkeylen;
  71.           /*
  72.            * We are unlikely to ever use more than 256 blocks (5120 bits!) but

crypto/evp/p5_crpt2.c:75:9: 
  73.            * just in case...
  74.            */
  75. >         itmp[0] = (unsigned char)((i >> 24) & 0xff);
  76.           itmp[1] = (unsigned char)((i >> 16) & 0xff);
  77.           itmp[2] = (unsigned char)((i >> 8) & 0xff);

crypto/evp/p5_crpt2.c:76:9: 
  74.            */
  75.           itmp[0] = (unsigned char)((i >> 24) & 0xff);
  76. >         itmp[1] = (unsigned char)((i >> 16) & 0xff);
  77.           itmp[2] = (unsigned char)((i >> 8) & 0xff);
  78.           itmp[3] = (unsigned char)(i & 0xff);

crypto/evp/p5_crpt2.c:77:9: 
  75.           itmp[0] = (unsigned char)((i >> 24) & 0xff);
  76.           itmp[1] = (unsigned char)((i >> 16) & 0xff);
  77. >         itmp[2] = (unsigned char)((i >> 8) & 0xff);
  78.           itmp[3] = (unsigned char)(i & 0xff);
  79.           if (!HMAC_CTX_copy(hctx, hctx_tpl)) {

crypto/evp/p5_crpt2.c:78:9: 
  76.           itmp[1] = (unsigned char)((i >> 16) & 0xff);
  77.           itmp[2] = (unsigned char)((i >> 8) & 0xff);
  78. >         itmp[3] = (unsigned char)(i & 0xff);
  79.           if (!HMAC_CTX_copy(hctx, hctx_tpl)) {
  80.               HMAC_CTX_free(hctx);

crypto/evp/p5_crpt2.c:79:14: 
  77.           itmp[2] = (unsigned char)((i >> 8) & 0xff);
  78.           itmp[3] = (unsigned char)(i & 0xff);
  79. >         if (!HMAC_CTX_copy(hctx, hctx_tpl)) {
  80.               HMAC_CTX_free(hctx);
  81.               HMAC_CTX_free(hctx_tpl);

crypto/hmac/hmac.c:187:1: start of procedure HMAC_CTX_copy()
    185.   }
    186.   
    187. > int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx)
    188.   {
    189.       if (!hmac_ctx_alloc_mds(dctx))

crypto/hmac/hmac.c:189:10: Taking true branch
    187.   int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx)
    188.   {
    189.       if (!hmac_ctx_alloc_mds(dctx))
                    ^
    190.           goto err;
    191.       if (!EVP_MD_CTX_copy_ex(dctx->i_ctx, sctx->i_ctx))

crypto/hmac/hmac.c:201:2: 
    199.       dctx->md = sctx->md;
    200.       return 1;
    201. >  err:
    202.       hmac_ctx_cleanup(dctx);
    203.       return 0;

crypto/hmac/hmac.c:202:5: 
    200.       return 1;
    201.    err:
    202. >     hmac_ctx_cleanup(dctx);
    203.       return 0;
    204.   }

crypto/hmac/hmac.c:139:1: start of procedure hmac_ctx_cleanup()
      137.   }
      138.   
      139. > static void hmac_ctx_cleanup(HMAC_CTX *ctx)
      140.   {
      141.       EVP_MD_CTX_reset(ctx->i_ctx);

crypto/hmac/hmac.c:141:5: Skipping EVP_MD_CTX_reset(): empty list of specs
      139.   static void hmac_ctx_cleanup(HMAC_CTX *ctx)
      140.   {
      141.       EVP_MD_CTX_reset(ctx->i_ctx);
                 ^
      142.       EVP_MD_CTX_reset(ctx->o_ctx);
      143.       EVP_MD_CTX_reset(ctx->md_ctx);

crypto/hmac/hmac.c:142:5: Skipping EVP_MD_CTX_reset(): empty list of specs
      140.   {
      141.       EVP_MD_CTX_reset(ctx->i_ctx);
      142.       EVP_MD_CTX_reset(ctx->o_ctx);
                 ^
      143.       EVP_MD_CTX_reset(ctx->md_ctx);
      144.       ctx->md = NULL;

crypto/hmac/hmac.c:143:5: Skipping EVP_MD_CTX_reset(): empty list of specs
      141.       EVP_MD_CTX_reset(ctx->i_ctx);
      142.       EVP_MD_CTX_reset(ctx->o_ctx);
      143.       EVP_MD_CTX_reset(ctx->md_ctx);
                 ^
      144.       ctx->md = NULL;
      145.       ctx->key_length = 0;

crypto/hmac/hmac.c:144:5: 
      142.       EVP_MD_CTX_reset(ctx->o_ctx);
      143.       EVP_MD_CTX_reset(ctx->md_ctx);
      144. >     ctx->md = NULL;
      145.       ctx->key_length = 0;
      146.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));

crypto/hmac/hmac.c:145:5: 
      143.       EVP_MD_CTX_reset(ctx->md_ctx);
      144.       ctx->md = NULL;
      145. >     ctx->key_length = 0;
      146.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));
      147.   }

crypto/hmac/hmac.c:146:5: Skipping OPENSSL_cleanse(): method has no implementation
      144.       ctx->md = NULL;
      145.       ctx->key_length = 0;
      146.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));
                 ^
      147.   }
      148.   

crypto/hmac/hmac.c:147:1: return from a call to hmac_ctx_cleanup
      145.       ctx->key_length = 0;
      146.       OPENSSL_cleanse(ctx->key, sizeof(ctx->key));
      147. > }
      148.   
      149.   void HMAC_CTX_free(HMAC_CTX *ctx)

crypto/hmac/hmac.c:203:5: 
    201.    err:
    202.       hmac_ctx_cleanup(dctx);
    203. >     return 0;
    204.   }
    205.   

crypto/hmac/hmac.c:204:1: return from a call to HMAC_CTX_copy
    202.       hmac_ctx_cleanup(dctx);
    203.       return 0;
    204. > }
    205.   
    206.   unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,

crypto/evp/p5_crpt2.c:79:14: Taking true branch
  77.           itmp[2] = (unsigned char)((i >> 8) & 0xff);
  78.           itmp[3] = (unsigned char)(i & 0xff);
  79.           if (!HMAC_CTX_copy(hctx, hctx_tpl)) {
                     ^
  80.               HMAC_CTX_free(hctx);
  81.               HMAC_CTX_free(hctx_tpl);

crypto/evp/p5_crpt2.c:80:13: Skipping HMAC_CTX_free(): empty list of specs
  78.           itmp[3] = (unsigned char)(i & 0xff);
  79.           if (!HMAC_CTX_copy(hctx, hctx_tpl)) {
  80.               HMAC_CTX_free(hctx);
                    ^
  81.               HMAC_CTX_free(hctx_tpl);
  82.               return 0;

crypto/evp/p5_crpt2.c:81:13: Skipping HMAC_CTX_free(): empty list of specs
  79.           if (!HMAC_CTX_copy(hctx, hctx_tpl)) {
  80.               HMAC_CTX_free(hctx);
  81.               HMAC_CTX_free(hctx_tpl);
                    ^
  82.               return 0;
  83.           }

crypto/evp/p5_crpt2.c:82:13: 
  80.               HMAC_CTX_free(hctx);
  81.               HMAC_CTX_free(hctx_tpl);
  82. >             return 0;
  83.           }
  84.           if (!HMAC_Update(hctx, salt, saltlen)

crypto/evp/p5_crpt2.c:123:1: return from a call to PKCS5_PBKDF2_HMAC
  121.   # endif
  122.       return 1;
  123. > }
  124.   
  125.   int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,

crypto/evp/scrypt.c:233:9: Taking true branch
231.       T = X + 32 * r;
232.       V = T + 32 * r;
233.       if (PKCS5_PBKDF2_HMAC(pass, passlen, salt, saltlen, 1, EVP_sha256(),
               ^
234.                             Blen, B) == 0)
235.           goto err;

crypto/evp/scrypt.c:244:2: 
242.           goto err;
243.       rv = 1;
244. >  err:
245.       OPENSSL_clear_free(B, allocsize);
246.       return rv;

crypto/evp/scrypt.c:245:5: 
243.       rv = 1;
244.    err:
245. >     OPENSSL_clear_free(B, allocsize);
246.       return rv;
247.   }

crypto/mem.c:284:1: start of procedure CRYPTO_clear_free()
  282.   }
  283.   
  284. > void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  285.   {
  286.       if (str == NULL)

crypto/mem.c:286:9: Taking false branch
  284.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  285.   {
  286.       if (str == NULL)
                 ^
  287.           return;
  288.       if (num)

crypto/mem.c:288:9: Taking true branch
  286.       if (str == NULL)
  287.           return;
  288.       if (num)
                 ^
  289.           OPENSSL_cleanse(str, num);
  290.       CRYPTO_free(str, file, line);

crypto/mem.c:289:9: Skipping OPENSSL_cleanse(): method has no implementation
  287.           return;
  288.       if (num)
  289.           OPENSSL_cleanse(str, num);
                 ^
  290.       CRYPTO_free(str, file, line);
  291.   }

crypto/mem.c:290:5: 
  288.       if (num)
  289.           OPENSSL_cleanse(str, num);
  290. >     CRYPTO_free(str, file, line);
  291.   }

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/mem.c:291:1: return from a call to CRYPTO_clear_free
  289.           OPENSSL_cleanse(str, num);
  290.       CRYPTO_free(str, file, line);
  291. > }

int EVP_PBE_scrypt(const char *pass, size_t passlen,
                   const unsigned char *salt, size_t saltlen,
                   uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem,
                   unsigned char *key, size_t keylen)
{
    int rv = 0;
    unsigned char *B;
    uint32_t *X, *V, *T;
    uint64_t i, Blen, Vlen;
    size_t allocsize;
    if (r == 0 || p == 0 || N < 2 || (N & (N - 1)))
        return 0;
    if (p > SCRYPT_PR_MAX / r)
        return 0;
    if (16 * r <= LOG2_UINT64_MAX) {
        if (N >= (((uint64_t)1) << (16 * r)))
            return 0;
    }
    Blen = p * 128 * r;
    i = UINT64_MAX / (32 * sizeof(uint32_t));
    if (N + 2 > i / r)
        return 0;
    Vlen = 32 * r * (N + 2) * sizeof(uint32_t);
    if (Blen > UINT64_MAX - Vlen)
        return 0;
    if (Blen > SIZE_MAX - Vlen)
        return 0;
    allocsize = (size_t)(Blen + Vlen);
    if (maxmem == 0)
        maxmem = SCRYPT_MAX_MEM;
    if (allocsize > maxmem) {
        EVPerr(EVP_F_EVP_PBE_SCRYPT, EVP_R_MEMORY_LIMIT_EXCEEDED);
        return 0;
    }
    if (key == NULL)
        return 1;
    B = OPENSSL_malloc(allocsize);
    if (B == NULL)
        return 0;
    X = (uint32_t *)(B + Blen);
    T = X + 32 * r;
    V = T + 32 * r;
    if (PKCS5_PBKDF2_HMAC(pass, passlen, salt, saltlen, 1, EVP_sha256(),
                          Blen, B) == 0)
        goto err;
    for (i = 0; i < p; i++)
        scryptROMix(B + 128 * r * i, r, N, X, T, V);
    if (PKCS5_PBKDF2_HMAC(pass, passlen, B, Blen, 1, EVP_sha256(),
                          keylen, key) == 0)
        goto err;
    rv = 1;
 err:
    OPENSSL_clear_free(B, allocsize);
    return rv;
}
['int EVP_PBE_scrypt(const char *pass, size_t passlen,\n                   const unsigned char *salt, size_t saltlen,\n                   uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem,\n                   unsigned char *key, size_t keylen)\n{\n    int rv = 0;\n    unsigned char *B;\n    uint32_t *X, *V, *T;\n    uint64_t i, Blen, Vlen;\n    size_t allocsize;\n    if (r == 0 || p == 0 || N < 2 || (N & (N - 1)))\n        return 0;\n    if (p > SCRYPT_PR_MAX / r)\n        return 0;\n    if (16 * r <= LOG2_UINT64_MAX) {\n        if (N >= (((uint64_t)1) << (16 * r)))\n            return 0;\n    }\n    Blen = p * 128 * r;\n    i = UINT64_MAX / (32 * sizeof(uint32_t));\n    if (N + 2 > i / r)\n        return 0;\n    Vlen = 32 * r * (N + 2) * sizeof(uint32_t);\n    if (Blen > UINT64_MAX - Vlen)\n        return 0;\n    if (Blen > SIZE_MAX - Vlen)\n        return 0;\n    allocsize = (size_t)(Blen + Vlen);\n    if (maxmem == 0)\n        maxmem = SCRYPT_MAX_MEM;\n    if (allocsize > maxmem) {\n        EVPerr(EVP_F_EVP_PBE_SCRYPT, EVP_R_MEMORY_LIMIT_EXCEEDED);\n        return 0;\n    }\n    if (key == NULL)\n        return 1;\n    B = OPENSSL_malloc(allocsize);\n    if (B == NULL)\n        return 0;\n    X = (uint32_t *)(B + Blen);\n    T = X + 32 * r;\n    V = T + 32 * r;\n    if (PKCS5_PBKDF2_HMAC(pass, passlen, salt, saltlen, 1, EVP_sha256(),\n                          Blen, B) == 0)\n        goto err;\n    for (i = 0; i < p; i++)\n        scryptROMix(B + 128 * r * i, r, N, X, T, V);\n    if (PKCS5_PBKDF2_HMAC(pass, passlen, B, Blen, 1, EVP_sha256(),\n                          keylen, key) == 0)\n        goto err;\n    rv = 1;\n err:\n    OPENSSL_clear_free(B, allocsize);\n    return rv;\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}', 'const EVP_MD *EVP_sha256(void)\n{\n    return (&sha256_md);\n}', 'int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,\n                      const unsigned char *salt, int saltlen, int iter,\n                      const EVP_MD *digest, int keylen, unsigned char *out)\n{\n    const char *empty = "";\n    unsigned char digtmp[EVP_MAX_MD_SIZE], *p, itmp[4];\n    int cplen, j, k, tkeylen, mdlen;\n    unsigned long i = 1;\n    HMAC_CTX *hctx_tpl = NULL, *hctx = NULL;\n    mdlen = EVP_MD_size(digest);\n    if (mdlen < 0)\n        return 0;\n    hctx_tpl = HMAC_CTX_new();\n    if (hctx_tpl == NULL)\n        return 0;\n    p = out;\n    tkeylen = keylen;\n    if (pass == NULL) {\n        pass = empty;\n        passlen = 0;\n    } else if (passlen == -1) {\n        passlen = strlen(pass);\n    }\n    if (!HMAC_Init_ex(hctx_tpl, pass, passlen, digest, NULL)) {\n        HMAC_CTX_free(hctx_tpl);\n        return 0;\n    }\n    hctx = HMAC_CTX_new();\n    if (hctx == NULL) {\n        HMAC_CTX_free(hctx_tpl);\n        return 0;\n    }\n    while (tkeylen) {\n        if (tkeylen > mdlen)\n            cplen = mdlen;\n        else\n            cplen = tkeylen;\n        itmp[0] = (unsigned char)((i >> 24) & 0xff);\n        itmp[1] = (unsigned char)((i >> 16) & 0xff);\n        itmp[2] = (unsigned char)((i >> 8) & 0xff);\n        itmp[3] = (unsigned char)(i & 0xff);\n        if (!HMAC_CTX_copy(hctx, hctx_tpl)) {\n            HMAC_CTX_free(hctx);\n            HMAC_CTX_free(hctx_tpl);\n            return 0;\n        }\n        if (!HMAC_Update(hctx, salt, saltlen)\n            || !HMAC_Update(hctx, itmp, 4)\n            || !HMAC_Final(hctx, digtmp, NULL)) {\n            HMAC_CTX_free(hctx);\n            HMAC_CTX_free(hctx_tpl);\n            return 0;\n        }\n        memcpy(p, digtmp, cplen);\n        for (j = 1; j < iter; j++) {\n            if (!HMAC_CTX_copy(hctx, hctx_tpl)) {\n                HMAC_CTX_free(hctx);\n                HMAC_CTX_free(hctx_tpl);\n                return 0;\n            }\n            if (!HMAC_Update(hctx, digtmp, mdlen)\n                || !HMAC_Final(hctx, digtmp, NULL)) {\n                HMAC_CTX_free(hctx);\n                HMAC_CTX_free(hctx_tpl);\n                return 0;\n            }\n            for (k = 0; k < cplen; k++)\n                p[k] ^= digtmp[k];\n        }\n        tkeylen -= cplen;\n        i++;\n        p += cplen;\n    }\n    HMAC_CTX_free(hctx);\n    HMAC_CTX_free(hctx_tpl);\n# ifdef OPENSSL_DEBUG_PKCS5V2\n    fprintf(stderr, "Password:\\n");\n    h__dump(pass, passlen);\n    fprintf(stderr, "Salt:\\n");\n    h__dump(salt, saltlen);\n    fprintf(stderr, "Iteration count %d\\n", iter);\n    fprintf(stderr, "Key:\\n");\n    h__dump(out, keylen);\n# endif\n    return 1;\n}', 'int EVP_MD_size(const EVP_MD *md)\n{\n    if (!md) {\n        EVPerr(EVP_F_EVP_MD_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL);\n        return -1;\n    }\n    return md->md_size;\n}', 'int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx)\n{\n    if (!hmac_ctx_alloc_mds(dctx))\n        goto err;\n    if (!EVP_MD_CTX_copy_ex(dctx->i_ctx, sctx->i_ctx))\n        goto err;\n    if (!EVP_MD_CTX_copy_ex(dctx->o_ctx, sctx->o_ctx))\n        goto err;\n    if (!EVP_MD_CTX_copy_ex(dctx->md_ctx, sctx->md_ctx))\n        goto err;\n    memcpy(dctx->key, sctx->key, HMAC_MAX_MD_CBLOCK);\n    dctx->key_length = sctx->key_length;\n    dctx->md = sctx->md;\n    return 1;\n err:\n    hmac_ctx_cleanup(dctx);\n    return 0;\n}', 'static void hmac_ctx_cleanup(HMAC_CTX *ctx)\n{\n    EVP_MD_CTX_reset(ctx->i_ctx);\n    EVP_MD_CTX_reset(ctx->o_ctx);\n    EVP_MD_CTX_reset(ctx->md_ctx);\n    ctx->md = NULL;\n    ctx->key_length = 0;\n    OPENSSL_cleanse(ctx->key, sizeof(ctx->key));\n}', 'void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)\n{\n    if (str == NULL)\n        return;\n    if (num)\n        OPENSSL_cleanse(str, num);\n    CRYPTO_free(str, file, line);\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}']