Guardtime KSI c SDK
Loading...
Searching...
No Matches
openssl_compatibility.h
Go to the documentation of this file.
1/*
2 * Copyright 2013-2017 Guardtime, Inc.
3 *
4 * This file is part of the Guardtime client SDK.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License").
7 * You may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES, CONDITIONS, OR OTHER LICENSES OF ANY KIND, either
13 * express or implied. See the License for the specific language governing
14 * permissions and limitations under the License.
15 * "Guardtime" and "KSI" are trademarks or registered trademarks of
16 * Guardtime, Inc., and no license to trademarks is granted; Guardtime
17 * reserves and retains all trademark rights.
18 */
19
20
21#ifndef OPENSSL_COMPATIBILITY_H_
22#define OPENSSL_COMPATIBILITY_H_
23
24#include <openssl/opensslv.h>
25#include <openssl/evp.h>
26#include <stddef.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32
34 void (*openssl_setup)(void);
35 void (*openssl_cleanup)(void);
36
37#if OPENSSL_VERSION_NUMBER >= 0x10100000L
38 void* (*mac_ctx_new)(void);
39 void (*mac_ctx_free)(void *ctx);
40 int (*mac_ctx_reset)(void *ctx, const unsigned char *key, size_t key_len, const EVP_MD *md);
41 int (*mac_ctx_update)(void *ctx, const unsigned char *data, size_t data_len);
42 int (*mac_ctx_final)(void *ctx, unsigned char *out, size_t out_size, size_t *out_len);
43#endif
44 };
45
47
54 #if OPENSSL_VERSION_NUMBER < 0x10100000L
55 # define KSI_EVP_MD_CTX_create() EVP_MD_CTX_create()
56 # define KSI_EVP_MD_CTX_destroy(md) EVP_MD_CTX_destroy((md))
57 # define KSI_EVP_MD_CTX_cleanup(md) EVP_MD_CTX_cleanup((md))
58 #else
59 # define KSI_EVP_MD_CTX_create() EVP_MD_CTX_new()
60 # define KSI_EVP_MD_CTX_destroy(md) EVP_MD_CTX_free((md))
61 # define KSI_EVP_MD_CTX_cleanup(md) EVP_MD_CTX_reset((md))
62 #endif
63
64
65#ifdef __cplusplus
66}
67#endif
68
69#endif /* OPENSSL_COMPATIBILITY_H_ */
struct openssl_compatibility_functions_st KSI_openssl
Definition openssl_compatibility.h:33
void(* openssl_setup)(void)
Definition openssl_compatibility.h:34
void(* openssl_cleanup)(void)
Definition openssl_compatibility.h:35