diff options
| author | jsing <> | 2018-02-14 16:57:25 +0000 |
|---|---|---|
| committer | jsing <> | 2018-02-14 16:57:25 +0000 |
| commit | 8140fe5d5618a8bb46275943c95cec9f0c156caa (patch) | |
| tree | 070ba1732882d2bb8be5ba4acdfa2f1ef543f094 /src/lib/libc | |
| parent | 203972bb77b50ae36c5e8f022071bbcd21d99788 (diff) | |
| download | openbsd-8140fe5d5618a8bb46275943c95cec9f0c156caa.tar.gz openbsd-8140fe5d5618a8bb46275943c95cec9f0c156caa.tar.bz2 openbsd-8140fe5d5618a8bb46275943c95cec9f0c156caa.zip | |
Provide X509_get{0,m}_not{Before,After}().
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/Symbols.list | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/x509/x509.h | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/x509/x509_set.c | 36 |
3 files changed, 41 insertions, 5 deletions
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list index 276c61b3a4..540213232b 100644 --- a/src/lib/libcrypto/Symbols.list +++ b/src/lib/libcrypto/Symbols.list | |||
| @@ -2857,6 +2857,8 @@ X509_email_free | |||
| 2857 | X509_find_by_issuer_and_serial | 2857 | X509_find_by_issuer_and_serial |
| 2858 | X509_find_by_subject | 2858 | X509_find_by_subject |
| 2859 | X509_free | 2859 | X509_free |
| 2860 | X509_get0_notAfter | ||
| 2861 | X509_get0_notBefore | ||
| 2860 | X509_get0_pubkey_bitstr | 2862 | X509_get0_pubkey_bitstr |
| 2861 | X509_get1_email | 2863 | X509_get1_email |
| 2862 | X509_get1_ocsp | 2864 | X509_get1_ocsp |
| @@ -2880,6 +2882,8 @@ X509_get_pubkey_parameters | |||
| 2880 | X509_get_serialNumber | 2882 | X509_get_serialNumber |
| 2881 | X509_get_signature_nid | 2883 | X509_get_signature_nid |
| 2882 | X509_get_subject_name | 2884 | X509_get_subject_name |
| 2885 | X509_getm_notAfter | ||
| 2886 | X509_getm_notBefore | ||
| 2883 | X509_gmtime_adj | 2887 | X509_gmtime_adj |
| 2884 | X509_issuer_and_serial_cmp | 2888 | X509_issuer_and_serial_cmp |
| 2885 | X509_issuer_and_serial_hash | 2889 | X509_issuer_and_serial_hash |
diff --git a/src/lib/libcrypto/x509/x509.h b/src/lib/libcrypto/x509/x509.h index cda89ac5af..0cb9e2826a 100644 --- a/src/lib/libcrypto/x509/x509.h +++ b/src/lib/libcrypto/x509/x509.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509.h,v 1.27 2018/02/14 16:18:10 jsing Exp $ */ | 1 | /* $OpenBSD: x509.h,v 1.28 2018/02/14 16:57:25 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -969,6 +969,10 @@ int X509_set_subject_name(X509 *x, X509_NAME *name); | |||
| 969 | X509_NAME * X509_get_subject_name(X509 *a); | 969 | X509_NAME * X509_get_subject_name(X509 *a); |
| 970 | int X509_set_notBefore(X509 *x, const ASN1_TIME *tm); | 970 | int X509_set_notBefore(X509 *x, const ASN1_TIME *tm); |
| 971 | int X509_set_notAfter(X509 *x, const ASN1_TIME *tm); | 971 | int X509_set_notAfter(X509 *x, const ASN1_TIME *tm); |
| 972 | const ASN1_TIME *X509_get0_notBefore(const X509 *x); | ||
| 973 | ASN1_TIME *X509_getm_notBefore(const X509 *x); | ||
| 974 | const ASN1_TIME *X509_get0_notAfter(const X509 *x); | ||
| 975 | ASN1_TIME *X509_getm_notAfter(const X509 *x); | ||
| 972 | int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); | 976 | int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); |
| 973 | EVP_PKEY * X509_get_pubkey(X509 *x); | 977 | EVP_PKEY * X509_get_pubkey(X509 *x); |
| 974 | ASN1_BIT_STRING * X509_get0_pubkey_bitstr(const X509 *x); | 978 | ASN1_BIT_STRING * X509_get0_pubkey_bitstr(const X509 *x); |
diff --git a/src/lib/libcrypto/x509/x509_set.c b/src/lib/libcrypto/x509/x509_set.c index aeaf161024..e60d6f967a 100644 --- a/src/lib/libcrypto/x509/x509_set.c +++ b/src/lib/libcrypto/x509/x509_set.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_set.c,v 1.12 2015/09/30 17:49:59 jsing Exp $ */ | 1 | /* $OpenBSD: x509_set.c,v 1.13 2018/02/14 16:57:25 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -104,17 +104,31 @@ X509_set_issuer_name(X509 *x, X509_NAME *name) | |||
| 104 | int | 104 | int |
| 105 | X509_set_subject_name(X509 *x, X509_NAME *name) | 105 | X509_set_subject_name(X509 *x, X509_NAME *name) |
| 106 | { | 106 | { |
| 107 | if ((x == NULL) || (x->cert_info == NULL)) | 107 | if (x == NULL || x->cert_info == NULL) |
| 108 | return (0); | 108 | return (0); |
| 109 | return (X509_NAME_set(&x->cert_info->subject, name)); | 109 | return (X509_NAME_set(&x->cert_info->subject, name)); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | const ASN1_TIME * | ||
| 113 | X509_get0_notBefore(const X509 *x) | ||
| 114 | { | ||
| 115 | return X509_getm_notBefore(x); | ||
| 116 | } | ||
| 117 | |||
| 118 | ASN1_TIME * | ||
| 119 | X509_getm_notBefore(const X509 *x) | ||
| 120 | { | ||
| 121 | if (x == NULL || x->cert_info == NULL || x->cert_info->validity == NULL) | ||
| 122 | return (NULL); | ||
| 123 | return x->cert_info->validity->notBefore; | ||
| 124 | } | ||
| 125 | |||
| 112 | int | 126 | int |
| 113 | X509_set_notBefore(X509 *x, const ASN1_TIME *tm) | 127 | X509_set_notBefore(X509 *x, const ASN1_TIME *tm) |
| 114 | { | 128 | { |
| 115 | ASN1_TIME *in; | 129 | ASN1_TIME *in; |
| 116 | 130 | ||
| 117 | if ((x == NULL) || (x->cert_info->validity == NULL)) | 131 | if (x == NULL || x->cert_info->validity == NULL) |
| 118 | return (0); | 132 | return (0); |
| 119 | in = x->cert_info->validity->notBefore; | 133 | in = x->cert_info->validity->notBefore; |
| 120 | if (in != tm) { | 134 | if (in != tm) { |
| @@ -127,12 +141,26 @@ X509_set_notBefore(X509 *x, const ASN1_TIME *tm) | |||
| 127 | return (in != NULL); | 141 | return (in != NULL); |
| 128 | } | 142 | } |
| 129 | 143 | ||
| 144 | const ASN1_TIME * | ||
| 145 | X509_get0_notAfter(const X509 *x) | ||
| 146 | { | ||
| 147 | return X509_getm_notAfter(x); | ||
| 148 | } | ||
| 149 | |||
| 150 | ASN1_TIME * | ||
| 151 | X509_getm_notAfter(const X509 *x) | ||
| 152 | { | ||
| 153 | if (x == NULL || x->cert_info == NULL || x->cert_info->validity == NULL) | ||
| 154 | return (NULL); | ||
| 155 | return x->cert_info->validity->notAfter; | ||
| 156 | } | ||
| 157 | |||
| 130 | int | 158 | int |
| 131 | X509_set_notAfter(X509 *x, const ASN1_TIME *tm) | 159 | X509_set_notAfter(X509 *x, const ASN1_TIME *tm) |
| 132 | { | 160 | { |
| 133 | ASN1_TIME *in; | 161 | ASN1_TIME *in; |
| 134 | 162 | ||
| 135 | if ((x == NULL) || (x->cert_info->validity == NULL)) | 163 | if (x == NULL || x->cert_info->validity == NULL) |
| 136 | return (0); | 164 | return (0); |
| 137 | in = x->cert_info->validity->notAfter; | 165 | in = x->cert_info->validity->notAfter; |
| 138 | if (in != tm) { | 166 | if (in != tm) { |
