Noise-C
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
symmetricstate.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Southern Storm Software, Pty Ltd.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef NOISE_SYMMETRICSTATE_H
24 #define NOISE_SYMMETRICSTATE_H
25 
27 #include <noise/protocol/names.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
34 
36  (NoiseSymmetricState **state, const NoiseProtocolId *id);
38  (NoiseSymmetricState **state, const char *name);
41  (const NoiseSymmetricState *state, NoiseProtocolId *id);
43  (NoiseSymmetricState *state, const uint8_t *input, size_t size);
45  (NoiseSymmetricState *state, const uint8_t *input, size_t size);
47  (NoiseSymmetricState *state, NoiseBuffer *buffer);
49  (NoiseSymmetricState *state, NoiseBuffer *buffer);
53 
54 #ifdef __cplusplus
55 };
56 #endif
57 
58 #endif
Noise protocol name broken out into separate identifier fields.
Definition: names.h:33
size_t size
Total size of the structure.
Definition: internal.h:503
int noise_symmetricstate_mix_key(NoiseSymmetricState *state, const uint8_t *input, size_t size)
Mixes new input data into the chaining key.
int noise_symmetricstate_get_protocol_id(const NoiseSymmetricState *state, NoiseProtocolId *id)
Gets the protocol identifier associated with a SymmetricState object.
int noise_symmetricstate_free(NoiseSymmetricState *state)
Frees a SymmetricState object after destroying all sensitive material.
Internal structure of the NoiseSymmetricState type.
Definition: internal.h:500
size_t noise_symmetricstate_get_mac_length(const NoiseSymmetricState *state)
Gets the current length of packet MAC values for a SymmetricState object.
int noise_symmetricstate_new_by_id(NoiseSymmetricState **state, const NoiseProtocolId *id)
Creates a new SymmetricState object from a protocol identifier.
int noise_symmetricstate_mix_hash(NoiseSymmetricState *state, const uint8_t *input, size_t size)
Mixes new input data into the handshake hash.
int noise_symmetricstate_encrypt_and_hash(NoiseSymmetricState *state, NoiseBuffer *buffer)
Encrypts a block of data with this SymmetricState object and adds the ciphertext to the handshake has...
Internal structure of the NoiseCipherState type.
Definition: internal.h:58
Mapping algorithm names to/from identifiers.
CipherState interface.
int noise_symmetricstate_split(NoiseSymmetricState *state, NoiseCipherState **c1, NoiseCipherState **c2)
Splits the transport encryption CipherState objects out of this SymmetricState object.
int noise_symmetricstate_new_by_name(NoiseSymmetricState **state, const char *name)
Creates a new SymmetricState object from a protocol name.
int noise_symmetricstate_decrypt_and_hash(NoiseSymmetricState *state, NoiseBuffer *buffer)
Decrypts a block of data with this SymmetricState object and adds the ciphertext to the handshake has...
Type that defines a region of memory for a data buffer.
Definition: buffer.h:33