You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@milagro.apache.org by km...@apache.org on 2019/06/14 15:27:03 UTC

[incubator-milagro-crypto-c] branch remove-cmocka created (now 03cb987)

This is an automated email from the ASF dual-hosted git repository.

kmccusker pushed a change to branch remove-cmocka
in repository https://gitbox.apache.org/repos/asf/incubator-milagro-crypto-c.git.


      at 03cb987  fixed typo and remove cmocka

This branch includes the following new commits:

     new 03cb987  fixed typo and remove cmocka

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-milagro-crypto-c] 01/01: fixed typo and remove cmocka

Posted by km...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kmccusker pushed a commit to branch remove-cmocka
in repository https://gitbox.apache.org/repos/asf/incubator-milagro-crypto-c.git

commit 03cb98720c95dc95ffc57af446bd8f3a0b812e18
Author: Kealan McCusker <ke...@gmail.com>
AuthorDate: Fri Jun 14 16:26:29 2019 +0100

    fixed typo and remove cmocka
---
 cmocka_tests/CMakeLists.txt            |  66 ---------
 cmocka_tests/README.md                 |   2 -
 cmocka_tests/aes_test.c                |  92 -------------
 cmocka_tests/cmake/AddCmockaTest.cmake |  51 -------
 cmocka_tests/cmake/Amcl.cmake          |  45 -------
 cmocka_tests/cmake/Cmocka.cmake        |  47 -------
 cmocka_tests/cmake/CodeCoverage.cmake  | 237 ---------------------------------
 cmocka_tests/cmake_install.cmake       |  49 -------
 cmocka_tests/crypto_context.c          |  76 -----------
 cmocka_tests/include/aes_test.h        |  26 ----
 cmocka_tests/include/crypto_context.h  |  63 ---------
 cmocka_tests/test_main.c               |  19 ---
 include/amcl.h.in                      |   2 +-
 src/ecp.c.in                           |   2 +-
 src/fp12.c.in                          |   6 +-
 src/fp24.c.in                          |   6 +-
 src/fp48.c.in                          |   6 +-
 src/pair.c.in                          |   2 +-
 src/pair192.c.in                       |   2 +-
 src/pair256.c.in                       |   2 +-
 20 files changed, 14 insertions(+), 787 deletions(-)

diff --git a/cmocka_tests/CMakeLists.txt b/cmocka_tests/CMakeLists.txt
deleted file mode 100644
index a4fc0db..0000000
--- a/cmocka_tests/CMakeLists.txt
+++ /dev/null
@@ -1,66 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
-get_filename_component(PROJECT_ROOT ${CMAKE_CURRENT_LIST_FILE} DIRECTORY)
-set(CMAKE_C_STANDARD 99)
-set(CMAKE_C_STANDARD_REQUIRED ON)
-set(CMAKE_MODULE_PATH "${PROJECT_ROOT}/cmake")
-include(${PROJECT_ROOT}/cmake/Cmocka.cmake)
-include(${PROJECT_ROOT}/cmake/AddCmockaTest.cmake)
-include(${PROJECT_ROOT}/cmake/Amcl.cmake)
-
-set(OPENSSL_USE_STATIC_LIBS TRUE)
-find_package(OpenSSL REQUIRED)
-
-function(ADD_CMOCKA_TEST_ENVIRONMENT _TARGET_NAME)
-    if (WIN32 OR CYGWIN OR MINGW)
-        file(TO_NATIVE_PATH "${cmocka-library_BINARY_DIR}" CMOCKA_DLL_PATH)
-
-        if (TARGET_SYSTEM_EMULATOR)
-            set(DLL_PATH_ENV "WINEPATH=${CMOCKA_DLL_PATH};$ENV{WINEPATH}")
-        else()
-            set(DLL_PATH_ENV "PATH=${CMOCKA_DLL_PATH};$ENV{PATH}")
-        endif()
-        #
-        # IMPORTANT NOTE: The set_tests_properties(), below, internally
-        # stores its name/value pairs with a semicolon delimiter.
-        # because of this we must protect the semicolons in the path
-        #
-        string(REPLACE ";" "\\;" DLL_PATH_ENV "${DLL_PATH_ENV}")
-
-        set_tests_properties(${_TARGET_NAME}
-                             PROPERTIES
-                                ENVIRONMENT
-                                    "${DLL_PATH_ENV}")
-    endif()
-endfunction()
-
-set_source_files_properties(aes_test.c crypto_context.c test_main.c
-                            PROPERTIES
-                            COMPILE_DEFINITIONS
-                            UNIT_TESTING=1)
-enable_testing()
-include_directories(${CMOCKA_INCLUDE_DIR} ${PROJECT_ROOT} include ../include)
-### The most simple test
-add_cmocka_test(aes_test
-                SOURCES crypto_context.c test_main.c aes_test.c
-                COMPILE_OPTIONS ${DEFAULT_C_COMPILE_FLAGS}
-                LINK_LIBRARIES ${CMOCKA_LIBRARY} ${AMCL_LIBRARY} OpenSSL::Crypto)
-add_cmocka_test_environment(aes_test)
-
-
diff --git a/cmocka_tests/README.md b/cmocka_tests/README.md
deleted file mode 100644
index 9831153..0000000
--- a/cmocka_tests/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-# Apache Milagro Cmocka Tests - Experimental feature
-We want to move the old test suite to this for enabling lcov and gcov for supporting more wrappers.
diff --git a/cmocka_tests/aes_test.c b/cmocka_tests/aes_test.c
deleted file mode 100644
index 61f1910..0000000
--- a/cmocka_tests/aes_test.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-#include <arch.h>
-#include <amcl.h>
-#include <setjmp.h> 
-#include <cmocka.h>
-#include <aes_test.h>
-#include <crypto_context.h>
-
-int aes_setup(void **state)
-{
-	crypto_context_t* context = calloc(1, sizeof(crypto_context_t));    
-  	*state = context;
-	return 0;
-}
-
-int aes_teardown(void **state)
-{
-	crypto_context_t* context = *state;
-	free(context);
-	return 0;
-}
-
-void should_encrypt_aes_ecb_128_correctly(void **state)
-{
-	crypto_context_t *ctx = *state;
-	assert_non_null(ctx);
-	ctx->mode = encrypt
-}
-
-void should_fail_aes_ecb_128_with_invalidkey(void **state)
-{
-
-}
-
-void should_encrypt_aes_cbc_128_correctly(void **state)
-{
-}
-
-void should_encrypt_aes_ctr_128_correctly(void **state)
-{
-}
-
-void should_encrypt_aes_cfb_1_correctly(void **state)
-{
-}
-
-static void
-test_encryption_aes(struct crypto_context *context,
-		    char *plain_text, size_t plain_text_size)
-{
-	// arrange test
-	amcl_aes block_cipher;
-	uint8_t valid_aes_init;
-	int i = 0;
-	size_t block_size = get_block_size("aes",context->mode);
-	size_t n_blocks = plain_text_size / block_size;
-	valid_aes_init = AES_init(&block_cipher,
-				  convert_mode(context->mode),
-				  context->key_length,
-				  context->key, context->init_vector);
-	// act & assert.
-	for (i = 0; i < n_blocks; i++) {
-		AES_encrypt(&block_cipher, &plain_text[i * block_size]);
-	}
-	octet ciphertext_octect =
-	    { plain_text_size, plain_text_size, plain_text };
-	octet expected_ciphertext = { context->ciphertext_length,
-		context->ciphertext_length,
-		context->ciphertext
-	};
-	int ret = OCT_comp(&expected_ciphertext, &ciphertext_octect);
-	assert_int_equal(1, ret);
-
-}
diff --git a/cmocka_tests/cmake/AddCmockaTest.cmake b/cmocka_tests/cmake/AddCmockaTest.cmake
deleted file mode 100644
index e02d48f..0000000
--- a/cmocka_tests/cmake/AddCmockaTest.cmake
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-function(ADD_CMOCKA_TEST _TARGET_NAME)
-
-    set(one_value_arguments
-    )
-
-    set(multi_value_arguments
-        SOURCES
-        COMPILE_OPTIONS
-        LINK_LIBRARIES
-        LINK_OPTIONS
-    )
-
-    cmake_parse_arguments(_add_cmocka_test
-        ""
-        "${one_value_arguments}"
-        "${multi_value_arguments}"
-        ${ARGN}
-    )
-
-    if (NOT DEFINED _add_cmocka_test_SOURCES)
-        message(FATAL_ERROR "No sources provided for target ${_TARGET_NAME}")
-    endif()
-
-    add_executable(${_TARGET_NAME} ${_add_cmocka_test_SOURCES})
-
-    if (DEFINED _add_cmocka_test_COMPILE_OPTIONS)
-        target_compile_options(${_TARGET_NAME}
-            PRIVATE ${_add_cmocka_test_COMPILE_OPTIONS}
-        )
-    endif()
-
-    if (DEFINED _add_cmocka_test_LINK_LIBRARIES)
-        target_link_libraries(${_TARGET_NAME}
-            PRIVATE ${_add_cmocka_test_LINK_LIBRARIES}
-        )
-    endif()
-
-    if (DEFINED _add_cmocka_test_LINK_OPTIONS)
-        set_target_properties(${_TARGET_NAME}
-            PROPERTIES LINK_FLAGS
-            ${_add_cmocka_test_LINK_OPTIONS}
-        )
-    endif()
-
-    add_test(${_TARGET_NAME}
-        ${TARGET_SYSTEM_EMULATOR} ${_TARGET_NAME}
-    )
-
-endfunction (ADD_CMOCKA_TEST)
diff --git a/cmocka_tests/cmake/Amcl.cmake b/cmocka_tests/cmake/Amcl.cmake
deleted file mode 100644
index f600d8c..0000000
--- a/cmocka_tests/cmake/Amcl.cmake
+++ /dev/null
@@ -1,45 +0,0 @@
-IF(UNIX)
-    FIND_PATH(AMCL_INCLUDE_DIR amcl.h
-      "../include"
-      "${PROJECT_ROOT}/../include"
-      "${CMAKE_SOURCE_DIR}/../include"
-      NO_DEFAULT_PATH
-      )
-
-    SET(CMAKE_FIND_LIBRARY_PREFIXES "" "lib")
-    SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a" ".lib")
-    FIND_LIBRARY(AMCL_LIBRARY NAMES amcl_core PATHS
-      $ENV{LIB}
-      ../lib
-      /usr/lib/x86_64-linux-gnu
-      "$ENV{LIB_DIR}/lib"
-      "${CMAKE_SOURCE_DIR}/lib"
-      #mingw
-      c:/msys/local/lib
-      NO_DEFAULT_PATH
-      )
-ELSE()
-    FIND_PATH(AMCL_INCLUDE_DIR amcl.h
-      "${PROJECT_ROOT}/include"
-      "${PROJECT_ROOT}/../include"
-      )
-
-    FILE(GLOB AMCL_LIBRARY NAMES 
-        "${PROJECT_ROOT}/../lib/*amcl_core.lib"
-        "${CMAKE_SOURCE_DIR}/../lib/*amcl_core.so"
-        )
-ENDIF()
-
-
-IF (AMCL_INCLUDE_DIR AND AMCL_LIBRARY)
-    SET(AMCL_FOUND TRUE)
-ENDIF (AMCL_INCLUDE_DIR AND AMCL_LIBRARY)
-
-MESSAGE(STATUS "Apache Milagro Include: ${AMCL_INCLUDE_DIR}")
-
-
-IF (AMCL_FOUND)
-    MESSAGE(STATUS "Found Apache Milagro: ${AMCL_LIBRARY}")
-ELSE (AMCL_FOUND)
-        MESSAGE(FATAL_ERROR "Could not find Apache Milagro")
-ENDIF (AMCL_FOUND)
diff --git a/cmocka_tests/cmake/Cmocka.cmake b/cmocka_tests/cmake/Cmocka.cmake
deleted file mode 100644
index d500796..0000000
--- a/cmocka_tests/cmake/Cmocka.cmake
+++ /dev/null
@@ -1,47 +0,0 @@
-
-IF(UNIX)
-    FIND_PATH(CMOCKA_INCLUDE_DIR cmocka.h
-      "$ENV{LIB_DIR}/include"
-      "/usr/include"
-      "/usr/include/cmockery"
-      "${CMAKE_SOURCE_DIR}/include"
-      "${CMAKE_SOURCE_DIR}/include/cmocka"
-      NO_DEFAULT_PATH
-      )
-
-    SET(CMAKE_FIND_LIBRARY_PREFIXES "" "lib")
-    SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a" ".lib")
-    FIND_LIBRARY(CMOCKA_LIBRARY NAMES cmocka PATHS
-      $ENV{LIB}
-      /usr/lib
-      /usr/lib/x86_64-linux-gnu
-      "$ENV{LIB_DIR}/lib"
-      "${CMAKE_SOURCE_DIR}/lib"
-      #mingw
-      c:/msys/local/lib
-      NO_DEFAULT_PATH
-      )
-ELSE()
-    FIND_PATH(CMOCKA_INCLUDE_DIR cmocka.h
-        "${PROJECT_ROOT}/include"
-      )
-
-    FILE(GLOB CMOCKA_LIBRARY NAMES
-        "${PROJECT_ROOT}/lib/cmocka*.lib"
-        "${PROJECT_ROOT}/lib/cmocka*.a"
-        )
-ENDIF()
-
-
-IF (CMOCKA_INCLUDE_DIR AND CMOCKA_LIBRARY)
-    SET(CMOCKA_FOUND TRUE)
-ENDIF (CMOCKA_INCLUDE_DIR AND CMOCKA_LIBRARY)
-
-MESSAGE(STATUS "CMocka Include: ${CMOCKA_INCLUDE_DIR}")
-
-
-IF (CMOCKA_FOUND)
-    MESSAGE(STATUS "Found CMocka: ${CMOCKA_LIBRARY}")
-ELSE (CMOCKA_FOUND)
-        MESSAGE(FATAL_ERROR "Could not find Cmocka")
-ENDIF (CMOCKA_FOUND)
diff --git a/cmocka_tests/cmake/CodeCoverage.cmake b/cmocka_tests/cmake/CodeCoverage.cmake
deleted file mode 100644
index 4d8bd43..0000000
--- a/cmocka_tests/cmake/CodeCoverage.cmake
+++ /dev/null
@@ -1,237 +0,0 @@
-include(CMakeParseArguments)
- 
- # Check prereqs
- find_program( GCOV_PATH gcov )
- find_program( LCOV_PATH  NAMES lcov lcov.bat lcov.exe lcov.perl)
- find_program( GENHTML_PATH NAMES genhtml genhtml.perl genhtml.bat )
- find_program( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/scripts/test)
- find_package (Python COMPONENTS Interpreter Development)
- 
- if(NOT GCOV_PATH)
-     message(FATAL_ERROR "gcov not found! Aborting...")
- endif() # NOT GCOV_PATH
- 
- if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
-     if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 3)
-         message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...")
-     endif()
- elseif(NOT CMAKE_COMPILER_IS_GNUCXX)
-     message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
- endif()
- 
- set(COVERAGE_COMPILER_FLAGS "-g --coverage -fprofile-arcs -ftest-coverage"
-     CACHE INTERNAL "")
- 
- set(CMAKE_CXX_FLAGS_COVERAGE
-     ${COVERAGE_COMPILER_FLAGS}
-     CACHE STRING "Flags used by the C++ compiler during coverage builds."
-     FORCE )
- set(CMAKE_C_FLAGS_COVERAGE
-     ${COVERAGE_COMPILER_FLAGS}
-     CACHE STRING "Flags used by the C compiler during coverage builds."
-     FORCE )
- set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
-     ""
-     CACHE STRING "Flags used for linking binaries during coverage builds."
-     FORCE )
- set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
-     ""
-     CACHE STRING "Flags used by the shared libraries linker during coverage builds."
-     FORCE )
- mark_as_advanced(
-     CMAKE_CXX_FLAGS_COVERAGE
-     CMAKE_C_FLAGS_COVERAGE
-     CMAKE_EXE_LINKER_FLAGS_COVERAGE
-     CMAKE_SHARED_LINKER_FLAGS_COVERAGE )
- 
- if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
-     message(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading")
- endif() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"
- 
- if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
-     link_libraries(gcov)
- else()
-     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
- endif()
- 
- # Defines a target for running and collection code coverage information
- # Builds dependencies, runs the given executable and outputs reports.
- # NOTE! The executable should always have a ZERO as exit code otherwise
- # the coverage generation will not complete.
- #
- # SETUP_TARGET_FOR_COVERAGE_LCOV(
- #     NAME testrunner_coverage                    # New target name
- #     EXECUTABLE testrunner -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
- #     DEPENDENCIES testrunner                     # Dependencies to build first
- # )
- function(SETUP_TARGET_FOR_COVERAGE_LCOV)
- 
-     set(options NONE)
-     set(oneValueArgs NAME)
-     set(multiValueArgs EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES LCOV_ARGS GENHTML_ARGS)
-     cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
- 
-     if(NOT LCOV_PATH)
-         message(FATAL_ERROR "lcov not found! Aborting...")
-     endif() # NOT LCOV_PATH
- 
-     if(NOT GENHTML_PATH)
-         message(FATAL_ERROR "genhtml not found! Aborting...")
-     endif() # NOT GENHTML_PATH
- 
-     # Setup target
-     add_custom_target(${Coverage_NAME}
- 
-         # Cleanup lcov
-         COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -directory . --zerocounters
-         # Create baseline to make sure untouched files show up in the report
-         COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -c -i -d . -o ${Coverage_NAME}.base
- 
-         # Run tests
-         COMMAND ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
- 
-         # Capturing lcov counters and generating report
-         COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --directory . --capture --output-file ${Coverage_NAME}.info
-         # add baseline counters
-         COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -a ${Coverage_NAME}.base -a ${Coverage_NAME}.info --output-file ${Coverage_NAME}.total
-         COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --remove ${Coverage_NAME}.total ${COVERAGE_LCOV_EXCLUDES} --output-file ${PROJECT_BINARY_DIR}/${Coverage_NAME}.info.cleaned
-         COMMAND ${GENHTML_PATH} ${Coverage_GENHTML_ARGS} -o ${Coverage_NAME} ${PROJECT_BINARY_DIR}/${Coverage_NAME}.info.cleaned
-         COMMAND ${CMAKE_COMMAND} -E remove ${Coverage_NAME}.base ${Coverage_NAME}.total ${PROJECT_BINARY_DIR}/${Coverage_NAME}.info.cleaned
- 
-         WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
-         DEPENDS ${Coverage_DEPENDENCIES}
-         COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
-     )
- 
-     # Show where to find the lcov info report
-     add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
-         COMMAND ;
-         COMMENT "Lcov code coverage info report saved in ${Coverage_NAME}.info."
-     )
- 
-     # Show info where to find the report
-     add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
-         COMMAND ;
-         COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report."
-     )
- 
- endfunction() # SETUP_TARGET_FOR_COVERAGE_LCOV
- 
- # Defines a target for running and collection code coverage information
- # Builds dependencies, runs the given executable and outputs reports.
- # NOTE! The executable should always have a ZERO as exit code otherwise
- # the coverage generation will not complete.
- #
- # SETUP_TARGET_FOR_COVERAGE_GCOVR_XML(
- #     NAME ctest_coverage                    # New target name
- #     EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
- #     DEPENDENCIES executable_target         # Dependencies to build first
- # )
- function(SETUP_TARGET_FOR_COVERAGE_GCOVR_XML)
- 
-     set(options NONE)
-     set(oneValueArgs NAME)
-     set(multiValueArgs EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)
-     cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
- 
-     if(NOT Python_FOUND)
-         message(FATAL_ERROR "python not found! Aborting...")
-     endif()
- 
-     if(NOT GCOVR_PATH)
-         message(FATAL_ERROR "gcovr not found! Aborting...")
-     endif() # NOT GCOVR_PATH
- 
-     # Combine excludes to several -e arguments
-     set(GCOVR_EXCLUDES "")
-     foreach(EXCLUDE ${COVERAGE_GCOVR_EXCLUDES})
-         string(REPLACE "*" "\\*" EXCLUDE_REPLACED ${EXCLUDE})
-         list(APPEND GCOVR_EXCLUDES "-e")
-         list(APPEND GCOVR_EXCLUDES "${EXCLUDE_REPLACED}")
-     endforeach()
- 
-     add_custom_target(${Coverage_NAME}
-         # Run tests
-         ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
- 
-         # Running gcovr
-         COMMAND ${GCOVR_PATH} --xml
-             -r ${PROJECT_SOURCE_DIR} ${GCOVR_EXCLUDES}
-             --object-directory=${PROJECT_BINARY_DIR}
-             -o ${Coverage_NAME}.xml
-         WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
-         DEPENDS ${Coverage_DEPENDENCIES}
-         COMMENT "Running gcovr to produce Cobertura code coverage report."
-     )
- 
-     # Show info where to find the report
-     add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
-         COMMAND ;
-         COMMENT "Cobertura code coverage report saved in ${Coverage_NAME}.xml."
-     )
- 
- endfunction() # SETUP_TARGET_FOR_COVERAGE_GCOVR_XML
- 
- # Defines a target for running and collection code coverage information
- # Builds dependencies, runs the given executable and outputs reports.
- # NOTE! The executable should always have a ZERO as exit code otherwise
- # the coverage generation will not complete.
- #
- # SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML(
- #     NAME ctest_coverage                    # New target name
- #     EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
- #     DEPENDENCIES executable_target         # Dependencies to build first
- # )
- function(SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML)
- 
-     set(options NONE)
-     set(oneValueArgs NAME)
-     set(multiValueArgs EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)
-     cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
- 
-     if(NOT Python_FOUND)
-         message(FATAL_ERROR "python not found! Aborting...")
-     endif()
- 
-     if(NOT GCOVR_PATH)
-         message(FATAL_ERROR "gcovr not found! Aborting...")
-     endif() # NOT GCOVR_PATH
- 
-     # Combine excludes to several -e arguments
-     set(GCOVR_EXCLUDES "")
-     foreach(EXCLUDE ${COVERAGE_GCOVR_EXCLUDES})
-         string(REPLACE "*" "\\*" EXCLUDE_REPLACED ${EXCLUDE})
-         list(APPEND GCOVR_EXCLUDES "-e")
-         list(APPEND GCOVR_EXCLUDES "${EXCLUDE_REPLACED}")
-     endforeach()
- 
-     add_custom_target(${Coverage_NAME}
-         # Run tests
-         ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
- 
-         # Create folder
-         COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/${Coverage_NAME}
- 
-         # Running gcovr
-         COMMAND ${Python_EXECUTABLE} ${GCOVR_PATH} --html --html-details
-             -r ${PROJECT_SOURCE_DIR} ${GCOVR_EXCLUDES}
-             --object-directory=${PROJECT_BINARY_DIR}
-             -o ${Coverage_NAME}/index.html
-         WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
-         DEPENDS ${Coverage_DEPENDENCIES}
-         COMMENT "Running gcovr to produce HTML code coverage report."
-     )
- 
-     # Show info where to find the report
-     add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
-         COMMAND ;
-         COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report."
-     )
- 
- endfunction() # SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML
- 
- function(APPEND_COVERAGE_COMPILER_FLAGS)
-     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
-     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
-     message(STATUS "Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}")
- endfunction() # APPEND_COVERAGE_COMPILER_FLAGS
diff --git a/cmocka_tests/cmake_install.cmake b/cmocka_tests/cmake_install.cmake
deleted file mode 100644
index d4d94e8..0000000
--- a/cmocka_tests/cmake_install.cmake
+++ /dev/null
@@ -1,49 +0,0 @@
-# Install script for directory: /home/jozoppi/projects/incubator-milagro-crypto-c/unit_test
-
-# Set the install prefix
-if(NOT DEFINED CMAKE_INSTALL_PREFIX)
-  set(CMAKE_INSTALL_PREFIX "/usr/local")
-endif()
-string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
-
-# Set the install configuration name.
-if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
-  if(BUILD_TYPE)
-    string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
-           CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
-  else()
-    set(CMAKE_INSTALL_CONFIG_NAME "")
-  endif()
-  message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
-endif()
-
-# Set the component getting installed.
-if(NOT CMAKE_INSTALL_COMPONENT)
-  if(COMPONENT)
-    message(STATUS "Install component: \"${COMPONENT}\"")
-    set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
-  else()
-    set(CMAKE_INSTALL_COMPONENT)
-  endif()
-endif()
-
-# Install shared libraries without execute permission?
-if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
-  set(CMAKE_INSTALL_SO_NO_EXE "1")
-endif()
-
-# Is this installation the result of a crosscompile?
-if(NOT DEFINED CMAKE_CROSSCOMPILING)
-  set(CMAKE_CROSSCOMPILING "FALSE")
-endif()
-
-if(CMAKE_INSTALL_COMPONENT)
-  set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
-else()
-  set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
-endif()
-
-string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
-       "${CMAKE_INSTALL_MANIFEST_FILES}")
-file(WRITE "/home/jozoppi/projects/incubator-milagro-crypto-c/unit_test/${CMAKE_INSTALL_MANIFEST}"
-     "${CMAKE_INSTALL_MANIFEST_CONTENT}")
diff --git a/cmocka_tests/crypto_context.c b/cmocka_tests/crypto_context.c
deleted file mode 100644
index 959d00d..0000000
--- a/cmocka_tests/crypto_context.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stdlib.h>
-#include <crypto_context.h>
-
-/* @brief  Create a new encryption context assigning the loader
-*  @param  encryption_mode  Mode of encryption (ECB, CBC, CFB, CTR)
-*  @param  loader           Init function to be used for parsing the vector file.
-*/
-crypto_context_t *new_context(encryption_mode mode,
-			      void (*loader) (crypto_context_t *))
-{
-	crypto_context_t *ctx = calloc(1, sizeof(struct crypto_context));
-	ctx->parse_vector_file = loader;
-	ctx->mode = mode;
-	return ctx;
-}
-
-/*
-* @brief Delete the memory for crypto context
-* @param ctx Context to be used.
-*/
-void delete_context(crypto_context_t * ctx)
-{
-	free(ctx->ciphertext);
-	free(ctx->key);
-	free(ctx->init_vector);
-}
-
-/*
-* @brief Convert the encryption mode to an integer;
-* @param mode encryption_mode Mode of encryption (ECB, CBC, CFB, CTR)
-*/
-int convert_mode(encryption_mode mode)
-{
-	return (int)mode;
-}
-
-/*
- * @brief Compute the block_size foreach algorithm;
- * @param algo   Block Cipher Algorithm name
- * @param mode   Mode for encryption
- */
-size_t get_block_size(char *algo, encryption_mode mode)
-{
-	if (!strcmp("aes", algo)) {
-		// we are aes
-		switch (mode) {
-		case cbc_mode:
-		case ecb_mode:
-		case ctr_mode:
-			{
-				return 16;
-			}
-		case cfb_mode:
-			{
-				return 1;
-			}
-		}
-	}
-	return 16;
-}
diff --git a/cmocka_tests/include/aes_test.h b/cmocka_tests/include/aes_test.h
deleted file mode 100644
index 42f156d..0000000
--- a/cmocka_tests/include/aes_test.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef AES_TEST_H
-#define AES_TEST_H
-#include <string.h>
-#include <crypto_context.h>
-extern void parse_aes_vectorfile(struct crypto_context* context);
-extern void should_encrypt_aes_ecb_128_correctly(void** state);
-extern void should_encrypt_aes_cbc_128_correctly(void** state);
-extern void should_encrypt_aes_ctr_128_correctly(void** state);
-extern void should_encrypt_aes_cfb_1_correctly(void** state);
-#endif
diff --git a/cmocka_tests/include/crypto_context.h b/cmocka_tests/include/crypto_context.h
deleted file mode 100644
index 40ce528..0000000
--- a/cmocka_tests/include/crypto_context.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef CRYPTO_CONTEXT
-#define CRYPTO_CONTEXT 
-#include <stdlib.h>
-#define CRYPTO_VEC_PATH_MAX 256
-typedef enum e_mode 
-{
-    ecb_mode,
-    cbc_mode,
-    cfb_mode,
-    ctr_mode
-} encryption_mode;
-typedef struct crypto_context
-{
-   char* ciphertext;                    /*<!-- Ciphertext to be compared */
-   size_t ciphertext_length;            /*<!-- Ciphertext lenght */
-   char filename[CRYPTO_VEC_PATH_MAX];  /*<!-- Path of the vector test filename */
-   char* key;                           /*<!-- Key to be used */
-   size_t key_length;                   /*<!-- Key length */
-   char* init_vector;                   /*<!-- IV */
-   size_t init_vector_length;           /*<!-- Vector length */
-   encryption_mode mode;                 /*<!-- Kind of encryption mode */
-   void (*parse_vector_file)(struct crypto_context* self); /*<!-- function for loading 
-                                                                  the file and init the structure */
-} crypto_context_t;
-
-/* @brief  Create a new encryption context assigning the loader
-*  @param  encryption_mode  Mode of encryption (ECB, CBC, CFB, CTR)
-*  @param  loader           Init function to be used for parsing the vector file.
-*/
-extern crypto_context_t* new_context(encryption_mode mode, void (*loader)(crypto_context_t*));
-/*
-* @brief Delete the memory for crypto context
-* @param ctx Context to be used.
-*/
-extern void delete_context(crypto_context_t* ctx);
-/*
-* @brief Convert the encryption mode to an integer;
-* @param mode encryption_mode Mode of encryption (ECB, CBC, CFB, CTR)
-*/
-extern int convert_mode(encryption_mode mode);
-/*
- * @brief Compute the block_size foreach algorithm;
- * @param algo   Block Cipher Algorithm name
- * @param mode   Mode for encryption
- */
-extern size_t get_block_size(char* algo, encryption_mode mode);
-#endif
diff --git a/cmocka_tests/test_main.c b/cmocka_tests/test_main.c
deleted file mode 100644
index 089f7d2..0000000
--- a/cmocka_tests/test_main.c
+++ /dev/null
@@ -1,19 +0,0 @@
-
-#include <aes_test.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <setjmp.h>
-#include <cmocka.h>
-
-
-int main(void)
-{
-	const struct CMUnitTest tests[] = {
-		cmocka_unit_test(should_encrypt_aes_ecb_128_correctly),
-		cmocka_unit_test(should_encrypt_aes_cbc_128_correctly),
-		cmocka_unit_test(should_encrypt_aes_ctr_128_correctly),
-		cmocka_unit_test(should_encrypt_aes_cfb_1_correctly)
-	};
-	return cmocka_run_group_tests(tests, NULL, NULL);
-}
diff --git a/include/amcl.h.in b/include/amcl.h.in
index a976e9f..f588c0a 100644
--- a/include/amcl.h.in
+++ b/include/amcl.h.in
@@ -59,7 +59,7 @@
 
 #define AMCL_FP_ZERO 0
 #define AMCL_FP_UNITY 1
-#define AMCL_AMCL_FP_SPARSER 2
+#define AMCL_FP_SPARSER 2
 #define AMCL_FP_SPARSE 3
 #define AMCL_FP_DENSE 4
 
diff --git a/src/ecp.c.in b/src/ecp.c.in
index f0ae94e..8b1d938 100644
--- a/src/ecp.c.in
+++ b/src/ecp.c.in
@@ -252,7 +252,7 @@ int ECP_ZZZ_get(BIG_XXX x,ECP_ZZZ *P)
     ECP_ZZZ_copy(&W,P);
     ECP_ZZZ_affine(&W);
     if (ECP_ZZZ_isinf(&W)) return -1;
-    FP_YYY_redc(x,&(W));
+    FP_YYY_redc(x,&(W.x));
     return 0;
 }
 
diff --git a/src/fp12.c.in b/src/fp12.c.in
index 04d39ac..c8b4765 100644
--- a/src/fp12.c.in
+++ b/src/fp12.c.in
@@ -129,7 +129,7 @@ void FP12_YYY_from_FP4(FP12_YYY *w,FP4_YYY *a)
     FP4_YYY_copy(&(w->a),a);
     FP4_YYY_zero(&(w->b));
     FP4_YYY_zero(&(w->c));
-    w->type=AMCL_AMCL_FP_SPARSER;
+    w->type=AMCL_FP_SPARSER;
 }
 
 /* Create FP12 from 3 FP4's */
@@ -229,7 +229,7 @@ void FP12_YYY_sqr(FP12_YYY *w,FP12_YYY *x)
     FP4_YYY_add(&(w->b),&C,&D);
     FP4_YYY_add(&(w->c),&(w->c),&A);
 
-    if (x->type==AMCL_AMCL_FP_SPARSER)
+    if (x->type==AMCL_FP_SPARSER)
         w->type=AMCL_FP_SPARSE;
     else
         w->type=AMCL_FP_DENSE;
@@ -387,7 +387,7 @@ void FP12_YYY_ssmul(FP12_YYY *w,FP12_YYY *y)
     }
     else
     {
-        if (w->type==AMCL_AMCL_FP_SPARSER)
+        if (w->type==AMCL_FP_SPARSER)
         {
             FP12_YYY_smul(w,y);
             return;
diff --git a/src/fp24.c.in b/src/fp24.c.in
index 815ce89..5470a70 100644
--- a/src/fp24.c.in
+++ b/src/fp24.c.in
@@ -126,7 +126,7 @@ void FP24_YYY_from_FP8(FP24_YYY *w,FP8_YYY *a)
     FP8_YYY_copy(&(w->a),a);
     FP8_YYY_zero(&(w->b));
     FP8_YYY_zero(&(w->c));
-    w->type=AMCL_AMCL_FP_SPARSER;
+    w->type=AMCL_FP_SPARSER;
 }
 
 /* Create FP24 from 3 FP8's */
@@ -227,7 +227,7 @@ void FP24_YYY_sqr(FP24_YYY *w,FP24_YYY *x)
     FP8_YYY_add(&(w->b),&C,&D);
     FP8_YYY_add(&(w->c),&(w->c),&A);
 
-    if (x->type==AMCL_AMCL_FP_SPARSER)
+    if (x->type==AMCL_FP_SPARSER)
         w->type=AMCL_FP_SPARSE;
     else
         w->type=AMCL_FP_DENSE;
@@ -384,7 +384,7 @@ void FP24_YYY_ssmul(FP24_YYY *w,FP24_YYY *y)
     }
     else
     {
-        if (w->type==AMCL_AMCL_FP_SPARSER)
+        if (w->type==AMCL_FP_SPARSER)
         {
             FP24_YYY_smul(w,y);
             return;
diff --git a/src/fp48.c.in b/src/fp48.c.in
index 8083bf5..cc5394e 100644
--- a/src/fp48.c.in
+++ b/src/fp48.c.in
@@ -127,7 +127,7 @@ void FP48_YYY_from_FP16(FP48_YYY *w,FP16_YYY *a)
     FP16_YYY_copy(&(w->a),a);
     FP16_YYY_zero(&(w->b));
     FP16_YYY_zero(&(w->c));
-    w->type=AMCL_AMCL_FP_SPARSER;
+    w->type=AMCL_FP_SPARSER;
 }
 
 /* Create FP48 from 3 FP16's */
@@ -228,7 +228,7 @@ void FP48_YYY_sqr(FP48_YYY *w,FP48_YYY *x)
     FP16_YYY_add(&(w->b),&C,&D);
     FP16_YYY_add(&(w->c),&(w->c),&A);
 
-    if (x->type==AMCL_AMCL_FP_SPARSER)
+    if (x->type==AMCL_FP_SPARSER)
         w->type=AMCL_FP_SPARSE;
     else
         w->type=AMCL_FP_DENSE;
@@ -385,7 +385,7 @@ void FP48_YYY_ssmul(FP48_YYY *w,FP48_YYY *y)
     }
     else
     {
-        if (w->type==AMCL_AMCL_FP_SPARSER)
+        if (w->type==AMCL_FP_SPARSER)
         {
             FP48_YYY_smul(w,y);
             return;
diff --git a/src/pair.c.in b/src/pair.c.in
index 8faf54a..5e8fdc2 100644
--- a/src/pair.c.in
+++ b/src/pair.c.in
@@ -131,7 +131,7 @@ static void PAIR_ZZZ_line(FP12_YYY *v,ECP2_ZZZ *A,ECP2_ZZZ *B,FP_YYY *Qx,FP_YYY
     }
 
     FP12_YYY_from_FP4s(v,&a,&b,&c);
-    v->type=AMCL_AMCL_FP_SPARSER;
+    v->type=AMCL_FP_SPARSER;
 }
 
 
diff --git a/src/pair192.c.in b/src/pair192.c.in
index 3e6f966..94f2d84 100644
--- a/src/pair192.c.in
+++ b/src/pair192.c.in
@@ -132,7 +132,7 @@ static void PAIR_ZZZ_line(FP24_YYY *v,ECP4_ZZZ *A,ECP4_ZZZ *B,FP_YYY *Qx,FP_YYY
     }
 
     FP24_YYY_from_FP8s(v,&a,&b,&c);
-    v->type=AMCL_AMCL_FP_SPARSER;
+    v->type=AMCL_FP_SPARSER;
 }
 
 /* prepare ate parameter, n=6u+2 (BN) or n=u (BLS), n3=3*n */
diff --git a/src/pair256.c.in b/src/pair256.c.in
index 2b53ba4..00a4603 100644
--- a/src/pair256.c.in
+++ b/src/pair256.c.in
@@ -129,7 +129,7 @@ static void PAIR_ZZZ_line(FP48_YYY *v,ECP8_ZZZ *A,ECP8_ZZZ *B,FP_YYY *Qx,FP_YYY
     }
 
     FP48_YYY_from_FP16s(v,&a,&b,&c);
-    v->type=AMCL_AMCL_FP_SPARSER;
+    v->type=AMCL_FP_SPARSER;
 }
 
 /* prepare ate parameter, n=6u+2 (BN) or n=u (BLS), n3=3*n */