From 487b36a37ed31d4a8e03d9126a6fe99b6fb7af32 Mon Sep 17 00:00:00 2001 From: ayy lmao Date: Wed, 6 Jul 2022 18:19:23 +0300 Subject: [PATCH] Fix build for g++ --- src-tauri/build.rs | 4 ++-- src-tauri/mhycrypto/{aes.c => aes.cpp} | 5 +++++ src-tauri/mhycrypto/aes.h | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) rename src-tauri/mhycrypto/{aes.c => aes.cpp} (99%) diff --git a/src-tauri/build.rs b/src-tauri/build.rs index fdf6fd3..a4b29c7 100644 --- a/src-tauri/build.rs +++ b/src-tauri/build.rs @@ -3,12 +3,12 @@ fn main() { .include("mhycrypto") .cpp(true) - .file("mhycrypto/aes.c") + .file("mhycrypto/aes.cpp") .file("mhycrypto/memecrypto.cpp") .file("mhycrypto/metadata.cpp") .file("mhycrypto/metadatastringdec.cpp") - .compile("mhycrypto"); + .compile("mhycrypto"); tauri_build::build() } diff --git a/src-tauri/mhycrypto/aes.c b/src-tauri/mhycrypto/aes.cpp similarity index 99% rename from src-tauri/mhycrypto/aes.c rename to src-tauri/mhycrypto/aes.cpp index be36e85..289d213 100644 --- a/src-tauri/mhycrypto/aes.c +++ b/src-tauri/mhycrypto/aes.cpp @@ -5,8 +5,11 @@ // http://en.wikipedia.org/wiki/Rijndael_key_schedule // http://en.wikipedia.org/wiki/Rijndael_mix_columns // http://en.wikipedia.org/wiki/Rijndael_S-box + // This code is public domain, or any OSI-approved license, your choice. No warranty. +extern "C" { + #include #include #include @@ -383,3 +386,5 @@ void oqs_mhy128_dec_c(const uint8_t *ciphertext, const void *_schedule, uint8_t // Reverse the first Round xor_round_key(plaintext, schedule, 0); } + +} \ No newline at end of file diff --git a/src-tauri/mhycrypto/aes.h b/src-tauri/mhycrypto/aes.h index f905742..d19da78 100644 --- a/src-tauri/mhycrypto/aes.h +++ b/src-tauri/mhycrypto/aes.h @@ -6,6 +6,8 @@ #ifndef __OQS_AES_H #define __OQS_AES_H +extern "C" { + #include #include @@ -63,4 +65,6 @@ 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); +} + #endif