engines/e_4758_cca.c:451: error: NULL_DEREFERENCE
  pointer `rtmp` last assigned on line 450 could be null and is dereferenced by call to `RSA_set_ex_data()` at line 451, column 2.
Showing all 102 steps of the trace


engines/e_4758_cca.c:377:1: start of procedure ibm_4758_load_privkey()
375.   #define MAX_CCA_PKA_TOKEN_SIZE 2500
376.   
377. > static EVP_PKEY *ibm_4758_load_privkey(ENGINE* e, const char* key_id,
378.   			UI_METHOD *ui_method, void *callback_data)
379.   	{

engines/e_4758_cca.c:380:2: 
378.   			UI_METHOD *ui_method, void *callback_data)
379.   	{
380. > 	RSA *rtmp = NULL;
381.   	EVP_PKEY *res = NULL;
382.   	unsigned char* keyToken = NULL;

engines/e_4758_cca.c:381:2: 
379.   	{
380.   	RSA *rtmp = NULL;
381. > 	EVP_PKEY *res = NULL;
382.   	unsigned char* keyToken = NULL;
383.   	unsigned char pubKeyToken[MAX_CCA_PKA_TOKEN_SIZE];

engines/e_4758_cca.c:382:2: 
380.   	RSA *rtmp = NULL;
381.   	EVP_PKEY *res = NULL;
382. > 	unsigned char* keyToken = NULL;
383.   	unsigned char pubKeyToken[MAX_CCA_PKA_TOKEN_SIZE];
384.   	long pubKeyTokenLength = MAX_CCA_PKA_TOKEN_SIZE;

engines/e_4758_cca.c:384:2: 
382.   	unsigned char* keyToken = NULL;
383.   	unsigned char pubKeyToken[MAX_CCA_PKA_TOKEN_SIZE];
384. > 	long pubKeyTokenLength = MAX_CCA_PKA_TOKEN_SIZE;
385.   	long keyTokenLength = MAX_CCA_PKA_TOKEN_SIZE;
386.   	long returnCode;

engines/e_4758_cca.c:385:2: 
383.   	unsigned char pubKeyToken[MAX_CCA_PKA_TOKEN_SIZE];
384.   	long pubKeyTokenLength = MAX_CCA_PKA_TOKEN_SIZE;
385. > 	long keyTokenLength = MAX_CCA_PKA_TOKEN_SIZE;
386.   	long returnCode;
387.   	long reasonCode;

engines/e_4758_cca.c:388:2: 
386.   	long returnCode;
387.   	long reasonCode;
388. > 	long exitDataLength = 0;
389.   	long ruleArrayLength = 0;
390.   	unsigned char exitData[8];

engines/e_4758_cca.c:389:2: 
387.   	long reasonCode;
388.   	long exitDataLength = 0;
389. > 	long ruleArrayLength = 0;
390.   	unsigned char exitData[8];
391.   	unsigned char ruleArray[8];

engines/e_4758_cca.c:393:2: 
391.   	unsigned char ruleArray[8];
392.   	unsigned char keyLabel[64];
393. > 	long keyLabelLength = strlen(key_id);
394.   	unsigned char modulus[256];
395.   	long modulusFieldLength = sizeof(modulus);

engines/e_4758_cca.c:395:2: 
393.   	long keyLabelLength = strlen(key_id);
394.   	unsigned char modulus[256];
395. > 	long modulusFieldLength = sizeof(modulus);
396.   	long modulusLength = 0;
397.   	unsigned char exponent[256];

engines/e_4758_cca.c:396:2: 
394.   	unsigned char modulus[256];
395.   	long modulusFieldLength = sizeof(modulus);
396. > 	long modulusLength = 0;
397.   	unsigned char exponent[256];
398.   	long exponentLength = sizeof(exponent);

engines/e_4758_cca.c:398:2: 
396.   	long modulusLength = 0;
397.   	unsigned char exponent[256];
398. > 	long exponentLength = sizeof(exponent);
399.   
400.   	if (keyLabelLength > sizeof(keyLabel))

engines/e_4758_cca.c:400:6: Taking false branch
398.   	long exponentLength = sizeof(exponent);
399.   
400.   	if (keyLabelLength > sizeof(keyLabel))
            ^
401.   		{
402.   		CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,

engines/e_4758_cca.c:407:2: 
405.   		}
406.   
407. > 	memset(keyLabel,' ', sizeof(keyLabel));
408.   	memcpy(keyLabel, key_id, keyLabelLength);
409.   

engines/e_4758_cca.c:408:2: 
406.   
407.   	memset(keyLabel,' ', sizeof(keyLabel));
408. > 	memcpy(keyLabel, key_id, keyLabelLength);
409.   
410.   	keyToken = OPENSSL_malloc(MAX_CCA_PKA_TOKEN_SIZE + sizeof(long));

engines/e_4758_cca.c:410:2: 
408.   	memcpy(keyLabel, key_id, keyLabelLength);
409.   
410. > 	keyToken = OPENSSL_malloc(MAX_CCA_PKA_TOKEN_SIZE + sizeof(long));
411.   	if (!keyToken)
412.   		{

crypto/mem.c:291:1: start of procedure CRYPTO_malloc()
  289.   	}
  290.   
  291. > void *CRYPTO_malloc(int num, const char *file, int line)
  292.   	{
  293.   	void *ret = NULL;

crypto/mem.c:293:2: 
  291.   void *CRYPTO_malloc(int num, const char *file, int line)
  292.   	{
  293. > 	void *ret = NULL;
  294.   	extern unsigned char cleanse_ctr;
  295.   

crypto/mem.c:296:6: Taking false branch
  294.   	extern unsigned char cleanse_ctr;
  295.   
  296.   	if (num < 0) return NULL;
              ^
  297.   
  298.   	allow_customize = 0;

crypto/mem.c:298:2: 
  296.   	if (num < 0) return NULL;
  297.   
  298. > 	allow_customize = 0;
  299.   	if (malloc_debug_func != NULL)
  300.   		{

crypto/mem.c:299:6: Taking true branch
  297.   
  298.   	allow_customize = 0;
  299.   	if (malloc_debug_func != NULL)
              ^
  300.   		{
  301.   		allow_customize_debug = 0;

crypto/mem.c:301:3: 
  299.   	if (malloc_debug_func != NULL)
  300.   		{
  301. > 		allow_customize_debug = 0;
  302.   		malloc_debug_func(NULL, num, file, line, 0);
  303.   		}

crypto/mem.c:302:3: Skipping __function_pointer__(): unresolved function pointer
  300.   		{
  301.   		allow_customize_debug = 0;
  302.   		malloc_debug_func(NULL, num, file, line, 0);
           ^
  303.   		}
  304.   	ret = malloc_ex_func(num,file,line);

crypto/mem.c:304:2: Skipping __function_pointer__(): unresolved function pointer
  302.   		malloc_debug_func(NULL, num, file, line, 0);
  303.   		}
  304.   	ret = malloc_ex_func(num,file,line);
          ^
  305.   #ifdef LEVITTE_DEBUG_MEM
  306.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:308:6: Taking true branch
  306.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
  307.   #endif
  308.   	if (malloc_debug_func != NULL)
              ^
  309.   		malloc_debug_func(ret, num, file, line, 1);
  310.   

crypto/mem.c:309:3: Skipping __function_pointer__(): unresolved function pointer
  307.   #endif
  308.   	if (malloc_debug_func != NULL)
  309.   		malloc_debug_func(ret, num, file, line, 1);
           ^
  310.   
  311.           /* Create a dependency on the value of 'cleanse_ctr' so our memory

crypto/mem.c:314:12: Taking true branch
  312.            * sanitisation function can't be optimised out. NB: We only do
  313.            * this for >2Kb so the overhead doesn't bother us. */
  314.           if(ret && (num > 2048))
                    ^
  315.                   ((unsigned char *)ret)[0] = cleanse_ctr;
  316.   

crypto/mem.c:314:20: Taking true branch
  312.            * sanitisation function can't be optimised out. NB: We only do
  313.            * this for >2Kb so the overhead doesn't bother us. */
  314.           if(ret && (num > 2048))
                            ^
  315.                   ((unsigned char *)ret)[0] = cleanse_ctr;
  316.   

crypto/mem.c:315:17: 
  313.            * this for >2Kb so the overhead doesn't bother us. */
  314.           if(ret && (num > 2048))
  315. >                 ((unsigned char *)ret)[0] = cleanse_ctr;
  316.   
  317.   	return ret;

crypto/mem.c:317:2: 
  315.                   ((unsigned char *)ret)[0] = cleanse_ctr;
  316.   
  317. > 	return ret;
  318.   	}
  319.   

crypto/mem.c:318:2: return from a call to CRYPTO_malloc
  316.   
  317.   	return ret;
  318.   	}
          ^
  319.   
  320.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

engines/e_4758_cca.c:411:7: Taking false branch
409.   
410.   	keyToken = OPENSSL_malloc(MAX_CCA_PKA_TOKEN_SIZE + sizeof(long));
411.   	if (!keyToken)
             ^
412.   		{
413.   		CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,

engines/e_4758_cca.c:418:2: Skipping __function_pointer__(): unresolved function pointer
416.   		}
417.   
418.   	keyRecordRead(&returnCode, &reasonCode, &exitDataLength,
        ^
419.   		exitData, &ruleArrayLength, ruleArray, keyLabel,
420.   		&keyTokenLength, keyToken+sizeof(long));

engines/e_4758_cca.c:422:6: Taking false branch
420.   		&keyTokenLength, keyToken+sizeof(long));
421.   
422.   	if (returnCode)
            ^
423.   		{
424.   		CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,

engines/e_4758_cca.c:429:2: Skipping __function_pointer__(): unresolved function pointer
427.   		}
428.   
429.   	publicKeyExtract(&returnCode, &reasonCode, &exitDataLength,
        ^
430.   		exitData, &ruleArrayLength, ruleArray, &keyTokenLength,
431.   		keyToken+sizeof(long), &pubKeyTokenLength, pubKeyToken);

engines/e_4758_cca.c:433:6: Taking false branch
431.   		keyToken+sizeof(long), &pubKeyTokenLength, pubKeyToken);
432.   
433.   	if (returnCode)
            ^
434.   		{
435.   		CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,

engines/e_4758_cca.c:440:7: 
438.   		}
439.   
440. > 	if (!getModulusAndExponent(pubKeyToken, &exponentLength,
441.   			exponent, &modulusLength, &modulusFieldLength,
442.   			modulus))

engines/e_4758_cca.c:853:1: start of procedure getModulusAndExponent()
  851.   	}
  852.   
  853. > static int getModulusAndExponent(const unsigned char*token, long *exponentLength,
  854.   		unsigned char *exponent, long *modulusLength, long *modulusFieldLength,
  855.   		unsigned char *modulus)

engines/e_4758_cca.c:859:6: Taking false branch
  857.   	unsigned long len;
  858.   
  859.   	if (*token++ != (char)0x1E) /* internal PKA token? */
              ^
  860.   		return 0;
  861.   

engines/e_4758_cca.c:862:6: Taking false branch
  860.   		return 0;
  861.   
  862.   	if (*token++) /* token version must be zero */
              ^
  863.   		return 0;
  864.   

engines/e_4758_cca.c:865:2: 
  863.   		return 0;
  864.   
  865. > 	len = *token++;
  866.   	len = len << 8;
  867.   	len |= (unsigned char)*token++;

engines/e_4758_cca.c:866:2: 
  864.   
  865.   	len = *token++;
  866. > 	len = len << 8;
  867.   	len |= (unsigned char)*token++;
  868.   

engines/e_4758_cca.c:867:2: 
  865.   	len = *token++;
  866.   	len = len << 8;
  867. > 	len |= (unsigned char)*token++;
  868.   
  869.   	token += 4; /* skip reserved bytes */

engines/e_4758_cca.c:869:2: 
  867.   	len |= (unsigned char)*token++;
  868.   
  869. > 	token += 4; /* skip reserved bytes */
  870.   
  871.   	if (*token++ == (char)0x04)

engines/e_4758_cca.c:871:6: Taking true branch
  869.   	token += 4; /* skip reserved bytes */
  870.   
  871.   	if (*token++ == (char)0x04)
              ^
  872.   		{
  873.   		if (*token++) /* token version must be zero */

engines/e_4758_cca.c:873:7: Taking false branch
  871.   	if (*token++ == (char)0x04)
  872.   		{
  873.   		if (*token++) /* token version must be zero */
               ^
  874.   			return 0;
  875.   

engines/e_4758_cca.c:876:3: 
  874.   			return 0;
  875.   
  876. > 		len = *token++;
  877.   		len = len << 8;
  878.   		len |= (unsigned char)*token++;

engines/e_4758_cca.c:877:3: 
  875.   
  876.   		len = *token++;
  877. > 		len = len << 8;
  878.   		len |= (unsigned char)*token++;
  879.   

engines/e_4758_cca.c:878:3: 
  876.   		len = *token++;
  877.   		len = len << 8;
  878. > 		len |= (unsigned char)*token++;
  879.   
  880.   		token+=2; /* skip reserved section */

engines/e_4758_cca.c:880:3: 
  878.   		len |= (unsigned char)*token++;
  879.   
  880. > 		token+=2; /* skip reserved section */
  881.   
  882.   		len = *token++;

engines/e_4758_cca.c:882:3: 
  880.   		token+=2; /* skip reserved section */
  881.   
  882. > 		len = *token++;
  883.   		len = len << 8;
  884.   		len |= (unsigned char)*token++;

engines/e_4758_cca.c:883:3: 
  881.   
  882.   		len = *token++;
  883. > 		len = len << 8;
  884.   		len |= (unsigned char)*token++;
  885.   

engines/e_4758_cca.c:884:3: 
  882.   		len = *token++;
  883.   		len = len << 8;
  884. > 		len |= (unsigned char)*token++;
  885.   
  886.   		*exponentLength = len;

engines/e_4758_cca.c:886:3: 
  884.   		len |= (unsigned char)*token++;
  885.   
  886. > 		*exponentLength = len;
  887.   
  888.   		len = *token++;

engines/e_4758_cca.c:888:3: 
  886.   		*exponentLength = len;
  887.   
  888. > 		len = *token++;
  889.   		len = len << 8;
  890.   		len |= (unsigned char)*token++;

engines/e_4758_cca.c:889:3: 
  887.   
  888.   		len = *token++;
  889. > 		len = len << 8;
  890.   		len |= (unsigned char)*token++;
  891.   

engines/e_4758_cca.c:890:3: 
  888.   		len = *token++;
  889.   		len = len << 8;
  890. > 		len |= (unsigned char)*token++;
  891.   
  892.   		*modulusLength = len;

engines/e_4758_cca.c:892:3: 
  890.   		len |= (unsigned char)*token++;
  891.   
  892. > 		*modulusLength = len;
  893.   
  894.   		len = *token++;

engines/e_4758_cca.c:894:3: 
  892.   		*modulusLength = len;
  893.   
  894. > 		len = *token++;
  895.   		len = len << 8;
  896.   		len |= (unsigned char)*token++;

engines/e_4758_cca.c:895:3: 
  893.   
  894.   		len = *token++;
  895. > 		len = len << 8;
  896.   		len |= (unsigned char)*token++;
  897.   

engines/e_4758_cca.c:896:3: 
  894.   		len = *token++;
  895.   		len = len << 8;
  896. > 		len |= (unsigned char)*token++;
  897.   
  898.   		*modulusFieldLength = len;

engines/e_4758_cca.c:898:3: 
  896.   		len |= (unsigned char)*token++;
  897.   
  898. > 		*modulusFieldLength = len;
  899.   
  900.   		memcpy(exponent, token, *exponentLength);

engines/e_4758_cca.c:900:3: 
  898.   		*modulusFieldLength = len;
  899.   
  900. > 		memcpy(exponent, token, *exponentLength);
  901.   		token+= *exponentLength;
  902.   

engines/e_4758_cca.c:901:3: 
  899.   
  900.   		memcpy(exponent, token, *exponentLength);
  901. > 		token+= *exponentLength;
  902.   
  903.   		memcpy(modulus, token, *modulusFieldLength);

engines/e_4758_cca.c:903:3: 
  901.   		token+= *exponentLength;
  902.   
  903. > 		memcpy(modulus, token, *modulusFieldLength);
  904.   		return 1;
  905.   		}

engines/e_4758_cca.c:904:3: 
  902.   
  903.   		memcpy(modulus, token, *modulusFieldLength);
  904. > 		return 1;
  905.   		}
  906.   	return 0;

engines/e_4758_cca.c:907:2: return from a call to getModulusAndExponent
  905.   		}
  906.   	return 0;
  907.   	}
          ^
  908.   
  909.   #endif /* OPENSSL_NO_RSA */

engines/e_4758_cca.c:440:7: Taking false branch
438.   		}
439.   
440.   	if (!getModulusAndExponent(pubKeyToken, &exponentLength,
             ^
441.   			exponent, &modulusLength, &modulusFieldLength,
442.   			modulus))

engines/e_4758_cca.c:449:2: 
447.   		}
448.   
449. > 	(*(long*)keyToken) = keyTokenLength;
450.   	rtmp = RSA_new_method(e);
451.   	RSA_set_ex_data(rtmp, hndidx, (char *)keyToken);

engines/e_4758_cca.c:450:2: 
448.   
449.   	(*(long*)keyToken) = keyTokenLength;
450. > 	rtmp = RSA_new_method(e);
451.   	RSA_set_ex_data(rtmp, hndidx, (char *)keyToken);
452.   

crypto/rsa/rsa_lib.c:128:1: start of procedure RSA_new_method()
  126.   	}
  127.   
  128. > RSA *RSA_new_method(ENGINE *engine)
  129.   	{
  130.   	RSA *ret;

crypto/rsa/rsa_lib.c:132:2: 
  130.   	RSA *ret;
  131.   
  132. > 	ret=(RSA *)OPENSSL_malloc(sizeof(RSA));
  133.   	if (ret == NULL)
  134.   		{

crypto/mem.c:291:1: start of procedure CRYPTO_malloc()
    289.   	}
    290.   
    291. > void *CRYPTO_malloc(int num, const char *file, int line)
    292.   	{
    293.   	void *ret = NULL;

crypto/mem.c:293:2: 
    291.   void *CRYPTO_malloc(int num, const char *file, int line)
    292.   	{
    293. > 	void *ret = NULL;
    294.   	extern unsigned char cleanse_ctr;
    295.   

crypto/mem.c:296:6: Taking false branch
    294.   	extern unsigned char cleanse_ctr;
    295.   
    296.   	if (num < 0) return NULL;
                ^
    297.   
    298.   	allow_customize = 0;

crypto/mem.c:298:2: 
    296.   	if (num < 0) return NULL;
    297.   
    298. > 	allow_customize = 0;
    299.   	if (malloc_debug_func != NULL)
    300.   		{

crypto/mem.c:299:6: Taking true branch
    297.   
    298.   	allow_customize = 0;
    299.   	if (malloc_debug_func != NULL)
                ^
    300.   		{
    301.   		allow_customize_debug = 0;

crypto/mem.c:301:3: 
    299.   	if (malloc_debug_func != NULL)
    300.   		{
    301. > 		allow_customize_debug = 0;
    302.   		malloc_debug_func(NULL, num, file, line, 0);
    303.   		}

crypto/mem.c:302:3: Skipping __function_pointer__(): unresolved function pointer
    300.   		{
    301.   		allow_customize_debug = 0;
    302.   		malloc_debug_func(NULL, num, file, line, 0);
             ^
    303.   		}
    304.   	ret = malloc_ex_func(num,file,line);

crypto/mem.c:304:2: Skipping __function_pointer__(): unresolved function pointer
    302.   		malloc_debug_func(NULL, num, file, line, 0);
    303.   		}
    304.   	ret = malloc_ex_func(num,file,line);
            ^
    305.   #ifdef LEVITTE_DEBUG_MEM
    306.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:308:6: Taking true branch
    306.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
    307.   #endif
    308.   	if (malloc_debug_func != NULL)
                ^
    309.   		malloc_debug_func(ret, num, file, line, 1);
    310.   

crypto/mem.c:309:3: Skipping __function_pointer__(): unresolved function pointer
    307.   #endif
    308.   	if (malloc_debug_func != NULL)
    309.   		malloc_debug_func(ret, num, file, line, 1);
             ^
    310.   
    311.           /* Create a dependency on the value of 'cleanse_ctr' so our memory

crypto/mem.c:314:12: Taking false branch
    312.            * sanitisation function can't be optimised out. NB: We only do
    313.            * this for >2Kb so the overhead doesn't bother us. */
    314.           if(ret && (num > 2048))
                      ^
    315.                   ((unsigned char *)ret)[0] = cleanse_ctr;
    316.   

crypto/mem.c:317:2: 
    315.                   ((unsigned char *)ret)[0] = cleanse_ctr;
    316.   
    317. > 	return ret;
    318.   	}
    319.   

crypto/mem.c:318:2: return from a call to CRYPTO_malloc
    316.   
    317.   	return ret;
    318.   	}
            ^
    319.   
    320.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/rsa/rsa_lib.c:133:6: Taking true branch
  131.   
  132.   	ret=(RSA *)OPENSSL_malloc(sizeof(RSA));
  133.   	if (ret == NULL)
              ^
  134.   		{
  135.   		RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);

crypto/rsa/rsa_lib.c:135:3: 
  133.   	if (ret == NULL)
  134.   		{
  135. > 		RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);
  136.   		return NULL;
  137.   		}

crypto/err/err.c:630:1: start of procedure ERR_put_error()
    628.   /********************************************************/
    629.   
    630. > void ERR_put_error(int lib, int func, int reason, const char *file,
    631.   	     int line)
    632.   	{

crypto/err/err.c:654:2: Skipping ERR_get_state(): empty list of specs
    652.   	}
    653.   #endif
    654.   	es=ERR_get_state();
            ^
    655.   
    656.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:656:2: 
    654.   	es=ERR_get_state();
    655.   
    656. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    657.   	if (es->top == es->bottom)
    658.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:657:6: Taking false branch
    655.   
    656.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    657.   	if (es->top == es->bottom)
                ^
    658.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    659.   	es->err_flags[es->top]=0;

crypto/err/err.c:659:2: 
    657.   	if (es->top == es->bottom)
    658.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    659. > 	es->err_flags[es->top]=0;
    660.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    661.   	es->err_file[es->top]=file;

crypto/err/err.c:660:2: 
    658.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    659.   	es->err_flags[es->top]=0;
    660. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    661.   	es->err_file[es->top]=file;
    662.   	es->err_line[es->top]=line;

crypto/err/err.c:661:2: 
    659.   	es->err_flags[es->top]=0;
    660.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    661. > 	es->err_file[es->top]=file;
    662.   	es->err_line[es->top]=line;
    663.   	err_clear_data(es,es->top);

crypto/err/err.c:662:2: 
    660.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    661.   	es->err_file[es->top]=file;
    662. > 	es->err_line[es->top]=line;
    663.   	err_clear_data(es,es->top);
    664.   	}

crypto/err/err.c:663:2: Taking true branch
    661.   	es->err_file[es->top]=file;
    662.   	es->err_line[es->top]=line;
    663.   	err_clear_data(es,es->top);
            ^
    664.   	}
    665.   

crypto/err/err.c:663:2: Taking false branch
    661.   	es->err_file[es->top]=file;
    662.   	es->err_line[es->top]=line;
    663.   	err_clear_data(es,es->top);
            ^
    664.   	}
    665.   

crypto/err/err.c:663:2: Loop condition is false. Leaving loop
    661.   	es->err_file[es->top]=file;
    662.   	es->err_line[es->top]=line;
    663.   	err_clear_data(es,es->top);
            ^
    664.   	}
    665.   

crypto/err/err.c:664:2: return from a call to ERR_put_error
    662.   	es->err_line[es->top]=line;
    663.   	err_clear_data(es,es->top);
    664.   	}
            ^
    665.   
    666.   void ERR_clear_error(void)

crypto/rsa/rsa_lib.c:136:3: 
  134.   		{
  135.   		RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);
  136. > 		return NULL;
  137.   		}
  138.   

crypto/rsa/rsa_lib.c:196:2: return from a call to RSA_new_method
  194.   		}
  195.   	return(ret);
  196.   	}
          ^
  197.   
  198.   void RSA_free(RSA *r)

engines/e_4758_cca.c:451:2: 
449.   	(*(long*)keyToken) = keyTokenLength;
450.   	rtmp = RSA_new_method(e);
451. > 	RSA_set_ex_data(rtmp, hndidx, (char *)keyToken);
452.   
453.   	rtmp->e = BN_bin2bn(exponent, exponentLength, NULL);

static EVP_PKEY *ibm_4758_load_privkey(ENGINE* e, const char* key_id,
			UI_METHOD *ui_method, void *callback_data)
	{
	RSA *rtmp = NULL;
	EVP_PKEY *res = NULL;
	unsigned char* keyToken = NULL;
	unsigned char pubKeyToken[MAX_CCA_PKA_TOKEN_SIZE];
	long pubKeyTokenLength = MAX_CCA_PKA_TOKEN_SIZE;
	long keyTokenLength = MAX_CCA_PKA_TOKEN_SIZE;
	long returnCode;
	long reasonCode;
	long exitDataLength = 0;
	long ruleArrayLength = 0;
	unsigned char exitData[8];
	unsigned char ruleArray[8];
	unsigned char keyLabel[64];
	long keyLabelLength = strlen(key_id);
	unsigned char modulus[256];
	long modulusFieldLength = sizeof(modulus);
	long modulusLength = 0;
	unsigned char exponent[256];
	long exponentLength = sizeof(exponent);
	if (keyLabelLength > sizeof(keyLabel))
		{
		CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,
		CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL);
		return NULL;
		}
	memset(keyLabel,' ', sizeof(keyLabel));
	memcpy(keyLabel, key_id, keyLabelLength);
	keyToken = OPENSSL_malloc(MAX_CCA_PKA_TOKEN_SIZE + sizeof(long));
	if (!keyToken)
		{
		CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,
				ERR_R_MALLOC_FAILURE);
		goto err;
		}
	keyRecordRead(&returnCode, &reasonCode, &exitDataLength,
		exitData, &ruleArrayLength, ruleArray, keyLabel,
		&keyTokenLength, keyToken+sizeof(long));
	if (returnCode)
		{
		CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,
			CCA4758_R_FAILED_LOADING_PRIVATE_KEY);
		goto err;
		}
	publicKeyExtract(&returnCode, &reasonCode, &exitDataLength,
		exitData, &ruleArrayLength, ruleArray, &keyTokenLength,
		keyToken+sizeof(long), &pubKeyTokenLength, pubKeyToken);
	if (returnCode)
		{
		CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,
			CCA4758_R_FAILED_LOADING_PRIVATE_KEY);
		goto err;
		}
	if (!getModulusAndExponent(pubKeyToken, &exponentLength,
			exponent, &modulusLength, &modulusFieldLength,
			modulus))
		{
		CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,
			CCA4758_R_FAILED_LOADING_PRIVATE_KEY);
		goto err;
		}
	(*(long*)keyToken) = keyTokenLength;
	rtmp = RSA_new_method(e);
	RSA_set_ex_data(rtmp, hndidx, (char *)keyToken);
	rtmp->e = BN_bin2bn(exponent, exponentLength, NULL);
	rtmp->n = BN_bin2bn(modulus, modulusFieldLength, NULL);
	rtmp->flags |= RSA_FLAG_EXT_PKEY;
	res = EVP_PKEY_new();
	EVP_PKEY_assign_RSA(res, rtmp);
	return res;
err:
	if (keyToken)
		OPENSSL_free(keyToken);
	if (res)
		EVP_PKEY_free(res);
	if (rtmp)
		RSA_free(rtmp);
	return NULL;
	}
["static EVP_PKEY *ibm_4758_load_privkey(ENGINE* e, const char* key_id,\n\t\t\tUI_METHOD *ui_method, void *callback_data)\n\t{\n\tRSA *rtmp = NULL;\n\tEVP_PKEY *res = NULL;\n\tunsigned char* keyToken = NULL;\n\tunsigned char pubKeyToken[MAX_CCA_PKA_TOKEN_SIZE];\n\tlong pubKeyTokenLength = MAX_CCA_PKA_TOKEN_SIZE;\n\tlong keyTokenLength = MAX_CCA_PKA_TOKEN_SIZE;\n\tlong returnCode;\n\tlong reasonCode;\n\tlong exitDataLength = 0;\n\tlong ruleArrayLength = 0;\n\tunsigned char exitData[8];\n\tunsigned char ruleArray[8];\n\tunsigned char keyLabel[64];\n\tlong keyLabelLength = strlen(key_id);\n\tunsigned char modulus[256];\n\tlong modulusFieldLength = sizeof(modulus);\n\tlong modulusLength = 0;\n\tunsigned char exponent[256];\n\tlong exponentLength = sizeof(exponent);\n\tif (keyLabelLength > sizeof(keyLabel))\n\t\t{\n\t\tCCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,\n\t\tCCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL);\n\t\treturn NULL;\n\t\t}\n\tmemset(keyLabel,' ', sizeof(keyLabel));\n\tmemcpy(keyLabel, key_id, keyLabelLength);\n\tkeyToken = OPENSSL_malloc(MAX_CCA_PKA_TOKEN_SIZE + sizeof(long));\n\tif (!keyToken)\n\t\t{\n\t\tCCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,\n\t\t\t\tERR_R_MALLOC_FAILURE);\n\t\tgoto err;\n\t\t}\n\tkeyRecordRead(&returnCode, &reasonCode, &exitDataLength,\n\t\texitData, &ruleArrayLength, ruleArray, keyLabel,\n\t\t&keyTokenLength, keyToken+sizeof(long));\n\tif (returnCode)\n\t\t{\n\t\tCCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,\n\t\t\tCCA4758_R_FAILED_LOADING_PRIVATE_KEY);\n\t\tgoto err;\n\t\t}\n\tpublicKeyExtract(&returnCode, &reasonCode, &exitDataLength,\n\t\texitData, &ruleArrayLength, ruleArray, &keyTokenLength,\n\t\tkeyToken+sizeof(long), &pubKeyTokenLength, pubKeyToken);\n\tif (returnCode)\n\t\t{\n\t\tCCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,\n\t\t\tCCA4758_R_FAILED_LOADING_PRIVATE_KEY);\n\t\tgoto err;\n\t\t}\n\tif (!getModulusAndExponent(pubKeyToken, &exponentLength,\n\t\t\texponent, &modulusLength, &modulusFieldLength,\n\t\t\tmodulus))\n\t\t{\n\t\tCCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,\n\t\t\tCCA4758_R_FAILED_LOADING_PRIVATE_KEY);\n\t\tgoto err;\n\t\t}\n\t(*(long*)keyToken) = keyTokenLength;\n\trtmp = RSA_new_method(e);\n\tRSA_set_ex_data(rtmp, hndidx, (char *)keyToken);\n\trtmp->e = BN_bin2bn(exponent, exponentLength, NULL);\n\trtmp->n = BN_bin2bn(modulus, modulusFieldLength, NULL);\n\trtmp->flags |= RSA_FLAG_EXT_PKEY;\n\tres = EVP_PKEY_new();\n\tEVP_PKEY_assign_RSA(res, rtmp);\n\treturn res;\nerr:\n\tif (keyToken)\n\t\tOPENSSL_free(keyToken);\n\tif (res)\n\t\tEVP_PKEY_free(res);\n\tif (rtmp)\n\t\tRSA_free(rtmp);\n\treturn NULL;\n\t}", 'void *CRYPTO_malloc(int num, const char *file, int line)\n\t{\n\tvoid *ret = NULL;\n\textern unsigned char cleanse_ctr;\n\tif (num < 0) return NULL;\n\tallow_customize = 0;\n\tif (malloc_debug_func != NULL)\n\t\t{\n\t\tallow_customize_debug = 0;\n\t\tmalloc_debug_func(NULL, num, file, line, 0);\n\t\t}\n\tret = malloc_ex_func(num,file,line);\n#ifdef LEVITTE_DEBUG_MEM\n\tfprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\\n", ret, num);\n#endif\n\tif (malloc_debug_func != NULL)\n\t\tmalloc_debug_func(ret, num, file, line, 1);\n        if(ret && (num > 2048))\n                ((unsigned char *)ret)[0] = cleanse_ctr;\n\treturn ret;\n\t}', 'static int getModulusAndExponent(const unsigned char*token, long *exponentLength,\n\t\tunsigned char *exponent, long *modulusLength, long *modulusFieldLength,\n\t\tunsigned char *modulus)\n\t{\n\tunsigned long len;\n\tif (*token++ != (char)0x1E)\n\t\treturn 0;\n\tif (*token++)\n\t\treturn 0;\n\tlen = *token++;\n\tlen = len << 8;\n\tlen |= (unsigned char)*token++;\n\ttoken += 4;\n\tif (*token++ == (char)0x04)\n\t\t{\n\t\tif (*token++)\n\t\t\treturn 0;\n\t\tlen = *token++;\n\t\tlen = len << 8;\n\t\tlen |= (unsigned char)*token++;\n\t\ttoken+=2;\n\t\tlen = *token++;\n\t\tlen = len << 8;\n\t\tlen |= (unsigned char)*token++;\n\t\t*exponentLength = len;\n\t\tlen = *token++;\n\t\tlen = len << 8;\n\t\tlen |= (unsigned char)*token++;\n\t\t*modulusLength = len;\n\t\tlen = *token++;\n\t\tlen = len << 8;\n\t\tlen |= (unsigned char)*token++;\n\t\t*modulusFieldLength = len;\n\t\tmemcpy(exponent, token, *exponentLength);\n\t\ttoken+= *exponentLength;\n\t\tmemcpy(modulus, token, *modulusFieldLength);\n\t\treturn 1;\n\t\t}\n\treturn 0;\n\t}', 'RSA *RSA_new_method(ENGINE *engine)\n\t{\n\tRSA *ret;\n\tret=(RSA *)OPENSSL_malloc(sizeof(RSA));\n\tif (ret == NULL)\n\t\t{\n\t\tRSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);\n\t\treturn NULL;\n\t\t}\n\tret->meth = RSA_get_default_method();\n#ifndef OPENSSL_NO_ENGINE\n\tif (engine)\n\t\t{\n\t\tif (!ENGINE_init(engine))\n\t\t\t{\n\t\t\tRSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB);\n\t\t\tOPENSSL_free(ret);\n\t\t\treturn NULL;\n\t\t\t}\n\t\tret->engine = engine;\n\t\t}\n\telse\n\t\tret->engine = ENGINE_get_default_RSA();\n\tif(ret->engine)\n\t\t{\n\t\tret->meth = ENGINE_get_RSA(ret->engine);\n\t\tif(!ret->meth)\n\t\t\t{\n\t\t\tRSAerr(RSA_F_RSA_NEW_METHOD,\n\t\t\t\tERR_R_ENGINE_LIB);\n\t\t\tENGINE_finish(ret->engine);\n\t\t\tOPENSSL_free(ret);\n\t\t\treturn NULL;\n\t\t\t}\n\t\t}\n#endif\n\tret->pad=0;\n\tret->version=0;\n\tret->n=NULL;\n\tret->e=NULL;\n\tret->d=NULL;\n\tret->p=NULL;\n\tret->q=NULL;\n\tret->dmp1=NULL;\n\tret->dmq1=NULL;\n\tret->iqmp=NULL;\n\tret->references=1;\n\tret->_method_mod_n=NULL;\n\tret->_method_mod_p=NULL;\n\tret->_method_mod_q=NULL;\n\tret->blinding=NULL;\n\tret->bignum_data=NULL;\n\tret->flags=ret->meth->flags;\n\tCRYPTO_new_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data);\n\tif ((ret->meth->init != NULL) && !ret->meth->init(ret))\n\t\t{\n#ifndef OPENSSL_NO_ENGINE\n\t\tif (ret->engine)\n\t\t\tENGINE_finish(ret->engine);\n#endif\n\t\tCRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data);\n\t\tOPENSSL_free(ret);\n\t\tret=NULL;\n\t\t}\n\treturn(ret);\n\t}', 'void ERR_put_error(int lib, int func, int reason, const char *file,\n\t     int line)\n\t{\n\tERR_STATE *es;\n#ifdef _OSD_POSIX\n\tif (strncmp(file,"*POSIX(", sizeof("*POSIX(")-1) == 0) {\n\t\tchar *end;\n\t\tfile += sizeof("*POSIX(")-1;\n\t\tend = &file[strlen(file)-1];\n\t\tif (*end == \')\')\n\t\t\t*end = \'\\0\';\n\t\tif ((end = strrchr(file, \'/\')) != NULL)\n\t\t\tfile = &end[1];\n\t}\n#endif\n\tes=ERR_get_state();\n\tes->top=(es->top+1)%ERR_NUM_ERRORS;\n\tif (es->top == es->bottom)\n\t\tes->bottom=(es->bottom+1)%ERR_NUM_ERRORS;\n\tes->err_flags[es->top]=0;\n\tes->err_buffer[es->top]=ERR_PACK(lib,func,reason);\n\tes->err_file[es->top]=file;\n\tes->err_line[es->top]=line;\n\terr_clear_data(es,es->top);\n\t}']