mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-07-03 03:03:34 +00:00
added some debug output
This commit is contained in:
@ -36,6 +36,8 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <config.h>
|
||||||
|
#include <ipmitool/bswap.h>
|
||||||
#include "lanplus.h"
|
#include "lanplus.h"
|
||||||
#include "lanplus_crypt.h"
|
#include "lanplus_crypt.h"
|
||||||
#include "lanplus_crypt_impl.h"
|
#include "lanplus_crypt_impl.h"
|
||||||
@ -77,6 +79,7 @@ int lanplus_rakp2_hmac_matches(const struct ipmi_session * session,
|
|||||||
|
|
||||||
unsigned int SIDm_lsbf, SIDc_lsbf;
|
unsigned int SIDm_lsbf, SIDc_lsbf;
|
||||||
|
|
||||||
|
|
||||||
if (session->v2_data.auth_alg == IPMI_AUTH_RAKP_NONE)
|
if (session->v2_data.auth_alg == IPMI_AUTH_RAKP_NONE)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -106,6 +109,7 @@ int lanplus_rakp2_hmac_matches(const struct ipmi_session * session,
|
|||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
SIDm_lsbf = BSWAP_32(SIDm_lsbf);
|
SIDm_lsbf = BSWAP_32(SIDm_lsbf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memcpy(buffer, &SIDm_lsbf, 4);
|
memcpy(buffer, &SIDm_lsbf, 4);
|
||||||
|
|
||||||
/* SIDc */
|
/* SIDc */
|
||||||
@ -262,6 +266,13 @@ int lanplus_rakp4_hmac_matches(const struct ipmi_session * session,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
if (verbose > 2)
|
||||||
|
{
|
||||||
|
printbuf(buffer, bufferLength, ">> rakp4 mac input buffer");
|
||||||
|
printbuf(session->v2_data.sik, 20l, ">> rakp4 mac key (sik)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The buffer is complete. Let's hash.
|
* The buffer is complete. Let's hash.
|
||||||
*/
|
*/
|
||||||
@ -273,6 +284,13 @@ int lanplus_rakp4_hmac_matches(const struct ipmi_session * session,
|
|||||||
mac,
|
mac,
|
||||||
&macLength);
|
&macLength);
|
||||||
|
|
||||||
|
if (verbose > 2)
|
||||||
|
{
|
||||||
|
printbuf(mac, macLength, ">> rakp4 mac as computed by the remote console");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
assert(macLength == 20);
|
assert(macLength == 20);
|
||||||
return (memcmp(bmc_mac, mac, 12) == 0);
|
return (memcmp(bmc_mac, mac, 12) == 0);
|
||||||
@ -362,6 +380,13 @@ int lanplus_generate_rakp3_authcode(char * output_buffer,
|
|||||||
for (i = 0; i < input_buffer[21]; ++i)
|
for (i = 0; i < input_buffer[21]; ++i)
|
||||||
input_buffer[22 + i] = session->username[i];
|
input_buffer[22 + i] = session->username[i];
|
||||||
|
|
||||||
|
if (verbose > 2)
|
||||||
|
{
|
||||||
|
printbuf(input_buffer, input_buffer_length, ">> rakp3 mac input buffer");
|
||||||
|
printbuf((char*)(session->authcode), IPMI_AUTHCODE_BUFFER_SIZE, ">> rakp3 mac key");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
lanplus_HMAC(session->v2_data.auth_alg,
|
lanplus_HMAC(session->v2_data.auth_alg,
|
||||||
session->authcode,
|
session->authcode,
|
||||||
(session->authcode[IPMI_AUTHCODE_BUFFER_SIZE - 1] == 0?
|
(session->authcode[IPMI_AUTHCODE_BUFFER_SIZE - 1] == 0?
|
||||||
@ -371,6 +396,10 @@ int lanplus_generate_rakp3_authcode(char * output_buffer,
|
|||||||
output_buffer,
|
output_buffer,
|
||||||
mac_length);
|
mac_length);
|
||||||
|
|
||||||
|
if (verbose > 2)
|
||||||
|
printbuf(output_buffer, *mac_length, "generated rakp3 mac");
|
||||||
|
|
||||||
|
|
||||||
free(input_buffer);
|
free(input_buffer);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -631,13 +660,7 @@ int lanplus_encrypt_payload(unsigned char crypt_alg,
|
|||||||
{
|
{
|
||||||
printf("NOT ENCRYPTING\n");
|
printf("NOT ENCRYPTING\n");
|
||||||
/* Just copy the input to the output */
|
/* Just copy the input to the output */
|
||||||
//memcpy(output, input, input_length);
|
|
||||||
|
|
||||||
//printf("input_length : %d\n", input_length);
|
|
||||||
|
|
||||||
*bytes_written = input_length;
|
*bytes_written = input_length;
|
||||||
|
|
||||||
//printf("bytes_written : %d\n", *bytes_written);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user