ssl/record/ssl3_record.c:946: error: NULL_DEREFERENCE
  pointer `hmac` last assigned on line 883 could be null and is dereferenced by call to `EVP_MD_CTX_free()` at line 946, column 13.
Showing all 60 steps of the trace


ssl/record/ssl3_record.c:876:1: start of procedure tls1_mac()
874.   }
875.   
876. > int tls1_mac(SSL *ssl, unsigned char *md, int send)
877.   {
878.       SSL3_RECORD *rec;

ssl/record/ssl3_record.c:883:5: 
881.       size_t md_size;
882.       int i;
883. >     EVP_MD_CTX *hmac = NULL, *mac_ctx;
884.       unsigned char header[13];
885.       int stream_mac = (send ? (ssl->mac_flags & SSL_MAC_FLAG_WRITE_MAC_STREAM)

ssl/record/ssl3_record.c:885:23: Condition is false
883.       EVP_MD_CTX *hmac = NULL, *mac_ctx;
884.       unsigned char header[13];
885.       int stream_mac = (send ? (ssl->mac_flags & SSL_MAC_FLAG_WRITE_MAC_STREAM)
                             ^
886.                         : (ssl->mac_flags & SSL_MAC_FLAG_READ_MAC_STREAM));
887.       int t;

ssl/record/ssl3_record.c:885:5: 
883.       EVP_MD_CTX *hmac = NULL, *mac_ctx;
884.       unsigned char header[13];
885. >     int stream_mac = (send ? (ssl->mac_flags & SSL_MAC_FLAG_WRITE_MAC_STREAM)
886.                         : (ssl->mac_flags & SSL_MAC_FLAG_READ_MAC_STREAM));
887.       int t;

ssl/record/ssl3_record.c:889:9: Taking false branch
887.       int t;
888.   
889.       if (send) {
               ^
890.           rec = RECORD_LAYER_get_wrec(&ssl->rlayer);
891.           seq = RECORD_LAYER_get_write_sequence(&ssl->rlayer);

ssl/record/ssl3_record.c:894:9: 
892.           hash = ssl->write_hash;
893.       } else {
894. >         rec = RECORD_LAYER_get_rrec(&ssl->rlayer);
895.           seq = RECORD_LAYER_get_read_sequence(&ssl->rlayer);
896.           hash = ssl->read_hash;

ssl/record/ssl3_record.c:895:9: 
893.       } else {
894.           rec = RECORD_LAYER_get_rrec(&ssl->rlayer);
895. >         seq = RECORD_LAYER_get_read_sequence(&ssl->rlayer);
896.           hash = ssl->read_hash;
897.       }

ssl/record/ssl3_record.c:896:9: 
894.           rec = RECORD_LAYER_get_rrec(&ssl->rlayer);
895.           seq = RECORD_LAYER_get_read_sequence(&ssl->rlayer);
896. >         hash = ssl->read_hash;
897.       }
898.   

ssl/record/ssl3_record.c:899:5: 
897.       }
898.   
899. >     t = EVP_MD_CTX_size(hash);
900.       OPENSSL_assert(t >= 0);
901.       md_size = t;

crypto/evp/evp_lib.c:436:1: start of procedure EVP_MD_CTX_md()
  434.   }
  435.   
  436. > const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)
  437.   {
  438.       if (!ctx)

crypto/evp/evp_lib.c:438:10: Taking false branch
  436.   const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)
  437.   {
  438.       if (!ctx)
                  ^
  439.           return NULL;
  440.       return ctx->digest;

crypto/evp/evp_lib.c:440:5: 
  438.       if (!ctx)
  439.           return NULL;
  440. >     return ctx->digest;
  441.   }
  442.   

crypto/evp/evp_lib.c:441:1: return from a call to EVP_MD_CTX_md
  439.           return NULL;
  440.       return ctx->digest;
  441. > }
  442.   
  443.   EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx)

crypto/evp/evp_lib.c:300:1: start of procedure EVP_MD_size()
  298.   }
  299.   
  300. > int EVP_MD_size(const EVP_MD *md)
  301.   {
  302.       if (!md) {

crypto/evp/evp_lib.c:302:10: Taking false branch
  300.   int EVP_MD_size(const EVP_MD *md)
  301.   {
  302.       if (!md) {
                  ^
  303.           EVPerr(EVP_F_EVP_MD_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL);
  304.           return -1;

crypto/evp/evp_lib.c:306:5: 
  304.           return -1;
  305.       }
  306. >     return md->md_size;
  307.   }
  308.   

crypto/evp/evp_lib.c:307:1: return from a call to EVP_MD_size
  305.       }
  306.       return md->md_size;
  307. > }
  308.   
  309.   unsigned long EVP_MD_flags(const EVP_MD *md)

ssl/record/ssl3_record.c:900:5: Condition is true
898.   
899.       t = EVP_MD_CTX_size(hash);
900.       OPENSSL_assert(t >= 0);
           ^
901.       md_size = t;
902.   

ssl/record/ssl3_record.c:901:5: 
899.       t = EVP_MD_CTX_size(hash);
900.       OPENSSL_assert(t >= 0);
901. >     md_size = t;
902.   
903.       /* I should fix this up TLS TLS TLS TLS TLS XXXXXXXX */

ssl/record/ssl3_record.c:904:9: Taking true branch
902.   
903.       /* I should fix this up TLS TLS TLS TLS TLS XXXXXXXX */
904.       if (stream_mac) {
               ^
905.           mac_ctx = hash;
906.       } else {

ssl/record/ssl3_record.c:905:9: 
903.       /* I should fix this up TLS TLS TLS TLS TLS XXXXXXXX */
904.       if (stream_mac) {
905. >         mac_ctx = hash;
906.       } else {
907.           hmac = EVP_MD_CTX_new();

ssl/record/ssl3_record.c:914:9: Taking true branch
912.       }
913.   
914.       if (SSL_IS_DTLS(ssl)) {
               ^
915.           unsigned char dtlsseq[8], *p = dtlsseq;
916.   

ssl/record/ssl3_record.c:915:9: 
913.   
914.       if (SSL_IS_DTLS(ssl)) {
915. >         unsigned char dtlsseq[8], *p = dtlsseq;
916.   
917.           s2n(send ? DTLS_RECORD_LAYER_get_w_epoch(&ssl->rlayer) :

ssl/record/ssl3_record.c:917:9: Condition is false
915.           unsigned char dtlsseq[8], *p = dtlsseq;
916.   
917.           s2n(send ? DTLS_RECORD_LAYER_get_w_epoch(&ssl->rlayer) :
               ^
918.               DTLS_RECORD_LAYER_get_r_epoch(&ssl->rlayer), p);
919.           memcpy(p, &seq[2], 6);

ssl/record/ssl3_record.c:917:9: Condition is false
915.           unsigned char dtlsseq[8], *p = dtlsseq;
916.   
917.           s2n(send ? DTLS_RECORD_LAYER_get_w_epoch(&ssl->rlayer) :
               ^
918.               DTLS_RECORD_LAYER_get_r_epoch(&ssl->rlayer), p);
919.           memcpy(p, &seq[2], 6);

ssl/record/ssl3_record.c:919:9: 
917.           s2n(send ? DTLS_RECORD_LAYER_get_w_epoch(&ssl->rlayer) :
918.               DTLS_RECORD_LAYER_get_r_epoch(&ssl->rlayer), p);
919. >         memcpy(p, &seq[2], 6);
920.   
921.           memcpy(header, dtlsseq, 8);

ssl/record/ssl3_record.c:921:9: 
919.           memcpy(p, &seq[2], 6);
920.   
921. >         memcpy(header, dtlsseq, 8);
922.       } else
923.           memcpy(header, seq, 8);

ssl/record/ssl3_record.c:925:5: 
923.           memcpy(header, seq, 8);
924.   
925. >     header[8] = rec->type;
926.       header[9] = (unsigned char)(ssl->version >> 8);
927.       header[10] = (unsigned char)(ssl->version);

ssl/record/ssl3_record.c:926:5: 
924.   
925.       header[8] = rec->type;
926. >     header[9] = (unsigned char)(ssl->version >> 8);
927.       header[10] = (unsigned char)(ssl->version);
928.       header[11] = (rec->length) >> 8;

ssl/record/ssl3_record.c:927:5: 
925.       header[8] = rec->type;
926.       header[9] = (unsigned char)(ssl->version >> 8);
927. >     header[10] = (unsigned char)(ssl->version);
928.       header[11] = (rec->length) >> 8;
929.       header[12] = (rec->length) & 0xff;

ssl/record/ssl3_record.c:928:5: 
926.       header[9] = (unsigned char)(ssl->version >> 8);
927.       header[10] = (unsigned char)(ssl->version);
928. >     header[11] = (rec->length) >> 8;
929.       header[12] = (rec->length) & 0xff;
930.   

ssl/record/ssl3_record.c:929:5: 
927.       header[10] = (unsigned char)(ssl->version);
928.       header[11] = (rec->length) >> 8;
929. >     header[12] = (rec->length) & 0xff;
930.   
931.       if (!send && !SSL_USE_ETM(ssl) &&

ssl/record/ssl3_record.c:931:10: Taking true branch
929.       header[12] = (rec->length) & 0xff;
930.   
931.       if (!send && !SSL_USE_ETM(ssl) &&
                ^
932.           EVP_CIPHER_CTX_mode(ssl->enc_read_ctx) == EVP_CIPH_CBC_MODE &&
933.           ssl3_cbc_record_digest_supported(mac_ctx)) {

ssl/record/ssl3_record.c:931:19: Taking true branch
929.       header[12] = (rec->length) & 0xff;
930.   
931.       if (!send && !SSL_USE_ETM(ssl) &&
                         ^
932.           EVP_CIPHER_CTX_mode(ssl->enc_read_ctx) == EVP_CIPH_CBC_MODE &&
933.           ssl3_cbc_record_digest_supported(mac_ctx)) {

ssl/record/ssl3_record.c:932:9: 
930.   
931.       if (!send && !SSL_USE_ETM(ssl) &&
932. >         EVP_CIPHER_CTX_mode(ssl->enc_read_ctx) == EVP_CIPH_CBC_MODE &&
933.           ssl3_cbc_record_digest_supported(mac_ctx)) {
934.           /*

crypto/evp/evp_lib.c:240:1: start of procedure EVP_CIPHER_CTX_flags()
  238.   }
  239.   
  240. > unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx)
  241.   {
  242.       return ctx->cipher->flags;

crypto/evp/evp_lib.c:242:5: 
  240.   unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx)
  241.   {
  242. >     return ctx->cipher->flags;
  243.   }
  244.   

crypto/evp/evp_lib.c:243:1: return from a call to EVP_CIPHER_CTX_flags
  241.   {
  242.       return ctx->cipher->flags;
  243. > }
  244.   
  245.   void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx)

ssl/record/ssl3_record.c:932:9: Taking true branch
930.   
931.       if (!send && !SSL_USE_ETM(ssl) &&
932.           EVP_CIPHER_CTX_mode(ssl->enc_read_ctx) == EVP_CIPH_CBC_MODE &&
               ^
933.           ssl3_cbc_record_digest_supported(mac_ctx)) {
934.           /*

ssl/record/ssl3_record.c:933:9: 
931.       if (!send && !SSL_USE_ETM(ssl) &&
932.           EVP_CIPHER_CTX_mode(ssl->enc_read_ctx) == EVP_CIPH_CBC_MODE &&
933. >         ssl3_cbc_record_digest_supported(mac_ctx)) {
934.           /*
935.            * This is a CBC-encrypted record. We must avoid leaking any

ssl/s3_cbc.c:138:1: start of procedure ssl3_cbc_record_digest_supported()
  136.    * which ssl3_cbc_digest_record supports.
  137.    */
  138. > char ssl3_cbc_record_digest_supported(const EVP_MD_CTX *ctx)
  139.   {
  140.       if (FIPS_mode())

ssl/s3_cbc.c:140:9: 
  138.   char ssl3_cbc_record_digest_supported(const EVP_MD_CTX *ctx)
  139.   {
  140. >     if (FIPS_mode())
  141.           return 0;
  142.       switch (EVP_MD_CTX_type(ctx)) {

crypto/o_fips.c:64:1: start of procedure FIPS_mode()
    62.   #endif
    63.   
    64. > int FIPS_mode(void)
    65.   {
    66.   #ifdef OPENSSL_FIPS

crypto/o_fips.c:69:5: 
    67.       return FIPS_module_mode();
    68.   #else
    69. >     return 0;
    70.   #endif
    71.   }

crypto/o_fips.c:71:1: return from a call to FIPS_mode
    69.       return 0;
    70.   #endif
    71. > }
    72.   
    73.   int FIPS_mode_set(int r)

ssl/s3_cbc.c:140:9: Taking false branch
  138.   char ssl3_cbc_record_digest_supported(const EVP_MD_CTX *ctx)
  139.   {
  140.       if (FIPS_mode())
                 ^
  141.           return 0;
  142.       switch (EVP_MD_CTX_type(ctx)) {

ssl/s3_cbc.c:142:5: 
  140.       if (FIPS_mode())
  141.           return 0;
  142. >     switch (EVP_MD_CTX_type(ctx)) {
  143.       case NID_md5:
  144.       case NID_sha1:

crypto/evp/evp_lib.c:436:1: start of procedure EVP_MD_CTX_md()
    434.   }
    435.   
    436. > const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)
    437.   {
    438.       if (!ctx)

crypto/evp/evp_lib.c:438:10: Taking false branch
    436.   const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)
    437.   {
    438.       if (!ctx)
                    ^
    439.           return NULL;
    440.       return ctx->digest;

crypto/evp/evp_lib.c:440:5: 
    438.       if (!ctx)
    439.           return NULL;
    440. >     return ctx->digest;
    441.   }
    442.   

crypto/evp/evp_lib.c:441:1: return from a call to EVP_MD_CTX_md
    439.           return NULL;
    440.       return ctx->digest;
    441. > }
    442.   
    443.   EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx)

crypto/evp/evp_lib.c:290:1: start of procedure EVP_MD_type()
    288.   }
    289.   
    290. > int EVP_MD_type(const EVP_MD *md)
    291.   {
    292.       return md->type;

crypto/evp/evp_lib.c:292:5: 
    290.   int EVP_MD_type(const EVP_MD *md)
    291.   {
    292. >     return md->type;
    293.   }
    294.   

crypto/evp/evp_lib.c:293:1: return from a call to EVP_MD_type
    291.   {
    292.       return md->type;
    293. > }
    294.   
    295.   int EVP_MD_pkey_type(const EVP_MD *md)

ssl/s3_cbc.c:143:5: Switch condition is true. Entering switch case
  141.           return 0;
  142.       switch (EVP_MD_CTX_type(ctx)) {
  143.       case NID_md5:
             ^
  144.       case NID_sha1:
  145.       case NID_sha224:

ssl/s3_cbc.c:149:9: 
  147.       case NID_sha384:
  148.       case NID_sha512:
  149. >         return 1;
  150.       default:
  151.           return 0;

ssl/s3_cbc.c:153:1: return from a call to ssl3_cbc_record_digest_supported
  151.           return 0;
  152.       }
  153. > }
  154.   
  155.   /*-

ssl/record/ssl3_record.c:933:9: Taking true branch
931.       if (!send && !SSL_USE_ETM(ssl) &&
932.           EVP_CIPHER_CTX_mode(ssl->enc_read_ctx) == EVP_CIPH_CBC_MODE &&
933.           ssl3_cbc_record_digest_supported(mac_ctx)) {
               ^
934.           /*
935.            * This is a CBC-encrypted record. We must avoid leaking any

ssl/record/ssl3_record.c:940:13: Taking true branch
938.            */
939.           /* Final param == not SSLv3 */
940.           if (ssl3_cbc_digest_record(mac_ctx,
                   ^
941.                                      md, &md_size,
942.                                      header, rec->input,

ssl/record/ssl3_record.c:946:13: 
944.                                      ssl->s3->read_mac_secret,
945.                                      ssl->s3->read_mac_secret_size, 0) <= 0) {
946. >             EVP_MD_CTX_free(hmac);
947.               return -1;
948.           }

int tls1_mac(SSL *ssl, unsigned char *md, int send)
{
    SSL3_RECORD *rec;
    unsigned char *seq;
    EVP_MD_CTX *hash;
    size_t md_size;
    int i;
    EVP_MD_CTX *hmac = NULL, *mac_ctx;
    unsigned char header[13];
    int stream_mac = (send ? (ssl->mac_flags & SSL_MAC_FLAG_WRITE_MAC_STREAM)
                      : (ssl->mac_flags & SSL_MAC_FLAG_READ_MAC_STREAM));
    int t;
    if (send) {
        rec = RECORD_LAYER_get_wrec(&ssl->rlayer);
        seq = RECORD_LAYER_get_write_sequence(&ssl->rlayer);
        hash = ssl->write_hash;
    } else {
        rec = RECORD_LAYER_get_rrec(&ssl->rlayer);
        seq = RECORD_LAYER_get_read_sequence(&ssl->rlayer);
        hash = ssl->read_hash;
    }
    t = EVP_MD_CTX_size(hash);
    OPENSSL_assert(t >= 0);
    md_size = t;
    if (stream_mac) {
        mac_ctx = hash;
    } else {
        hmac = EVP_MD_CTX_new();
        if (hmac == NULL
                || !EVP_MD_CTX_copy(hmac, hash))
            return -1;
        mac_ctx = hmac;
    }
    if (SSL_IS_DTLS(ssl)) {
        unsigned char dtlsseq[8], *p = dtlsseq;
        s2n(send ? DTLS_RECORD_LAYER_get_w_epoch(&ssl->rlayer) :
            DTLS_RECORD_LAYER_get_r_epoch(&ssl->rlayer), p);
        memcpy(p, &seq[2], 6);
        memcpy(header, dtlsseq, 8);
    } else
        memcpy(header, seq, 8);
    header[8] = rec->type;
    header[9] = (unsigned char)(ssl->version >> 8);
    header[10] = (unsigned char)(ssl->version);
    header[11] = (rec->length) >> 8;
    header[12] = (rec->length) & 0xff;
    if (!send && !SSL_USE_ETM(ssl) &&
        EVP_CIPHER_CTX_mode(ssl->enc_read_ctx) == EVP_CIPH_CBC_MODE &&
        ssl3_cbc_record_digest_supported(mac_ctx)) {
        if (ssl3_cbc_digest_record(mac_ctx,
                                   md, &md_size,
                                   header, rec->input,
                                   rec->length + md_size, rec->orig_len,
                                   ssl->s3->read_mac_secret,
                                   ssl->s3->read_mac_secret_size, 0) <= 0) {
            EVP_MD_CTX_free(hmac);
            return -1;
        }
    } else {
        if (EVP_DigestSignUpdate(mac_ctx, header, sizeof(header)) <= 0
                || EVP_DigestSignUpdate(mac_ctx, rec->input, rec->length) <= 0
                || EVP_DigestSignFinal(mac_ctx, md, &md_size) <= 0) {
            EVP_MD_CTX_free(hmac);
            return -1;
        }
        if (!send && !SSL_USE_ETM(ssl) && FIPS_mode())
            tls_fips_digest_extra(ssl->enc_read_ctx,
                                  mac_ctx, rec->input,
                                  rec->length, rec->orig_len);
    }
    EVP_MD_CTX_free(hmac);
#ifdef TLS_DEBUG
    fprintf(stderr, "seq=");
    {
        int z;
        for (z = 0; z < 8; z++)
            fprintf(stderr, "%02X ", seq[z]);
        fprintf(stderr, "\n");
    }
    fprintf(stderr, "rec=");
    {
        unsigned int z;
        for (z = 0; z < rec->length; z++)
            fprintf(stderr, "%02X ", rec->data[z]);
        fprintf(stderr, "\n");
    }
#endif
    if (!SSL_IS_DTLS(ssl)) {
        for (i = 7; i >= 0; i--) {
            ++seq[i];
            if (seq[i] != 0)
                break;
        }
    }
#ifdef TLS_DEBUG
    {
        unsigned int z;
        for (z = 0; z < md_size; z++)
            fprintf(stderr, "%02X ", md[z]);
        fprintf(stderr, "\n");
    }
#endif
    return (md_size);
}
['int tls1_mac(SSL *ssl, unsigned char *md, int send)\n{\n    SSL3_RECORD *rec;\n    unsigned char *seq;\n    EVP_MD_CTX *hash;\n    size_t md_size;\n    int i;\n    EVP_MD_CTX *hmac = NULL, *mac_ctx;\n    unsigned char header[13];\n    int stream_mac = (send ? (ssl->mac_flags & SSL_MAC_FLAG_WRITE_MAC_STREAM)\n                      : (ssl->mac_flags & SSL_MAC_FLAG_READ_MAC_STREAM));\n    int t;\n    if (send) {\n        rec = RECORD_LAYER_get_wrec(&ssl->rlayer);\n        seq = RECORD_LAYER_get_write_sequence(&ssl->rlayer);\n        hash = ssl->write_hash;\n    } else {\n        rec = RECORD_LAYER_get_rrec(&ssl->rlayer);\n        seq = RECORD_LAYER_get_read_sequence(&ssl->rlayer);\n        hash = ssl->read_hash;\n    }\n    t = EVP_MD_CTX_size(hash);\n    OPENSSL_assert(t >= 0);\n    md_size = t;\n    if (stream_mac) {\n        mac_ctx = hash;\n    } else {\n        hmac = EVP_MD_CTX_new();\n        if (hmac == NULL\n                || !EVP_MD_CTX_copy(hmac, hash))\n            return -1;\n        mac_ctx = hmac;\n    }\n    if (SSL_IS_DTLS(ssl)) {\n        unsigned char dtlsseq[8], *p = dtlsseq;\n        s2n(send ? DTLS_RECORD_LAYER_get_w_epoch(&ssl->rlayer) :\n            DTLS_RECORD_LAYER_get_r_epoch(&ssl->rlayer), p);\n        memcpy(p, &seq[2], 6);\n        memcpy(header, dtlsseq, 8);\n    } else\n        memcpy(header, seq, 8);\n    header[8] = rec->type;\n    header[9] = (unsigned char)(ssl->version >> 8);\n    header[10] = (unsigned char)(ssl->version);\n    header[11] = (rec->length) >> 8;\n    header[12] = (rec->length) & 0xff;\n    if (!send && !SSL_USE_ETM(ssl) &&\n        EVP_CIPHER_CTX_mode(ssl->enc_read_ctx) == EVP_CIPH_CBC_MODE &&\n        ssl3_cbc_record_digest_supported(mac_ctx)) {\n        if (ssl3_cbc_digest_record(mac_ctx,\n                                   md, &md_size,\n                                   header, rec->input,\n                                   rec->length + md_size, rec->orig_len,\n                                   ssl->s3->read_mac_secret,\n                                   ssl->s3->read_mac_secret_size, 0) <= 0) {\n            EVP_MD_CTX_free(hmac);\n            return -1;\n        }\n    } else {\n        if (EVP_DigestSignUpdate(mac_ctx, header, sizeof(header)) <= 0\n                || EVP_DigestSignUpdate(mac_ctx, rec->input, rec->length) <= 0\n                || EVP_DigestSignFinal(mac_ctx, md, &md_size) <= 0) {\n            EVP_MD_CTX_free(hmac);\n            return -1;\n        }\n        if (!send && !SSL_USE_ETM(ssl) && FIPS_mode())\n            tls_fips_digest_extra(ssl->enc_read_ctx,\n                                  mac_ctx, rec->input,\n                                  rec->length, rec->orig_len);\n    }\n    EVP_MD_CTX_free(hmac);\n#ifdef TLS_DEBUG\n    fprintf(stderr, "seq=");\n    {\n        int z;\n        for (z = 0; z < 8; z++)\n            fprintf(stderr, "%02X ", seq[z]);\n        fprintf(stderr, "\\n");\n    }\n    fprintf(stderr, "rec=");\n    {\n        unsigned int z;\n        for (z = 0; z < rec->length; z++)\n            fprintf(stderr, "%02X ", rec->data[z]);\n        fprintf(stderr, "\\n");\n    }\n#endif\n    if (!SSL_IS_DTLS(ssl)) {\n        for (i = 7; i >= 0; i--) {\n            ++seq[i];\n            if (seq[i] != 0)\n                break;\n        }\n    }\n#ifdef TLS_DEBUG\n    {\n        unsigned int z;\n        for (z = 0; z < md_size; z++)\n            fprintf(stderr, "%02X ", md[z]);\n        fprintf(stderr, "\\n");\n    }\n#endif\n    return (md_size);\n}', 'const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)\n{\n    if (!ctx)\n        return NULL;\n    return ctx->digest;\n}', 'int EVP_MD_size(const EVP_MD *md)\n{\n    if (!md) {\n        EVPerr(EVP_F_EVP_MD_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL);\n        return -1;\n    }\n    return md->md_size;\n}', 'unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx)\n{\n    return ctx->cipher->flags;\n}', 'char ssl3_cbc_record_digest_supported(const EVP_MD_CTX *ctx)\n{\n    if (FIPS_mode())\n        return 0;\n    switch (EVP_MD_CTX_type(ctx)) {\n    case NID_md5:\n    case NID_sha1:\n    case NID_sha224:\n    case NID_sha256:\n    case NID_sha384:\n    case NID_sha512:\n        return 1;\n    default:\n        return 0;\n    }\n}', 'int FIPS_mode(void)\n{\n#ifdef OPENSSL_FIPS\n    return FIPS_module_mode();\n#else\n    return 0;\n#endif\n}', 'int EVP_MD_type(const EVP_MD *md)\n{\n    return md->type;\n}']