Skip to content
Snippets Groups Projects
Commit bb2a88fa authored by Ivan Deniskin's avatar Ivan Deniskin
Browse files

Build C++ fixes

parent 76eba8a4
No related branches found
No related tags found
No related merge requests found
...@@ -5,10 +5,12 @@ ...@@ -5,10 +5,12 @@
#include "dap_enc_aes.h" #include "dap_enc_aes.h"
#include "dap_enc_key.h" #include "dap_enc_key.h"
uint8_t tail_block[] = {21,27,20,36,16,20,27,31,22,41,27,33,30,21,32,28};
#define AES_BLOCKSIZE 16
#define AES_KEYSIZE 16 #define AES_KEYSIZE 16
uint8_t tail_block[] = {21,27,20,36,16,20,27,31,22,41,27,33,30,21,32,28};
#define DAP_ENC_AES_KEY(a) ((dap_enc_aes_key_t *)((a)->_inheritor) ) #define DAP_ENC_AES_KEY(a) ((dap_enc_aes_key_t *)((a)->_inheritor) )
static void print_bytes(uint8_t *bytes, size_t num_bytes) { static void print_bytes(uint8_t *bytes, size_t num_bytes) {
......
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
#define AES_BLOCK_SIZE 16 #define AES_BLOCK_SIZE 16
#ifdef __cplusplus
extern "C" {
#endif
struct dap_enc_key; struct dap_enc_key;
void dap_enc_aes_key_new_generate(struct dap_enc_key * a_key,size_t a_size); void dap_enc_aes_key_new_generate(struct dap_enc_key * a_key,size_t a_size);
...@@ -17,4 +21,8 @@ int test_key_aes(); ...@@ -17,4 +21,8 @@ int test_key_aes();
size_t dap_enc_aes_decode(struct dap_enc_key* a_key, const void * a_in, size_t a_in_size,void * a_out); size_t dap_enc_aes_decode(struct dap_enc_key* a_key, const void * a_in, size_t a_in_size,void * a_out);
size_t dap_enc_aes_encode(struct dap_enc_key* a_key, const void * a_in, size_t a_in_size,void * a_out); size_t dap_enc_aes_encode(struct dap_enc_key* a_key, const void * a_in, size_t a_in_size,void * a_out);
#ifdef __cplusplus
}
#endif
#endif #endif
...@@ -23,6 +23,11 @@ ...@@ -23,6 +23,11 @@
#include <stddef.h> #include <stddef.h>
#include <time.h> #include <time.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum dap_enc_data_type{DAP_ENC_DATA_TYPE_RAW, typedef enum dap_enc_data_type{DAP_ENC_DATA_TYPE_RAW,
DAP_ENC_DATA_TYPE_B64, DAP_ENC_DATA_TYPE_B64,
...@@ -126,4 +131,8 @@ dap_enc_key_t *dap_enc_key_new_from_data(dap_enc_key_type_t a_key_type, void * a ...@@ -126,4 +131,8 @@ dap_enc_key_t *dap_enc_key_new_from_data(dap_enc_key_type_t a_key_type, void * a
dap_enc_key_t *dap_enc_key_new_from_str(dap_enc_key_type_t a_key_type, const char *a_key_str); dap_enc_key_t *dap_enc_key_new_from_str(dap_enc_key_type_t a_key_type, const char *a_key_str);
void dap_enc_key_delete(dap_enc_key_t * a_key); void dap_enc_key_delete(dap_enc_key_t * a_key);
#ifdef __cplusplus
}
#endif
#endif #endif
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
#include "aes.h" #include "aes.h"
#include "aes_local.h" #include "aes_local.h"
#ifdef __cplusplus
extern "C" {
#endif
void OQS_AES128_load_schedule(const uint8_t *key, void **schedule, int for_encryption) { void OQS_AES128_load_schedule(const uint8_t *key, void **schedule, int for_encryption) {
#ifdef USE_OPENSSL #ifdef USE_OPENSSL
oqs_aes128_load_schedule_ossl(key, schedule, for_encryption); oqs_aes128_load_schedule_ossl(key, schedule, for_encryption);
...@@ -191,4 +195,10 @@ inline void oqs_aes128_ecb_dec_sch_ossl(const uint8_t *ciphertext, const size_t ...@@ -191,4 +195,10 @@ inline void oqs_aes128_ecb_dec_sch_ossl(const uint8_t *ciphertext, const size_t
assert(1 == EVP_DecryptFinal_ex((EVP_CIPHER_CTX *) schedule, plaintext, &outlen)); assert(1 == EVP_DecryptFinal_ex((EVP_CIPHER_CTX *) schedule, plaintext, &outlen));
} }
#endif
#ifdef __cplusplus
}
#endif #endif
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* Function to fill a key schedule given an initial key. * Function to fill a key schedule given an initial key.
* *
...@@ -63,4 +67,8 @@ void OQS_AES128_ECB_enc_sch(const uint8_t *plaintext, const size_t plaintext_len ...@@ -63,4 +67,8 @@ void OQS_AES128_ECB_enc_sch(const uint8_t *plaintext, const size_t plaintext_len
*/ */
void OQS_AES128_ECB_dec_sch(const uint8_t *ciphertext, const size_t ciphertext_len, const void *schedule, uint8_t *plaintext); void OQS_AES128_ECB_dec_sch(const uint8_t *ciphertext, const size_t ciphertext_len, const void *schedule, uint8_t *plaintext);
#ifdef __cplusplus
}
#endif
#endif #endif
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
void oqs_aes128_load_schedule_ni(const uint8_t *key, void **schedule); void oqs_aes128_load_schedule_ni(const uint8_t *key, void **schedule);
void oqs_aes128_free_schedule_ni(void *schedule); void oqs_aes128_free_schedule_ni(void *schedule);
void oqs_aes128_enc_ni(const uint8_t *plaintext, const void *schedule, uint8_t *ciphertext); void oqs_aes128_enc_ni(const uint8_t *plaintext, const void *schedule, uint8_t *ciphertext);
...@@ -36,4 +40,8 @@ void oqs_aes128_ecb_enc_sch_ossl(const uint8_t *plaintext, const size_t plaintex ...@@ -36,4 +40,8 @@ void oqs_aes128_ecb_enc_sch_ossl(const uint8_t *plaintext, const size_t plaintex
void oqs_aes128_ecb_dec_sch_ossl(const uint8_t *ciphertext, const size_t ciphertext_len, const void *schedule, uint8_t *plaintext); void oqs_aes128_ecb_dec_sch_ossl(const uint8_t *ciphertext, const size_t ciphertext_len, const void *schedule, uint8_t *plaintext);
#endif #endif
#ifdef __cplusplus
}
#endif
#endif #endif
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
enum OQS_RAND_alg_name { enum OQS_RAND_alg_name {
OQS_RAND_alg_default, OQS_RAND_alg_default,
OQS_RAND_alg_urandom_chacha20, OQS_RAND_alg_urandom_chacha20,
...@@ -95,4 +99,9 @@ double OQS_RAND_zscore_deviation_from_uniform(const unsigned long occurrences[25 ...@@ -95,4 +99,9 @@ double OQS_RAND_zscore_deviation_from_uniform(const unsigned long occurrences[25
void OQS_RAND_report_statistics(const unsigned long occurrences[256], const char *indent); void OQS_RAND_report_statistics(const unsigned long occurrences[256], const char *indent);
int OQS_RAND_get_system_entropy(uint8_t *buf, size_t n); int OQS_RAND_get_system_entropy(uint8_t *buf, size_t n);
#ifdef __cplusplus
}
#endif
#endif #endif
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
/*#include <oqs/kex.h> /*#include <oqs/kex.h>
#include <oqs/rand.h>*/ #include <oqs/rand.h>*/
#ifdef __cplusplus
extern "C" {
#endif
OQS_KEX *OQS_KEX_rlwe_msrln16_new(OQS_RAND *rand); OQS_KEX *OQS_KEX_rlwe_msrln16_new(OQS_RAND *rand);
int OQS_KEX_rlwe_msrln16_alice_0(OQS_KEX *k, void **alice_priv, uint8_t **alice_msg, size_t *alice_msg_len); int OQS_KEX_rlwe_msrln16_alice_0(OQS_KEX *k, void **alice_priv, uint8_t **alice_msg, size_t *alice_msg_len);
...@@ -25,4 +29,8 @@ int OQS_KEX_rlwe_msrln16_alice_1(OQS_KEX *k, const void *alice_priv, const uint8 ...@@ -25,4 +29,8 @@ int OQS_KEX_rlwe_msrln16_alice_1(OQS_KEX *k, const void *alice_priv, const uint8
void OQS_KEX_rlwe_msrln16_alice_priv_free(OQS_KEX *k, void *alice_priv); void OQS_KEX_rlwe_msrln16_alice_priv_free(OQS_KEX *k, void *alice_priv);
void OQS_KEX_rlwe_msrln16_free(OQS_KEX *k); void OQS_KEX_rlwe_msrln16_free(OQS_KEX *k);
#ifdef __cplusplus
}
#endif
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment