summaryrefslogtreecommitdiffstats
path: root/M2Crypto_ext.i
blob: 95d0524927d314fdcc7bfaf055c40ed350e70383 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
%module M2Crypto_ext

%include "constraints.i"

%{
#include <stdbool.h>
#include <openssl/x509.h>
typedef STACK_OF(X509_EXTENSION) X509_EXTENSION_STACK;
%}

%apply Pointer NONNULL { X509_REQ * };

%inline %{
X509_EXTENSION_STACK *x509_req_get_extensions(X509_REQ *req) {
    return X509_REQ_get_extensions(req);
}

ASN1_OCTET_STRING *x509_extension_get_data(X509_EXTENSION *ext) {
    return X509_EXTENSION_get_data(ext);
}

bool x509_extension_cmp(X509_EXTENSION *ext1, X509_EXTENSION *ext2) {
    ASN1_OCTET_STRING *data1 = X509_EXTENSION_get_data(ext1);
    ASN1_OCTET_STRING *data2 = X509_EXTENSION_get_data(ext2);
    return ASN1_OCTET_STRING_cmp(data1, data2) == 0;
}
%}