Преглед на файлове

Adds method registration

kyber
Henry Case преди 3 години
родител
ревизия
09db976f4c
променени са 3 файла, в които са добавени 36 реда и са изтрити 19 реда
  1. +26
    -0
      CMakeLists.txt
  2. +1
    -19
      src/capi/pqapi.c
  3. +9
    -0
      test/mytest.cpp

+ 26
- 0
CMakeLists.txt Целия файл

@@ -233,3 +233,29 @@ target_link_libraries(
pqclean_dilithium3_clean
pqclean_dilithium5_clean
)

add_executable(
mytest

test/mytest.cpp
)

target_link_libraries(
mytest
gtest
pqclean_s
gtest_main)

target_include_directories(
mytest PRIVATE

${CMAKE_SOURCE_DIR})


install(TARGETS pqclean pqclean_s
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ WORLD_WRITE
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES
${QRS_PUBLIC_INC}
DESTINATION include/pqclean)

+ 1
- 19
src/capi/pqapi.c Целия файл

@@ -1,4 +1,5 @@
#include <stdint.h>
#include "pqapi.h"
#include "kem/kyber/kyber512/clean/api.h"

// helpers
@@ -30,25 +31,6 @@
#define PQC_NAME(x) GLUE(A(x), CRYPTO_ALGNAME)


// Parameters of the scheme
typedef struct params_t {
const uint8_t alg_id;
const char* alg_name;
const uint32_t prv_key_bsz;
const uint32_t pub_key_bsz;
} params_t;

typedef struct kem_params_t {
params_t p;
const uint32_t ciphertext_bsz;
const uint32_t secret_bsz;
} kem_params_t;

typedef struct sig_params_t {
params_t p;
const uint32_t sign_bsz;
} sig_params_t;

// Macro magic needed to initialize parameters for a scheme
#define REG_KEM(ID) \
{ \


+ 9
- 0
test/mytest.cpp Целия файл

@@ -0,0 +1,9 @@
#include <gtest/gtest.h>
#include "capi/pqapi.h"

extern const kem_params_t kems[];

// TODO: change - just to see if function registration works OK.
TEST(Kyber,XXX) {
ASSERT_EQ(kems[0].p.prv_key_bsz, 1632);
}

Зареждане…
Отказ
Запис