aboutsummaryrefslogtreecommitdiffstats
path: root/server/resty/openssl/include/evp/mac.lua
blob: a83107654a6e279367001ea3c8503da9a1eec964 (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
local ffi = require "ffi"

require "resty.openssl.include.ossl_typ"
require "resty.openssl.include.provider"

ffi.cdef [[
  typedef struct evp_mac_st EVP_MAC;
  typedef struct evp_mac_ctx_st EVP_MAC_CTX;

  EVP_MAC_CTX *EVP_MAC_CTX_new(EVP_MAC *mac);
  void EVP_MAC_CTX_free(EVP_MAC_CTX *ctx);

  const OSSL_PROVIDER *EVP_MAC_get0_provider(const EVP_MAC *mac);
  EVP_MAC *EVP_MAC_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,
                          const char *properties);

  int EVP_MAC_init(EVP_MAC_CTX *ctx, const unsigned char *key, size_t keylen,
                    const OSSL_PARAM params[]);
  int EVP_MAC_update(EVP_MAC_CTX *ctx, const unsigned char *data, size_t datalen);
  int EVP_MAC_final(EVP_MAC_CTX *ctx,
                    unsigned char *out, size_t *outl, size_t outsize);

  size_t EVP_MAC_CTX_get_mac_size(EVP_MAC_CTX *ctx);

  typedef void* fake_openssl_mac_provided_list_fn(EVP_MAC *mac, void *arg);
  void EVP_MAC_do_all_provided(OSSL_LIB_CTX *libctx,
                              fake_openssl_mac_provided_list_fn*,
                              void *arg);
  int EVP_MAC_up_ref(EVP_MAC *mac);
  void EVP_MAC_free(EVP_MAC *mac);

  const char *EVP_MAC_get0_name(const EVP_MAC *mac);

  int EVP_MAC_CTX_set_params(EVP_MAC_CTX *ctx, const OSSL_PARAM params[]);
  const OSSL_PARAM *EVP_MAC_CTX_settable_params(EVP_MAC_CTX *ctx);
  int EVP_MAC_CTX_get_params(EVP_MAC_CTX *ctx, OSSL_PARAM params[]);
  const OSSL_PARAM *EVP_MAC_CTX_gettable_params(EVP_MAC_CTX *ctx);
]]