engines/e_sureware.c:680: error: NULL_DEREFERENCE
  pointer `rsatmp->e` last assigned on line 678 could be null and is dereferenced by call to `bn_expand2()` at line 680, column 3.
Showing all 100 steps of the trace


engines/e_sureware.c:652:1: start of procedure sureware_load_public()
650.   }
651.   
652. > static EVP_PKEY* sureware_load_public(ENGINE *e,const char *key_id,char *hptr,unsigned long el,char keytype)
653.   {
654.   	EVP_PKEY *res = NULL;

engines/e_sureware.c:654:2: 
652.   static EVP_PKEY* sureware_load_public(ENGINE *e,const char *key_id,char *hptr,unsigned long el,char keytype)
653.   {
654. > 	EVP_PKEY *res = NULL;
655.   #ifndef OPENSSL_NO_RSA
656.   	RSA *rsatmp = NULL;

engines/e_sureware.c:656:2: 
654.   	EVP_PKEY *res = NULL;
655.   #ifndef OPENSSL_NO_RSA
656. > 	RSA *rsatmp = NULL;
657.   #endif
658.   #ifndef OPENSSL_NO_DSA

engines/e_sureware.c:659:2: 
657.   #endif
658.   #ifndef OPENSSL_NO_DSA
659. > 	DSA *dsatmp=NULL;
660.   #endif
661.   	char msg[64]="sureware_load_public";

engines/e_sureware.c:661:2: 
659.   	DSA *dsatmp=NULL;
660.   #endif
661. > 	char msg[64]="sureware_load_public";
662.   	int ret=0;
663.   	if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)

engines/e_sureware.c:662:2: 
660.   #endif
661.   	char msg[64]="sureware_load_public";
662. > 	int ret=0;
663.   	if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)
664.   	{

engines/e_sureware.c:663:6: Taking false branch
661.   	char msg[64]="sureware_load_public";
662.   	int ret=0;
663.   	if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)
            ^
664.   	{
665.   		SUREWAREerr(SUREWARE_F_SUREWARE_LOAD_PUBLIC,ENGINE_R_NOT_INITIALISED);

engines/e_sureware.c:663:39: Taking false branch
661.   	char msg[64]="sureware_load_public";
662.   	int ret=0;
663.   	if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)
                                             ^
664.   	{
665.   		SUREWAREerr(SUREWARE_F_SUREWARE_LOAD_PUBLIC,ENGINE_R_NOT_INITIALISED);

engines/e_sureware.c:668:2: 
666.   		goto err;
667.   	}
668. > 	switch (keytype)
669.   	{
670.   #ifndef OPENSSL_NO_RSA

engines/e_sureware.c:671:2: Switch condition is true. Entering switch case
669.   	{
670.   #ifndef OPENSSL_NO_RSA
671.   	case 1: /*RSA*/
        ^
672.   		/* set private external reference */
673.   		rsatmp = RSA_new_method(e);

engines/e_sureware.c:673:3: Skipping RSA_new_method(): empty list of specs
671.   	case 1: /*RSA*/
672.   		/* set private external reference */
673.   		rsatmp = RSA_new_method(e);
         ^
674.   		RSA_set_ex_data(rsatmp,rsaHndidx,hptr);
675.   		rsatmp->flags |= RSA_FLAG_EXT_PKEY;

engines/e_sureware.c:674:3: 
672.   		/* set private external reference */
673.   		rsatmp = RSA_new_method(e);
674. > 		RSA_set_ex_data(rsatmp,rsaHndidx,hptr);
675.   		rsatmp->flags |= RSA_FLAG_EXT_PKEY;
676.   

crypto/rsa/rsa_lib.c:264:1: start of procedure RSA_set_ex_data()
  262.           }
  263.   
  264. > int RSA_set_ex_data(RSA *r, int idx, void *arg)
  265.   	{
  266.   	return(CRYPTO_set_ex_data(&r->ex_data,idx,arg));

crypto/rsa/rsa_lib.c:266:2: 
  264.   int RSA_set_ex_data(RSA *r, int idx, void *arg)
  265.   	{
  266. > 	return(CRYPTO_set_ex_data(&r->ex_data,idx,arg));
  267.   	}
  268.   

crypto/ex_data.c:593:1: start of procedure CRYPTO_set_ex_data()
    591.   /* For a given CRYPTO_EX_DATA variable, set the value corresponding to a
    592.    * particular index in the class used by this variable */
    593. > int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val)
    594.   	{
    595.   	int i;

crypto/ex_data.c:597:6: Taking false branch
    595.   	int i;
    596.   
    597.   	if (ad->sk == NULL)
                ^
    598.   		{
    599.   		if ((ad->sk=sk_new_null()) == NULL)

crypto/ex_data.c:605:2: 
    603.   			}
    604.   		}
    605. > 	i=sk_num(ad->sk);
    606.   
    607.   	while (i <= idx)

crypto/stack/stack.c:301:1: start of procedure sk_num()
      299.   	}
      300.   
      301. > int sk_num(const STACK *st)
      302.   {
      303.   	if(st == NULL) return -1;

crypto/stack/stack.c:303:5: Taking false branch
      301.   int sk_num(const STACK *st)
      302.   {
      303.   	if(st == NULL) return -1;
                 ^
      304.   	return st->num;
      305.   }

crypto/stack/stack.c:304:2: 
      302.   {
      303.   	if(st == NULL) return -1;
      304. > 	return st->num;
      305.   }
      306.   

crypto/stack/stack.c:305:1: return from a call to sk_num
      303.   	if(st == NULL) return -1;
      304.   	return st->num;
      305. > }
      306.   
      307.   char *sk_value(const STACK *st, int i)

crypto/ex_data.c:607:9: Loop condition is false. Leaving loop
    605.   	i=sk_num(ad->sk);
    606.   
    607.   	while (i <= idx)
                   ^
    608.   		{
    609.   		if (!sk_push(ad->sk,NULL))

crypto/ex_data.c:616:2: 
    614.   		i++;
    615.   		}
    616. > 	sk_set(ad->sk,idx,val);
    617.   	return(1);
    618.   	}

crypto/stack/stack.c:313:1: start of procedure sk_set()
      311.   }
      312.   
      313. > char *sk_set(STACK *st, int i, char *value)
      314.   {
      315.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:315:6: Taking false branch
      313.   char *sk_set(STACK *st, int i, char *value)
      314.   {
      315.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                  ^
      316.   	return (st->data[i] = value);
      317.   }

crypto/stack/stack.c:315:13: Taking false branch
      313.   char *sk_set(STACK *st, int i, char *value)
      314.   {
      315.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                         ^
      316.   	return (st->data[i] = value);
      317.   }

crypto/stack/stack.c:315:24: Taking false branch
      313.   char *sk_set(STACK *st, int i, char *value)
      314.   {
      315.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                                    ^
      316.   	return (st->data[i] = value);
      317.   }

crypto/stack/stack.c:316:2: 
      314.   {
      315.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
      316. > 	return (st->data[i] = value);
      317.   }
      318.   

crypto/stack/stack.c:317:1: return from a call to sk_set
      315.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
      316.   	return (st->data[i] = value);
      317. > }
      318.   
      319.   void sk_sort(STACK *st)

crypto/ex_data.c:617:2: 
    615.   		}
    616.   	sk_set(ad->sk,idx,val);
    617. > 	return(1);
    618.   	}
    619.   

crypto/ex_data.c:618:2: return from a call to CRYPTO_set_ex_data
    616.   	sk_set(ad->sk,idx,val);
    617.   	return(1);
    618.   	}
            ^
    619.   
    620.   /* For a given CRYPTO_EX_DATA_ variable, get the value corresponding to a

crypto/rsa/rsa_lib.c:267:2: return from a call to RSA_set_ex_data
  265.   	{
  266.   	return(CRYPTO_set_ex_data(&r->ex_data,idx,arg));
  267.   	}
          ^
  268.   
  269.   void *RSA_get_ex_data(const RSA *r, int idx)

engines/e_sureware.c:675:3: 
673.   		rsatmp = RSA_new_method(e);
674.   		RSA_set_ex_data(rsatmp,rsaHndidx,hptr);
675. > 		rsatmp->flags |= RSA_FLAG_EXT_PKEY;
676.   
677.   		/* set public big nums*/

engines/e_sureware.c:678:3: 
676.   
677.   		/* set public big nums*/
678. > 		rsatmp->e = BN_new();
679.   		rsatmp->n = BN_new();
680.   		bn_expand2(rsatmp->e, el/sizeof(BN_ULONG));

crypto/bn/bn_lib.c:298:1: start of procedure BN_new()
  296.   	}
  297.   
  298. > BIGNUM *BN_new(void)
  299.   	{
  300.   	BIGNUM *ret;

crypto/bn/bn_lib.c:302:6: 
  300.   	BIGNUM *ret;
  301.   
  302. > 	if ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL)
  303.   		{
  304.   		BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE);

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

crypto/mem.c:296:2: 
    294.   void *CRYPTO_malloc(int num, const char *file, int line)
    295.   	{
    296. > 	void *ret = NULL;
    297.   
    298.   	if (num <= 0) return NULL;

crypto/mem.c:298:6: Taking false branch
    296.   	void *ret = NULL;
    297.   
    298.   	if (num <= 0) return NULL;
                ^
    299.   
    300.   	allow_customize = 0;

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

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

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

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

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

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

crypto/mem.c:311:3: Skipping __function_pointer__(): unresolved function pointer
    309.   #endif
    310.   	if (malloc_debug_func != NULL)
    311.   		malloc_debug_func(ret, num, file, line, 1);
             ^
    312.   
    313.   #ifndef OPENSSL_CPUID_OBJ

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

crypto/mem.c:323:2: 
    321.   #endif
    322.   
    323. > 	return ret;
    324.   	}
    325.   

crypto/mem.c:324:2: return from a call to CRYPTO_malloc
    322.   
    323.   	return ret;
    324.   	}
            ^
    325.   
    326.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/bn/bn_lib.c:302:6: Taking true branch
  300.   	BIGNUM *ret;
  301.   
  302.   	if ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL)
              ^
  303.   		{
  304.   		BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE);

crypto/bn/bn_lib.c:304:3: 
  302.   	if ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL)
  303.   		{
  304. > 		BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE);
  305.   		return(NULL);
  306.   		}

crypto/err/err.c:680:1: start of procedure ERR_put_error()
    678.   /********************************************************/
    679.   
    680. > void ERR_put_error(int lib, int func, int reason, const char *file,
    681.   	     int line)
    682.   	{

crypto/err/err.c:704:2: Skipping ERR_get_state(): empty list of specs
    702.   	}
    703.   #endif
    704.   	es=ERR_get_state();
            ^
    705.   
    706.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:706:2: 
    704.   	es=ERR_get_state();
    705.   
    706. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    707.   	if (es->top == es->bottom)
    708.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:707:6: Taking false branch
    705.   
    706.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    707.   	if (es->top == es->bottom)
                ^
    708.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    709.   	es->err_flags[es->top]=0;

crypto/err/err.c:709:2: 
    707.   	if (es->top == es->bottom)
    708.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    709. > 	es->err_flags[es->top]=0;
    710.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    711.   	es->err_file[es->top]=file;

crypto/err/err.c:710:2: 
    708.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    709.   	es->err_flags[es->top]=0;
    710. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    711.   	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;

crypto/err/err.c:711:2: 
    709.   	es->err_flags[es->top]=0;
    710.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    711. > 	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);

crypto/err/err.c:712:2: 
    710.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    711.   	es->err_file[es->top]=file;
    712. > 	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
    714.   	}

crypto/err/err.c:713:2: Taking true branch
    711.   	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
            ^
    714.   	}
    715.   

crypto/err/err.c:713:2: Taking false branch
    711.   	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
            ^
    714.   	}
    715.   

crypto/err/err.c:713:2: Loop condition is false. Leaving loop
    711.   	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
            ^
    714.   	}
    715.   

crypto/err/err.c:714:2: return from a call to ERR_put_error
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
    714.   	}
            ^
    715.   
    716.   void ERR_clear_error(void)

crypto/bn/bn_lib.c:305:3: 
  303.   		{
  304.   		BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE);
  305. > 		return(NULL);
  306.   		}
  307.   	ret->flags=BN_FLG_MALLOCED;

crypto/bn/bn_lib.c:314:2: return from a call to BN_new
  312.   	bn_check_top(ret);
  313.   	return(ret);
  314.   	}
          ^
  315.   
  316.   /* This is used both by bn_expand2() and bn_dup_expand() */

engines/e_sureware.c:679:3: 
677.   		/* set public big nums*/
678.   		rsatmp->e = BN_new();
679. > 		rsatmp->n = BN_new();
680.   		bn_expand2(rsatmp->e, el/sizeof(BN_ULONG));
681.   		bn_expand2(rsatmp->n, el/sizeof(BN_ULONG));

crypto/bn/bn_lib.c:298:1: start of procedure BN_new()
  296.   	}
  297.   
  298. > BIGNUM *BN_new(void)
  299.   	{
  300.   	BIGNUM *ret;

crypto/bn/bn_lib.c:302:6: 
  300.   	BIGNUM *ret;
  301.   
  302. > 	if ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL)
  303.   		{
  304.   		BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE);

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

crypto/mem.c:296:2: 
    294.   void *CRYPTO_malloc(int num, const char *file, int line)
    295.   	{
    296. > 	void *ret = NULL;
    297.   
    298.   	if (num <= 0) return NULL;

crypto/mem.c:298:6: Taking false branch
    296.   	void *ret = NULL;
    297.   
    298.   	if (num <= 0) return NULL;
                ^
    299.   
    300.   	allow_customize = 0;

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

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

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

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

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

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

crypto/mem.c:311:3: Skipping __function_pointer__(): unresolved function pointer
    309.   #endif
    310.   	if (malloc_debug_func != NULL)
    311.   		malloc_debug_func(ret, num, file, line, 1);
             ^
    312.   
    313.   #ifndef OPENSSL_CPUID_OBJ

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

crypto/mem.c:323:2: 
    321.   #endif
    322.   
    323. > 	return ret;
    324.   	}
    325.   

crypto/mem.c:324:2: return from a call to CRYPTO_malloc
    322.   
    323.   	return ret;
    324.   	}
            ^
    325.   
    326.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/bn/bn_lib.c:302:6: Taking true branch
  300.   	BIGNUM *ret;
  301.   
  302.   	if ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL)
              ^
  303.   		{
  304.   		BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE);

crypto/bn/bn_lib.c:304:3: 
  302.   	if ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL)
  303.   		{
  304. > 		BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE);
  305.   		return(NULL);
  306.   		}

crypto/err/err.c:680:1: start of procedure ERR_put_error()
    678.   /********************************************************/
    679.   
    680. > void ERR_put_error(int lib, int func, int reason, const char *file,
    681.   	     int line)
    682.   	{

crypto/err/err.c:704:2: Skipping ERR_get_state(): empty list of specs
    702.   	}
    703.   #endif
    704.   	es=ERR_get_state();
            ^
    705.   
    706.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:706:2: 
    704.   	es=ERR_get_state();
    705.   
    706. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    707.   	if (es->top == es->bottom)
    708.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:707:6: Taking false branch
    705.   
    706.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    707.   	if (es->top == es->bottom)
                ^
    708.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    709.   	es->err_flags[es->top]=0;

crypto/err/err.c:709:2: 
    707.   	if (es->top == es->bottom)
    708.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    709. > 	es->err_flags[es->top]=0;
    710.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    711.   	es->err_file[es->top]=file;

crypto/err/err.c:710:2: 
    708.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    709.   	es->err_flags[es->top]=0;
    710. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    711.   	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;

crypto/err/err.c:711:2: 
    709.   	es->err_flags[es->top]=0;
    710.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    711. > 	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);

crypto/err/err.c:712:2: 
    710.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    711.   	es->err_file[es->top]=file;
    712. > 	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
    714.   	}

crypto/err/err.c:713:2: Taking true branch
    711.   	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
            ^
    714.   	}
    715.   

crypto/err/err.c:713:2: Taking false branch
    711.   	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
            ^
    714.   	}
    715.   

crypto/err/err.c:713:2: Loop condition is false. Leaving loop
    711.   	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
            ^
    714.   	}
    715.   

crypto/err/err.c:714:2: return from a call to ERR_put_error
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
    714.   	}
            ^
    715.   
    716.   void ERR_clear_error(void)

crypto/bn/bn_lib.c:305:3: 
  303.   		{
  304.   		BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE);
  305. > 		return(NULL);
  306.   		}
  307.   	ret->flags=BN_FLG_MALLOCED;

crypto/bn/bn_lib.c:314:2: return from a call to BN_new
  312.   	bn_check_top(ret);
  313.   	return(ret);
  314.   	}
          ^
  315.   
  316.   /* This is used both by bn_expand2() and bn_dup_expand() */

engines/e_sureware.c:680:3: 
678.   		rsatmp->e = BN_new();
679.   		rsatmp->n = BN_new();
680. > 		bn_expand2(rsatmp->e, el/sizeof(BN_ULONG));
681.   		bn_expand2(rsatmp->n, el/sizeof(BN_ULONG));
682.   		if (!rsatmp->e || rsatmp->e->dmax!=(int)(el/sizeof(BN_ULONG))|| 

crypto/bn/bn_lib.c:445:1: start of procedure bn_expand2()
  443.    * NULL is returned. If not, 'b' is returned. */
  444.   
  445. > BIGNUM *bn_expand2(BIGNUM *b, int words)
  446.   	{
  447.   	bn_check_top(b);

crypto/bn/bn_lib.c:449:6: 
  447.   	bn_check_top(b);
  448.   
  449. > 	if (words > b->dmax)
  450.   		{
  451.   		BN_ULONG *a = bn_expand_internal(b, words);

static EVP_PKEY* sureware_load_public(ENGINE *e,const char *key_id,char *hptr,unsigned long el,char keytype)
{
	EVP_PKEY *res = NULL;
#ifndef OPENSSL_NO_RSA
	RSA *rsatmp = NULL;
#endif
#ifndef OPENSSL_NO_DSA
	DSA *dsatmp=NULL;
#endif
	char msg[64]="sureware_load_public";
	int ret=0;
	if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)
	{
		SUREWAREerr(SUREWARE_F_SUREWARE_LOAD_PUBLIC,ENGINE_R_NOT_INITIALISED);
		goto err;
	}
	switch (keytype)
	{
#ifndef OPENSSL_NO_RSA
	case 1:
		rsatmp = RSA_new_method(e);
		RSA_set_ex_data(rsatmp,rsaHndidx,hptr);
		rsatmp->flags |= RSA_FLAG_EXT_PKEY;
		rsatmp->e = BN_new();
		rsatmp->n = BN_new();
		bn_expand2(rsatmp->e, el/sizeof(BN_ULONG));
		bn_expand2(rsatmp->n, el/sizeof(BN_ULONG));
		if (!rsatmp->e || rsatmp->e->dmax!=(int)(el/sizeof(BN_ULONG))||
			!rsatmp->n || rsatmp->n->dmax!=(int)(el/sizeof(BN_ULONG)))
			goto err;
		ret=p_surewarehk_Load_Rsa_Pubkey(msg,key_id,el,
						 (unsigned long *)rsatmp->n->d,
						 (unsigned long *)rsatmp->e->d);
		surewarehk_error_handling(msg,SUREWARE_F_SUREWARE_LOAD_PUBLIC,ret);
		if (ret!=1)
		{
			SUREWAREerr(SUREWARE_F_SUREWARE_LOAD_PUBLIC,ENGINE_R_FAILED_LOADING_PUBLIC_KEY);
			goto err;
		}
		rsatmp->e->top=el/sizeof(BN_ULONG);
		bn_fix_top(rsatmp->e);
		rsatmp->n->top=el/sizeof(BN_ULONG);
		bn_fix_top(rsatmp->n);
		res = EVP_PKEY_new();
		EVP_PKEY_assign_RSA(res, rsatmp);
		break;
#endif
#ifndef OPENSSL_NO_DSA
	case 2:
		dsatmp = DSA_new_method(e);
		DSA_set_ex_data(dsatmp,dsaHndidx,hptr);
		dsatmp->pub_key = BN_new();
		dsatmp->p = BN_new();
		dsatmp->q = BN_new();
		dsatmp->g = BN_new();
		bn_expand2(dsatmp->pub_key, el/sizeof(BN_ULONG));
		bn_expand2(dsatmp->p, el/sizeof(BN_ULONG));
		bn_expand2(dsatmp->q, 20/sizeof(BN_ULONG));
		bn_expand2(dsatmp->g, el/sizeof(BN_ULONG));
		if (!dsatmp->pub_key || dsatmp->pub_key->dmax!=(int)(el/sizeof(BN_ULONG))||
			!dsatmp->p || dsatmp->p->dmax!=(int)(el/sizeof(BN_ULONG)) ||
			!dsatmp->q || dsatmp->q->dmax!=20/sizeof(BN_ULONG) ||
			!dsatmp->g || dsatmp->g->dmax!=(int)(el/sizeof(BN_ULONG)))
			goto err;
		ret=p_surewarehk_Load_Dsa_Pubkey(msg,key_id,el,
						 (unsigned long *)dsatmp->pub_key->d,
						 (unsigned long *)dsatmp->p->d,
						 (unsigned long *)dsatmp->q->d,
						 (unsigned long *)dsatmp->g->d);
		surewarehk_error_handling(msg,SUREWARE_F_SUREWARE_LOAD_PUBLIC,ret);
		if (ret!=1)
		{
			SUREWAREerr(SUREWARE_F_SUREWARE_LOAD_PUBLIC,ENGINE_R_FAILED_LOADING_PUBLIC_KEY);
			goto err;
		}
		dsatmp->pub_key->top=el/sizeof(BN_ULONG);
		bn_fix_top(dsatmp->pub_key);
		dsatmp->p->top=el/sizeof(BN_ULONG);
		bn_fix_top(dsatmp->p);
		dsatmp->q->top=20/sizeof(BN_ULONG);
		bn_fix_top(dsatmp->q);
		dsatmp->g->top=el/sizeof(BN_ULONG);
		bn_fix_top(dsatmp->g);
		res = EVP_PKEY_new();
		EVP_PKEY_assign_DSA(res, dsatmp);
		break;
#endif
	default:
		SUREWAREerr(SUREWARE_F_SUREWARE_LOAD_PUBLIC,ENGINE_R_FAILED_LOADING_PRIVATE_KEY);
		goto err;
	}
	return res;
 err:
#ifndef OPENSSL_NO_RSA
	if (rsatmp)
		RSA_free(rsatmp);
#endif
#ifndef OPENSSL_NO_DSA
	if (dsatmp)
		DSA_free(dsatmp);
#endif
	return NULL;
}
['static EVP_PKEY* sureware_load_public(ENGINE *e,const char *key_id,char *hptr,unsigned long el,char keytype)\n{\n\tEVP_PKEY *res = NULL;\n#ifndef OPENSSL_NO_RSA\n\tRSA *rsatmp = NULL;\n#endif\n#ifndef OPENSSL_NO_DSA\n\tDSA *dsatmp=NULL;\n#endif\n\tchar msg[64]="sureware_load_public";\n\tint ret=0;\n\tif(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)\n\t{\n\t\tSUREWAREerr(SUREWARE_F_SUREWARE_LOAD_PUBLIC,ENGINE_R_NOT_INITIALISED);\n\t\tgoto err;\n\t}\n\tswitch (keytype)\n\t{\n#ifndef OPENSSL_NO_RSA\n\tcase 1:\n\t\trsatmp = RSA_new_method(e);\n\t\tRSA_set_ex_data(rsatmp,rsaHndidx,hptr);\n\t\trsatmp->flags |= RSA_FLAG_EXT_PKEY;\n\t\trsatmp->e = BN_new();\n\t\trsatmp->n = BN_new();\n\t\tbn_expand2(rsatmp->e, el/sizeof(BN_ULONG));\n\t\tbn_expand2(rsatmp->n, el/sizeof(BN_ULONG));\n\t\tif (!rsatmp->e || rsatmp->e->dmax!=(int)(el/sizeof(BN_ULONG))||\n\t\t\t!rsatmp->n || rsatmp->n->dmax!=(int)(el/sizeof(BN_ULONG)))\n\t\t\tgoto err;\n\t\tret=p_surewarehk_Load_Rsa_Pubkey(msg,key_id,el,\n\t\t\t\t\t\t (unsigned long *)rsatmp->n->d,\n\t\t\t\t\t\t (unsigned long *)rsatmp->e->d);\n\t\tsurewarehk_error_handling(msg,SUREWARE_F_SUREWARE_LOAD_PUBLIC,ret);\n\t\tif (ret!=1)\n\t\t{\n\t\t\tSUREWAREerr(SUREWARE_F_SUREWARE_LOAD_PUBLIC,ENGINE_R_FAILED_LOADING_PUBLIC_KEY);\n\t\t\tgoto err;\n\t\t}\n\t\trsatmp->e->top=el/sizeof(BN_ULONG);\n\t\tbn_fix_top(rsatmp->e);\n\t\trsatmp->n->top=el/sizeof(BN_ULONG);\n\t\tbn_fix_top(rsatmp->n);\n\t\tres = EVP_PKEY_new();\n\t\tEVP_PKEY_assign_RSA(res, rsatmp);\n\t\tbreak;\n#endif\n#ifndef OPENSSL_NO_DSA\n\tcase 2:\n\t\tdsatmp = DSA_new_method(e);\n\t\tDSA_set_ex_data(dsatmp,dsaHndidx,hptr);\n\t\tdsatmp->pub_key = BN_new();\n\t\tdsatmp->p = BN_new();\n\t\tdsatmp->q = BN_new();\n\t\tdsatmp->g = BN_new();\n\t\tbn_expand2(dsatmp->pub_key, el/sizeof(BN_ULONG));\n\t\tbn_expand2(dsatmp->p, el/sizeof(BN_ULONG));\n\t\tbn_expand2(dsatmp->q, 20/sizeof(BN_ULONG));\n\t\tbn_expand2(dsatmp->g, el/sizeof(BN_ULONG));\n\t\tif (!dsatmp->pub_key || dsatmp->pub_key->dmax!=(int)(el/sizeof(BN_ULONG))||\n\t\t\t!dsatmp->p || dsatmp->p->dmax!=(int)(el/sizeof(BN_ULONG)) ||\n\t\t\t!dsatmp->q || dsatmp->q->dmax!=20/sizeof(BN_ULONG) ||\n\t\t\t!dsatmp->g || dsatmp->g->dmax!=(int)(el/sizeof(BN_ULONG)))\n\t\t\tgoto err;\n\t\tret=p_surewarehk_Load_Dsa_Pubkey(msg,key_id,el,\n\t\t\t\t\t\t (unsigned long *)dsatmp->pub_key->d,\n\t\t\t\t\t\t (unsigned long *)dsatmp->p->d,\n\t\t\t\t\t\t (unsigned long *)dsatmp->q->d,\n\t\t\t\t\t\t (unsigned long *)dsatmp->g->d);\n\t\tsurewarehk_error_handling(msg,SUREWARE_F_SUREWARE_LOAD_PUBLIC,ret);\n\t\tif (ret!=1)\n\t\t{\n\t\t\tSUREWAREerr(SUREWARE_F_SUREWARE_LOAD_PUBLIC,ENGINE_R_FAILED_LOADING_PUBLIC_KEY);\n\t\t\tgoto err;\n\t\t}\n\t\tdsatmp->pub_key->top=el/sizeof(BN_ULONG);\n\t\tbn_fix_top(dsatmp->pub_key);\n\t\tdsatmp->p->top=el/sizeof(BN_ULONG);\n\t\tbn_fix_top(dsatmp->p);\n\t\tdsatmp->q->top=20/sizeof(BN_ULONG);\n\t\tbn_fix_top(dsatmp->q);\n\t\tdsatmp->g->top=el/sizeof(BN_ULONG);\n\t\tbn_fix_top(dsatmp->g);\n\t\tres = EVP_PKEY_new();\n\t\tEVP_PKEY_assign_DSA(res, dsatmp);\n\t\tbreak;\n#endif\n\tdefault:\n\t\tSUREWAREerr(SUREWARE_F_SUREWARE_LOAD_PUBLIC,ENGINE_R_FAILED_LOADING_PRIVATE_KEY);\n\t\tgoto err;\n\t}\n\treturn res;\n err:\n#ifndef OPENSSL_NO_RSA\n\tif (rsatmp)\n\t\tRSA_free(rsatmp);\n#endif\n#ifndef OPENSSL_NO_DSA\n\tif (dsatmp)\n\t\tDSA_free(dsatmp);\n#endif\n\treturn NULL;\n}', 'int RSA_set_ex_data(RSA *r, int idx, void *arg)\n\t{\n\treturn(CRYPTO_set_ex_data(&r->ex_data,idx,arg));\n\t}', 'int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val)\n\t{\n\tint i;\n\tif (ad->sk == NULL)\n\t\t{\n\t\tif ((ad->sk=sk_new_null()) == NULL)\n\t\t\t{\n\t\t\tCRYPTOerr(CRYPTO_F_CRYPTO_SET_EX_DATA,ERR_R_MALLOC_FAILURE);\n\t\t\treturn(0);\n\t\t\t}\n\t\t}\n\ti=sk_num(ad->sk);\n\twhile (i <= idx)\n\t\t{\n\t\tif (!sk_push(ad->sk,NULL))\n\t\t\t{\n\t\t\tCRYPTOerr(CRYPTO_F_CRYPTO_SET_EX_DATA,ERR_R_MALLOC_FAILURE);\n\t\t\treturn(0);\n\t\t\t}\n\t\ti++;\n\t\t}\n\tsk_set(ad->sk,idx,val);\n\treturn(1);\n\t}', 'int sk_num(const STACK *st)\n{\n\tif(st == NULL) return -1;\n\treturn st->num;\n}', 'char *sk_set(STACK *st, int i, char *value)\n{\n\tif(!st || (i < 0) || (i >= st->num)) return NULL;\n\treturn (st->data[i] = value);\n}', 'BIGNUM *BN_new(void)\n\t{\n\tBIGNUM *ret;\n\tif ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL)\n\t\t{\n\t\tBNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE);\n\t\treturn(NULL);\n\t\t}\n\tret->flags=BN_FLG_MALLOCED;\n\tret->top=0;\n\tret->neg=0;\n\tret->dmax=0;\n\tret->d=NULL;\n\tbn_check_top(ret);\n\treturn(ret);\n\t}', 'void *CRYPTO_malloc(int num, const char *file, int line)\n\t{\n\tvoid *ret = NULL;\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#ifndef OPENSSL_CPUID_OBJ\n        if(ret && (num > 2048))\n\t{\textern unsigned char cleanse_ctr;\n                ((unsigned char *)ret)[0] = cleanse_ctr;\n\t}\n#endif\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}', 'BIGNUM *bn_expand2(BIGNUM *b, int words)\n\t{\n\tbn_check_top(b);\n\tif (words > b->dmax)\n\t\t{\n\t\tBN_ULONG *a = bn_expand_internal(b, words);\n\t\tif(!a) return NULL;\n\t\tif(b->d) OPENSSL_free(b->d);\n\t\tb->d=a;\n\t\tb->dmax=words;\n\t\t}\n#if 0\n\tif (b->top < b->dmax)\n\t\t{\n\t\tint i;\n\t\tBN_ULONG *A = &(b->d[b->top]);\n\t\tfor (i=(b->dmax - b->top)>>3; i>0; i--,A+=8)\n\t\t\t{\n\t\t\tA[0]=0; A[1]=0; A[2]=0; A[3]=0;\n\t\t\tA[4]=0; A[5]=0; A[6]=0; A[7]=0;\n\t\t\t}\n\t\tfor (i=(b->dmax - b->top)&7; i>0; i--,A++)\n\t\t\tA[0]=0;\n\t\tassert(A == &(b->d[b->dmax]));\n\t\t}\n#endif\n\tbn_check_top(b);\n\treturn b;\n\t}']