| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2020-04-23 20:55:52 +08:00
										 |  |  |  * Copyright 2008-2020 The OpenSSL Project Authors. All Rights Reserved. | 
					
						
							| 
									
										
										
										
											2008-03-13 05:14:28 +08:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2018-12-06 20:16:23 +08:00
										 |  |  |  * Licensed under the Apache License 2.0 (the "License").  You may not use | 
					
						
							| 
									
										
										
										
											2016-05-18 03:38:09 +08:00
										 |  |  |  * this file except in compliance with the License.  You can obtain a copy | 
					
						
							|  |  |  |  * in the file LICENSE in the source distribution or at | 
					
						
							|  |  |  |  * https://www.openssl.org/source/license.html
 | 
					
						
							| 
									
										
										
										
											2008-03-13 05:14:28 +08:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-06 01:09:49 +08:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * AES_encrypt/AES_decrypt are deprecated - but we need to use them to implement | 
					
						
							|  |  |  |  * these functions | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #include "internal/deprecated.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-14 22:56:48 +08:00
										 |  |  | #include "internal/cryptlib.h"
 | 
					
						
							| 
									
										
										
										
											2008-03-13 05:14:28 +08:00
										 |  |  | #include <openssl/aes.h>
 | 
					
						
							| 
									
										
										
										
											2013-07-17 21:05:19 +08:00
										 |  |  | #include <openssl/modes.h>
 | 
					
						
							| 
									
										
										
										
											2008-03-18 09:00:38 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-03-13 05:14:28 +08:00
										 |  |  | int AES_wrap_key(AES_KEY *key, const unsigned char *iv, | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |                  unsigned char *out, | 
					
						
							|  |  |  |                  const unsigned char *in, unsigned int inlen) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return CRYPTO_128_wrap(key, iv, out, in, inlen, (block128_f) AES_encrypt); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2008-03-13 05:14:28 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |                    unsigned char *out, | 
					
						
							|  |  |  |                    const unsigned char *in, unsigned int inlen) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return CRYPTO_128_unwrap(key, iv, out, in, inlen, | 
					
						
							|  |  |  |                              (block128_f) AES_decrypt); | 
					
						
							|  |  |  | } |