Convert tls13encryptiontest so that we pass around a pointer not an index
[openssl.git] / test / methtest.c
1 /*
2  * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the OpenSSL license (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 <stdlib.h>
12 #include <openssl/rsa.h>
13 #include <openssl/x509.h>
14 #include "meth.h"
15 #include <openssl/err.h>
16
17 int main(argc, argv)
18 int argc;
19 char *argv[];
20 {
21     METHOD_CTX *top, *tmp1, *tmp2;
22
23     top = METH_new(x509_lookup()); /* get a top level context */
24     if (top == NULL)
25         goto err;
26
27     tmp1 = METH_new(x509_by_file());
28     if (top == NULL)
29         goto err;
30     METH_arg(tmp1, METH_TYPE_FILE, "cafile1");
31     METH_arg(tmp1, METH_TYPE_FILE, "cafile2");
32     METH_push(top, METH_X509_CA_BY_SUBJECT, tmp1);
33
34     tmp2 = METH_new(x509_by_dir());
35     METH_arg(tmp2, METH_TYPE_DIR, "/home/eay/.CAcerts");
36     METH_arg(tmp2, METH_TYPE_DIR, "/home/eay/SSLeay/certs");
37     METH_arg(tmp2, METH_TYPE_DIR, "/usr/local/ssl/certs");
38     METH_push(top, METH_X509_CA_BY_SUBJECT, tmp2);
39
40 /*- tmp=METH_new(x509_by_issuer_dir);
41     METH_arg(tmp,METH_TYPE_DIR,"/home/eay/.mycerts");
42     METH_push(top,METH_X509_BY_ISSUER,tmp);
43
44     tmp=METH_new(x509_by_issuer_primary);
45     METH_arg(tmp,METH_TYPE_FILE,"/home/eay/.mycerts/primary.pem");
46     METH_push(top,METH_X509_BY_ISSUER,tmp);
47 */
48
49     METH_init(top);
50     METH_control(tmp1, METH_CONTROL_DUMP, stdout);
51     METH_control(tmp2, METH_CONTROL_DUMP, stdout);
52     EXIT(0);
53  err:
54     ERR_print_errors_fp(stderr);
55     EXIT(1);
56     return (0);
57 }