2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Contact: Krzysztof Jackiewicz <k.jackiewicz@samsung.com>
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
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License
24 #ifndef YACA_INTERNAL_H
25 #define YACA_INTERNAL_H
28 #include <openssl/ossl_typ.h>
30 #include <yaca/types.h>
32 #define API __attribute__ ((visibility ("default")))
43 /* Base structure for crypto contexts - to be inherited */
46 enum yaca_ctx_type_e type;
48 void (*ctx_destroy)(const yaca_ctx_h ctx);
49 int (*get_output_length)(const yaca_ctx_h ctx, size_t input_len, size_t *output_len);
50 int (*set_param)(yaca_ctx_h ctx, yaca_ex_param_e param,
51 const void *value, size_t value_len);
52 int (*get_param)(const yaca_ctx_h ctx, yaca_ex_param_e param,
53 void **value, size_t *value_len);
57 /* Base structure for crypto keys - to be inherited */
65 * - YACA_KEY_TYPE_SYMMETRIC
69 struct yaca_key_simple_s
71 struct yaca_key_s key;
79 * - YACA_KEY_TYPE_RSA_PUB
80 * - YACA_KEY_TYPE_RSA_PRIV
81 * - YACA_KEY_TYPE_DSA_PUB
82 * - YACA_KEY_TYPE_DSA_PRIV
84 * TODO: and possibly others (for every key that uses EVP_PKEY)
88 struct yaca_key_s key;
93 int digest_get_algorithm(yaca_digest_algo_e algo, const EVP_MD **md);
95 int encrypt_get_algorithm(yaca_enc_algo_e algo,
96 yaca_block_cipher_mode_e bcm,
98 const EVP_CIPHER **cipher);
100 struct yaca_key_simple_s *key_get_simple(const yaca_key_h key);
101 struct yaca_key_evp_s *key_get_evp(const yaca_key_h key);
103 void error_dump(const char *file, int line, const char *function, int code);
104 #define ERROR_DUMP(code) error_dump(__FILE__, __LINE__, __func__, (code))
106 #endif /* YACA_INTERNAL_H */