diff options
author | tedu <> | 2014-04-18 01:59:00 +0000 |
---|---|---|
committer | tedu <> | 2014-04-18 01:59:00 +0000 |
commit | 513bec93d6747369737d3a618ef58a44410059f6 (patch) | |
tree | 88ee4831e2437f9075e786ffb662bb05fe0e3df6 /src/lib/libcrypto/x509/x509cset.c | |
parent | 1fca82b89342502ff32bda59bd067e303ff9d5ab (diff) | |
download | openbsd-513bec93d6747369737d3a618ef58a44410059f6.tar.gz openbsd-513bec93d6747369737d3a618ef58a44410059f6.tar.bz2 openbsd-513bec93d6747369737d3a618ef58a44410059f6.zip |
blunt force knf
Diffstat (limited to 'src/lib/libcrypto/x509/x509cset.c')
-rw-r--r-- | src/lib/libcrypto/x509/x509cset.c | 70 |
1 files changed, 30 insertions, 40 deletions
diff --git a/src/lib/libcrypto/x509/x509cset.c b/src/lib/libcrypto/x509/x509cset.c index 3109defb0b..bb39cf4e04 100644 --- a/src/lib/libcrypto/x509/x509cset.c +++ b/src/lib/libcrypto/x509/x509cset.c | |||
@@ -64,107 +64,97 @@ | |||
64 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
65 | 65 | ||
66 | int X509_CRL_set_version(X509_CRL *x, long version) | 66 | int X509_CRL_set_version(X509_CRL *x, long version) |
67 | { | 67 | { |
68 | if (x == NULL) return(0); | 68 | if (x == NULL) return(0); |
69 | if (x->crl->version == NULL) | 69 | if (x->crl->version == NULL) { |
70 | { | ||
71 | if ((x->crl->version=M_ASN1_INTEGER_new()) == NULL) | 70 | if ((x->crl->version=M_ASN1_INTEGER_new()) == NULL) |
72 | return(0); | 71 | return(0); |
73 | } | ||
74 | return(ASN1_INTEGER_set(x->crl->version,version)); | ||
75 | } | 72 | } |
73 | return(ASN1_INTEGER_set(x->crl->version,version)); | ||
74 | } | ||
76 | 75 | ||
77 | int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name) | 76 | int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name) |
78 | { | 77 | { |
79 | if ((x == NULL) || (x->crl == NULL)) return(0); | 78 | if ((x == NULL) || (x->crl == NULL)) return(0); |
80 | return(X509_NAME_set(&x->crl->issuer,name)); | 79 | return(X509_NAME_set(&x->crl->issuer,name)); |
81 | } | 80 | } |
82 | 81 | ||
83 | 82 | ||
84 | int X509_CRL_set_lastUpdate(X509_CRL *x, const ASN1_TIME *tm) | 83 | int X509_CRL_set_lastUpdate(X509_CRL *x, const ASN1_TIME *tm) |
85 | { | 84 | { |
86 | ASN1_TIME *in; | 85 | ASN1_TIME *in; |
87 | 86 | ||
88 | if (x == NULL) return(0); | 87 | if (x == NULL) return(0); |
89 | in=x->crl->lastUpdate; | 88 | in=x->crl->lastUpdate; |
90 | if (in != tm) | 89 | if (in != tm) { |
91 | { | ||
92 | in=M_ASN1_TIME_dup(tm); | 90 | in=M_ASN1_TIME_dup(tm); |
93 | if (in != NULL) | 91 | if (in != NULL) { |
94 | { | ||
95 | M_ASN1_TIME_free(x->crl->lastUpdate); | 92 | M_ASN1_TIME_free(x->crl->lastUpdate); |
96 | x->crl->lastUpdate=in; | 93 | x->crl->lastUpdate=in; |
97 | } | ||
98 | } | 94 | } |
99 | return(in != NULL); | ||
100 | } | 95 | } |
96 | return(in != NULL); | ||
97 | } | ||
101 | 98 | ||
102 | int X509_CRL_set_nextUpdate(X509_CRL *x, const ASN1_TIME *tm) | 99 | int X509_CRL_set_nextUpdate(X509_CRL *x, const ASN1_TIME *tm) |
103 | { | 100 | { |
104 | ASN1_TIME *in; | 101 | ASN1_TIME *in; |
105 | 102 | ||
106 | if (x == NULL) return(0); | 103 | if (x == NULL) return(0); |
107 | in=x->crl->nextUpdate; | 104 | in=x->crl->nextUpdate; |
108 | if (in != tm) | 105 | if (in != tm) { |
109 | { | ||
110 | in=M_ASN1_TIME_dup(tm); | 106 | in=M_ASN1_TIME_dup(tm); |
111 | if (in != NULL) | 107 | if (in != NULL) { |
112 | { | ||
113 | M_ASN1_TIME_free(x->crl->nextUpdate); | 108 | M_ASN1_TIME_free(x->crl->nextUpdate); |
114 | x->crl->nextUpdate=in; | 109 | x->crl->nextUpdate=in; |
115 | } | ||
116 | } | 110 | } |
117 | return(in != NULL); | ||
118 | } | 111 | } |
112 | return(in != NULL); | ||
113 | } | ||
119 | 114 | ||
120 | int X509_CRL_sort(X509_CRL *c) | 115 | int X509_CRL_sort(X509_CRL *c) |
121 | { | 116 | { |
122 | int i; | 117 | int i; |
123 | X509_REVOKED *r; | 118 | X509_REVOKED *r; |
124 | /* sort the data so it will be written in serial | 119 | /* sort the data so it will be written in serial |
125 | * number order */ | 120 | * number order */ |
126 | sk_X509_REVOKED_sort(c->crl->revoked); | 121 | sk_X509_REVOKED_sort(c->crl->revoked); |
127 | for (i=0; i<sk_X509_REVOKED_num(c->crl->revoked); i++) | 122 | for (i=0; i<sk_X509_REVOKED_num(c->crl->revoked); i++) { |
128 | { | ||
129 | r=sk_X509_REVOKED_value(c->crl->revoked,i); | 123 | r=sk_X509_REVOKED_value(c->crl->revoked,i); |
130 | r->sequence=i; | 124 | r->sequence=i; |
131 | } | 125 | } |
132 | c->crl->enc.modified = 1; | 126 | c->crl->enc.modified = 1; |
133 | return 1; | 127 | return 1; |
134 | } | 128 | } |
135 | 129 | ||
136 | int X509_REVOKED_set_revocationDate(X509_REVOKED *x, ASN1_TIME *tm) | 130 | int X509_REVOKED_set_revocationDate(X509_REVOKED *x, ASN1_TIME *tm) |
137 | { | 131 | { |
138 | ASN1_TIME *in; | 132 | ASN1_TIME *in; |
139 | 133 | ||
140 | if (x == NULL) return(0); | 134 | if (x == NULL) return(0); |
141 | in=x->revocationDate; | 135 | in=x->revocationDate; |
142 | if (in != tm) | 136 | if (in != tm) { |
143 | { | ||
144 | in=M_ASN1_TIME_dup(tm); | 137 | in=M_ASN1_TIME_dup(tm); |
145 | if (in != NULL) | 138 | if (in != NULL) { |
146 | { | ||
147 | M_ASN1_TIME_free(x->revocationDate); | 139 | M_ASN1_TIME_free(x->revocationDate); |
148 | x->revocationDate=in; | 140 | x->revocationDate=in; |
149 | } | ||
150 | } | 141 | } |
151 | return(in != NULL); | ||
152 | } | 142 | } |
143 | return(in != NULL); | ||
144 | } | ||
153 | 145 | ||
154 | int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial) | 146 | int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial) |
155 | { | 147 | { |
156 | ASN1_INTEGER *in; | 148 | ASN1_INTEGER *in; |
157 | 149 | ||
158 | if (x == NULL) return(0); | 150 | if (x == NULL) return(0); |
159 | in=x->serialNumber; | 151 | in=x->serialNumber; |
160 | if (in != serial) | 152 | if (in != serial) { |
161 | { | ||
162 | in=M_ASN1_INTEGER_dup(serial); | 153 | in=M_ASN1_INTEGER_dup(serial); |
163 | if (in != NULL) | 154 | if (in != NULL) { |
164 | { | ||
165 | M_ASN1_INTEGER_free(x->serialNumber); | 155 | M_ASN1_INTEGER_free(x->serialNumber); |
166 | x->serialNumber=in; | 156 | x->serialNumber=in; |
167 | } | ||
168 | } | 157 | } |
169 | return(in != NULL); | ||
170 | } | 158 | } |
159 | return(in != NULL); | ||
160 | } | ||