source: mod_gnutls/test/gnutls_openpgp_support.c @ 439005a

debian/masterdebian/stretch-backportsupstream
Last change on this file since 439005a was 439005a, checked in by Thomas Klute <thomas2.klute@…>, 3 years ago

Skip OpenPGP test if GnuTLS was compiled without OpenPGP support

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/**
2 * Check if GnuTLS was compiled with OpenPGP support
3 *
4 * Copyright 2017 Thomas Klute
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License"); you
7 * may not use this file except in compliance with the License.  You
8 * may obtain a copy of the License at
9 *
10 *      http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15 * implied.  See the License for the specific language governing
16 * permissions and limitations under the License.
17 */
18#include <gnutls/gnutls.h>
19#include <gnutls/openpgp.h>
20
21#include <stdio.h>
22
23int main()
24{
25    gnutls_openpgp_crt_t cert;
26    int ret = gnutls_openpgp_crt_init(&cert);
27    if (ret == GNUTLS_E_UNIMPLEMENTED_FEATURE)
28    {
29        printf("OpenPGP support is disabled in libgnutls.\n");
30        return 77;
31    }
32    if (ret != GNUTLS_E_SUCCESS)
33    {
34        fprintf(stderr, "Unexpected error in gnutls_openpgp_crt_init(): "
35                "%s (%d)\n", gnutls_strerror(ret), ret);
36        return 1;
37    }
38    gnutls_openpgp_crt_deinit(cert);
39    return 0;
40}
Note: See TracBrowser for help on using the repository browser.