AWS Encryption SDK for C v2.4
Loading...
Searching...
No Matches
enc_ctx.h
Go to the documentation of this file.
1/*
2 * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. A copy of the License is
6 * located at
7 *
8 * http://aws.amazon.com/apache2.0/
9 *
10 * or in the "license" file accompanying this file. This file is distributed on an
11 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12 * implied. See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef AWS_CRYPTOSDK_ENC_CTX_H
16#define AWS_CRYPTOSDK_ENC_CTX_H
17
18#include <aws/cryptosdk/exports.h>
19
20#include <aws/common/hash_table.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
37
47AWS_CRYPTOSDK_API
48int aws_cryptosdk_enc_ctx_init(struct aws_allocator *alloc, struct aws_hash_table *enc_ctx);
49
54AWS_CRYPTOSDK_STATIC_INLINE void aws_cryptosdk_enc_ctx_clear(struct aws_hash_table *enc_ctx) {
55 AWS_PRECONDITION(aws_hash_table_is_valid(enc_ctx));
56 aws_hash_table_clear(enc_ctx);
57 AWS_PRECONDITION(aws_hash_table_is_valid(enc_ctx));
58}
59
64AWS_CRYPTOSDK_STATIC_INLINE void aws_cryptosdk_enc_ctx_clean_up(struct aws_hash_table *enc_ctx) {
65 AWS_PRECONDITION(enc_ctx != NULL);
66 AWS_PRECONDITION(
67 enc_ctx->p_impl == NULL || aws_hash_table_is_valid(enc_ctx),
68 "Input aws_hash_table [map] must be valid or hash_table_state pointer [map->p_impl] must be NULL, in case "
69 "aws_hash_table_clean_up was called twice.");
70 aws_hash_table_clean_up(enc_ctx);
71 AWS_POSTCONDITION(enc_ctx->p_impl == NULL);
72}
73
86AWS_CRYPTOSDK_API
88 struct aws_allocator *alloc, struct aws_hash_table *dest, const struct aws_hash_table *src);
89 // doxygen group enc_ctx
91
92#ifdef __cplusplus
93}
94#endif
95
96#endif // AWS_CRYPTOSDK_ENC_CTX_H
void aws_cryptosdk_enc_ctx_clear(struct aws_hash_table *enc_ctx)
Definition enc_ctx.h:54
int aws_cryptosdk_enc_ctx_clone(struct aws_allocator *alloc, struct aws_hash_table *dest, const struct aws_hash_table *src)
int aws_cryptosdk_enc_ctx_init(struct aws_allocator *alloc, struct aws_hash_table *enc_ctx)
void aws_cryptosdk_enc_ctx_clean_up(struct aws_hash_table *enc_ctx)
Definition enc_ctx.h:64