Coverage Report

Created: 2026-02-14 07:20

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl36/crypto/x509/x_crl.c
Line
Count
Source
1
/*
2
 * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved.
3
 *
4
 * Licensed under the Apache License 2.0 (the "License").  You may not use
5
 * this file except in compliance with the License.  You can obtain a copy
6
 * in the file LICENSE in the source distribution or at
7
 * https://www.openssl.org/source/license.html
8
 */
9
10
#include <stdio.h>
11
#include "internal/cryptlib.h"
12
#include <openssl/asn1t.h>
13
#include <openssl/x509.h>
14
#include "crypto/x509.h"
15
#include <openssl/x509v3.h>
16
#include "x509_local.h"
17
18
static int X509_REVOKED_cmp(const X509_REVOKED *const *a,
19
    const X509_REVOKED *const *b);
20
static int setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp);
21
22
ASN1_SEQUENCE(X509_REVOKED) = {
23
    ASN1_EMBED(X509_REVOKED, serialNumber, ASN1_INTEGER),
24
    ASN1_SIMPLE(X509_REVOKED, revocationDate, ASN1_TIME),
25
    ASN1_SEQUENCE_OF_OPT(X509_REVOKED, extensions, X509_EXTENSION)
26
1.42M
} ASN1_SEQUENCE_END(X509_REVOKED)
27
1.42M
28
1.42M
static int def_crl_verify(X509_CRL *crl, EVP_PKEY *r);
29
1.42M
static int def_crl_lookup(X509_CRL *crl,
30
1.42M
    X509_REVOKED **ret, const ASN1_INTEGER *serial,
31
1.42M
    const X509_NAME *issuer);
32
1.42M
33
1.42M
static X509_CRL_METHOD int_crl_meth = {
34
1.42M
    0,
35
1.42M
    0, 0,
36
1.42M
    def_crl_lookup,
37
1.42M
    def_crl_verify
38
1.42M
};
39
1.42M
40
1.42M
static const X509_CRL_METHOD *default_crl_method = &int_crl_meth;
41
1.42M
42
1.42M
/*
43
1.42M
 * The X509_CRL_INFO structure needs a bit of customisation. Since we cache
44
1.42M
 * the original encoding the signature won't be affected by reordering of the
45
1.42M
 * revoked field.
46
1.42M
 */
47
1.42M
static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
48
1.42M
    void *exarg)
49
1.89M
{
50
1.89M
    X509_CRL_INFO *a = (X509_CRL_INFO *)*pval;
51
52
1.89M
    if (!a || !a->revoked)
53
1.82M
        return 1;
54
75.0k
    switch (operation) {
55
        /*
56
         * Just set cmp function here. We don't sort because that would
57
         * affect the output of X509_CRL_print().
58
         */
59
36.2k
    case ASN1_OP_D2I_POST:
60
36.2k
        (void)sk_X509_REVOKED_set_cmp_func(a->revoked, X509_REVOKED_cmp);
61
36.2k
        break;
62
75.0k
    }
63
75.0k
    return 1;
64
75.0k
}
65
66
ASN1_SEQUENCE_enc(X509_CRL_INFO, enc, crl_inf_cb) = {
67
    ASN1_OPT(X509_CRL_INFO, version, ASN1_INTEGER),
68
    ASN1_EMBED(X509_CRL_INFO, sig_alg, X509_ALGOR),
69
    ASN1_SIMPLE(X509_CRL_INFO, issuer, X509_NAME),
70
    ASN1_SIMPLE(X509_CRL_INFO, lastUpdate, ASN1_TIME),
71
    ASN1_OPT(X509_CRL_INFO, nextUpdate, ASN1_TIME),
72
    ASN1_SEQUENCE_OF_OPT(X509_CRL_INFO, revoked, X509_REVOKED),
73
    ASN1_EXP_SEQUENCE_OF_OPT(X509_CRL_INFO, extensions, X509_EXTENSION, 0)
74
} ASN1_SEQUENCE_END_enc(X509_CRL_INFO, X509_CRL_INFO)
75
76
/*
77
 * Set CRL entry issuer according to CRL certificate issuer extension. Check
78
 * for unhandled critical CRL entry extensions.
79
 */
80
81
static int crl_set_issuers(X509_CRL *crl)
82
132k
{
83
84
132k
    int i, j;
85
132k
    GENERAL_NAMES *gens, *gtmp;
86
132k
    STACK_OF(X509_REVOKED) *revoked;
87
88
132k
    revoked = X509_CRL_get_REVOKED(crl);
89
90
132k
    gens = NULL;
91
369k
    for (i = 0; i < sk_X509_REVOKED_num(revoked); i++) {
92
247k
        X509_REVOKED *rev = sk_X509_REVOKED_value(revoked, i);
93
247k
        STACK_OF(X509_EXTENSION) *exts;
94
247k
        ASN1_ENUMERATED *reason;
95
247k
        X509_EXTENSION *ext;
96
97
247k
        gtmp = X509_REVOKED_get_ext_d2i(rev,
98
247k
            NID_certificate_issuer, &j, NULL);
99
247k
        if (gtmp == NULL && j != -1) {
100
1.97k
            crl->flags |= EXFLAG_INVALID;
101
1.97k
            return 1;
102
1.97k
        }
103
104
245k
        if (gtmp != NULL) {
105
25.4k
            if (crl->issuers == NULL) {
106
3.83k
                crl->issuers = sk_GENERAL_NAMES_new_null();
107
3.83k
                if (crl->issuers == NULL) {
108
0
                    GENERAL_NAMES_free(gtmp);
109
0
                    return 0;
110
0
                }
111
3.83k
            }
112
25.4k
            if (!sk_GENERAL_NAMES_push(crl->issuers, gtmp)) {
113
0
                GENERAL_NAMES_free(gtmp);
114
0
                return 0;
115
0
            }
116
25.4k
            gens = gtmp;
117
25.4k
        }
118
245k
        rev->issuer = gens;
119
120
245k
        reason = X509_REVOKED_get_ext_d2i(rev, NID_crl_reason, &j, NULL);
121
245k
        if (reason == NULL && j != -1) {
122
7.54k
            crl->flags |= EXFLAG_INVALID;
123
7.54k
            return 1;
124
7.54k
        }
125
126
237k
        if (reason != NULL) {
127
83.7k
            rev->reason = ASN1_ENUMERATED_get(reason);
128
83.7k
            ASN1_ENUMERATED_free(reason);
129
83.7k
        } else
130
153k
            rev->reason = CRL_REASON_NONE;
131
132
        /* Check for critical CRL entry extensions */
133
134
237k
        exts = rev->extensions;
135
136
403k
        for (j = 0; j < sk_X509_EXTENSION_num(exts); j++) {
137
168k
            ext = sk_X509_EXTENSION_value(exts, j);
138
168k
            if (X509_EXTENSION_get_critical(ext)) {
139
2.79k
                if (OBJ_obj2nid(X509_EXTENSION_get_object(ext))
140
2.79k
                    == NID_certificate_issuer)
141
285
                    continue;
142
2.51k
                crl->flags |= EXFLAG_CRITICAL;
143
2.51k
                break;
144
2.79k
            }
145
168k
        }
146
237k
    }
147
148
122k
    return 1;
149
132k
}
150
151
/*
152
 * The X509_CRL structure needs a bit of customisation. Cache some extensions
153
 * and hash of the whole CRL or set EXFLAG_NO_FINGERPRINT if this fails.
154
 */
155
static int crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
156
    void *exarg)
157
2.42M
{
158
2.42M
    X509_CRL *crl = (X509_CRL *)*pval;
159
2.42M
    STACK_OF(X509_EXTENSION) *exts;
160
2.42M
    X509_EXTENSION *ext;
161
2.42M
    int idx, i;
162
163
2.42M
    switch (operation) {
164
286k
    case ASN1_OP_D2I_PRE:
165
286k
        if (crl->meth->crl_free) {
166
0
            if (!crl->meth->crl_free(crl))
167
0
                return 0;
168
0
        }
169
286k
        AUTHORITY_KEYID_free(crl->akid);
170
286k
        ISSUING_DIST_POINT_free(crl->idp);
171
286k
        ASN1_INTEGER_free(crl->crl_number);
172
286k
        ASN1_INTEGER_free(crl->base_crl_number);
173
286k
        sk_GENERAL_NAMES_pop_free(crl->issuers, GENERAL_NAMES_free);
174
        /* fall through */
175
176
573k
    case ASN1_OP_NEW_POST:
177
573k
        crl->idp = NULL;
178
573k
        crl->akid = NULL;
179
573k
        crl->flags = 0;
180
573k
        crl->idp_flags = 0;
181
573k
        crl->idp_reasons = CRLDP_ALL_REASONS;
182
573k
        crl->meth = default_crl_method;
183
573k
        crl->meth_data = NULL;
184
573k
        crl->issuers = NULL;
185
573k
        crl->crl_number = NULL;
186
573k
        crl->base_crl_number = NULL;
187
573k
        break;
188
189
211k
    case ASN1_OP_D2I_POST:
190
211k
        if (!X509_CRL_digest(crl, EVP_sha1(), crl->sha1_hash, NULL))
191
0
            crl->flags |= EXFLAG_NO_FINGERPRINT;
192
211k
        crl->idp = X509_CRL_get_ext_d2i(crl,
193
211k
            NID_issuing_distribution_point, &i,
194
211k
            NULL);
195
211k
        if (crl->idp != NULL) {
196
32.8k
            if (!setup_idp(crl, crl->idp))
197
5.50k
                crl->flags |= EXFLAG_INVALID;
198
178k
        } else if (i != -1) {
199
71.0k
            crl->flags |= EXFLAG_INVALID;
200
71.0k
        }
201
202
211k
        crl->akid = X509_CRL_get_ext_d2i(crl,
203
211k
            NID_authority_key_identifier, &i,
204
211k
            NULL);
205
211k
        if (crl->akid == NULL && i != -1)
206
43.1k
            crl->flags |= EXFLAG_INVALID;
207
208
211k
        crl->crl_number = X509_CRL_get_ext_d2i(crl,
209
211k
            NID_crl_number, &i, NULL);
210
211k
        if (crl->crl_number == NULL && i != -1)
211
15.5k
            crl->flags |= EXFLAG_INVALID;
212
213
211k
        crl->base_crl_number = X509_CRL_get_ext_d2i(crl,
214
211k
            NID_delta_crl, &i,
215
211k
            NULL);
216
211k
        if (crl->base_crl_number == NULL && i != -1)
217
8.16k
            crl->flags |= EXFLAG_INVALID;
218
        /* Delta CRLs must have CRL number */
219
211k
        if (crl->base_crl_number && !crl->crl_number)
220
1.50k
            crl->flags |= EXFLAG_INVALID;
221
222
        /*
223
         * See if we have any unhandled critical CRL extensions and indicate
224
         * this in a flag. We only currently handle IDP so anything else
225
         * critical sets the flag. This code accesses the X509_CRL structure
226
         * directly: applications shouldn't do this.
227
         */
228
229
211k
        exts = crl->crl.extensions;
230
231
1.40M
        for (idx = 0; idx < sk_X509_EXTENSION_num(exts); idx++) {
232
1.20M
            int nid;
233
1.20M
            ext = sk_X509_EXTENSION_value(exts, idx);
234
1.20M
            nid = OBJ_obj2nid(X509_EXTENSION_get_object(ext));
235
1.20M
            if (nid == NID_freshest_crl)
236
64.2k
                crl->flags |= EXFLAG_FRESHEST;
237
1.20M
            if (X509_EXTENSION_get_critical(ext)) {
238
                /* We handle IDP and deltas */
239
45.1k
                if ((nid == NID_issuing_distribution_point)
240
17.6k
                    || (nid == NID_authority_key_identifier)
241
8.94k
                    || (nid == NID_delta_crl))
242
38.5k
                    continue;
243
6.57k
                crl->flags |= EXFLAG_CRITICAL;
244
6.57k
                break;
245
45.1k
            }
246
1.20M
        }
247
248
211k
        if (!crl_set_issuers(crl))
249
38
            return 0;
250
251
211k
        if (crl->meth->crl_init) {
252
0
            if (crl->meth->crl_init(crl) == 0)
253
0
                return 0;
254
0
        }
255
256
211k
        crl->flags |= EXFLAG_SET;
257
211k
        break;
258
259
286k
    case ASN1_OP_FREE_POST:
260
286k
        if (crl->meth != NULL && crl->meth->crl_free != NULL) {
261
0
            if (!crl->meth->crl_free(crl))
262
0
                return 0;
263
0
        }
264
286k
        AUTHORITY_KEYID_free(crl->akid);
265
286k
        ISSUING_DIST_POINT_free(crl->idp);
266
286k
        ASN1_INTEGER_free(crl->crl_number);
267
286k
        ASN1_INTEGER_free(crl->base_crl_number);
268
286k
        sk_GENERAL_NAMES_pop_free(crl->issuers, GENERAL_NAMES_free);
269
286k
        OPENSSL_free(crl->propq);
270
286k
        break;
271
0
    case ASN1_OP_DUP_POST: {
272
0
        X509_CRL *old = exarg;
273
274
0
        if (!ossl_x509_crl_set0_libctx(crl, old->libctx, old->propq))
275
0
            return 0;
276
0
    } break;
277
2.42M
    }
278
2.42M
    return 1;
279
2.42M
}
280
281
/* Convert IDP into a more convenient form */
282
283
static int setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp)
284
16.7k
{
285
16.7k
    int idp_only = 0;
286
16.7k
    int ret = 0;
287
288
    /* Set various flags according to IDP */
289
16.7k
    crl->idp_flags |= IDP_PRESENT;
290
16.7k
    if (idp->onlyuser > 0) {
291
145
        idp_only++;
292
145
        crl->idp_flags |= IDP_ONLYUSER;
293
145
    }
294
16.7k
    if (idp->onlyCA > 0) {
295
2.66k
        idp_only++;
296
2.66k
        crl->idp_flags |= IDP_ONLYCA;
297
2.66k
    }
298
16.7k
    if (idp->onlyattr > 0) {
299
291
        idp_only++;
300
291
        crl->idp_flags |= IDP_ONLYATTR;
301
291
    }
302
303
16.7k
    if (idp_only > 1)
304
95
        crl->idp_flags |= IDP_INVALID;
305
306
16.7k
    if (idp->indirectCRL > 0)
307
97
        crl->idp_flags |= IDP_INDIRECT;
308
309
16.7k
    if (idp->onlysomereasons) {
310
2.18k
        crl->idp_flags |= IDP_REASONS;
311
2.18k
        if (idp->onlysomereasons->length > 0)
312
1.58k
            crl->idp_reasons = idp->onlysomereasons->data[0];
313
2.18k
        if (idp->onlysomereasons->length > 1)
314
1.24k
            crl->idp_reasons |= (idp->onlysomereasons->data[1] << 8);
315
2.18k
        crl->idp_reasons &= CRLDP_ALL_REASONS;
316
2.18k
    }
317
318
16.7k
    ret = DIST_POINT_set_dpname(idp->distpoint, X509_CRL_get_issuer(crl));
319
320
    /*
321
     * RFC5280 specifies that if onlyContainsUserCerts, onlyContainsCACerts,
322
     * indirectCRL, and OnlyContainsAttributeCerts are all FALSE, there must
323
     * be either a distributionPoint field or an onlySomeReasons field present.
324
     */
325
16.7k
    if (crl->idp_flags == IDP_PRESENT && idp->distpoint == NULL)
326
2.83k
        crl->idp_flags |= IDP_INVALID;
327
328
16.7k
    return ret;
329
16.7k
}
330
331
ASN1_SEQUENCE_ref(X509_CRL, crl_cb) = {
332
    ASN1_EMBED(X509_CRL, crl, X509_CRL_INFO),
333
    ASN1_EMBED(X509_CRL, sig_alg, X509_ALGOR),
334
    ASN1_EMBED(X509_CRL, signature, ASN1_BIT_STRING)
335
} ASN1_SEQUENCE_END_ref(X509_CRL, X509_CRL)
336
337
IMPLEMENT_ASN1_FUNCTIONS(X509_REVOKED)
338
339
IMPLEMENT_ASN1_DUP_FUNCTION(X509_REVOKED)
340
341
IMPLEMENT_ASN1_FUNCTIONS(X509_CRL_INFO)
342
343
IMPLEMENT_ASN1_FUNCTIONS(X509_CRL)
344
345
IMPLEMENT_ASN1_DUP_FUNCTION(X509_CRL)
346
347
static int X509_REVOKED_cmp(const X509_REVOKED *const *a,
348
    const X509_REVOKED *const *b)
349
26.7k
{
350
26.7k
    return (ASN1_STRING_cmp((ASN1_STRING *)&(*a)->serialNumber,
351
26.7k
        (ASN1_STRING *)&(*b)->serialNumber));
352
26.7k
}
353
354
X509_CRL *X509_CRL_new_ex(OSSL_LIB_CTX *libctx, const char *propq)
355
0
{
356
0
    X509_CRL *crl = NULL;
357
358
0
    crl = (X509_CRL *)ASN1_item_new((X509_CRL_it()));
359
0
    if (!ossl_x509_crl_set0_libctx(crl, libctx, propq)) {
360
0
        X509_CRL_free(crl);
361
0
        crl = NULL;
362
0
    }
363
0
    return crl;
364
0
}
365
366
int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev)
367
0
{
368
0
    X509_CRL_INFO *inf;
369
370
0
    inf = &crl->crl;
371
0
    if (inf->revoked == NULL)
372
0
        inf->revoked = sk_X509_REVOKED_new(X509_REVOKED_cmp);
373
0
    if (inf->revoked == NULL || !sk_X509_REVOKED_push(inf->revoked, rev)) {
374
0
        ERR_raise(ERR_LIB_ASN1, ERR_R_CRYPTO_LIB);
375
0
        return 0;
376
0
    }
377
0
    inf->enc.modified = 1;
378
0
    return 1;
379
0
}
380
381
int X509_CRL_verify(X509_CRL *crl, EVP_PKEY *r)
382
5.43k
{
383
5.43k
    if (crl->meth->crl_verify)
384
5.43k
        return crl->meth->crl_verify(crl, r);
385
0
    return 0;
386
5.43k
}
387
388
int X509_CRL_get0_by_serial(X509_CRL *crl,
389
    X509_REVOKED **ret, const ASN1_INTEGER *serial)
390
0
{
391
0
    if (crl->meth->crl_lookup)
392
0
        return crl->meth->crl_lookup(crl, ret, serial, NULL);
393
0
    return 0;
394
0
}
395
396
int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x)
397
5.43k
{
398
5.43k
    if (crl->meth->crl_lookup)
399
5.43k
        return crl->meth->crl_lookup(crl, ret,
400
5.43k
            X509_get0_serialNumber(x),
401
5.43k
            X509_get_issuer_name(x));
402
0
    return 0;
403
5.43k
}
404
405
static int def_crl_verify(X509_CRL *crl, EVP_PKEY *r)
406
5.43k
{
407
5.43k
    return ASN1_item_verify_ex(ASN1_ITEM_rptr(X509_CRL_INFO),
408
5.43k
        &crl->sig_alg, &crl->signature, &crl->crl, NULL,
409
5.43k
        r, crl->libctx, crl->propq);
410
5.43k
}
411
412
static int crl_revoked_issuer_match(X509_CRL *crl, const X509_NAME *nm,
413
    X509_REVOKED *rev)
414
31
{
415
31
    int i;
416
417
31
    if (!rev->issuer) {
418
31
        if (!nm)
419
0
            return 1;
420
31
        if (!X509_NAME_cmp(nm, X509_CRL_get_issuer(crl)))
421
31
            return 1;
422
0
        return 0;
423
31
    }
424
425
0
    if (!nm)
426
0
        nm = X509_CRL_get_issuer(crl);
427
428
0
    for (i = 0; i < sk_GENERAL_NAME_num(rev->issuer); i++) {
429
0
        GENERAL_NAME *gen = sk_GENERAL_NAME_value(rev->issuer, i);
430
0
        if (gen->type != GEN_DIRNAME)
431
0
            continue;
432
0
        if (!X509_NAME_cmp(nm, gen->d.directoryName))
433
0
            return 1;
434
0
    }
435
0
    return 0;
436
0
}
437
438
static int def_crl_lookup(X509_CRL *crl,
439
    X509_REVOKED **ret, const ASN1_INTEGER *serial,
440
    const X509_NAME *issuer)
441
5.43k
{
442
5.43k
    X509_REVOKED rtmp, *rev;
443
5.43k
    int idx, num;
444
445
5.43k
    if (crl->crl.revoked == NULL)
446
5.33k
        return 0;
447
448
    /*
449
     * Sort revoked into serial number order if not already sorted. Do this
450
     * under a lock to avoid race condition.
451
     */
452
101
    if (!sk_X509_REVOKED_is_sorted(crl->crl.revoked)) {
453
100
        if (!CRYPTO_THREAD_write_lock(crl->lock))
454
0
            return 0;
455
100
        sk_X509_REVOKED_sort(crl->crl.revoked);
456
100
        CRYPTO_THREAD_unlock(crl->lock);
457
100
    }
458
101
    rtmp.serialNumber = *serial;
459
101
    idx = sk_X509_REVOKED_find(crl->crl.revoked, &rtmp);
460
101
    if (idx < 0)
461
70
        return 0;
462
    /* Need to look for matching name */
463
31
    for (num = sk_X509_REVOKED_num(crl->crl.revoked); idx < num; idx++) {
464
31
        rev = sk_X509_REVOKED_value(crl->crl.revoked, idx);
465
31
        if (ASN1_INTEGER_cmp(&rev->serialNumber, serial))
466
0
            return 0;
467
31
        if (crl_revoked_issuer_match(crl, issuer, rev)) {
468
31
            if (ret)
469
31
                *ret = rev;
470
31
            if (rev->reason == CRL_REASON_REMOVE_FROM_CRL)
471
0
                return 2;
472
31
            return 1;
473
31
        }
474
31
    }
475
0
    return 0;
476
31
}
477
478
void X509_CRL_set_default_method(const X509_CRL_METHOD *meth)
479
0
{
480
0
    if (meth == NULL)
481
0
        default_crl_method = &int_crl_meth;
482
0
    else
483
0
        default_crl_method = meth;
484
0
}
485
486
X509_CRL_METHOD *X509_CRL_METHOD_new(int (*crl_init)(X509_CRL *crl),
487
    int (*crl_free)(X509_CRL *crl),
488
    int (*crl_lookup)(X509_CRL *crl,
489
        X509_REVOKED **ret,
490
        const ASN1_INTEGER *ser,
491
        const X509_NAME *issuer),
492
    int (*crl_verify)(X509_CRL *crl,
493
        EVP_PKEY *pk))
494
0
{
495
0
    X509_CRL_METHOD *m = OPENSSL_malloc(sizeof(*m));
496
497
0
    if (m == NULL)
498
0
        return NULL;
499
0
    m->crl_init = crl_init;
500
0
    m->crl_free = crl_free;
501
0
    m->crl_lookup = crl_lookup;
502
0
    m->crl_verify = crl_verify;
503
0
    m->flags = X509_CRL_METHOD_DYNAMIC;
504
0
    return m;
505
0
}
506
507
void X509_CRL_METHOD_free(X509_CRL_METHOD *m)
508
0
{
509
0
    if (m == NULL || !(m->flags & X509_CRL_METHOD_DYNAMIC))
510
0
        return;
511
0
    OPENSSL_free(m);
512
0
}
513
514
void X509_CRL_set_meth_data(X509_CRL *crl, void *dat)
515
0
{
516
0
    crl->meth_data = dat;
517
0
}
518
519
void *X509_CRL_get_meth_data(X509_CRL *crl)
520
0
{
521
0
    return crl->meth_data;
522
0
}
523
524
int ossl_x509_crl_set0_libctx(X509_CRL *x, OSSL_LIB_CTX *libctx,
525
    const char *propq)
526
0
{
527
0
    if (x != NULL) {
528
0
        x->libctx = libctx;
529
0
        OPENSSL_free(x->propq);
530
0
        x->propq = NULL;
531
0
        if (propq != NULL) {
532
0
            x->propq = OPENSSL_strdup(propq);
533
0
            if (x->propq == NULL)
534
0
                return 0;
535
0
        }
536
0
    }
537
0
    return 1;
538
0
}