VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Crypto/kuznyechik.h
blob: 79ca539b754c9334d4f24951dd4c9f6d5843f2de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
This code is written by kerukuro for cppcrypto library (http://cppcrypto.sourceforge.net/)
and released into public domain.
*/

/* Adapted to VeraCrypt */

#ifndef CPPCRYPTO_KUZNYECHIK_H
#define CPPCRYPTO_KUZNYECHIK_H

#include "Common/Tcdefs.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _kuznyechik_kds
{
	uint64 rke[10][2];
	uint64 rkd[10][2];
} kuznyechik_kds;

#define KUZNYECHIK_KS				(sizeof(kuznyechik_kds))

void kuznyechik_encrypt_block(byte* out, const byte* in, kuznyechik_kds* kds);
void kuznyechik_decrypt_block(byte* out, const byte* in, kuznyechik_kds* kds);
void kuznyechik_set_key(const byte* key, kuznyechik_kds *kds);

#ifdef __cplusplus
}
#endif

#endif
ECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "zipint.h" ZIP_EXTERN int zip_set_archive_flag(zip_t *za, zip_flags_t flag, int value) { unsigned int new_flags; if (value) new_flags = za->ch_flags | flag; else new_flags = za->ch_flags & ~flag; if (new_flags == za->ch_flags) return 0; if (ZIP_IS_RDONLY(za)) { zip_error_set(&za->error, ZIP_ER_RDONLY, 0); return -1; } if ((flag & ZIP_AFL_RDONLY) && value && (za->ch_flags & ZIP_AFL_RDONLY) == 0) { if (_zip_changed(za, NULL)) { zip_error_set(&za->error, ZIP_ER_CHANGED, 0); return -1; } } za->ch_flags = new_flags; return 0; }