]>
git.ipfire.org Git - thirdparty/openssl.git/blob - include/openssl/core_numbers.h
a7238547aa8da6546990f418050fadd4d83639ea
2 * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #ifndef OSSL_CORE_NUMBERS_H
11 # define OSSL_CORE_NUMBERS_H
13 # include <openssl/core.h>
23 * All series start with 1, to allow 0 to be an array terminator.
24 * For any FUNC identity, we also provide a function signature typedef
25 * and a static inline function to extract a function pointer from a
26 * OSSL_DISPATCH element in a type safe manner.
29 * for any function base name 'foo' (uppercase form 'FOO'), we will have
31 * - a macro for the identity with the name OSSL_FUNC_'FOO' or derivates
32 * thereof (to be specified further down)
33 * - a function signature typedef with the name OSSL_'foo'_fn
34 * - a function pointer extractor function with the name OSSL_'foo'
37 /* Helper macro to create the function signature typedef and the extractor */
38 #define OSSL_CORE_MAKE_FUNC(type,name,args) \
39 typedef type (OSSL_##name##_fn)args; \
41 OSSL_##name##_fn *OSSL_get_##name(const OSSL_DISPATCH *opf) \
43 return (OSSL_##name##_fn *)opf->function; \
47 * Core function identities, for the two OSSL_DISPATCH tables being passed
48 * in the OSSL_provider_init call.
50 * 0 serves as a marker for the end of the OSSL_DISPATCH array, and must
51 * therefore NEVER be used as a function identity.
53 /* Functions provided by the Core to the provider, reserved numbers 1-1023 */
54 # define OSSL_FUNC_CORE_GET_PARAM_TYPES 1
55 OSSL_CORE_MAKE_FUNC(const OSSL_ITEM
*,
56 core_get_param_types
,(const OSSL_PROVIDER
*prov
))
57 # define OSSL_FUNC_CORE_GET_PARAMS 2
58 OSSL_CORE_MAKE_FUNC(int,core_get_params
,(const OSSL_PROVIDER
*prov
,
59 const OSSL_PARAM params
[]))
61 /* Functions provided by the provider to the Core, reserved numbers 1024-1535 */
62 # define OSSL_FUNC_PROVIDER_TEARDOWN 1024
63 OSSL_CORE_MAKE_FUNC(void,provider_teardown
,(void))
64 # define OSSL_FUNC_PROVIDER_GET_PARAM_TYPES 1025
65 OSSL_CORE_MAKE_FUNC(const OSSL_ITEM
*,
66 provider_get_param_types
,(const OSSL_PROVIDER
*prov
))
67 # define OSSL_FUNC_PROVIDER_GET_PARAMS 1026
68 OSSL_CORE_MAKE_FUNC(int,provider_get_params
,(const OSSL_PROVIDER
*prov
,
69 const OSSL_PARAM params
[]))
70 # define OSSL_FUNC_PROVIDER_QUERY_OPERATION 1027
71 OSSL_CORE_MAKE_FUNC(const OSSL_ALGORITHM
*,provider_query_operation
,
72 (const OSSL_PROVIDER
*, int operation_id
,
77 # define OSSL_OP_DIGEST 1
79 # define OSSL_FUNC_DIGEST_NEWCTX 1
80 # define OSSL_FUNC_DIGEST_INIT 2
81 # define OSSL_FUNC_DIGEST_UPDDATE 3
82 # define OSSL_FUNC_DIGEST_FINAL 4
83 # define OSSL_FUNC_DIGEST_DIGEST 5
84 # define OSSL_FUNC_DIGEST_FREECTX 6
85 # define OSSL_FUNC_DIGEST_DUPCTX 7
86 # define OSSL_FUNC_DIGEST_SIZE 8
88 OSSL_CORE_MAKE_FUNC(void *, OP_digest_newctx
, (void))
89 OSSL_CORE_MAKE_FUNC(int, OP_digest_init
, (void *vctx
))
90 OSSL_CORE_MAKE_FUNC(int, OP_digest_update
,
91 (void *, const unsigned char *in
, size_t inl
))
92 OSSL_CORE_MAKE_FUNC(int, OP_digest_final
,
93 (void *, unsigned char *out
, size_t *outl
))
94 OSSL_CORE_MAKE_FUNC(int, OP_digest_digest
,
95 (const unsigned char *in
, size_t inl
, unsigned char *out
,
97 OSSL_CORE_MAKE_FUNC(void, OP_digest_cleanctx
, (void *vctx
))
98 OSSL_CORE_MAKE_FUNC(void, OP_digest_freectx
, (void *vctx
))
99 OSSL_CORE_MAKE_FUNC(void *, OP_digest_dupctx
, (void *vctx
))
100 OSSL_CORE_MAKE_FUNC(size_t, OP_digest_size
, (void))