Fix checkpatch errors
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
This commit is contained in:
		
							
								
								
									
										15
									
								
								src/evmctl.c
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								src/evmctl.c
									
									
									
									
									
								
							| @@ -309,6 +309,7 @@ static int calc_evm_hash(const char *file, unsigned char *hash) | |||||||
| 		/* we cannot at the momement to get generation of special files.. | 		/* we cannot at the momement to get generation of special files.. | ||||||
| 		 * kernel API does not support it */ | 		 * kernel API does not support it */ | ||||||
| 		int fd = open(file, 0); | 		int fd = open(file, 0); | ||||||
|  |  | ||||||
| 		if (fd < 0) { | 		if (fd < 0) { | ||||||
| 			log_err("Unable to open %s\n", file); | 			log_err("Unable to open %s\n", file); | ||||||
| 			return -1; | 			return -1; | ||||||
| @@ -358,6 +359,7 @@ static int calc_evm_hash(const char *file, unsigned char *hash) | |||||||
|  |  | ||||||
| 	if (msize == 0) { | 	if (msize == 0) { | ||||||
| 		struct h_misc *hmac = (struct h_misc *)&hmac_misc; | 		struct h_misc *hmac = (struct h_misc *)&hmac_misc; | ||||||
|  |  | ||||||
| 		hmac_size = sizeof(*hmac); | 		hmac_size = sizeof(*hmac); | ||||||
| 		hmac->ino = st.st_ino; | 		hmac->ino = st.st_ino; | ||||||
| 		hmac->generation = generation; | 		hmac->generation = generation; | ||||||
| @@ -366,6 +368,7 @@ static int calc_evm_hash(const char *file, unsigned char *hash) | |||||||
| 		hmac->mode = st.st_mode; | 		hmac->mode = st.st_mode; | ||||||
| 	} else if (msize == 64) { | 	} else if (msize == 64) { | ||||||
| 		struct h_misc_64 *hmac = (struct h_misc_64 *)&hmac_misc; | 		struct h_misc_64 *hmac = (struct h_misc_64 *)&hmac_misc; | ||||||
|  |  | ||||||
| 		hmac_size = sizeof(*hmac); | 		hmac_size = sizeof(*hmac); | ||||||
| 		hmac->ino = st.st_ino; | 		hmac->ino = st.st_ino; | ||||||
| 		hmac->generation = generation; | 		hmac->generation = generation; | ||||||
| @@ -374,6 +377,7 @@ static int calc_evm_hash(const char *file, unsigned char *hash) | |||||||
| 		hmac->mode = st.st_mode; | 		hmac->mode = st.st_mode; | ||||||
| 	} else { | 	} else { | ||||||
| 		struct h_misc_32 *hmac = (struct h_misc_32 *)&hmac_misc; | 		struct h_misc_32 *hmac = (struct h_misc_32 *)&hmac_misc; | ||||||
|  |  | ||||||
| 		hmac_size = sizeof(*hmac); | 		hmac_size = sizeof(*hmac); | ||||||
| 		hmac->ino = st.st_ino; | 		hmac->ino = st.st_ino; | ||||||
| 		hmac->generation = generation; | 		hmac->generation = generation; | ||||||
| @@ -735,8 +739,8 @@ static int verify_ima(const char *file) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (sigfile) { | 	if (sigfile) { | ||||||
| 		void *tmp; | 		void *tmp = file2bin(file, "sig", &len); | ||||||
| 		tmp = file2bin(file, "sig", &len); |  | ||||||
| 		memcpy(sig, tmp, len); | 		memcpy(sig, tmp, len); | ||||||
| 		free(tmp); | 		free(tmp); | ||||||
| 	} | 	} | ||||||
| @@ -778,6 +782,7 @@ static int cmd_import(struct command *cmd) | |||||||
| 	if (ring) { | 	if (ring) { | ||||||
| 		if (ring[0] != '@') { | 		if (ring[0] != '@') { | ||||||
| 			int base = 10; | 			int base = 10; | ||||||
|  |  | ||||||
| 			if (ring[0] == '0' && ring[1] == 'x') | 			if (ring[0] == '0' && ring[1] == 'x') | ||||||
| 				base = 16; | 				base = 16; | ||||||
| 			id = strtoul(ring, NULL, base); | 			id = strtoul(ring, NULL, base); | ||||||
| @@ -871,6 +876,7 @@ static int calc_evm_hmac(const char *file, const char *keyfile, unsigned char *h | |||||||
| 		/* we cannot at the momement to get generation of special files.. | 		/* we cannot at the momement to get generation of special files.. | ||||||
| 		 * kernel API does not support it */ | 		 * kernel API does not support it */ | ||||||
| 		int fd = open(file, 0); | 		int fd = open(file, 0); | ||||||
|  |  | ||||||
| 		if (fd < 0) { | 		if (fd < 0) { | ||||||
| 			log_err("Unable to open %s\n", file); | 			log_err("Unable to open %s\n", file); | ||||||
| 			goto out; | 			goto out; | ||||||
| @@ -920,6 +926,7 @@ static int calc_evm_hmac(const char *file, const char *keyfile, unsigned char *h | |||||||
|  |  | ||||||
| 	if (msize == 0) { | 	if (msize == 0) { | ||||||
| 		struct h_misc *hmac = (struct h_misc *)&hmac_misc; | 		struct h_misc *hmac = (struct h_misc *)&hmac_misc; | ||||||
|  |  | ||||||
| 		hmac_size = sizeof(*hmac); | 		hmac_size = sizeof(*hmac); | ||||||
| 		hmac->ino = st.st_ino; | 		hmac->ino = st.st_ino; | ||||||
| 		hmac->generation = generation; | 		hmac->generation = generation; | ||||||
| @@ -928,6 +935,7 @@ static int calc_evm_hmac(const char *file, const char *keyfile, unsigned char *h | |||||||
| 		hmac->mode = st.st_mode; | 		hmac->mode = st.st_mode; | ||||||
| 	} else if (msize == 64) { | 	} else if (msize == 64) { | ||||||
| 		struct h_misc_64 *hmac = (struct h_misc_64 *)&hmac_misc; | 		struct h_misc_64 *hmac = (struct h_misc_64 *)&hmac_misc; | ||||||
|  |  | ||||||
| 		hmac_size = sizeof(*hmac); | 		hmac_size = sizeof(*hmac); | ||||||
| 		hmac->ino = st.st_ino; | 		hmac->ino = st.st_ino; | ||||||
| 		hmac->generation = generation; | 		hmac->generation = generation; | ||||||
| @@ -936,6 +944,7 @@ static int calc_evm_hmac(const char *file, const char *keyfile, unsigned char *h | |||||||
| 		hmac->mode = st.st_mode; | 		hmac->mode = st.st_mode; | ||||||
| 	} else { | 	} else { | ||||||
| 		struct h_misc_32 *hmac = (struct h_misc_32 *)&hmac_misc; | 		struct h_misc_32 *hmac = (struct h_misc_32 *)&hmac_misc; | ||||||
|  |  | ||||||
| 		hmac_size = sizeof(*hmac); | 		hmac_size = sizeof(*hmac); | ||||||
| 		hmac->ino = st.st_ino; | 		hmac->ino = st.st_ino; | ||||||
| 		hmac->generation = generation; | 		hmac->generation = generation; | ||||||
| @@ -1062,6 +1071,7 @@ static int find(const char *path, int dts, find_cb_t func) | |||||||
| 	if (fs_dev) { | 	if (fs_dev) { | ||||||
| 		struct stat st; | 		struct stat st; | ||||||
| 		int err = lstat(path, &st); | 		int err = lstat(path, &st); | ||||||
|  |  | ||||||
| 		if (err < 0) { | 		if (err < 0) { | ||||||
| 			log_err("stat() failed\n"); | 			log_err("stat() failed\n"); | ||||||
| 			return err; | 			return err; | ||||||
| @@ -1576,6 +1586,7 @@ int main(int argc, char *argv[]) | |||||||
|  |  | ||||||
| 	if (err) { | 	if (err) { | ||||||
| 		unsigned long error; | 		unsigned long error; | ||||||
|  |  | ||||||
| 		if (errno) | 		if (errno) | ||||||
| 			log_err("errno: %s (%d)\n", strerror(errno), errno); | 			log_err("errno: %s (%d)\n", strerror(errno), errno); | ||||||
| 		for (;;) { | 		for (;;) { | ||||||
|   | |||||||
| @@ -257,15 +257,16 @@ static int add_dev_hash(struct stat *st, EVP_MD_CTX *ctx) | |||||||
| 	uint32_t dev = st->st_rdev; | 	uint32_t dev = st->st_rdev; | ||||||
| 	unsigned major = (dev & 0xfff00) >> 8; | 	unsigned major = (dev & 0xfff00) >> 8; | ||||||
| 	unsigned minor = (dev & 0xff) | ((dev >> 12) & 0xfff00); | 	unsigned minor = (dev & 0xff) | ((dev >> 12) & 0xfff00); | ||||||
|  |  | ||||||
| 	log_info("device: %u:%u\n", major, minor); | 	log_info("device: %u:%u\n", major, minor); | ||||||
| 	return !EVP_DigestUpdate(ctx, &dev, sizeof(dev)); | 	return !EVP_DigestUpdate(ctx, &dev, sizeof(dev)); | ||||||
| } | } | ||||||
|  |  | ||||||
| int ima_calc_hash(const char *file, uint8_t *hash) | int ima_calc_hash(const char *file, uint8_t *hash) | ||||||
| { | { | ||||||
|  | 	const EVP_MD *md; | ||||||
| 	struct stat st; | 	struct stat st; | ||||||
| 	EVP_MD_CTX ctx; | 	EVP_MD_CTX ctx; | ||||||
| 	const EVP_MD *md; |  | ||||||
| 	unsigned int mdlen; | 	unsigned int mdlen; | ||||||
| 	int err; | 	int err; | ||||||
|  |  | ||||||
| @@ -671,9 +672,8 @@ int sign_hash_v1(const char *hashalgo, const unsigned char *hash, int size, cons | |||||||
| 	log_dump(hash, size); | 	log_dump(hash, size); | ||||||
|  |  | ||||||
| 	key = read_priv_key(keyfile, params.keypass); | 	key = read_priv_key(keyfile, params.keypass); | ||||||
| 	if (!key) { | 	if (!key) | ||||||
| 		return -1; | 		return -1; | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	hdr = (struct signature_hdr *)sig; | 	hdr = (struct signature_hdr *)sig; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Dmitry Kasatkin
					Dmitry Kasatkin