diff options
author | Alexander Amelkin <alexander@amelkin.msk.ru> | 2021-04-21 13:26:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-21 13:26:27 +0300 |
commit | 5958d09ca48bedc746267be9803630819c0eb8d8 (patch) | |
tree | 85a50df918ae59f2941682fb6c6c5e12baeb039a /src/plugins/lanplus/lanplus_crypt.c | |
parent | b9b81bfe0e61522379e36a8eb810a1bc43525e28 (diff) | |
parent | 6b1ce6c1ac34c567d594b24f03ddb43911284f1a (diff) | |
download | ipmitool-bugfix/280-fix-psu-inactive-offset.tar.gz |
Merge branch 'master' into bugfix/280-fix-psu-inactive-offsetbugfix/280-fix-psu-inactive-offset
Diffstat (limited to 'src/plugins/lanplus/lanplus_crypt.c')
-rw-r--r-- | src/plugins/lanplus/lanplus_crypt.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/plugins/lanplus/lanplus_crypt.c b/src/plugins/lanplus/lanplus_crypt.c index 145c880..b4d677b 100644 --- a/src/plugins/lanplus/lanplus_crypt.c +++ b/src/plugins/lanplus/lanplus_crypt.c @@ -84,12 +84,16 @@ lanplus_rakp2_hmac_matches(const struct ipmi_session * session, return 1; /* We don't yet support other algorithms */ +#ifdef HAVE_CRYPTO_SHA256 // assert() is a macro, must not put #ifdef inside it assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) -#ifdef HAVE_CRYPTO_SHA256 || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256) -#endif /* HAVE_CRYPTO_SHA256 */ ); +#else + assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1) + || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) + ); +#endif /* HAVE_CRYPTO_SHA256 */ bufferLength = @@ -251,12 +255,16 @@ lanplus_rakp4_hmac_matches(const struct ipmi_session * session, return 1; /* We don't yet support other algorithms */ +#ifdef HAVE_CRYPTO_SHA256 // assert() is a macro, must not put #ifdef inside it assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) -#ifdef HAVE_CRYPTO_SHA256 || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256) -#endif /* HAVE_CRYPTO_SHA256 */ ); +#else + assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1) + || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) + ); +#endif /* HAVE_CRYPTO_SHA256 */ } bufferLength = @@ -417,12 +425,16 @@ lanplus_generate_rakp3_authcode(uint8_t * output_buffer, } /* We don't yet support other algorithms */ +#ifdef HAVE_CRYPTO_SHA256 // assert() is a macro, must not put #ifdef inside it assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) -#ifdef HAVE_CRYPTO_SHA256 || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256) -#endif /* HAVE_CRYPTO_SHA256 */ ); +#else + assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1) + || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) + ); +#endif /* HAVE_CRYPTO_SHA256 */ input_buffer_length = 16 + /* Rc */ @@ -539,12 +551,16 @@ lanplus_generate_sik(struct ipmi_session * session, struct ipmi_intf * intf) return 0; /* We don't yet support other algorithms */ +#ifdef HAVE_CRYPTO_SHA256 // assert() is a macro, must not put #ifdef inside it assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) -#ifdef HAVE_CRYPTO_SHA256 || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256) -#endif /* HAVE_CRYPTO_SHA256 */ ); +#else + assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1) + || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) + ); +#endif /* HAVE_CRYPTO_SHA256 */ input_buffer_length = 16 + /* Rm */ |