mirror of
				https://git.code.sf.net/p/linux-ima/ima-evm-utils
				synced 2025-10-30 20:52:15 +01:00 
			
		
		
		
	evmctl: Implement function for setting up an OpenSSL engine
Move the code that sets up an OpenSSL engine into its own function. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
		 Stefan Berger
					Stefan Berger
				
			
				
					committed by
					
						 Mimi Zohar
						Mimi Zohar
					
				
			
			
				
	
			
			
			 Mimi Zohar
						Mimi Zohar
					
				
			
						parent
						
							47510a1050
						
					
				
				
					commit
					29aa7465d5
				
			
							
								
								
									
										32
									
								
								src/evmctl.c
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								src/evmctl.c
									
									
									
									
									
								
							| @@ -2640,6 +2640,23 @@ static char *get_password(void) | ||||
| 	return password; | ||||
| } | ||||
|  | ||||
| static ENGINE *setup_engine(const char *engine_id) | ||||
| { | ||||
| 	ENGINE *eng = ENGINE_by_id(engine_id); | ||||
| 	if (!eng) { | ||||
| 		log_err("engine %s isn't available\n", optarg); | ||||
| 		ERR_print_errors_fp(stderr); | ||||
| 	} else if (!ENGINE_init(eng)) { | ||||
| 		log_err("engine %s init failed\n", optarg); | ||||
| 		ERR_print_errors_fp(stderr); | ||||
| 		ENGINE_free(eng); | ||||
| 		eng = NULL; | ||||
| 	} | ||||
| 	if (eng) | ||||
| 		ENGINE_set_default(eng, ENGINE_METHOD_ALL); | ||||
| 	return eng; | ||||
| } | ||||
|  | ||||
| int main(int argc, char *argv[]) | ||||
| { | ||||
| 	int err = 0, c, lind; | ||||
| @@ -2764,19 +2781,8 @@ int main(int argc, char *argv[]) | ||||
| 			verify_list_sig = 1; | ||||
| 			break; | ||||
| 		case 139: /* --engine e */ | ||||
| 			eng = ENGINE_by_id(optarg); | ||||
| 			if (!eng) { | ||||
| 				log_err("engine %s isn't available\n", optarg); | ||||
| 				ERR_print_errors_fp(stderr); | ||||
| 			} else if (!ENGINE_init(eng)) { | ||||
| 				log_err("engine %s init failed\n", optarg); | ||||
| 				ERR_print_errors_fp(stderr); | ||||
| 				ENGINE_free(eng); | ||||
| 				eng = NULL; | ||||
| 			} | ||||
| 			if (eng) | ||||
| 				ENGINE_set_default(eng, ENGINE_METHOD_ALL); | ||||
| 			else | ||||
| 			eng = setup_engine(optarg); | ||||
| 			if (!eng) | ||||
| 				goto error; | ||||
| 			break; | ||||
| 		case 140: /* --xattr-user */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user