init commit of lib

This commit is contained in:
Pavel authored and GitHub committed 2025-01-17 16:52:53 +03:00
1 parent bc3358be39
commit bae7d1ced4
13 files changed
+2787

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
// kuznechik.h
// 04-Jan-15 Markku-Juhani O. Saarinen <mjos@iki.fi>
#ifndef KUZNECHIK_H
#define KUZNECHIK_H
#include <stdint.h>
#include <stdio.h>
// my 128-bit datatype
typedef union {
uint64_t q[2];
uint8_t b[16];
} w128_t;
// cipher context
typedef struct {
w128_t k[10]; // round keys
} kuz_key_t;
// init lookup tables
void kuz_init(void);
// key setup
void kuz_set_encrypt_key(kuz_key_t *subkeys, const uint8_t key[32]);
void kuz_set_decrypt_key(kuz_key_t *subkeys, const uint8_t key[32]);
// single-block ecp ops
void kuz_encrypt_block(kuz_key_t *subkeys, void *x);
void kuz_decrypt_block(kuz_key_t *subkeys, void *x);
// utils
void print_w128(w128_t *x);
// tests
#ifdef TEST_FUNCTIONS_ENABLED
void exec_kuznechik_test(void);
#endif
#endif