engines/e_4758cca.c:568: error: NULL_DEREFERENCE
  pointer `keyToken` last assigned on line 566 could be null and is dereferenced at line 568, column 22.
Showing all 42 steps of the trace


engines/e_4758cca.c:552:1: start of procedure cca_rsa_pub_enc()
550.   }
551.   
552. > static int cca_rsa_pub_enc(int flen, const unsigned char *from,
553.                              unsigned char *to, RSA *rsa, int padding)
554.   {

engines/e_4758cca.c:557:5: 
555.       long returnCode;
556.       long reasonCode;
557. >     long lflen = flen;
558.       long exitDataLength = 0;
559.       unsigned char exitData[8];

engines/e_4758cca.c:558:5: 
556.       long reasonCode;
557.       long lflen = flen;
558. >     long exitDataLength = 0;
559.       unsigned char exitData[8];
560.       long ruleArrayLength = 1;

engines/e_4758cca.c:560:5: 
558.       long exitDataLength = 0;
559.       unsigned char exitData[8];
560. >     long ruleArrayLength = 1;
561.       unsigned char ruleArray[8] = "PKCS-1.2";
562.       long dataStructureLength = 0;

engines/e_4758cca.c:561:5: 
559.       unsigned char exitData[8];
560.       long ruleArrayLength = 1;
561. >     unsigned char ruleArray[8] = "PKCS-1.2";
562.       long dataStructureLength = 0;
563.       unsigned char dataStructure[8];

engines/e_4758cca.c:562:5: 
560.       long ruleArrayLength = 1;
561.       unsigned char ruleArray[8] = "PKCS-1.2";
562. >     long dataStructureLength = 0;
563.       unsigned char dataStructure[8];
564.       long outputLength = RSA_size(rsa);

engines/e_4758cca.c:564:5: 
562.       long dataStructureLength = 0;
563.       unsigned char dataStructure[8];
564. >     long outputLength = RSA_size(rsa);
565.       long keyTokenLength;
566.       unsigned char *keyToken = (unsigned char *)RSA_get_ex_data(rsa, hndidx);

crypto/rsa/rsa_crpt.c:67:1: start of procedure RSA_size()
  65.   #include <openssl/rand.h>
  66.   
  67. > int RSA_size(const RSA *r)
  68.   {
  69.       return (BN_num_bytes(r->n));

crypto/rsa/rsa_crpt.c:69:5: 
  67.   int RSA_size(const RSA *r)
  68.   {
  69. >     return (BN_num_bytes(r->n));
  70.   }
  71.   

crypto/bn/bn_lib.c:216:1: start of procedure BN_num_bits()
    214.   }
    215.   
    216. > int BN_num_bits(const BIGNUM *a)
    217.   {
    218.       int i = a->top - 1;

crypto/bn/bn_lib.c:218:5: 
    216.   int BN_num_bits(const BIGNUM *a)
    217.   {
    218. >     int i = a->top - 1;
    219.       bn_check_top(a);
    220.   

crypto/bn/bn_lib.c:221:9: 
    219.       bn_check_top(a);
    220.   
    221. >     if (BN_is_zero(a))
    222.           return 0;
    223.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));

crypto/bn/bn_lib.c:901:1: start of procedure BN_is_zero()
      899.   }
      900.   
      901. > int BN_is_zero(const BIGNUM *a)
      902.   {
      903.       return a->top == 0;

crypto/bn/bn_lib.c:903:12: Condition is false
      901.   int BN_is_zero(const BIGNUM *a)
      902.   {
      903.       return a->top == 0;
                        ^
      904.   }
      905.   

crypto/bn/bn_lib.c:903:5: 
      901.   int BN_is_zero(const BIGNUM *a)
      902.   {
      903. >     return a->top == 0;
      904.   }
      905.   

crypto/bn/bn_lib.c:904:1: return from a call to BN_is_zero
      902.   {
      903.       return a->top == 0;
      904. > }
      905.   
      906.   int BN_is_one(const BIGNUM *a)

crypto/bn/bn_lib.c:221:9: Taking false branch
    219.       bn_check_top(a);
    220.   
    221.       if (BN_is_zero(a))
                   ^
    222.           return 0;
    223.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));

crypto/bn/bn_lib.c:223:5: Skipping BN_num_bits_word(): empty list of specs
    221.       if (BN_is_zero(a))
    222.           return 0;
    223.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
               ^
    224.   }
    225.   

crypto/bn/bn_lib.c:224:1: return from a call to BN_num_bits
    222.           return 0;
    223.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
    224. > }
    225.   
    226.   void BN_clear_free(BIGNUM *a)

crypto/rsa/rsa_crpt.c:70:1: return from a call to RSA_size
  68.   {
  69.       return (BN_num_bytes(r->n));
  70. > }
  71.   
  72.   int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to,

engines/e_4758cca.c:566:5: 
564.       long outputLength = RSA_size(rsa);
565.       long keyTokenLength;
566. >     unsigned char *keyToken = (unsigned char *)RSA_get_ex_data(rsa, hndidx);
567.   
568.       keyTokenLength = *(long *)keyToken;

crypto/rsa/rsa_lib.c:278:1: start of procedure RSA_get_ex_data()
  276.   }
  277.   
  278. > void *RSA_get_ex_data(const RSA *r, int idx)
  279.   {
  280.       return (CRYPTO_get_ex_data(&r->ex_data, idx));

crypto/rsa/rsa_lib.c:280:5: 
  278.   void *RSA_get_ex_data(const RSA *r, int idx)
  279.   {
  280. >     return (CRYPTO_get_ex_data(&r->ex_data, idx));
  281.   }
  282.   

crypto/ex_data.c:634:1: start of procedure CRYPTO_get_ex_data()
    632.    * particular index in the class used by this variable
    633.    */
    634. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    635.   {
    636.       if (ad->sk == NULL)

crypto/ex_data.c:636:9: Taking false branch
    634.   void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    635.   {
    636.       if (ad->sk == NULL)
                   ^
    637.           return (0);
    638.       else if (idx >= sk_void_num(ad->sk))

crypto/ex_data.c:638:21: Condition is true
    636.       if (ad->sk == NULL)
    637.           return (0);
    638.       else if (idx >= sk_void_num(ad->sk))
                               ^
    639.           return (0);
    640.       else

crypto/ex_data.c:638:14: 
    636.       if (ad->sk == NULL)
    637.           return (0);
    638. >     else if (idx >= sk_void_num(ad->sk))
    639.           return (0);
    640.       else

crypto/stack/stack.c:340:1: start of procedure sk_num()
      338.   }
      339.   
      340. > int sk_num(const _STACK *st)
      341.   {
      342.       if (st == NULL)

crypto/stack/stack.c:342:9: Taking false branch
      340.   int sk_num(const _STACK *st)
      341.   {
      342.       if (st == NULL)
                     ^
      343.           return -1;
      344.       return st->num;

crypto/stack/stack.c:344:5: 
      342.       if (st == NULL)
      343.           return -1;
      344. >     return st->num;
      345.   }
      346.   

crypto/stack/stack.c:345:1: return from a call to sk_num
      343.           return -1;
      344.       return st->num;
      345. > }
      346.   
      347.   void *sk_value(const _STACK *st, int i)

crypto/ex_data.c:638:14: Taking false branch
    636.       if (ad->sk == NULL)
    637.           return (0);
    638.       else if (idx >= sk_void_num(ad->sk))
                        ^
    639.           return (0);
    640.       else

crypto/ex_data.c:641:17: Condition is true
    639.           return (0);
    640.       else
    641.           return (sk_void_value(ad->sk, idx));
                           ^
    642.   }
    643.   

crypto/ex_data.c:641:9: 
    639.           return (0);
    640.       else
    641. >         return (sk_void_value(ad->sk, idx));
    642.   }
    643.   

crypto/stack/stack.c:347:1: start of procedure sk_value()
      345.   }
      346.   
      347. > void *sk_value(const _STACK *st, int i)
      348.   {
      349.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:349:10: Taking false branch
      347.   void *sk_value(const _STACK *st, int i)
      348.   {
      349.       if (!st || (i < 0) || (i >= st->num))
                      ^
      350.           return NULL;
      351.       return st->data[i];

crypto/stack/stack.c:349:17: Taking true branch
      347.   void *sk_value(const _STACK *st, int i)
      348.   {
      349.       if (!st || (i < 0) || (i >= st->num))
                             ^
      350.           return NULL;
      351.       return st->data[i];

crypto/stack/stack.c:350:9: 
      348.   {
      349.       if (!st || (i < 0) || (i >= st->num))
      350. >         return NULL;
      351.       return st->data[i];
      352.   }

crypto/stack/stack.c:352:1: return from a call to sk_value
      350.           return NULL;
      351.       return st->data[i];
      352. > }
      353.   
      354.   void *sk_set(_STACK *st, int i, void *value)

crypto/ex_data.c:642:1: return from a call to CRYPTO_get_ex_data
    640.       else
    641.           return (sk_void_value(ad->sk, idx));
    642. > }
    643.   
    644.   IMPLEMENT_STACK_OF(CRYPTO_EX_DATA_FUNCS)

crypto/rsa/rsa_lib.c:281:1: return from a call to RSA_get_ex_data
  279.   {
  280.       return (CRYPTO_get_ex_data(&r->ex_data, idx));
  281. > }
  282.   
  283.   int RSA_memory_lock(RSA *r)

engines/e_4758cca.c:568:5: 
566.       unsigned char *keyToken = (unsigned char *)RSA_get_ex_data(rsa, hndidx);
567.   
568. >     keyTokenLength = *(long *)keyToken;
569.       keyToken += sizeof(long);
570.   

static int cca_rsa_pub_enc(int flen, const unsigned char *from,
                           unsigned char *to, RSA *rsa, int padding)
{
    long returnCode;
    long reasonCode;
    long lflen = flen;
    long exitDataLength = 0;
    unsigned char exitData[8];
    long ruleArrayLength = 1;
    unsigned char ruleArray[8] = "PKCS-1.2";
    long dataStructureLength = 0;
    unsigned char dataStructure[8];
    long outputLength = RSA_size(rsa);
    long keyTokenLength;
    unsigned char *keyToken = (unsigned char *)RSA_get_ex_data(rsa, hndidx);
    keyTokenLength = *(long *)keyToken;
    keyToken += sizeof(long);
    pkaEncrypt(&returnCode, &reasonCode, &exitDataLength, exitData,
               &ruleArrayLength, ruleArray, &lflen, (unsigned char *)from,
               &dataStructureLength, dataStructure, &keyTokenLength,
               keyToken, &outputLength, to);
    if (returnCode || reasonCode)
        return -(returnCode << 16 | reasonCode);
    return outputLength;
}
['static int cca_rsa_pub_enc(int flen, const unsigned char *from,\n                           unsigned char *to, RSA *rsa, int padding)\n{\n    long returnCode;\n    long reasonCode;\n    long lflen = flen;\n    long exitDataLength = 0;\n    unsigned char exitData[8];\n    long ruleArrayLength = 1;\n    unsigned char ruleArray[8] = "PKCS-1.2";\n    long dataStructureLength = 0;\n    unsigned char dataStructure[8];\n    long outputLength = RSA_size(rsa);\n    long keyTokenLength;\n    unsigned char *keyToken = (unsigned char *)RSA_get_ex_data(rsa, hndidx);\n    keyTokenLength = *(long *)keyToken;\n    keyToken += sizeof(long);\n    pkaEncrypt(&returnCode, &reasonCode, &exitDataLength, exitData,\n               &ruleArrayLength, ruleArray, &lflen, (unsigned char *)from,\n               &dataStructureLength, dataStructure, &keyTokenLength,\n               keyToken, &outputLength, to);\n    if (returnCode || reasonCode)\n        return -(returnCode << 16 | reasonCode);\n    return outputLength;\n}', 'int RSA_size(const RSA *r)\n{\n    return (BN_num_bytes(r->n));\n}', 'int BN_num_bits(const BIGNUM *a)\n{\n    int i = a->top - 1;\n    bn_check_top(a);\n    if (BN_is_zero(a))\n        return 0;\n    return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));\n}', 'int BN_is_zero(const BIGNUM *a)\n{\n    return a->top == 0;\n}', 'void *RSA_get_ex_data(const RSA *r, int idx)\n{\n    return (CRYPTO_get_ex_data(&r->ex_data, idx));\n}', 'void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)\n{\n    if (ad->sk == NULL)\n        return (0);\n    else if (idx >= sk_void_num(ad->sk))\n        return (0);\n    else\n        return (sk_void_value(ad->sk, idx));\n}', 'int sk_num(const _STACK *st)\n{\n    if (st == NULL)\n        return -1;\n    return st->num;\n}', 'void *sk_value(const _STACK *st, int i)\n{\n    if (!st || (i < 0) || (i >= st->num))\n        return NULL;\n    return st->data[i];\n}']