apps/apps.c:1409: error: NULL_DEREFERENCE
  pointer `retdb` last assigned on line 1408 could be null and is dereferenced at line 1409, column 5.
Showing all 82 steps of the trace


apps/apps.c:1370:1: start of procedure load_index()
1368.   }
1369.   
1370. > CA_DB *load_index(const char *dbfile, DB_ATTR *db_attr)
1371.   {
1372.       CA_DB *retdb = NULL;

apps/apps.c:1372:5: 
1370.   CA_DB *load_index(const char *dbfile, DB_ATTR *db_attr)
1371.   {
1372. >     CA_DB *retdb = NULL;
1373.       TXT_DB *tmpdb = NULL;
1374.       BIO *in;

apps/apps.c:1373:5: 
1371.   {
1372.       CA_DB *retdb = NULL;
1373. >     TXT_DB *tmpdb = NULL;
1374.       BIO *in;
1375.       CONF *dbattr_conf = NULL;

apps/apps.c:1375:5: 
1373.       TXT_DB *tmpdb = NULL;
1374.       BIO *in;
1375. >     CONF *dbattr_conf = NULL;
1376.       char buf[BSIZE];
1377.   #ifndef OPENSSL_NO_POSIX_IO

apps/apps.c:1382:5: Skipping BIO_new_file(): empty list of specs
1380.   #endif
1381.   
1382.       in = BIO_new_file(dbfile, "r");
            ^
1383.       if (in == NULL) {
1384.           ERR_print_errors(bio_err);

apps/apps.c:1383:9: Taking false branch
1381.   
1382.       in = BIO_new_file(dbfile, "r");
1383.       if (in == NULL) {
                ^
1384.           ERR_print_errors(bio_err);
1385.           goto err;

apps/apps.c:1389:5: 
1387.   
1388.   #ifndef OPENSSL_NO_POSIX_IO
1389. >     BIO_get_fp(in, &dbfp);
1390.       if (fstat(fileno(dbfp), &dbst) == -1) {
1391.           SYSerr(SYS_F_FSTAT, errno);

crypto/bio/bio_lib.c:510:1: start of procedure BIO_ctrl()
  508.   }
  509.   
  510. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
  511.   {
  512.       long ret;

crypto/bio/bio_lib.c:514:9: Taking false branch
  512.       long ret;
  513.   
  514.       if (b == NULL)
                 ^
  515.           return 0;
  516.   

crypto/bio/bio_lib.c:517:10: Taking false branch
  515.           return 0;
  516.   
  517.       if ((b->method == NULL) || (b->method->ctrl == NULL)) {
                  ^
  518.           BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
  519.           return -2;

crypto/bio/bio_lib.c:517:33: Taking true branch
  515.           return 0;
  516.   
  517.       if ((b->method == NULL) || (b->method->ctrl == NULL)) {
                                         ^
  518.           BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
  519.           return -2;

crypto/bio/bio_lib.c:518:9: 
  516.   
  517.       if ((b->method == NULL) || (b->method->ctrl == NULL)) {
  518. >         BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
  519.           return -2;
  520.       }

providers/fips/fipsprov.c:381:1: start of procedure ERR_put_error()
    379.   }
    380.   
    381. > void ERR_put_error(int lib, int func, int reason, const char *file, int line)
    382.   {
    383.       /*

providers/fips/fipsprov.c:388:5: Skipping __function_pointer__(): unresolved function pointer
    386.        * a OPENSSL_CTX pointer.
    387.        */
    388.       c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
               ^
    389.       ERR_add_error_data(1, "(in the FIPS module)");
    390.   }

providers/fips/fipsprov.c:389:5: Skipping ERR_add_error_data(): empty list of specs
    387.        */
    388.       c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
    389.       ERR_add_error_data(1, "(in the FIPS module)");
               ^
    390.   }
    391.   

providers/fips/fipsprov.c:390:1: return from a call to ERR_put_error
    388.       c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
    389.       ERR_add_error_data(1, "(in the FIPS module)");
    390. > }
    391.   
    392.   void ERR_add_error_data(int num, ...)

crypto/bio/bio_lib.c:519:9: 
  517.       if ((b->method == NULL) || (b->method->ctrl == NULL)) {
  518.           BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
  519. >         return -2;
  520.       }
  521.   

crypto/bio/bio_lib.c:535:1: return from a call to BIO_ctrl
  533.   
  534.       return ret;
  535. > }
  536.   
  537.   long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)

apps/apps.c:1390:9: Taking false branch
1388.   #ifndef OPENSSL_NO_POSIX_IO
1389.       BIO_get_fp(in, &dbfp);
1390.       if (fstat(fileno(dbfp), &dbst) == -1) {
                ^
1391.           SYSerr(SYS_F_FSTAT, errno);
1392.           ERR_add_error_data(3, "fstat('", dbfile, "')");

apps/apps.c:1398:9: Taking false branch
1396.   #endif
1397.   
1398.       if ((tmpdb = TXT_DB_read(in, DB_NUMBER)) == NULL)
                ^
1399.           goto err;
1400.   

apps/apps.c:1402:5: Skipping BIO_snprintf(): empty list of specs
1400.   
1401.   #ifndef OPENSSL_SYS_VMS
1402.       BIO_snprintf(buf, sizeof(buf), "%s.attr", dbfile);
            ^
1403.   #else
1404.       BIO_snprintf(buf, sizeof(buf), "%s-attr", dbfile);

apps/apps.c:1406:5: 
1404.       BIO_snprintf(buf, sizeof(buf), "%s-attr", dbfile);
1405.   #endif
1406. >     dbattr_conf = app_load_config_quiet(buf);
1407.   
1408.       retdb = app_malloc(sizeof(*retdb), "new DB");

apps/apps.c:327:1: start of procedure app_load_config_quiet()
  325.   }
  326.   
  327. > CONF *app_load_config_quiet(const char *filename)
  328.   {
  329.       BIO *in;

apps/apps.c:332:5: 
  330.       CONF *conf;
  331.   
  332. >     in = bio_open_default_quiet(filename, 'r', FORMAT_TEXT);
  333.       if (in == NULL)
  334.           return NULL;

apps/apps.c:2453:1: start of procedure bio_open_default_quiet()
    2451.   }
    2452.   
    2453. > BIO *bio_open_default_quiet(const char *filename, char mode, int format)
    2454.   {
    2455.       return bio_open_default_(filename, mode, format, 1);

apps/apps.c:2455:5: 
    2453.   BIO *bio_open_default_quiet(const char *filename, char mode, int format)
    2454.   {
    2455. >     return bio_open_default_(filename, mode, format, 1);
    2456.   }
    2457.   

apps/apps.c:2416:1: start of procedure bio_open_default_()
      2414.   }
      2415.   
      2416. > static BIO *bio_open_default_(const char *filename, char mode, int format,
      2417.                                 int quiet)
      2418.   {

apps/apps.c:2421:9: Taking false branch
      2419.       BIO *ret;
      2420.   
      2421.       if (filename == NULL || strcmp(filename, "-") == 0) {
                      ^
      2422.           ret = mode == 'r' ? dup_bio_in(format) : dup_bio_out(format);
      2423.           if (quiet) {

apps/apps.c:2421:29: Taking true branch
      2419.       BIO *ret;
      2420.   
      2421.       if (filename == NULL || strcmp(filename, "-") == 0) {
                                          ^
      2422.           ret = mode == 'r' ? dup_bio_in(format) : dup_bio_out(format);
      2423.           if (quiet) {

apps/apps.c:2422:15: Condition is true
      2420.   
      2421.       if (filename == NULL || strcmp(filename, "-") == 0) {
      2422.           ret = mode == 'r' ? dup_bio_in(format) : dup_bio_out(format);
                            ^
      2423.           if (quiet) {
      2424.               ERR_clear_error();

apps/apps.c:2257:1: start of procedure dup_bio_in()
        2255.    * text and binary input/output on non-Unix platforms
        2256.    */
        2257. > BIO *dup_bio_in(int format)
        2258.   {
        2259.       return BIO_new_fp(stdin,

apps/apps.c:2260:38: 
        2258.   {
        2259.       return BIO_new_fp(stdin,
        2260. >                       BIO_NOCLOSE | (FMT_istext(format) ? BIO_FP_TEXT : 0));
        2261.   }
        2262.   

apps/fmt.c:12:1: start of procedure FMT_istext()
          10.   #include "fmt.h"
          11.   
          12. > int FMT_istext(int format)
          13.   {
          14.       return (format & B_FORMAT_TEXT) == B_FORMAT_TEXT;

apps/fmt.c:14:12: Condition is true
          12.   int FMT_istext(int format)
          13.   {
          14.       return (format & B_FORMAT_TEXT) == B_FORMAT_TEXT;
                           ^
          15.   }

apps/fmt.c:14:5: 
          12.   int FMT_istext(int format)
          13.   {
          14. >     return (format & B_FORMAT_TEXT) == B_FORMAT_TEXT;
          15.   }

apps/fmt.c:15:1: return from a call to FMT_istext
          13.   {
          14.       return (format & B_FORMAT_TEXT) == B_FORMAT_TEXT;
          15. > }

apps/apps.c:2260:38: Condition is true
        2258.   {
        2259.       return BIO_new_fp(stdin,
        2260.                         BIO_NOCLOSE | (FMT_istext(format) ? BIO_FP_TEXT : 0));
                                                     ^
        2261.   }
        2262.   

apps/apps.c:2259:5: 
        2257.   BIO *dup_bio_in(int format)
        2258.   {
        2259. >     return BIO_new_fp(stdin,
        2260.                         BIO_NOCLOSE | (FMT_istext(format) ? BIO_FP_TEXT : 0));
        2261.   }

crypto/bio/bss_file.c:95:1: start of procedure BIO_new_fp()
          93.   }
          94.   
          95. > BIO *BIO_new_fp(FILE *stream, int close_flag)
          96.   {
          97.       BIO *ret;

crypto/bio/bss_file.c:99:9: 
          97.       BIO *ret;
          98.   
          99. >     if ((ret = BIO_new(BIO_s_file())) == NULL)
          100.           return NULL;
          101.   

crypto/bio/bss_file.c:108:1: start of procedure BIO_s_file()
            106.   }
            107.   
            108. > const BIO_METHOD *BIO_s_file(void)
            109.   {
            110.       return &methods_filep;

crypto/bio/bss_file.c:110:5: 
            108.   const BIO_METHOD *BIO_s_file(void)
            109.   {
            110. >     return &methods_filep;
            111.   }
            112.   

crypto/bio/bss_file.c:111:1: return from a call to BIO_s_file
            109.   {
            110.       return &methods_filep;
            111. > }
            112.   
            113.   static int file_new(BIO *bi)

crypto/bio/bss_file.c:99:9: Taking true branch
          97.       BIO *ret;
          98.   
          99.       if ((ret = BIO_new(BIO_s_file())) == NULL)
                         ^
          100.           return NULL;
          101.   

crypto/bio/bss_file.c:100:9: 
          98.   
          99.       if ((ret = BIO_new(BIO_s_file())) == NULL)
          100. >         return NULL;
          101.   
          102.       /* redundant flag, left for documentation purposes */

crypto/bio/bss_file.c:106:1: return from a call to BIO_new_fp
          104.       BIO_set_fp(ret, stream, close_flag);
          105.       return ret;
          106. > }
          107.   
          108.   const BIO_METHOD *BIO_s_file(void)

apps/apps.c:2261:1: return from a call to dup_bio_in
        2259.       return BIO_new_fp(stdin,
        2260.                         BIO_NOCLOSE | (FMT_istext(format) ? BIO_FP_TEXT : 0));
        2261. > }
        2262.   
        2263.   BIO *dup_bio_out(int format)

apps/apps.c:2422:9: 
      2420.   
      2421.       if (filename == NULL || strcmp(filename, "-") == 0) {
      2422. >         ret = mode == 'r' ? dup_bio_in(format) : dup_bio_out(format);
      2423.           if (quiet) {
      2424.               ERR_clear_error();

apps/apps.c:2423:13: Taking true branch
      2421.       if (filename == NULL || strcmp(filename, "-") == 0) {
      2422.           ret = mode == 'r' ? dup_bio_in(format) : dup_bio_out(format);
      2423.           if (quiet) {
                          ^
      2424.               ERR_clear_error();
      2425.               return ret;

apps/apps.c:2424:13: 
      2422.           ret = mode == 'r' ? dup_bio_in(format) : dup_bio_out(format);
      2423.           if (quiet) {
      2424. >             ERR_clear_error();
      2425.               return ret;
      2426.           }

crypto/err/err.c:444:1: start of procedure ERR_clear_error()
        442.   }
        443.   
        444. > void ERR_clear_error(void)
        445.   {
        446.       int i;

crypto/err/err.c:449:5: 
        447.       ERR_STATE *es;
        448.   
        449. >     es = ERR_get_state();
        450.       if (es == NULL)
        451.           return;

crypto/err/err.c:720:1: start of procedure ERR_get_state()
          718.   }
          719.   
          720. > ERR_STATE *ERR_get_state(void)
          721.   {
          722.       ERR_STATE *state;

crypto/err/err.c:723:5: 
          721.   {
          722.       ERR_STATE *state;
          723. >     int saveerrno = get_last_sys_error();
          724.   
          725.       if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL))

crypto/err/err.c:725:10: Taking true branch
          723.       int saveerrno = get_last_sys_error();
          724.   
          725.       if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL))
                          ^
          726.           return NULL;
          727.   

crypto/err/err.c:726:9: 
          724.   
          725.       if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL))
          726. >         return NULL;
          727.   
          728.       if (!RUN_ONCE(&err_init, err_do_init))

crypto/err/err.c:757:1: return from a call to ERR_get_state
          755.       set_sys_error(saveerrno);
          756.       return state;
          757. > }
          758.   
          759.   /*

crypto/err/err.c:450:9: Taking true branch
        448.   
        449.       es = ERR_get_state();
        450.       if (es == NULL)
                       ^
        451.           return;
        452.   

crypto/err/err.c:451:9: 
        449.       es = ERR_get_state();
        450.       if (es == NULL)
        451. >         return;
        452.   
        453.       for (i = 0; i < ERR_NUM_ERRORS; i++) {

crypto/err/err.c:457:1: return from a call to ERR_clear_error
        455.       }
        456.       es->top = es->bottom = 0;
        457. > }
        458.   
        459.   unsigned long ERR_get_error(void)

apps/apps.c:2425:13: 
      2423.           if (quiet) {
      2424.               ERR_clear_error();
      2425. >             return ret;
      2426.           }
      2427.           if (ret != NULL)

apps/apps.c:2446:1: return from a call to bio_open_default_
      2444.       ERR_print_errors(bio_err);
      2445.       return NULL;
      2446. > }
      2447.   
      2448.   BIO *bio_open_default(const char *filename, char mode, int format)

apps/apps.c:2456:1: return from a call to bio_open_default_quiet
    2454.   {
    2455.       return bio_open_default_(filename, mode, format, 1);
    2456. > }
    2457.   
    2458.   void wait_for_async(SSL *s)

apps/apps.c:333:9: Taking true branch
  331.   
  332.       in = bio_open_default_quiet(filename, 'r', FORMAT_TEXT);
  333.       if (in == NULL)
                 ^
  334.           return NULL;
  335.   

apps/apps.c:334:9: 
  332.       in = bio_open_default_quiet(filename, 'r', FORMAT_TEXT);
  333.       if (in == NULL)
  334. >         return NULL;
  335.   
  336.       conf = app_load_config_bio(in, filename);

apps/apps.c:339:1: return from a call to app_load_config_quiet
  337.       BIO_free(in);
  338.       return conf;
  339. > }
  340.   
  341.   int app_load_modules(const CONF *config)

apps/apps.c:1408:5: 
1406.       dbattr_conf = app_load_config_quiet(buf);
1407.   
1408. >     retdb = app_malloc(sizeof(*retdb), "new DB");
1409.       retdb->db = tmpdb;
1410.       tmpdb = NULL;

test/testutil/apps_mem.c:14:1: start of procedure app_malloc()
  12.   /* shim that avoids sucking in too much from apps/apps.c */
  13.   
  14. > void* app_malloc(int sz, const char *what)
  15.   {
  16.       void *vp = OPENSSL_malloc(sz);

test/testutil/apps_mem.c:16:5: 
  14.   void* app_malloc(int sz, const char *what)
  15.   {
  16. >     void *vp = OPENSSL_malloc(sz);
  17.   
  18.       return vp;

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 false branch
    202.   
    203.       FAILTEST();
    204.       if (allow_customize) {
                   ^
    205.           /*
    206.            * Disallow customization after the first allocation. We only set this

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)

test/testutil/apps_mem.c:18:5: 
  16.       void *vp = OPENSSL_malloc(sz);
  17.   
  18. >     return vp;
  19.   }

test/testutil/apps_mem.c:19:1: return from a call to app_malloc
  17.   
  18.       return vp;
  19. > }

apps/apps.c:1409:5: 
1407.   
1408.       retdb = app_malloc(sizeof(*retdb), "new DB");
1409. >     retdb->db = tmpdb;
1410.       tmpdb = NULL;
1411.       if (db_attr)

CA_DB *load_index(const char *dbfile, DB_ATTR *db_attr)
{
    CA_DB *retdb = NULL;
    TXT_DB *tmpdb = NULL;
    BIO *in;
    CONF *dbattr_conf = NULL;
    char buf[BSIZE];
#ifndef OPENSSL_NO_POSIX_IO
    FILE *dbfp;
    struct stat dbst;
#endif
    in = BIO_new_file(dbfile, "r");
    if (in == NULL) {
        ERR_print_errors(bio_err);
        goto err;
    }
#ifndef OPENSSL_NO_POSIX_IO
    BIO_get_fp(in, &dbfp);
    if (fstat(fileno(dbfp), &dbst) == -1) {
        SYSerr(SYS_F_FSTAT, errno);
        ERR_add_error_data(3, "fstat('", dbfile, "')");
        ERR_print_errors(bio_err);
        goto err;
    }
#endif
    if ((tmpdb = TXT_DB_read(in, DB_NUMBER)) == NULL)
        goto err;
#ifndef OPENSSL_SYS_VMS
    BIO_snprintf(buf, sizeof(buf), "%s.attr", dbfile);
#else
    BIO_snprintf(buf, sizeof(buf), "%s-attr", dbfile);
#endif
    dbattr_conf = app_load_config_quiet(buf);
    retdb = app_malloc(sizeof(*retdb), "new DB");
    retdb->db = tmpdb;
    tmpdb = NULL;
    if (db_attr)
        retdb->attributes = *db_attr;
    else {
        retdb->attributes.unique_subject = 1;
    }
    if (dbattr_conf) {
        char *p = NCONF_get_string(dbattr_conf, NULL, "unique_subject");
        if (p) {
            retdb->attributes.unique_subject = parse_yesno(p, 1);
        }
    }
    retdb->dbfname = OPENSSL_strdup(dbfile);
#ifndef OPENSSL_NO_POSIX_IO
    retdb->dbst = dbst;
#endif
 err:
    NCONF_free(dbattr_conf);
    TXT_DB_free(tmpdb);
    BIO_free_all(in);
    return retdb;
}
['CA_DB *load_index(const char *dbfile, DB_ATTR *db_attr)\n{\n    CA_DB *retdb = NULL;\n    TXT_DB *tmpdb = NULL;\n    BIO *in;\n    CONF *dbattr_conf = NULL;\n    char buf[BSIZE];\n#ifndef OPENSSL_NO_POSIX_IO\n    FILE *dbfp;\n    struct stat dbst;\n#endif\n    in = BIO_new_file(dbfile, "r");\n    if (in == NULL) {\n        ERR_print_errors(bio_err);\n        goto err;\n    }\n#ifndef OPENSSL_NO_POSIX_IO\n    BIO_get_fp(in, &dbfp);\n    if (fstat(fileno(dbfp), &dbst) == -1) {\n        SYSerr(SYS_F_FSTAT, errno);\n        ERR_add_error_data(3, "fstat(\'", dbfile, "\')");\n        ERR_print_errors(bio_err);\n        goto err;\n    }\n#endif\n    if ((tmpdb = TXT_DB_read(in, DB_NUMBER)) == NULL)\n        goto err;\n#ifndef OPENSSL_SYS_VMS\n    BIO_snprintf(buf, sizeof(buf), "%s.attr", dbfile);\n#else\n    BIO_snprintf(buf, sizeof(buf), "%s-attr", dbfile);\n#endif\n    dbattr_conf = app_load_config_quiet(buf);\n    retdb = app_malloc(sizeof(*retdb), "new DB");\n    retdb->db = tmpdb;\n    tmpdb = NULL;\n    if (db_attr)\n        retdb->attributes = *db_attr;\n    else {\n        retdb->attributes.unique_subject = 1;\n    }\n    if (dbattr_conf) {\n        char *p = NCONF_get_string(dbattr_conf, NULL, "unique_subject");\n        if (p) {\n            retdb->attributes.unique_subject = parse_yesno(p, 1);\n        }\n    }\n    retdb->dbfname = OPENSSL_strdup(dbfile);\n#ifndef OPENSSL_NO_POSIX_IO\n    retdb->dbst = dbst;\n#endif\n err:\n    NCONF_free(dbattr_conf);\n    TXT_DB_free(tmpdb);\n    BIO_free_all(in);\n    return retdb;\n}', 'long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)\n{\n    long ret;\n    if (b == NULL)\n        return 0;\n    if ((b->method == NULL) || (b->method->ctrl == NULL)) {\n        BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);\n        return -2;\n    }\n    if (b->callback != NULL || b->callback_ex != NULL) {\n        ret = bio_call_callback(b, BIO_CB_CTRL, parg, 0, cmd, larg, 1L, NULL);\n        if (ret <= 0)\n            return ret;\n    }\n    ret = b->method->ctrl(b, cmd, larg, parg);\n    if (b->callback != NULL || b->callback_ex != NULL)\n        ret = bio_call_callback(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, 0, cmd,\n                                larg, ret, NULL);\n    return ret;\n}', 'void ERR_put_error(int lib, int func, int reason, const char *file, int line)\n{\n    c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);\n    ERR_add_error_data(1, "(in the FIPS module)");\n}', "CONF *app_load_config_quiet(const char *filename)\n{\n    BIO *in;\n    CONF *conf;\n    in = bio_open_default_quiet(filename, 'r', FORMAT_TEXT);\n    if (in == NULL)\n        return NULL;\n    conf = app_load_config_bio(in, filename);\n    BIO_free(in);\n    return conf;\n}", 'BIO *bio_open_default_quiet(const char *filename, char mode, int format)\n{\n    return bio_open_default_(filename, mode, format, 1);\n}', 'static BIO *bio_open_default_(const char *filename, char mode, int format,\n                              int quiet)\n{\n    BIO *ret;\n    if (filename == NULL || strcmp(filename, "-") == 0) {\n        ret = mode == \'r\' ? dup_bio_in(format) : dup_bio_out(format);\n        if (quiet) {\n            ERR_clear_error();\n            return ret;\n        }\n        if (ret != NULL)\n            return ret;\n        BIO_printf(bio_err,\n                   "Can\'t open %s, %s\\n",\n                   mode == \'r\' ? "stdin" : "stdout", strerror(errno));\n    } else {\n        ret = BIO_new_file(filename, modestr(mode, format));\n        if (quiet) {\n            ERR_clear_error();\n            return ret;\n        }\n        if (ret != NULL)\n            return ret;\n        BIO_printf(bio_err,\n                   "Can\'t open %s for %s, %s\\n",\n                   filename, modeverb(mode), strerror(errno));\n    }\n    ERR_print_errors(bio_err);\n    return NULL;\n}', 'BIO *dup_bio_in(int format)\n{\n    return BIO_new_fp(stdin,\n                      BIO_NOCLOSE | (FMT_istext(format) ? BIO_FP_TEXT : 0));\n}', 'int FMT_istext(int format)\n{\n    return (format & B_FORMAT_TEXT) == B_FORMAT_TEXT;\n}', 'BIO *BIO_new_fp(FILE *stream, int close_flag)\n{\n    BIO *ret;\n    if ((ret = BIO_new(BIO_s_file())) == NULL)\n        return NULL;\n    BIO_set_flags(ret, BIO_FLAGS_UPLINK_INTERNAL);\n    BIO_set_fp(ret, stream, close_flag);\n    return ret;\n}', 'const BIO_METHOD *BIO_s_file(void)\n{\n    return &methods_filep;\n}', 'void ERR_clear_error(void)\n{\n    int i;\n    ERR_STATE *es;\n    es = ERR_get_state();\n    if (es == NULL)\n        return;\n    for (i = 0; i < ERR_NUM_ERRORS; i++) {\n        err_clear(es, i);\n    }\n    es->top = es->bottom = 0;\n}', 'ERR_STATE *ERR_get_state(void)\n{\n    ERR_STATE *state;\n    int saveerrno = get_last_sys_error();\n    if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL))\n        return NULL;\n    if (!RUN_ONCE(&err_init, err_do_init))\n        return NULL;\n    state = CRYPTO_THREAD_get_local(&err_thread_local);\n    if (state == (ERR_STATE*)-1)\n        return NULL;\n    if (state == NULL) {\n        if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1))\n            return NULL;\n        if ((state = OPENSSL_zalloc(sizeof(*state))) == NULL) {\n            CRYPTO_THREAD_set_local(&err_thread_local, NULL);\n            return NULL;\n        }\n        if (!ossl_init_thread_start(NULL, NULL, err_delete_thread_state)\n                || !CRYPTO_THREAD_set_local(&err_thread_local, state)) {\n            ERR_STATE_free(state);\n            CRYPTO_THREAD_set_local(&err_thread_local, NULL);\n            return NULL;\n        }\n        OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);\n    }\n    set_sys_error(saveerrno);\n    return state;\n}', 'void* app_malloc(int sz, const char *what)\n{\n    void *vp = OPENSSL_malloc(sz);\n    return vp;\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#if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE)\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}']