| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2021-04-08 20:04:41 +08:00
										 |  |  |  * Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved. | 
					
						
							| 
									
										
										
										
											1999-02-20 09:15:41 +08:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2018-12-06 21:00:54 +08:00
										 |  |  |  * Licensed under the Apache License 2.0 (the "License").  You may not use | 
					
						
							| 
									
										
										
										
											2016-05-18 02:51:26 +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
 | 
					
						
							| 
									
										
										
										
											1999-02-20 09:15:41 +08:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <stdio.h>
 | 
					
						
							| 
									
										
										
										
											2015-05-14 22:56:48 +08:00
										 |  |  | #include "internal/cryptlib.h"
 | 
					
						
							| 
									
										
										
										
											1999-04-24 06:13:45 +08:00
										 |  |  | #include <openssl/x509v3.h>
 | 
					
						
							| 
									
										
										
										
											2015-09-05 20:32:58 +08:00
										 |  |  | #include "ext_dat.h"
 | 
					
						
							| 
									
										
										
										
											1999-02-20 09:15:41 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | static ENUMERATED_NAMES crl_reasons[] = { | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |     {CRL_REASON_UNSPECIFIED, "Unspecified", "unspecified"}, | 
					
						
							|  |  |  |     {CRL_REASON_KEY_COMPROMISE, "Key Compromise", "keyCompromise"}, | 
					
						
							|  |  |  |     {CRL_REASON_CA_COMPROMISE, "CA Compromise", "CACompromise"}, | 
					
						
							|  |  |  |     {CRL_REASON_AFFILIATION_CHANGED, "Affiliation Changed", | 
					
						
							|  |  |  |      "affiliationChanged"}, | 
					
						
							|  |  |  |     {CRL_REASON_SUPERSEDED, "Superseded", "superseded"}, | 
					
						
							|  |  |  |     {CRL_REASON_CESSATION_OF_OPERATION, | 
					
						
							|  |  |  |      "Cessation Of Operation", "cessationOfOperation"}, | 
					
						
							|  |  |  |     {CRL_REASON_CERTIFICATE_HOLD, "Certificate Hold", "certificateHold"}, | 
					
						
							|  |  |  |     {CRL_REASON_REMOVE_FROM_CRL, "Remove From CRL", "removeFromCRL"}, | 
					
						
							|  |  |  |     {CRL_REASON_PRIVILEGE_WITHDRAWN, "Privilege Withdrawn", | 
					
						
							|  |  |  |      "privilegeWithdrawn"}, | 
					
						
							|  |  |  |     {CRL_REASON_AA_COMPROMISE, "AA Compromise", "AACompromise"}, | 
					
						
							|  |  |  |     {-1, NULL, NULL} | 
					
						
							| 
									
										
										
										
											1999-02-20 09:15:41 +08:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-09 08:52:15 +08:00
										 |  |  | const X509V3_EXT_METHOD ossl_v3_crl_reason = { | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |     NID_crl_reason, 0, ASN1_ITEM_ref(ASN1_ENUMERATED), | 
					
						
							|  |  |  |     0, 0, 0, 0, | 
					
						
							|  |  |  |     (X509V3_EXT_I2S)i2s_ASN1_ENUMERATED_TABLE, | 
					
						
							|  |  |  |     0, | 
					
						
							|  |  |  |     0, 0, 0, 0, | 
					
						
							|  |  |  |     crl_reasons | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											1999-02-20 09:15:41 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-11 00:01:24 +08:00
										 |  |  | char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *method, | 
					
						
							| 
									
										
										
										
											2016-08-12 06:40:49 +08:00
										 |  |  |                                 const ASN1_ENUMERATED *e) | 
					
						
							| 
									
										
										
										
											1999-02-20 09:15:41 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |     ENUMERATED_NAMES *enam; | 
					
						
							|  |  |  |     long strval; | 
					
						
							| 
									
										
										
										
											2016-08-12 06:40:49 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |     strval = ASN1_ENUMERATED_get(e); | 
					
						
							|  |  |  |     for (enam = method->usr_data; enam->lname; enam++) { | 
					
						
							|  |  |  |         if (strval == enam->bitnum) | 
					
						
							| 
									
										
										
											
												Rename some BUF_xxx to OPENSSL_xxx
Rename BUF_{strdup,strlcat,strlcpy,memdup,strndup,strnlen}
to OPENSSL_{strdup,strlcat,strlcpy,memdup,strndup,strnlen}
Add #define's for the old names.
Add CRYPTO_{memdup,strndup}, called by OPENSSL_{memdup,strndup} macros.
Reviewed-by: Tim Hudson <tjh@openssl.org>
											
										 
											2015-12-17 05:12:24 +08:00
										 |  |  |             return OPENSSL_strdup(enam->lname); | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |     return i2s_ASN1_ENUMERATED(method, e); | 
					
						
							| 
									
										
										
										
											1999-02-20 09:15:41 +08:00
										 |  |  | } |