tools:acrn-crashlog: Change the algorithm of generating event key

Acrnprobe is using SHA to generate ids for events. These ids are only used
to index events, not for cryptographic purpose.

This patch unify the generating algorithm of short and long ids to
SHA256.

Tracked-On: #1024
Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhi Jin <zhi.jin@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
This commit is contained in:
Liu, Xinwu
2018-09-11 16:48:47 +08:00
committed by lijinxia
parent b1ba12ae1b
commit 876cc68311
5 changed files with 71 additions and 155 deletions

View File

@@ -11,6 +11,7 @@
#include <openssl/sha.h>
#include <ext2fs/ext2fs.h>
#include "event_queue.h"
#include "probeutils.h"
#define CONTENT_MAX 10
#define EXPRESSION_MAX 5
@@ -38,7 +39,7 @@ struct vm_t {
ext2_filsys datafs;
unsigned long history_size[SENDER_MAX];
char *history_data;
char last_synced_line_key[SENDER_MAX][SHA_DIGEST_LENGTH + 1];
char last_synced_line_key[SENDER_MAX][SHORT_KEY_LENGTH + 1];
};
struct log_t {

View File

@@ -24,6 +24,8 @@
#define UPTIME_SIZE 24
#define LONG_TIME_SIZE 32
#define SHORT_KEY_LENGTH 20
#define LONG_KEY_LENGTH 32
enum e_dir_mode {
MODE_CRASH = 0,
@@ -31,11 +33,16 @@ enum e_dir_mode {
MODE_VMEVENT,
};
enum key_type {
KEY_SHORT = 0,
KEY_LONG,
};
int get_uptime_string(char newuptime[24], int *hours);
int get_current_time_long(char buf[32]);
unsigned long long get_uptime(void);
char *generate_event_id(char *seed1, char *seed2);
char *generate_eventid256(char *seed);
char *generate_event_id(const char *seed1, const char *seed2,
enum key_type type);
void generate_crashfile(char *dir, char *event, char *hashkey,
char *type, char *data0,
char *data1, char *data2);