aboutsummaryrefslogtreecommitdiffstats
path: root/server/resty/openssl/include/pem.lua
blob: 50185e59fbcf2fe722aeaa8d3439f87adad1c81a (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
local ffi = require "ffi"

require "resty.openssl.include.ossl_typ"

ffi.cdef [[
  // all pem_password_cb* has been modified to pem_password_cb to avoid a table overflow issue
  typedef int (*pem_password_cb)(char *buf, int size, int rwflag, void *userdata);
  EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x,
  // the following signature has been modified to avoid ffi.cast
    pem_password_cb cb, const char *u);
  //  pem_password_cb *cb, void *u);
  EVP_PKEY *PEM_read_bio_PUBKEY(BIO *bp, EVP_PKEY **x,
  // the following signature has been modified to avoid ffi.cast
    pem_password_cb cb, const char *u);
  //  pem_password_cb *cb, void *u);
  int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
    unsigned char *kstr, int klen,
    pem_password_cb *cb, void *u);
  int PEM_write_bio_PUBKEY(BIO *bp, EVP_PKEY *x);

  RSA *PEM_read_bio_RSAPrivateKey(BIO *bp, RSA **x,
  // the following signature has been modified to avoid ffi.cast
    pem_password_cb cb, const char *u);
  //  pem_password_cb *cb, void *u);
  RSA *PEM_read_bio_RSAPublicKey(BIO *bp, RSA **x,
  // the following signature has been modified to avoid ffi.cast
    pem_password_cb cb, const char *u);
  //  pem_password_cb *cb, void *u);
  int PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc,
    unsigned char *kstr, int klen,
    pem_password_cb *cb, void *u);
  int PEM_write_bio_RSAPublicKey(BIO *bp, RSA *x);

  X509_REQ *PEM_read_bio_X509_REQ(BIO *bp, X509_REQ **x, pem_password_cb cb, void *u);
  int PEM_write_bio_X509_REQ(BIO *bp, X509_REQ *x);

  X509_CRL *PEM_read_bio_X509_CRL(BIO *bp, X509_CRL **x, pem_password_cb cb, void *u);
  int PEM_write_bio_X509_CRL(BIO *bp, X509_CRL *x);

  X509 *PEM_read_bio_X509(BIO *bp, X509 **x, pem_password_cb cb, void *u);
  int PEM_write_bio_X509(BIO *bp, X509 *x);

  DH *PEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb cb, void *u);
  int PEM_write_bio_DHparams(BIO *bp, DH *x);

  EC_GROUP *PEM_read_bio_ECPKParameters(BIO *bp, EC_GROUP **x, pem_password_cb cb, void *u);
  int PEM_write_bio_ECPKParameters(BIO *bp, const EC_GROUP *x);

]]