diff options
Diffstat (limited to 'src/lib/libcrypto/x509v3/v3_pku.c')
| -rw-r--r-- | src/lib/libcrypto/x509v3/v3_pku.c | 61 |
1 files changed, 9 insertions, 52 deletions
diff --git a/src/lib/libcrypto/x509v3/v3_pku.c b/src/lib/libcrypto/x509v3/v3_pku.c index c13e7d8f45..49a2e4697a 100644 --- a/src/lib/libcrypto/x509v3/v3_pku.c +++ b/src/lib/libcrypto/x509v3/v3_pku.c | |||
| @@ -59,7 +59,7 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
| 62 | #include <openssl/asn1_mac.h> | 62 | #include <openssl/asn1t.h> |
| 63 | #include <openssl/x509v3.h> | 63 | #include <openssl/x509v3.h> |
| 64 | 64 | ||
| 65 | static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method, PKEY_USAGE_PERIOD *usage, BIO *out, int indent); | 65 | static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method, PKEY_USAGE_PERIOD *usage, BIO *out, int indent); |
| @@ -67,62 +67,19 @@ static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method, PKEY_USAGE_PERIOD *u | |||
| 67 | static PKEY_USAGE_PERIOD *v2i_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *values); | 67 | static PKEY_USAGE_PERIOD *v2i_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *values); |
| 68 | */ | 68 | */ |
| 69 | X509V3_EXT_METHOD v3_pkey_usage_period = { | 69 | X509V3_EXT_METHOD v3_pkey_usage_period = { |
| 70 | NID_private_key_usage_period, 0, | 70 | NID_private_key_usage_period, 0, ASN1_ITEM_ref(PKEY_USAGE_PERIOD), |
| 71 | (X509V3_EXT_NEW)PKEY_USAGE_PERIOD_new, | 71 | 0,0,0,0, |
| 72 | (X509V3_EXT_FREE)PKEY_USAGE_PERIOD_free, | 72 | 0,0,0,0, |
| 73 | (X509V3_EXT_D2I)d2i_PKEY_USAGE_PERIOD, | ||
| 74 | (X509V3_EXT_I2D)i2d_PKEY_USAGE_PERIOD, | ||
| 75 | NULL, NULL, NULL, NULL, | ||
| 76 | (X509V3_EXT_I2R)i2r_PKEY_USAGE_PERIOD, NULL, | 73 | (X509V3_EXT_I2R)i2r_PKEY_USAGE_PERIOD, NULL, |
| 77 | NULL | 74 | NULL |
| 78 | }; | 75 | }; |
| 79 | 76 | ||
| 80 | int i2d_PKEY_USAGE_PERIOD(PKEY_USAGE_PERIOD *a, unsigned char **pp) | 77 | ASN1_SEQUENCE(PKEY_USAGE_PERIOD) = { |
| 81 | { | 78 | ASN1_IMP_OPT(PKEY_USAGE_PERIOD, notBefore, ASN1_GENERALIZEDTIME, 0), |
| 82 | M_ASN1_I2D_vars(a); | 79 | ASN1_IMP_OPT(PKEY_USAGE_PERIOD, notAfter, ASN1_GENERALIZEDTIME, 1) |
| 83 | 80 | } ASN1_SEQUENCE_END(PKEY_USAGE_PERIOD) | |
| 84 | M_ASN1_I2D_len_IMP_opt (a->notBefore, i2d_ASN1_GENERALIZEDTIME); | ||
| 85 | M_ASN1_I2D_len_IMP_opt (a->notAfter, i2d_ASN1_GENERALIZEDTIME); | ||
| 86 | |||
| 87 | M_ASN1_I2D_seq_total(); | ||
| 88 | |||
| 89 | M_ASN1_I2D_put_IMP_opt (a->notBefore, i2d_ASN1_GENERALIZEDTIME, 0); | ||
| 90 | M_ASN1_I2D_put_IMP_opt (a->notAfter, i2d_ASN1_GENERALIZEDTIME, 1); | ||
| 91 | |||
| 92 | M_ASN1_I2D_finish(); | ||
| 93 | } | ||
| 94 | |||
| 95 | PKEY_USAGE_PERIOD *PKEY_USAGE_PERIOD_new(void) | ||
| 96 | { | ||
| 97 | PKEY_USAGE_PERIOD *ret=NULL; | ||
| 98 | ASN1_CTX c; | ||
| 99 | M_ASN1_New_Malloc(ret, PKEY_USAGE_PERIOD); | ||
| 100 | ret->notBefore = NULL; | ||
| 101 | ret->notAfter = NULL; | ||
| 102 | return (ret); | ||
| 103 | M_ASN1_New_Error(ASN1_F_PKEY_USAGE_PERIOD_NEW); | ||
| 104 | } | ||
| 105 | 81 | ||
| 106 | PKEY_USAGE_PERIOD *d2i_PKEY_USAGE_PERIOD(PKEY_USAGE_PERIOD **a, | 82 | IMPLEMENT_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) |
| 107 | unsigned char **pp, long length) | ||
| 108 | { | ||
| 109 | M_ASN1_D2I_vars(a,PKEY_USAGE_PERIOD *,PKEY_USAGE_PERIOD_new); | ||
| 110 | M_ASN1_D2I_Init(); | ||
| 111 | M_ASN1_D2I_start_sequence(); | ||
| 112 | M_ASN1_D2I_get_IMP_opt (ret->notBefore, d2i_ASN1_GENERALIZEDTIME, 0, | ||
| 113 | V_ASN1_GENERALIZEDTIME); | ||
| 114 | M_ASN1_D2I_get_IMP_opt (ret->notAfter, d2i_ASN1_GENERALIZEDTIME, 1, | ||
| 115 | V_ASN1_GENERALIZEDTIME); | ||
| 116 | M_ASN1_D2I_Finish(a, PKEY_USAGE_PERIOD_free, ASN1_F_D2I_PKEY_USAGE_PERIOD); | ||
| 117 | } | ||
| 118 | |||
| 119 | void PKEY_USAGE_PERIOD_free(PKEY_USAGE_PERIOD *a) | ||
| 120 | { | ||
| 121 | if (a == NULL) return; | ||
| 122 | ASN1_GENERALIZEDTIME_free(a->notBefore); | ||
| 123 | ASN1_GENERALIZEDTIME_free(a->notAfter); | ||
| 124 | Free ((char *)a); | ||
| 125 | } | ||
| 126 | 83 | ||
| 127 | static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method, | 84 | static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method, |
| 128 | PKEY_USAGE_PERIOD *usage, BIO *out, int indent) | 85 | PKEY_USAGE_PERIOD *usage, BIO *out, int indent) |
