Exemplo n.º 1
0
static void
satip_device_calc_uuid( tvh_uuid_t *uuid, const char *satip_uuid )
{
  uint8_t uuidbin[20];

  sha1_calc(uuidbin, (const uint8_t *)satip_uuid, strlen(satip_uuid), NULL, 0);
  bin2hex(uuid->hex, sizeof(uuid->hex), uuidbin, sizeof(uuidbin));
}
Exemplo n.º 2
0
bool system_identifier_read(system_identifier_t *system_id)
{
	os_read(system_id->os, sizeof(system_id->os));
	system_serial_read(system_id->system, sizeof(system_id->system));
	chassis_serial_read(system_id->chassis, sizeof(system_id->chassis));
	baseboard_serial_read(system_id->baseboard, sizeof(system_id->baseboard));

	unsigned char mac[6];
	mac_read(mac, sizeof(mac));
	sha1_calc(mac, sizeof(mac), system_id->mac, sizeof(system_id->mac));

	return true;
}
Exemplo n.º 3
0
static void dmidecode_read(const char *field_name, char *buf, int len)
{
	char cmd[128];

	memset(buf, 0, len);

	snprintf(cmd, sizeof(cmd), "dmidecode -s %s", field_name);
	if (!cmd_str(cmd, buf, len))
		return;

	int actual_len = strlen(buf);
	switch (buf[actual_len-1]) {
		case '\r':
		case '\n':
			buf[actual_len-1] = 0;
			actual_len--;
			break;
	}

	sha1_calc((unsigned char *)buf, actual_len, buf, len);
}