wickr-crypto-c

ecdh_cipher_ctx.h
1 /*
2 * Copyright © 2012-2020 Wickr Inc. All rights reserved.
3 *
4 * This code is being released for EDUCATIONAL, ACADEMIC, AND CODE REVIEW PURPOSES
5 * ONLY. COMMERCIAL USE OF THE CODE IS EXPRESSLY PROHIBITED. For additional details,
6 * please see LICENSE
7 *
8 * THE CODE IS MADE AVAILABLE "AS-IS" AND WITHOUT ANY EXPRESS OR
9 * IMPLIED GUARANTEES AS TO FITNESS, MERCHANTABILITY, NON-
10 * INFRINGEMENT OR OTHERWISE. IT IS NOT BEING PROVIDED IN TRADE BUT ON
11 * A VOLUNTARY BASIS ON BEHALF OF THE AUTHOR’S PART FOR THE BENEFIT
12 * OF THE LICENSEE AND IS NOT MADE AVAILABLE FOR CONSUMER USE OR ANY
13 * OTHER USE OUTSIDE THE TERMS OF THIS LICENSE. ANYONE ACCESSING THE
14 * CODE SHOULD HAVE THE REQUISITE EXPERTISE TO SECURE THEIR SYSTEM
15 * AND DEVICES AND TO ACCESS AND USE THE CODE FOR REVIEW PURPOSES
16 * ONLY. LICENSEE BEARS THE RISK OF ACCESSING AND USING THE CODE. IN
17 * PARTICULAR, AUTHOR BEARS NO LIABILITY FOR ANY INTERFERENCE WITH OR
18 * ADVERSE EFFECT THAT MAY OCCUR AS A RESULT OF THE LICENSEE
19 * ACCESSING AND/OR USING THE CODE ON LICENSEE’S SYSTEM.
20 */
21
22 #ifndef ecdh_cipher_ctx_h
23 #define ecdh_cipher_ctx_h
24
25 #include "crypto_engine.h"
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
47 struct wickr_ecdh_cipher_ctx {
48 wickr_crypto_engine_t engine;
49 wickr_ec_key_t *local_key;
50 wickr_cipher_t cipher;
51 };
52
53 typedef struct wickr_ecdh_cipher_ctx wickr_ecdh_cipher_ctx_t;
54
64 wickr_ecdh_cipher_ctx_t *wickr_ecdh_cipher_ctx_create(wickr_crypto_engine_t engine,
65 wickr_ec_curve_t curve,
66 wickr_cipher_t cipher);
67
76 wickr_ecdh_cipher_ctx_t *wickr_ecdh_cipher_ctx_create_key(wickr_crypto_engine_t engine,
77 wickr_ec_key_t *key,
78 wickr_cipher_t cipher);
79
86 wickr_ecdh_cipher_ctx_t *wickr_ecdh_cipher_ctx_copy(const wickr_ecdh_cipher_ctx_t *ctx);
87
93 void wickr_ecdh_cipher_ctx_destroy(wickr_ecdh_cipher_ctx_t **ctx);
94
111 wickr_cipher_result_t *wickr_ecdh_cipher_ctx_cipher(const wickr_ecdh_cipher_ctx_t *ctx,
112 const wickr_buffer_t *plaintext,
113 const wickr_ec_key_t *remote_pub,
114 const wickr_kdf_meta_t *kdf_params);
115
127 wickr_buffer_t *wickr_ecdh_cipher_ctx_decipher(const wickr_ecdh_cipher_ctx_t *ctx,
128 const wickr_cipher_result_t *ciphertext,
129 const wickr_ec_key_t *remote_pub,
130 const wickr_kdf_meta_t *kdf_params);
131
132
133
134 #ifdef __cplusplus
135 }
136 #endif
137
138 #endif /* ecdh_cipher_ctx_h */
wickr_buffer
Represents an array of bytes and the length of the allocation associated with those bytes.
Definition: buffer.h:51
wickr_cipher_result
Definition: cipher.h:97
wickr_cipher
Represents a cipher that can be used in the crypto_engine. This meta object holds parameters for the ...
Definition: cipher.h:56
wickr_crypto_engine
Interface to a set of cryptographic operations used throughout the library. Currently the default imp...
Definition: crypto_engine.h:53
wickr_ec_curve
Metadata about curve types to help with key generation, and signatures.
Definition: eckey.h:67
wickr_ec_key
Representation of public and private Elliptic Curve Keypair information as buffers.
Definition: eckey.h:92
wickr_ecdh_cipher_ctx
A cipher context designed to modularize the ECDH_HKDF_AES256 workflow.
Definition: ecdh_cipher_ctx.h:47
wickr_ecdh_cipher_ctx::cipher
wickr_cipher_t cipher
Definition: ecdh_cipher_ctx.h:50
wickr_ecdh_cipher_ctx::engine
wickr_crypto_engine_t engine
Definition: ecdh_cipher_ctx.h:48
wickr_ecdh_cipher_ctx::local_key
wickr_ec_key_t * local_key
Definition: ecdh_cipher_ctx.h:49
wickr_kdf_meta
Represents the information the KDF function will need along with it's input to derive a particular ou...
Definition: kdf.h:135