| 
									
										
										
										
											2016-05-18 02:24:46 +08:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2021-03-11 21:27:36 +08:00
										 |  |  |  * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. | 
					
						
							| 
									
										
										
										
											1998-12-21 18:56:39 +08:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2018-12-06 20:40:06 +08:00
										 |  |  |  * Licensed under the Apache License 2.0 (the "License").  You may not use | 
					
						
							| 
									
										
										
										
											2016-05-18 02:24:46 +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
 | 
					
						
							| 
									
										
										
										
											1998-12-21 18:56:39 +08:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-04 22:34:31 +08:00
										 |  |  | /* We need to use the deprecated RSA low level calls */ | 
					
						
							|  |  |  | #define OPENSSL_SUPPRESS_DEPRECATED
 | 
					
						
							| 
									
										
										
										
											2020-02-12 13:03:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-12-21 18:56:39 +08:00
										 |  |  | #include <stdio.h>
 | 
					
						
							| 
									
										
										
										
											2015-05-14 22:56:48 +08:00
										 |  |  | #include "internal/cryptlib.h"
 | 
					
						
							| 
									
										
										
										
											2016-03-19 02:30:20 +08:00
										 |  |  | #include <openssl/rsa.h>
 | 
					
						
							| 
									
										
										
										
											1999-04-24 06:13:45 +08:00
										 |  |  | #include <openssl/evp.h>
 | 
					
						
							|  |  |  | #include <openssl/objects.h>
 | 
					
						
							|  |  |  | #include <openssl/x509.h>
 | 
					
						
							| 
									
										
										
										
											2021-03-02 23:52:00 +08:00
										 |  |  | #include "crypto/evp.h"
 | 
					
						
							| 
									
										
										
										
											1998-12-21 18:56:39 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-04-08 00:42:09 +08:00
										 |  |  | int EVP_PKEY_decrypt_old(unsigned char *key, const unsigned char *ek, int ekl, | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |                          EVP_PKEY *priv) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int ret = -1; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												Rename all getters to use get/get0 in name
For functions that exist in 1.1.1 provide a simple aliases via #define.
Fixes #15236
Functions with OSSL_DECODER_, OSSL_ENCODER_, OSSL_STORE_LOADER_,
EVP_KEYEXCH_, EVP_KEM_, EVP_ASYM_CIPHER_, EVP_SIGNATURE_,
EVP_KEYMGMT_, EVP_RAND_, EVP_MAC_, EVP_KDF_, EVP_PKEY_,
EVP_MD_, and EVP_CIPHER_ prefixes are renamed.
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15405)
											
										 
											2021-05-21 22:58:08 +08:00
										 |  |  |     if (EVP_PKEY_get_id(priv) != EVP_PKEY_RSA) { | 
					
						
							| 
									
										
										
										
											2020-11-04 19:23:19 +08:00
										 |  |  |         ERR_raise(ERR_LIB_EVP, EVP_R_PUBLIC_KEY_NOT_RSA); | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |         goto err; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											1998-12-21 18:56:39 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |     ret = | 
					
						
							| 
									
										
										
										
											2021-03-02 23:52:00 +08:00
										 |  |  |         RSA_private_decrypt(ekl, ek, key, evp_pkey_get0_RSA_int(priv), | 
					
						
							| 
									
										
										
										
											2016-01-19 08:21:12 +08:00
										 |  |  |                             RSA_PKCS1_PADDING); | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |  err: | 
					
						
							| 
									
										
										
										
											2017-10-17 22:04:09 +08:00
										 |  |  |     return ret; | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | } |