diff options
Diffstat (limited to 'src/lib/libcrypto/x509/x509_purp.c')
| -rw-r--r-- | src/lib/libcrypto/x509/x509_purp.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/lib/libcrypto/x509/x509_purp.c b/src/lib/libcrypto/x509/x509_purp.c index 3c05cc31b2..43236b2cd3 100644 --- a/src/lib/libcrypto/x509/x509_purp.c +++ b/src/lib/libcrypto/x509/x509_purp.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_purp.c,v 1.8 2021/10/21 13:51:52 tb Exp $ */ | 1 | /* $OpenBSD: x509_purp.c,v 1.9 2021/10/22 18:37:15 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2001. | 3 | * project 2001. |
| 4 | */ | 4 | */ |
| @@ -942,3 +942,29 @@ X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid) | |||
| 942 | } | 942 | } |
| 943 | return X509_V_OK; | 943 | return X509_V_OK; |
| 944 | } | 944 | } |
| 945 | |||
| 946 | uint32_t | ||
| 947 | X509_get_key_usage(X509 *x) | ||
| 948 | { | ||
| 949 | /* Call for side-effect of computing hash and caching extensions */ | ||
| 950 | if (X509_check_purpose(x, -1, -1) != 1) | ||
| 951 | return 0; | ||
| 952 | |||
| 953 | if (x->ex_flags & EXFLAG_KUSAGE) | ||
| 954 | return x->ex_kusage; | ||
| 955 | |||
| 956 | return UINT32_MAX; | ||
| 957 | } | ||
| 958 | |||
| 959 | uint32_t | ||
| 960 | X509_get_extended_key_usage(X509 *x) | ||
| 961 | { | ||
| 962 | /* Call for side-effect of computing hash and caching extensions */ | ||
| 963 | if (X509_check_purpose(x, -1, -1) != 1) | ||
| 964 | return 0; | ||
| 965 | |||
| 966 | if (x->ex_flags & EXFLAG_XKUSAGE) | ||
| 967 | return x->ex_xkusage; | ||
| 968 | |||
| 969 | return UINT32_MAX; | ||
| 970 | } | ||
