diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/bad_dtls_test.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/test/bad_dtls_test.c b/test/bad_dtls_test.c index d60daa447f..48cf45bae6 100644 --- a/test/bad_dtls_test.c +++ b/test/bad_dtls_test.c @@ -281,8 +281,8 @@ static int send_record(BIO *rbio, unsigned char type, uint64_t seqnr, static unsigned char seq[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static unsigned char ver[2] = { 0x01, 0x00 }; /* DTLS1_BAD_VER */ unsigned char lenbytes[2]; - EVP_MAC *hmac; - EVP_MAC_CTX *ctx; + EVP_MAC *hmac = NULL; + EVP_MAC_CTX *ctx = NULL; EVP_CIPHER_CTX *enc_ctx = NULL; unsigned char iv[16]; unsigned char pad; @@ -306,12 +306,9 @@ static int send_record(BIO *rbio, unsigned char type, uint64_t seqnr, memcpy(enc, msg, len); /* Append HMAC to data */ - if ((hmac = EVP_MAC_fetch(NULL, "HMAC", NULL)) == NULL) - return 0; - ctx = EVP_MAC_CTX_new(hmac); - EVP_MAC_free(hmac); - if (ctx == NULL) - return 0; + if (!TEST_ptr(hmac = EVP_MAC_fetch(NULL, "HMAC", NULL)) + || !TEST_ptr(ctx = EVP_MAC_CTX_new(hmac))) + goto end; params[0] = OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST, "SHA1", 0); params[1] = OSSL_PARAM_construct_end(); @@ -354,6 +351,7 @@ static int send_record(BIO *rbio, unsigned char type, uint64_t seqnr, BIO_write(rbio, enc, len); ret = 1; end: + EVP_MAC_free(hmac); EVP_MAC_CTX_free(ctx); EVP_CIPHER_CTX_free(enc_ctx); OPENSSL_free(enc); |