engines/e_sureware.c:992: error: NULL_DEREFERENCE
  pointer `psign` last assigned on line 961 could be null and is dereferenced at line 992, column 2.
Showing all 52 steps of the trace


engines/e_sureware.c:957:1: start of procedure surewarehk_dsa_do_sign()
955.   #ifndef OPENSSL_NO_DSA
956.   /* DSA sign and verify */
957. > static	DSA_SIG * surewarehk_dsa_do_sign(const unsigned char *from, int flen, DSA *dsa)
958.   {
959.   	int ret=0;

engines/e_sureware.c:959:2: 
957.   static	DSA_SIG * surewarehk_dsa_do_sign(const unsigned char *from, int flen, DSA *dsa)
958.   {
959. > 	int ret=0;
960.   	char *hptr=NULL;
961.   	DSA_SIG *psign=NULL;

engines/e_sureware.c:960:2: 
958.   {
959.   	int ret=0;
960. > 	char *hptr=NULL;
961.   	DSA_SIG *psign=NULL;
962.   	char msg[64]="ENGINE_dsa_do_sign";

engines/e_sureware.c:961:2: 
959.   	int ret=0;
960.   	char *hptr=NULL;
961. > 	DSA_SIG *psign=NULL;
962.   	char msg[64]="ENGINE_dsa_do_sign";
963.   	if (!p_surewarehk_Dsa_Sign)

engines/e_sureware.c:962:2: 
960.   	char *hptr=NULL;
961.   	DSA_SIG *psign=NULL;
962. > 	char msg[64]="ENGINE_dsa_do_sign";
963.   	if (!p_surewarehk_Dsa_Sign)
964.   	{

engines/e_sureware.c:963:7: Taking false branch
961.   	DSA_SIG *psign=NULL;
962.   	char msg[64]="ENGINE_dsa_do_sign";
963.   	if (!p_surewarehk_Dsa_Sign)
             ^
964.   	{
965.   		SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,ENGINE_R_NOT_INITIALISED);

engines/e_sureware.c:968:13: 
966.   	}
967.   	/* extract ref to private key */
968. > 	else if (!(hptr=DSA_get_ex_data(dsa, dsaHndidx)))
969.   	{
970.   		SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,SUREWARE_R_MISSING_KEY_COMPONENTS);

crypto/dsa/dsa_lib.c:267:1: start of procedure DSA_get_ex_data()
  265.   	}
  266.   
  267. > void *DSA_get_ex_data(DSA *d, int idx)
  268.   	{
  269.   	return(CRYPTO_get_ex_data(&d->ex_data,idx));

crypto/dsa/dsa_lib.c:269:2: 
  267.   void *DSA_get_ex_data(DSA *d, int idx)
  268.   	{
  269. > 	return(CRYPTO_get_ex_data(&d->ex_data,idx));
  270.   	}
  271.   

crypto/ex_data.c:626:1: start of procedure CRYPTO_get_ex_data()
    624.   /* For a given CRYPTO_EX_DATA_ variable, get the value corresponding to a
    625.    * particular index in the class used by this variable */
    626. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    627.   	{
    628.   	if (ad->sk == NULL)

crypto/ex_data.c:628:6: Taking false branch
    626.   void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    627.   	{
    628.   	if (ad->sk == NULL)
                ^
    629.   		return(0);
    630.   	else if (idx >= sk_num(ad->sk))

crypto/ex_data.c:630:11: 
    628.   	if (ad->sk == NULL)
    629.   		return(0);
    630. > 	else if (idx >= sk_num(ad->sk))
    631.   		return(0);
    632.   	else

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

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

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

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

crypto/ex_data.c:630:11: Taking false branch
    628.   	if (ad->sk == NULL)
    629.   		return(0);
    630.   	else if (idx >= sk_num(ad->sk))
                     ^
    631.   		return(0);
    632.   	else

crypto/ex_data.c:633:3: 
    631.   		return(0);
    632.   	else
    633. > 		return(sk_value(ad->sk,idx));
    634.   	}
    635.   

crypto/stack/stack.c:308:1: start of procedure sk_value()
      306.   }
      307.   
      308. > char *sk_value(const STACK *st, int i)
      309.   {
      310.   	if(st == NULL) return NULL;

crypto/stack/stack.c:310:5: Taking false branch
      308.   char *sk_value(const STACK *st, int i)
      309.   {
      310.   	if(st == NULL) return NULL;
                 ^
      311.   	return st->data[i];
      312.   }

crypto/stack/stack.c:311:2: 
      309.   {
      310.   	if(st == NULL) return NULL;
      311. > 	return st->data[i];
      312.   }
      313.   

crypto/stack/stack.c:312:1: return from a call to sk_value
      310.   	if(st == NULL) return NULL;
      311.   	return st->data[i];
      312. > }
      313.   
      314.   char *sk_set(STACK *st, int i, char *value)

crypto/ex_data.c:634:2: return from a call to CRYPTO_get_ex_data
    632.   	else
    633.   		return(sk_value(ad->sk,idx));
    634.   	}
            ^
    635.   
    636.   IMPLEMENT_STACK_OF(CRYPTO_EX_DATA_FUNCS)

crypto/dsa/dsa_lib.c:270:2: return from a call to DSA_get_ex_data
  268.   	{
  269.   	return(CRYPTO_get_ex_data(&d->ex_data,idx));
  270.   	}
          ^
  271.   
  272.   #ifndef OPENSSL_NO_DH

engines/e_sureware.c:968:13: Taking true branch
966.   	}
967.   	/* extract ref to private key */
968.   	else if (!(hptr=DSA_get_ex_data(dsa, dsaHndidx)))
                   ^
969.   	{
970.   		SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,SUREWARE_R_MISSING_KEY_COMPONENTS);

engines/e_sureware.c:970:3: 
968.   	else if (!(hptr=DSA_get_ex_data(dsa, dsaHndidx)))
969.   	{
970. > 		SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,SUREWARE_R_MISSING_KEY_COMPONENTS);
971.   	}
972.   	else

engines/e_sureware_err.c:145:1: start of procedure ERR_SUREWARE_error()
  143.   	}
  144.   
  145. > static void ERR_SUREWARE_error(int function, int reason, char *file, int line)
  146.   	{
  147.   	if (SUREWARE_lib_error_code == 0)

engines/e_sureware_err.c:147:6: Taking true branch
  145.   static void ERR_SUREWARE_error(int function, int reason, char *file, int line)
  146.   	{
  147.   	if (SUREWARE_lib_error_code == 0)
              ^
  148.   		SUREWARE_lib_error_code=ERR_get_next_error_library();
  149.   	ERR_PUT_error(SUREWARE_lib_error_code,function,reason,file,line);

engines/e_sureware_err.c:148:3: 
  146.   	{
  147.   	if (SUREWARE_lib_error_code == 0)
  148. > 		SUREWARE_lib_error_code=ERR_get_next_error_library();
  149.   	ERR_PUT_error(SUREWARE_lib_error_code,function,reason,file,line);
  150.   	}

crypto/err/err.c:984:1: start of procedure ERR_get_next_error_library()
    982.   	}
    983.   
    984. > int ERR_get_next_error_library(void)
    985.   	{
    986.   	err_fns_check();

crypto/err/err.c:986:2: 
    984.   int ERR_get_next_error_library(void)
    985.   	{
    986. > 	err_fns_check();
    987.   	return ERRFN(get_next_lib)();
    988.   	}

crypto/err/err.c:279:1: start of procedure err_fns_check()
      277.   /* Internal function that checks whether "err_fns" is set and if not, sets it to
      278.    * the defaults. */
      279. > static void err_fns_check(void)
      280.   	{
      281.   	if (err_fns) return;

crypto/err/err.c:281:6: Taking true branch
      279.   static void err_fns_check(void)
      280.   	{
      281.   	if (err_fns) return;
                  ^
      282.   	
      283.   	CRYPTO_w_lock(CRYPTO_LOCK_ERR);

crypto/err/err.c:281:15: 
      279.   static void err_fns_check(void)
      280.   	{
      281. > 	if (err_fns) return;
      282.   	
      283.   	CRYPTO_w_lock(CRYPTO_LOCK_ERR);

crypto/err/err.c:287:2: return from a call to err_fns_check
      285.   		err_fns = &err_defaults;
      286.   	CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
      287.   	}
              ^
      288.   
      289.   /* API functions to get or set the underlying ERR functions. */

crypto/err/err.c:987:2: Skipping __function_pointer__(): unresolved function pointer
    985.   	{
    986.   	err_fns_check();
    987.   	return ERRFN(get_next_lib)();
            ^
    988.   	}
    989.   

crypto/err/err.c:988:2: return from a call to ERR_get_next_error_library
    986.   	err_fns_check();
    987.   	return ERRFN(get_next_lib)();
    988.   	}
            ^
    989.   
    990.   void ERR_set_error_data(char *data, int flags)

engines/e_sureware_err.c:149:2: 
  147.   	if (SUREWARE_lib_error_code == 0)
  148.   		SUREWARE_lib_error_code=ERR_get_next_error_library();
  149. > 	ERR_PUT_error(SUREWARE_lib_error_code,function,reason,file,line);
  150.   	}

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)

engines/e_sureware_err.c:150:2: return from a call to ERR_SUREWARE_error
  148.   		SUREWARE_lib_error_code=ERR_get_next_error_library();
  149.   	ERR_PUT_error(SUREWARE_lib_error_code,function,reason,file,line);
  150.   	}
          ^

engines/e_sureware.c:992:2: 
990.   		surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,ret);
991.   	}
992. > 	psign->r->top=20/sizeof(BN_ULONG);
993.   	bn_fix_top(psign->r);
994.   	psign->s->top=20/sizeof(BN_ULONG);
