~ubuntu-branches/ubuntu/utopic/mongrel2/utopic

« back to all changes in this revision

Viewing changes to .pc/debian-changes/tests/cert_tests.c

  • Committer: Package Import Robot
  • Author(s): Jan Niehusmann
  • Date: 2014-06-11 15:26:26 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20140611152626-7ixr3pdpkvjk7h92
Tags: 1.9.1-1
* Update to upstream release 1.9.1
* remove binary .swf files from source tarball
* revert certificate workaround (fixed upstream)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "minunit.h"
2
 
#include "stdio.h"
3
 
#include "polarssl/x509_crt.h"
4
 
 
5
 
char *test_SSL_verify_cert() 
6
 
{
7
 
 
8
 
    x509_crt crt;
9
 
    memset( &crt, 0, sizeof( x509_crt ) );
10
 
 
11
 
    x509_crt ca_crt;
12
 
    memset( &ca_crt, 0, sizeof( x509_crt ) );
13
 
 
14
 
    x509_crl crl;
15
 
    memset( &crl, 0, sizeof( x509_crl ) );
16
 
 
17
 
    int ret = 0;
18
 
 
19
 
    ret =x509_crt_parse_file( &crt, "tests/ca/certs/m2-cert.pem" );
20
 
 
21
 
    mu_assert(ret == 0, "failed to parse cert m2-cert.pem");
22
 
 
23
 
    ret =x509_crt_parse_file( &ca_crt, "tests/ca/none.pem" );
24
 
 
25
 
    mu_assert(ret != 0, "failed to fail on non-existent pem none.pem");
26
 
 
27
 
    ret =x509_crt_parse_file( &ca_crt, "tests/ca/cacert.pem" );
28
 
 
29
 
    mu_assert(ret == 0, "failed to parse cert cacert.pem");
30
 
 
31
 
    ret =x509_crl_parse_file( &crl, "tests/ca/crl.pem" );
32
 
 
33
 
    mu_assert(ret == 0, "failed to parse cert crl.pem");
34
 
 
35
 
    int flags = 0;
36
 
    ret =x509_crt_verify( &crt, &ca_crt, NULL, NULL, &flags, NULL, NULL);
37
 
 
38
 
    mu_assert(ret == 0, "failed to verify cert m2-cert.pem");
39
 
 
40
 
    x509_crt_free( &crt );
41
 
    x509_crt_free( &ca_crt );
42
 
    x509_crl_free( &crl );
43
 
 
44
 
    return NULL;
45
 
}
46
 
 
47
 
char * all_tests() {
48
 
    mu_suite_start();
49
 
 
50
 
    mu_run_test(test_SSL_verify_cert);
51
 
 
52
 
    return NULL;
53
 
}
54
 
 
55
 
RUN_TESTS(all_tests);
56