/src/gnutls/lib/minitasn1/version.c
Line  | Count  | Source (jump to first uncovered line)  | 
1  |  | /*  | 
2  |  |  * Copyright (C) 2000-2025 Free Software Foundation, Inc.  | 
3  |  |  *  | 
4  |  |  * This file is part of LIBTASN1.  | 
5  |  |  *  | 
6  |  |  * The LIBTASN1 library is free software; you can redistribute it  | 
7  |  |  * and/or modify it under the terms of the GNU Lesser General Public  | 
8  |  |  * License as published by the Free Software Foundation; either  | 
9  |  |  * version 2.1 of the License, or (at your option) any later version.  | 
10  |  |  *  | 
11  |  |  * This library is distributed in the hope that it will be useful, but  | 
12  |  |  * WITHOUT ANY WARRANTY; without even the implied warranty of  | 
13  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  | 
14  |  |  * Lesser General Public License for more details.  | 
15  |  |  *  | 
16  |  |  * You should have received a copy of the GNU Lesser General Public  | 
17  |  |  * License along with this library; if not, see  | 
18  |  |  * <https://www.gnu.org/licenses/>.  | 
19  |  |  */  | 
20  |  |  | 
21  |  | #include <config.h>  | 
22  |  |  | 
23  |  | #include <string.h>   /* for strverscmp */  | 
24  |  |  | 
25  |  | #include "libtasn1.h"  | 
26  |  |  | 
27  |  | /**  | 
28  |  |  * asn1_check_version:  | 
29  |  |  * @req_version: Required version number, or %NULL.  | 
30  |  |  *  | 
31  |  |  * Check that the version of the library is at minimum the  | 
32  |  |  * requested one and return the version string; return %NULL if the  | 
33  |  |  * condition is not satisfied.  If a %NULL is passed to this function,  | 
34  |  |  * no check is done, but the version string is simply returned.  | 
35  |  |  *  | 
36  |  |  * See %ASN1_VERSION for a suitable @req_version string.  | 
37  |  |  *  | 
38  |  |  * Returns: Version string of run-time library, or %NULL if the  | 
39  |  |  *   run-time library does not meet the required version number.  | 
40  |  |  */  | 
41  |  | const char *  | 
42  |  | asn1_check_version (const char *req_version)  | 
43  | 2  | { | 
44  | 2  |   if (!req_version || strverscmp (req_version, ASN1_VERSION) <= 0)  | 
45  | 2  |     return ASN1_VERSION;  | 
46  |  |  | 
47  | 0  |   return NULL;  | 
48  | 2  | }  |