apps/pkeyutl.c:689: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 679, column 17 is not reachable after line 689, column 24.
Showing all 54 steps of the trace


apps/pkeyutl.c:668:1: start of procedure do_raw_keyop()
666.   #define TBUF_MAXSIZE 2048
667.   
668. > static int do_raw_keyop(int pkey_op, EVP_PKEY_CTX *ctx,
669.                           const EVP_MD *md, EVP_PKEY *pkey, BIO *in,
670.                           int filesize, unsigned char *sig, int siglen,

apps/pkeyutl.c:673:5: 
671.                           unsigned char **out, size_t *poutlen)
672.   {
673. >     int rv = 0;
674.       EVP_MD_CTX *mctx = NULL;
675.       unsigned char tbuf[TBUF_MAXSIZE];

apps/pkeyutl.c:674:5: 
672.   {
673.       int rv = 0;
674. >     EVP_MD_CTX *mctx = NULL;
675.       unsigned char tbuf[TBUF_MAXSIZE];
676.       unsigned char *mbuf = NULL;

apps/pkeyutl.c:676:5: 
674.       EVP_MD_CTX *mctx = NULL;
675.       unsigned char tbuf[TBUF_MAXSIZE];
676. >     unsigned char *mbuf = NULL;
677.       int buf_len = 0;
678.   

apps/pkeyutl.c:677:5: 
675.       unsigned char tbuf[TBUF_MAXSIZE];
676.       unsigned char *mbuf = NULL;
677. >     int buf_len = 0;
678.   
679.       if ((mctx = EVP_MD_CTX_new()) == NULL) {

apps/pkeyutl.c:679:9: 
677.       int buf_len = 0;
678.   
679. >     if ((mctx = EVP_MD_CTX_new()) == NULL) {
680.           BIO_printf(bio_err, "Error: out of memory\n");
681.           return rv;

crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_new()
  47.   }
  48.   
  49. > EVP_MD_CTX *EVP_MD_CTX_new(void)
  50.   {
  51.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));

crypto/evp/digest.c:51:5: 
  49.   EVP_MD_CTX *EVP_MD_CTX_new(void)
  50.   {
  51. >     return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  52.   }
  53.   

crypto/mem.c:228:1: start of procedure CRYPTO_zalloc()
    226.   }
    227.   
    228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:230:5: 
    228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230. >     void *ret = CRYPTO_malloc(num, file, line);
    231.   
    232.       FAILTEST();

crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
      190.   #endif
      191.   
      192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      193.   {
      194.       void *ret = NULL;

crypto/mem.c:194:5: 
      192.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      193.   {
      194. >     void *ret = NULL;
      195.   
      196.       INCREMENT(malloc_count);

crypto/mem.c:197:9: Taking false branch
      195.   
      196.       INCREMENT(malloc_count);
      197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      198.           return malloc_impl(num, file, line);
      199.   

crypto/mem.c:200:9: Taking false branch
      198.           return malloc_impl(num, file, line);
      199.   
      200.       if (num == 0)
                     ^
      201.           return NULL;
      202.   

crypto/mem.c:204:9: Taking true branch
      202.   
      203.       FAILTEST();
      204.       if (allow_customize) {
                     ^
      205.           /*
      206.            * Disallow customization after the first allocation. We only set this

crypto/mem.c:210:9: 
      208.            * allocation.
      209.            */
      210. >         allow_customize = 0;
      211.       }
      212.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:221:5: 
      219.       }
      220.   #else
      221. >     (void)(file); (void)(line);
      222.       ret = malloc(num);
      223.   #endif

crypto/mem.c:221:19: 
      219.       }
      220.   #else
      221. >     (void)(file); (void)(line);
      222.       ret = malloc(num);
      223.   #endif

crypto/mem.c:222:5: 
      220.   #else
      221.       (void)(file); (void)(line);
      222. >     ret = malloc(num);
      223.   #endif
      224.   

crypto/mem.c:225:5: 
      223.   #endif
      224.   
      225. >     return ret;
      226.   }
      227.   

crypto/mem.c:226:1: return from a call to CRYPTO_malloc
      224.   
      225.       return ret;
      226. > }
      227.   
      228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:233:9: Taking true branch
    231.   
    232.       FAILTEST();
    233.       if (ret != NULL)
                   ^
    234.           memset(ret, 0, num);
    235.       return ret;

crypto/mem.c:234:9: 
    232.       FAILTEST();
    233.       if (ret != NULL)
    234. >         memset(ret, 0, num);
    235.       return ret;
    236.   }

crypto/mem.c:235:5: 
    233.       if (ret != NULL)
    234.           memset(ret, 0, num);
    235. >     return ret;
    236.   }
    237.   

crypto/mem.c:236:1: return from a call to CRYPTO_zalloc
    234.           memset(ret, 0, num);
    235.       return ret;
    236. > }
    237.   
    238.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:52:1: return from a call to EVP_MD_CTX_new
  50.   {
  51.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  52. > }
  53.   
  54.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)

apps/pkeyutl.c:679:9: Taking false branch
677.       int buf_len = 0;
678.   
679.       if ((mctx = EVP_MD_CTX_new()) == NULL) {
               ^
680.           BIO_printf(bio_err, "Error: out of memory\n");
681.           return rv;

apps/pkeyutl.c:683:5: 
681.           return rv;
682.       }
683. >     EVP_MD_CTX_set_pkey_ctx(mctx, ctx);
684.   
685.       /* Some algorithms only support oneshot digests */

crypto/evp/evp_lib.c:463:1: start of procedure EVP_MD_CTX_set_pkey_ctx()
  461.   }
  462.   
  463. > void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx)
  464.   {
  465.       /*

crypto/evp/evp_lib.c:469:10: 
  467.        * we have to deal with the cleanup job here.
  468.        */
  469. >     if (!EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX))
  470.           EVP_PKEY_CTX_free(ctx->pctx);
  471.   

crypto/evp/evp_lib.c:510:1: start of procedure EVP_MD_CTX_test_flags()
    508.   }
    509.   
    510. > int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags)
    511.   {
    512.       return (ctx->flags & flags);

crypto/evp/evp_lib.c:512:5: 
    510.   int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags)
    511.   {
    512. >     return (ctx->flags & flags);
    513.   }
    514.   

crypto/evp/evp_lib.c:513:1: return from a call to EVP_MD_CTX_test_flags
    511.   {
    512.       return (ctx->flags & flags);
    513. > }
    514.   
    515.   void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags)

crypto/evp/evp_lib.c:469:10: Taking false branch
  467.        * we have to deal with the cleanup job here.
  468.        */
  469.       if (!EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX))
                  ^
  470.           EVP_PKEY_CTX_free(ctx->pctx);
  471.   

crypto/evp/evp_lib.c:472:5: 
  470.           EVP_PKEY_CTX_free(ctx->pctx);
  471.   
  472. >     ctx->pctx = pctx;
  473.   
  474.       if (pctx != NULL) {

crypto/evp/evp_lib.c:474:9: Taking true branch
  472.       ctx->pctx = pctx;
  473.   
  474.       if (pctx != NULL) {
                 ^
  475.           /* make sure pctx is not freed when destroying EVP_MD_CTX */
  476.           EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX);

crypto/evp/evp_lib.c:476:9: 
  474.       if (pctx != NULL) {
  475.           /* make sure pctx is not freed when destroying EVP_MD_CTX */
  476. >         EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX);
  477.       } else {
  478.           EVP_MD_CTX_clear_flags(ctx, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX);

crypto/evp/evp_lib.c:500:1: start of procedure EVP_MD_CTX_set_flags()
    498.   }
    499.   
    500. > void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags)
    501.   {
    502.       ctx->flags |= flags;

crypto/evp/evp_lib.c:502:5: 
    500.   void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags)
    501.   {
    502. >     ctx->flags |= flags;
    503.   }
    504.   

crypto/evp/evp_lib.c:503:1: return from a call to EVP_MD_CTX_set_flags
    501.   {
    502.       ctx->flags |= flags;
    503. > }
    504.   
    505.   void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags)

crypto/evp/evp_lib.c:474:5: 
  472.       ctx->pctx = pctx;
  473.   
  474. >     if (pctx != NULL) {
  475.           /* make sure pctx is not freed when destroying EVP_MD_CTX */
  476.           EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX);

crypto/evp/evp_lib.c:480:1: return from a call to EVP_MD_CTX_set_pkey_ctx
  478.           EVP_MD_CTX_clear_flags(ctx, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX);
  479.       }
  480. > }
  481.   
  482.   void *EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx)

apps/pkeyutl.c:686:9: 
684.   
685.       /* Some algorithms only support oneshot digests */
686. >     if (EVP_PKEY_id(pkey) == EVP_PKEY_ED25519
687.               || EVP_PKEY_id(pkey) == EVP_PKEY_ED448) {
688.           if (filesize < 0) {

crypto/evp/p_lib.c:580:1: start of procedure EVP_PKEY_id()
  578.   }
  579.   
  580. > int EVP_PKEY_id(const EVP_PKEY *pkey)
  581.   {
  582.       return pkey->type;

crypto/evp/p_lib.c:582:5: 
  580.   int EVP_PKEY_id(const EVP_PKEY *pkey)
  581.   {
  582. >     return pkey->type;
  583.   }
  584.   

crypto/evp/p_lib.c:583:1: return from a call to EVP_PKEY_id
  581.   {
  582.       return pkey->type;
  583. > }
  584.   
  585.   int EVP_PKEY_base_id(const EVP_PKEY *pkey)

apps/pkeyutl.c:686:9: Taking false branch
684.   
685.       /* Some algorithms only support oneshot digests */
686.       if (EVP_PKEY_id(pkey) == EVP_PKEY_ED25519
               ^
687.               || EVP_PKEY_id(pkey) == EVP_PKEY_ED448) {
688.           if (filesize < 0) {

apps/pkeyutl.c:687:16: 
685.       /* Some algorithms only support oneshot digests */
686.       if (EVP_PKEY_id(pkey) == EVP_PKEY_ED25519
687. >             || EVP_PKEY_id(pkey) == EVP_PKEY_ED448) {
688.           if (filesize < 0) {
689.               BIO_printf(bio_err,

crypto/evp/p_lib.c:580:1: start of procedure EVP_PKEY_id()
  578.   }
  579.   
  580. > int EVP_PKEY_id(const EVP_PKEY *pkey)
  581.   {
  582.       return pkey->type;

crypto/evp/p_lib.c:582:5: 
  580.   int EVP_PKEY_id(const EVP_PKEY *pkey)
  581.   {
  582. >     return pkey->type;
  583.   }
  584.   

crypto/evp/p_lib.c:583:1: return from a call to EVP_PKEY_id
  581.   {
  582.       return pkey->type;
  583. > }
  584.   
  585.   int EVP_PKEY_base_id(const EVP_PKEY *pkey)

apps/pkeyutl.c:687:16: Taking true branch
685.       /* Some algorithms only support oneshot digests */
686.       if (EVP_PKEY_id(pkey) == EVP_PKEY_ED25519
687.               || EVP_PKEY_id(pkey) == EVP_PKEY_ED448) {
                      ^
688.           if (filesize < 0) {
689.               BIO_printf(bio_err,

apps/pkeyutl.c:688:13: Taking true branch
686.       if (EVP_PKEY_id(pkey) == EVP_PKEY_ED25519
687.               || EVP_PKEY_id(pkey) == EVP_PKEY_ED448) {
688.           if (filesize < 0) {
                   ^
689.               BIO_printf(bio_err,
690.                          "Error: unable to determine file size for oneshot operation\n");

apps/pkeyutl.c:689:13: 
687.               || EVP_PKEY_id(pkey) == EVP_PKEY_ED448) {
688.           if (filesize < 0) {
689. >             BIO_printf(bio_err,
690.                          "Error: unable to determine file size for oneshot operation\n");
691.               return rv;

static int do_raw_keyop(int pkey_op, EVP_PKEY_CTX *ctx,
                        const EVP_MD *md, EVP_PKEY *pkey, BIO *in,
                        int filesize, unsigned char *sig, int siglen,
                        unsigned char **out, size_t *poutlen)
{
    int rv = 0;
    EVP_MD_CTX *mctx = NULL;
    unsigned char tbuf[TBUF_MAXSIZE];
    unsigned char *mbuf = NULL;
    int buf_len = 0;
    if ((mctx = EVP_MD_CTX_new()) == NULL) {
        BIO_printf(bio_err, "Error: out of memory\n");
        return rv;
    }
    EVP_MD_CTX_set_pkey_ctx(mctx, ctx);
    if (EVP_PKEY_id(pkey) == EVP_PKEY_ED25519
            || EVP_PKEY_id(pkey) == EVP_PKEY_ED448) {
        if (filesize < 0) {
            BIO_printf(bio_err,
                       "Error: unable to determine file size for oneshot operation\n");
            return rv;
        }
        mbuf = app_malloc(filesize, "oneshot sign/verify buffer");
        switch(pkey_op) {
        case EVP_PKEY_OP_VERIFY:
            if (EVP_DigestVerifyInit(mctx, NULL, md, NULL, pkey) != 1)
                goto end;
            buf_len = BIO_read(in, mbuf, filesize);
            if (buf_len != filesize) {
                BIO_printf(bio_err, "Error reading raw input data\n");
                goto end;
            }
            rv = EVP_DigestVerify(mctx, sig, (size_t)siglen, mbuf, buf_len);
            break;
        case EVP_PKEY_OP_SIGN:
            if (EVP_DigestSignInit(mctx, NULL, md, NULL, pkey) != 1)
                goto end;
            buf_len = BIO_read(in, mbuf, filesize);
            if (buf_len != filesize) {
                BIO_printf(bio_err, "Error reading raw input data\n");
                goto end;
            }
            rv = EVP_DigestSign(mctx, NULL, poutlen, mbuf, buf_len);
            if (rv == 1 && out != NULL) {
                *out = app_malloc(*poutlen, "buffer output");
                rv = EVP_DigestSign(mctx, *out, poutlen, mbuf, buf_len);
            }
            break;
        }
        OPENSSL_free(mbuf);
        goto end;
    }
    switch(pkey_op) {
    case EVP_PKEY_OP_VERIFY:
        if (EVP_DigestVerifyInit(mctx, NULL, md, NULL, pkey) != 1)
            goto end;
        for (;;) {
            buf_len = BIO_read(in, tbuf, TBUF_MAXSIZE);
            if (buf_len == 0)
                break;
            if (buf_len < 0) {
                BIO_printf(bio_err, "Error reading raw input data\n");
                goto end;
            }
            rv = EVP_DigestVerifyUpdate(mctx, tbuf, (size_t)buf_len);
            if (rv != 1) {
                BIO_printf(bio_err, "Error verifying raw input data\n");
                goto end;
            }
        }
        rv = EVP_DigestVerifyFinal(mctx, sig, (size_t)siglen);
        break;
    case EVP_PKEY_OP_SIGN:
        if (EVP_DigestSignInit(mctx, NULL, md, NULL, pkey) != 1)
            goto end;
        for (;;) {
            buf_len = BIO_read(in, tbuf, TBUF_MAXSIZE);
            if (buf_len == 0)
                break;
            if (buf_len < 0) {
                BIO_printf(bio_err, "Error reading raw input data\n");
                goto end;
            }
            rv = EVP_DigestSignUpdate(mctx, tbuf, (size_t)buf_len);
            if (rv != 1) {
                BIO_printf(bio_err, "Error signing raw input data\n");
                goto end;
            }
        }
        rv = EVP_DigestSignFinal(mctx, NULL, poutlen);
        if (rv == 1 && out != NULL) {
            *out = app_malloc(*poutlen, "buffer output");
            rv = EVP_DigestSignFinal(mctx, *out, poutlen);
        }
        break;
    }
 end:
    EVP_MD_CTX_free(mctx);
    return rv;
}
['static int do_raw_keyop(int pkey_op, EVP_PKEY_CTX *ctx,\n                        const EVP_MD *md, EVP_PKEY *pkey, BIO *in,\n                        int filesize, unsigned char *sig, int siglen,\n                        unsigned char **out, size_t *poutlen)\n{\n    int rv = 0;\n    EVP_MD_CTX *mctx = NULL;\n    unsigned char tbuf[TBUF_MAXSIZE];\n    unsigned char *mbuf = NULL;\n    int buf_len = 0;\n    if ((mctx = EVP_MD_CTX_new()) == NULL) {\n        BIO_printf(bio_err, "Error: out of memory\\n");\n        return rv;\n    }\n    EVP_MD_CTX_set_pkey_ctx(mctx, ctx);\n    if (EVP_PKEY_id(pkey) == EVP_PKEY_ED25519\n            || EVP_PKEY_id(pkey) == EVP_PKEY_ED448) {\n        if (filesize < 0) {\n            BIO_printf(bio_err,\n                       "Error: unable to determine file size for oneshot operation\\n");\n            return rv;\n        }\n        mbuf = app_malloc(filesize, "oneshot sign/verify buffer");\n        switch(pkey_op) {\n        case EVP_PKEY_OP_VERIFY:\n            if (EVP_DigestVerifyInit(mctx, NULL, md, NULL, pkey) != 1)\n                goto end;\n            buf_len = BIO_read(in, mbuf, filesize);\n            if (buf_len != filesize) {\n                BIO_printf(bio_err, "Error reading raw input data\\n");\n                goto end;\n            }\n            rv = EVP_DigestVerify(mctx, sig, (size_t)siglen, mbuf, buf_len);\n            break;\n        case EVP_PKEY_OP_SIGN:\n            if (EVP_DigestSignInit(mctx, NULL, md, NULL, pkey) != 1)\n                goto end;\n            buf_len = BIO_read(in, mbuf, filesize);\n            if (buf_len != filesize) {\n                BIO_printf(bio_err, "Error reading raw input data\\n");\n                goto end;\n            }\n            rv = EVP_DigestSign(mctx, NULL, poutlen, mbuf, buf_len);\n            if (rv == 1 && out != NULL) {\n                *out = app_malloc(*poutlen, "buffer output");\n                rv = EVP_DigestSign(mctx, *out, poutlen, mbuf, buf_len);\n            }\n            break;\n        }\n        OPENSSL_free(mbuf);\n        goto end;\n    }\n    switch(pkey_op) {\n    case EVP_PKEY_OP_VERIFY:\n        if (EVP_DigestVerifyInit(mctx, NULL, md, NULL, pkey) != 1)\n            goto end;\n        for (;;) {\n            buf_len = BIO_read(in, tbuf, TBUF_MAXSIZE);\n            if (buf_len == 0)\n                break;\n            if (buf_len < 0) {\n                BIO_printf(bio_err, "Error reading raw input data\\n");\n                goto end;\n            }\n            rv = EVP_DigestVerifyUpdate(mctx, tbuf, (size_t)buf_len);\n            if (rv != 1) {\n                BIO_printf(bio_err, "Error verifying raw input data\\n");\n                goto end;\n            }\n        }\n        rv = EVP_DigestVerifyFinal(mctx, sig, (size_t)siglen);\n        break;\n    case EVP_PKEY_OP_SIGN:\n        if (EVP_DigestSignInit(mctx, NULL, md, NULL, pkey) != 1)\n            goto end;\n        for (;;) {\n            buf_len = BIO_read(in, tbuf, TBUF_MAXSIZE);\n            if (buf_len == 0)\n                break;\n            if (buf_len < 0) {\n                BIO_printf(bio_err, "Error reading raw input data\\n");\n                goto end;\n            }\n            rv = EVP_DigestSignUpdate(mctx, tbuf, (size_t)buf_len);\n            if (rv != 1) {\n                BIO_printf(bio_err, "Error signing raw input data\\n");\n                goto end;\n            }\n        }\n        rv = EVP_DigestSignFinal(mctx, NULL, poutlen);\n        if (rv == 1 && out != NULL) {\n            *out = app_malloc(*poutlen, "buffer output");\n            rv = EVP_DigestSignFinal(mctx, *out, poutlen);\n        }\n        break;\n    }\n end:\n    EVP_MD_CTX_free(mctx);\n    return rv;\n}', 'EVP_MD_CTX *EVP_MD_CTX_new(void)\n{\n    return OPENSSL_zalloc(sizeof(EVP_MD_CTX));\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    FAILTEST();\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    INCREMENT(malloc_count);\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num == 0)\n        return NULL;\n    FAILTEST();\n    if (allow_customize) {\n        allow_customize = 0;\n    }\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)(file); (void)(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}', 'void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx)\n{\n    if (!EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX))\n        EVP_PKEY_CTX_free(ctx->pctx);\n    ctx->pctx = pctx;\n    if (pctx != NULL) {\n        EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX);\n    } else {\n        EVP_MD_CTX_clear_flags(ctx, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX);\n    }\n}', 'int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags)\n{\n    return (ctx->flags & flags);\n}', 'void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags)\n{\n    ctx->flags |= flags;\n}', 'int EVP_PKEY_id(const EVP_PKEY *pkey)\n{\n    return pkey->type;\n}']