From 0e9b185152b56ff33fe8a2a89a4f84923a308300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Mon, 14 Sep 2020 12:27:22 +0200 Subject: New upstream version 3.1.7 --- lib/lanplus/lanplus_crypt_impl.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'lib/lanplus/lanplus_crypt_impl.c') diff --git a/lib/lanplus/lanplus_crypt_impl.c b/lib/lanplus/lanplus_crypt_impl.c index 389a436..821ae0a 100644 --- a/lib/lanplus/lanplus_crypt_impl.c +++ b/lib/lanplus/lanplus_crypt_impl.c @@ -168,6 +168,9 @@ lanplus_HMAC(uint8_t mac, uint8_t *pnew; *md_len = 0; /*if return NULL, also return zero length*/ + if (verbose > 2) { + printf("lanplus_HMAC start mac=%x\n",mac); + } if ((mac == IPMI_AUTH_RAKP_HMAC_SHA1) || (mac == IPMI_INTEGRITY_HMAC_SHA1_96)) evp_md = EVP_sha1(); @@ -179,15 +182,20 @@ lanplus_HMAC(uint8_t mac, #ifdef HAVE_SHA256 evp_md = EVP_sha256(); #else + printf("lanplus_HMAC: Invalid EVP_sha256 in lanplus_HMAC\n"); lprintf(LOG_ERR, "Invalid EVP_sha256 in lanplus_HMAC"); return NULL; // assert(0); #endif } else { + printf("lanplus_HMAC: Invalid mac type 0x%x in lanplus_HMAC\n",mac); lprintf(LOG_ERR,"Invalid mac type 0x%x in lanplus_HMAC",mac); return NULL; // assert(0); } - mlen = 20; /* *md_len is usually not initialized */ + mlen = 20; /* md_len is usually not initialized, default IPMI_AUTHCODE_BUFFER_SIZE=20 */ pnew = HMAC(evp_md, key, key_len, d, n, md, &mlen); + if (verbose > 2) { + printf("lanplus_HMAC mac=%x, pnew=%p, mlen=%d",mac,pnew,mlen); + } *md_len = (uint32_t)mlen; return(pnew); } @@ -244,7 +252,10 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv, * data is perfectly aligned. We would like to keep that from happening. * We have made a point to have our input perfectly padded. */ - assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0); + // assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0); + if ((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) != 0) { + os_assert("lanplus_encrypt_aes_cbc_128"); /**/ + } inlen = input_length; if(!EVP_EncryptUpdate(pctx, output, &nwritten, input, inlen)) @@ -324,7 +335,10 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv, * data is perfectly aligned. We would like to keep that from happening. * We have made a point to have our input perfectly padded. */ - assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0); + // assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0); + if ((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) != 0) { + os_assert("lanplus_decrypt_aes_cbc_128"); /**/ + } inlen = input_length; if (!EVP_DecryptUpdate(pctx, output, &nwritten, input, inlen)) -- cgit v1.2.3