OLD | NEW |
1 /* crypto/x509/x509_set.c */ | 1 /* crypto/x509/x509_set.c */ |
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 * |
5 * This package is an SSL implementation written | 5 * This package is an SSL implementation written |
6 * by Eric Young (eay@cryptsoft.com). | 6 * by Eric Young (eay@cryptsoft.com). |
7 * The implementation was written so as to conform with Netscapes SSL. | 7 * The implementation was written so as to conform with Netscapes SSL. |
8 * | 8 * |
9 * This library is free for commercial and non-commercial use as long as | 9 * This library is free for commercial and non-commercial use as long as |
10 * the following conditions are aheared to. The following conditions | 10 * the following conditions are aheared to. The following conditions |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 if ((x == NULL) || (x->cert_info == NULL)) return(0); | 97 if ((x == NULL) || (x->cert_info == NULL)) return(0); |
98 return(X509_NAME_set(&x->cert_info->issuer,name)); | 98 return(X509_NAME_set(&x->cert_info->issuer,name)); |
99 } | 99 } |
100 | 100 |
101 int X509_set_subject_name(X509 *x, X509_NAME *name) | 101 int X509_set_subject_name(X509 *x, X509_NAME *name) |
102 { | 102 { |
103 if ((x == NULL) || (x->cert_info == NULL)) return(0); | 103 if ((x == NULL) || (x->cert_info == NULL)) return(0); |
104 return(X509_NAME_set(&x->cert_info->subject,name)); | 104 return(X509_NAME_set(&x->cert_info->subject,name)); |
105 } | 105 } |
106 | 106 |
107 int X509_set_notBefore(X509 *x, ASN1_TIME *tm) | 107 int X509_set_notBefore(X509 *x, const ASN1_TIME *tm) |
108 { | 108 { |
109 ASN1_TIME *in; | 109 ASN1_TIME *in; |
110 | 110 |
111 if ((x == NULL) || (x->cert_info->validity == NULL)) return(0); | 111 if ((x == NULL) || (x->cert_info->validity == NULL)) return(0); |
112 in=x->cert_info->validity->notBefore; | 112 in=x->cert_info->validity->notBefore; |
113 if (in != tm) | 113 if (in != tm) |
114 { | 114 { |
115 in=M_ASN1_TIME_dup(tm); | 115 in=M_ASN1_TIME_dup(tm); |
116 if (in != NULL) | 116 if (in != NULL) |
117 { | 117 { |
118 M_ASN1_TIME_free(x->cert_info->validity->notBefore); | 118 M_ASN1_TIME_free(x->cert_info->validity->notBefore); |
119 x->cert_info->validity->notBefore=in; | 119 x->cert_info->validity->notBefore=in; |
120 } | 120 } |
121 } | 121 } |
122 return(in != NULL); | 122 return(in != NULL); |
123 } | 123 } |
124 | 124 |
125 int X509_set_notAfter(X509 *x, ASN1_TIME *tm) | 125 int X509_set_notAfter(X509 *x, const ASN1_TIME *tm) |
126 { | 126 { |
127 ASN1_TIME *in; | 127 ASN1_TIME *in; |
128 | 128 |
129 if ((x == NULL) || (x->cert_info->validity == NULL)) return(0); | 129 if ((x == NULL) || (x->cert_info->validity == NULL)) return(0); |
130 in=x->cert_info->validity->notAfter; | 130 in=x->cert_info->validity->notAfter; |
131 if (in != tm) | 131 if (in != tm) |
132 { | 132 { |
133 in=M_ASN1_TIME_dup(tm); | 133 in=M_ASN1_TIME_dup(tm); |
134 if (in != NULL) | 134 if (in != NULL) |
135 { | 135 { |
136 M_ASN1_TIME_free(x->cert_info->validity->notAfter); | 136 M_ASN1_TIME_free(x->cert_info->validity->notAfter); |
137 x->cert_info->validity->notAfter=in; | 137 x->cert_info->validity->notAfter=in; |
138 } | 138 } |
139 } | 139 } |
140 return(in != NULL); | 140 return(in != NULL); |
141 } | 141 } |
142 | 142 |
143 int X509_set_pubkey(X509 *x, EVP_PKEY *pkey) | 143 int X509_set_pubkey(X509 *x, EVP_PKEY *pkey) |
144 { | 144 { |
145 if ((x == NULL) || (x->cert_info == NULL)) return(0); | 145 if ((x == NULL) || (x->cert_info == NULL)) return(0); |
146 return(X509_PUBKEY_set(&(x->cert_info->key),pkey)); | 146 return(X509_PUBKEY_set(&(x->cert_info->key),pkey)); |
147 } | 147 } |
148 | 148 |
149 | 149 |
150 | 150 |
OLD | NEW |