forked from qwertroot123456/genshinblkstuff
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Jasuf/master
Some improvements
- Loading branch information
Showing
6 changed files
with
677 additions
and
599 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CXX=g++ | ||
LD=g++ | ||
LIBS=-llz4 -lc -lomp | ||
CXXFLAGS=-O2 -std=c++17 -fopenmp -Wall -Wextra | ||
CFLAGS=-O2 -std=c17 -fopenmp -Wall -Wextra | ||
|
||
blkstuff: main.o util.o aes.o | ||
$(LD) $(LIBS) $^ -o $@ | ||
|
||
clean: | ||
-rm main.o util.o blkstuff |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/** | ||
* \file aes.h | ||
* \brief Header defining the API for OQS AES | ||
*/ | ||
|
||
#ifndef __OQS_AES_H | ||
#define __OQS_AES_H | ||
|
||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
/** | ||
* Function to fill a key schedule given an initial key. | ||
* | ||
* @param key Initial Key. | ||
* @param schedule Abstract data structure for a key schedule. | ||
* @param forEncryption 1 if key schedule is for encryption, 0 if for decryption. | ||
*/ | ||
void OQS_AES128_load_schedule(const uint8_t *key, void **schedule, int for_encryption); | ||
|
||
/** | ||
* Function to free a key schedule. | ||
* | ||
* @param schedule Schedule generated with OQS_AES128_load_schedule(). | ||
*/ | ||
void OQS_AES128_free_schedule(void *schedule); | ||
|
||
/** | ||
* Function to encrypt blocks of plaintext using ECB mode. | ||
* A schedule based on the key is generated and used internally. | ||
* | ||
* @param plaintext Plaintext to be encrypted. | ||
* @param plaintext_len Length on the plaintext in bytes. Must be a multiple of 16. | ||
* @param key Key to be used for encryption. | ||
* @param ciphertext Pointer to a block of memory which >= in size to the plaintext block. The result will be written here. | ||
*/ | ||
void OQS_AES128_ECB_enc(const uint8_t *plaintext, const size_t plaintext_len, const uint8_t *key, uint8_t *ciphertext); | ||
|
||
/** | ||
* Function to decrypt blocks of plaintext using ECB mode. | ||
* A schedule based on the key is generated and used internally. | ||
* | ||
* @param ciphertext Ciphertext to be decrypted. | ||
* @param ciphertext_len Length on the ciphertext in bytes. Must be a multiple of 16. | ||
* @param key Key to be used for encryption. | ||
* @param ciphertext Pointer to a block of memory which >= in size to the ciphertext block. The result will be written here. | ||
*/ | ||
void OQS_AES128_ECB_dec(const uint8_t *ciphertext, const size_t ciphertext_len, const uint8_t *key, uint8_t *plaintext); | ||
|
||
/** | ||
* Same as OQS_AES128_ECB_enc() except a schedule generated by | ||
* OQS_AES128_load_schedule() is passed rather then a key. This is faster | ||
* if the same schedule is used for multiple encryptions since it does | ||
* not have to be regenerated from the key. | ||
*/ | ||
void OQS_AES128_ECB_enc_sch(const uint8_t *plaintext, const size_t plaintext_len, const void *schedule, uint8_t *ciphertext); | ||
|
||
/** | ||
* Same as OQS_AES128_ECB_dec() except a schedule generated by | ||
* OQS_AES128_load_schedule() is passed rather then a key. This is faster | ||
* if the same schedule is used for multiple encryptions since it does | ||
* not have to be regenerated from the key. | ||
*/ | ||
void OQS_AES128_ECB_dec_sch(const uint8_t *ciphertext, const size_t ciphertext_len, const void *schedule, uint8_t *plaintext); | ||
|
||
#endif |
Oops, something went wrong.