apps/speed.c:972: error: NULL_DEREFERENCE
  pointer `null` is dereferenced by call to `EVP_EncryptUpdate()` at line 972, column 13.
Showing all 35 steps of the trace


apps/speed.c:951:1: start of procedure EVP_Update_loop_ccm()
949.    * code in your application.
950.    */
951. > static int EVP_Update_loop_ccm(void *args)
952.   {
953.       loopargs_t *tempargs = *(loopargs_t **) args;

apps/speed.c:953:5: 
951.   static int EVP_Update_loop_ccm(void *args)
952.   {
953. >     loopargs_t *tempargs = *(loopargs_t **) args;
954.       unsigned char *buf = tempargs->buf;
955.       EVP_CIPHER_CTX *ctx = tempargs->ctx;

apps/speed.c:954:5: 
952.   {
953.       loopargs_t *tempargs = *(loopargs_t **) args;
954. >     unsigned char *buf = tempargs->buf;
955.       EVP_CIPHER_CTX *ctx = tempargs->ctx;
956.       int outl, count;

apps/speed.c:955:5: 
953.       loopargs_t *tempargs = *(loopargs_t **) args;
954.       unsigned char *buf = tempargs->buf;
955. >     EVP_CIPHER_CTX *ctx = tempargs->ctx;
956.       int outl, count;
957.       unsigned char tag[12];

apps/speed.c:961:9: Taking false branch
959.       int nb_iter = save_count * 4 * lengths[0] / lengths[testnum];
960.   #endif
961.       if (decrypt) {
               ^
962.           for (count = 0; COND(nb_iter); count++) {
963.               EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, sizeof(tag), tag);

apps/speed.c:970:14: 
968.           }
969.       } else {
970. >         for (count = 0; COND(nb_iter); count++) {
971.               /* restore iv length field */
972.               EVP_EncryptUpdate(ctx, NULL, &outl, NULL, lengths[testnum]);

apps/speed.c:970:25: Loop condition is true. Entering loop body
968.           }
969.       } else {
970.           for (count = 0; COND(nb_iter); count++) {
                               ^
971.               /* restore iv length field */
972.               EVP_EncryptUpdate(ctx, NULL, &outl, NULL, lengths[testnum]);

apps/speed.c:970:25: Loop condition is true. Entering loop body
968.           }
969.       } else {
970.           for (count = 0; COND(nb_iter); count++) {
                               ^
971.               /* restore iv length field */
972.               EVP_EncryptUpdate(ctx, NULL, &outl, NULL, lengths[testnum]);

apps/speed.c:972:13: 
970.           for (count = 0; COND(nb_iter); count++) {
971.               /* restore iv length field */
972. >             EVP_EncryptUpdate(ctx, NULL, &outl, NULL, lengths[testnum]);
973.               /* counter is reset on every update */
974.               EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);

crypto/evp/evp_enc.c:297:1: start of procedure EVP_EncryptUpdate()
  295.   }
  296.   
  297. > int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
  298.                         const unsigned char *in, int inl)
  299.   {

crypto/evp/evp_enc.c:300:5: 
  298.                         const unsigned char *in, int inl)
  299.   {
  300. >     int i, j, bl, cmpl = inl;
  301.   
  302.       if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS))

crypto/evp/evp_enc.c:302:9: 
  300.       int i, j, bl, cmpl = inl;
  301.   
  302. >     if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS))
  303.           cmpl = (cmpl + 7) / 8;
  304.   

crypto/evp/evp_lib.c:525:1: start of procedure EVP_CIPHER_CTX_test_flags()
    523.   }
    524.   
    525. > int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags)
    526.   {
    527.       return (ctx->flags & flags);

crypto/evp/evp_lib.c:527:5: 
    525.   int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags)
    526.   {
    527. >     return (ctx->flags & flags);
    528.   }
    529.   

crypto/evp/evp_lib.c:528:1: return from a call to EVP_CIPHER_CTX_test_flags
    526.   {
    527.       return (ctx->flags & flags);
    528. > }
    529.   
    530.   int EVP_str2ctrl(int (*cb)(void *ctx, int cmd, void *buf, size_t buflen),

crypto/evp/evp_enc.c:302:9: Taking false branch
  300.       int i, j, bl, cmpl = inl;
  301.   
  302.       if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS))
                 ^
  303.           cmpl = (cmpl + 7) / 8;
  304.   

crypto/evp/evp_enc.c:305:5: 
  303.           cmpl = (cmpl + 7) / 8;
  304.   
  305. >     bl = ctx->cipher->block_size;
  306.   
  307.       if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {

crypto/evp/evp_enc.c:307:9: Taking true branch
  305.       bl = ctx->cipher->block_size;
  306.   
  307.       if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
                 ^
  308.           /* If block size > 1 then the cipher will have to do this check */
  309.           if (bl == 1 && is_partially_overlapping(out, in, cmpl)) {

crypto/evp/evp_enc.c:309:13: Taking true branch
  307.       if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
  308.           /* If block size > 1 then the cipher will have to do this check */
  309.           if (bl == 1 && is_partially_overlapping(out, in, cmpl)) {
                     ^
  310.               EVPerr(EVP_F_EVP_ENCRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);
  311.               return 0;

crypto/evp/evp_enc.c:309:24: 
  307.       if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
  308.           /* If block size > 1 then the cipher will have to do this check */
  309. >         if (bl == 1 && is_partially_overlapping(out, in, cmpl)) {
  310.               EVPerr(EVP_F_EVP_ENCRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);
  311.               return 0;

crypto/evp/evp_enc.c:283:1: start of procedure is_partially_overlapping()
    281.   #endif
    282.   
    283. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
    284.   {
    285.       PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;

crypto/evp/evp_enc.c:285:5: 
    283.   int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
    284.   {
    285. >     PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;
    286.       /*
    287.        * Check for partially overlapping buffers. [Binary logical

crypto/evp/evp_enc.c:291:23: Condition is true
    289.        * of conditional branches.]
    290.        */
    291.       int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |
                                 ^
    292.                                                   (diff > (0 - (PTRDIFF_T)len)));
    293.   

crypto/evp/evp_enc.c:291:35: Condition is false
    289.        * of conditional branches.]
    290.        */
    291.       int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |
                                             ^
    292.                                                   (diff > (0 - (PTRDIFF_T)len)));
    293.   

crypto/evp/evp_enc.c:291:50: Condition is true
    289.        * of conditional branches.]
    290.        */
    291.       int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |
                                                            ^
    292.                                                   (diff > (0 - (PTRDIFF_T)len)));
    293.   

crypto/evp/evp_enc.c:292:50: Condition is true
    290.        */
    291.       int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |
    292.                                                   (diff > (0 - (PTRDIFF_T)len)));
                                                            ^
    293.   
    294.       return overlapped;

crypto/evp/evp_enc.c:291:5: 
    289.        * of conditional branches.]
    290.        */
    291. >     int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |
    292.                                                   (diff > (0 - (PTRDIFF_T)len)));
    293.   

crypto/evp/evp_enc.c:294:5: 
    292.                                                   (diff > (0 - (PTRDIFF_T)len)));
    293.   
    294. >     return overlapped;
    295.   }
    296.   

crypto/evp/evp_enc.c:295:1: return from a call to is_partially_overlapping
    293.   
    294.       return overlapped;
    295. > }
    296.   
    297.   int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,

crypto/evp/evp_enc.c:309:24: Taking false branch
  307.       if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
  308.           /* If block size > 1 then the cipher will have to do this check */
  309.           if (bl == 1 && is_partially_overlapping(out, in, cmpl)) {
                                ^
  310.               EVPerr(EVP_F_EVP_ENCRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);
  311.               return 0;

crypto/evp/evp_enc.c:314:9: Skipping __function_pointer__(): unresolved function pointer
  312.           }
  313.   
  314.           i = ctx->cipher->do_cipher(ctx, out, in, inl);
                 ^
  315.           if (i < 0)
  316.               return 0;

crypto/evp/evp_enc.c:315:13: Taking false branch
  313.   
  314.           i = ctx->cipher->do_cipher(ctx, out, in, inl);
  315.           if (i < 0)
                     ^
  316.               return 0;
  317.           else

crypto/evp/evp_enc.c:318:13: 
  316.               return 0;
  317.           else
  318. >             *outl = i;
  319.           return 1;
  320.       }

crypto/evp/evp_enc.c:319:9: 
  317.           else
  318.               *outl = i;
  319. >         return 1;
  320.       }
  321.   

crypto/evp/evp_enc.c:372:1: return from a call to EVP_EncryptUpdate
  370.       ctx->buf_len = i;
  371.       return 1;
  372. > }
  373.   
  374.   int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)

static int EVP_Update_loop_ccm(void *args)
{
    loopargs_t *tempargs = *(loopargs_t **) args;
    unsigned char *buf = tempargs->buf;
    EVP_CIPHER_CTX *ctx = tempargs->ctx;
    int outl, count;
    unsigned char tag[12];
#ifndef SIGALRM
    int nb_iter = save_count * 4 * lengths[0] / lengths[testnum];
#endif
    if (decrypt) {
        for (count = 0; COND(nb_iter); count++) {
            EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, sizeof(tag), tag);
            EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv);
            EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
        }
    } else {
        for (count = 0; COND(nb_iter); count++) {
            EVP_EncryptUpdate(ctx, NULL, &outl, NULL, lengths[testnum]);
            EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
        }
    }
    if (decrypt)
        EVP_DecryptFinal_ex(ctx, buf, &outl);
    else
        EVP_EncryptFinal_ex(ctx, buf, &outl);
    return count;
}
['static int EVP_Update_loop_ccm(void *args)\n{\n    loopargs_t *tempargs = *(loopargs_t **) args;\n    unsigned char *buf = tempargs->buf;\n    EVP_CIPHER_CTX *ctx = tempargs->ctx;\n    int outl, count;\n    unsigned char tag[12];\n#ifndef SIGALRM\n    int nb_iter = save_count * 4 * lengths[0] / lengths[testnum];\n#endif\n    if (decrypt) {\n        for (count = 0; COND(nb_iter); count++) {\n            EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, sizeof(tag), tag);\n            EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv);\n            EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);\n        }\n    } else {\n        for (count = 0; COND(nb_iter); count++) {\n            EVP_EncryptUpdate(ctx, NULL, &outl, NULL, lengths[testnum]);\n            EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);\n        }\n    }\n    if (decrypt)\n        EVP_DecryptFinal_ex(ctx, buf, &outl);\n    else\n        EVP_EncryptFinal_ex(ctx, buf, &outl);\n    return count;\n}', 'int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,\n                      const unsigned char *in, int inl)\n{\n    int i, j, bl, cmpl = inl;\n    if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS))\n        cmpl = (cmpl + 7) / 8;\n    bl = ctx->cipher->block_size;\n    if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {\n        if (bl == 1 && is_partially_overlapping(out, in, cmpl)) {\n            EVPerr(EVP_F_EVP_ENCRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);\n            return 0;\n        }\n        i = ctx->cipher->do_cipher(ctx, out, in, inl);\n        if (i < 0)\n            return 0;\n        else\n            *outl = i;\n        return 1;\n    }\n    if (inl <= 0) {\n        *outl = 0;\n        return inl == 0;\n    }\n    if (is_partially_overlapping(out + ctx->buf_len, in, cmpl)) {\n        EVPerr(EVP_F_EVP_ENCRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);\n        return 0;\n    }\n    if (ctx->buf_len == 0 && (inl & (ctx->block_mask)) == 0) {\n        if (ctx->cipher->do_cipher(ctx, out, in, inl)) {\n            *outl = inl;\n            return 1;\n        } else {\n            *outl = 0;\n            return 0;\n        }\n    }\n    i = ctx->buf_len;\n    OPENSSL_assert(bl <= (int)sizeof(ctx->buf));\n    if (i != 0) {\n        if (bl - i > inl) {\n            memcpy(&(ctx->buf[i]), in, inl);\n            ctx->buf_len += inl;\n            *outl = 0;\n            return 1;\n        } else {\n            j = bl - i;\n            memcpy(&(ctx->buf[i]), in, j);\n            inl -= j;\n            in += j;\n            if (!ctx->cipher->do_cipher(ctx, out, ctx->buf, bl))\n                return 0;\n            out += bl;\n            *outl = bl;\n        }\n    } else\n        *outl = 0;\n    i = inl & (bl - 1);\n    inl -= i;\n    if (inl > 0) {\n        if (!ctx->cipher->do_cipher(ctx, out, in, inl))\n            return 0;\n        *outl += inl;\n    }\n    if (i != 0)\n        memcpy(ctx->buf, &(in[inl]), i);\n    ctx->buf_len = i;\n    return 1;\n}', 'int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags)\n{\n    return (ctx->flags & flags);\n}', 'int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)\n{\n    PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;\n    int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |\n                                                (diff > (0 - (PTRDIFF_T)len)));\n    return overlapped;\n}']