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

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

commit 71c2bed2574f1fec093f68384b3243a54775ef90
Author: Kealan McCusker <[email protected]>
AuthorDate: Mon Jun 17 14:31:57 2019 +0100

    add bls to library
---
 CMakeLists.txt                      |  60 ++++++++++++++-
 Makefile                            |   1 +
 config.mk                           |   5 +-
 examples/CMakeLists.txt             |   6 ++
 examples/testbls_ZZZ.c.in           | 140 ++++++++++++++++++++++++++++++++++
 examples/testmpin_ZZZ.c.in          |   2 +-
 examples/testwcc_ZZZ.c.in           |   5 +-
 include/bls.h.in                    |  75 +++++++++++++++++++
 include/bls192.h.in                 |  75 +++++++++++++++++++
 include/bls256.h.in                 |  75 +++++++++++++++++++
 include/ecp4.h.in                   |  22 +-----
 include/ecp8.h.in                   |  20 +----
 include/fp24.h.in                   |   2 +-
 include/fp48.h.in                   |   2 +-
 include/mpin192.h.in                |  10 ++-
 include/mpin256.h.in                |  10 ++-
 src/bls.c.in                        |  93 +++++++++++++++++++++++
 src/bls192.c.in                     |  91 ++++++++++++++++++++++
 src/bls256.c.in                     |  92 +++++++++++++++++++++++
 test/CMakeLists.txt                 |   7 ++
 test/test_bls_ZZZ.c.in              | 145 ++++++++++++++++++++++++++++++++++++
 test/test_fp12_arithmetics_YYY.c.in |  58 +++++++--------
 test/test_fp24_arithmetics_YYY.c.in |  50 ++++++-------
 test/test_fp_arithmetics_YYY.c.in   |  34 ++++-----
 24 files changed, 961 insertions(+), 119 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b6ec5ed..f161106 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,7 +64,7 @@ set(AMCL_SOVERSION ${AMCL_VERSION_MAJOR})
 if(CMAKE_COMPILER_IS_GNUCC)
     execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
                     OUTPUT_VARIABLE GCC_VERSION)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -static-libgcc -Wall -Wextra 
-Wno-strict-prototypes -Wunused-value -Wcast-align -Wunused-variable -Wundef 
-Wformat-security")
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc -Wall -Wextra 
-Wno-strict-prototypes -Wunused-value -Wcast-align -Wunused-variable -Wundef 
-Wformat-security")
 
     if (GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow")
@@ -117,9 +117,11 @@ log(BUILD_TESTING) # added by 'include(CTest)'
 option(BUILD_MPIN    "Build MPIN"    ON)
 option(BUILD_WCC     "Build WCC"     ON)
 option(BUILD_X509    "BUild X509"    ON)
+option(BUILD_BLS     "Build BLS"    ON)
 log(BUILD_MPIN)
 log(BUILD_WCC)
 log(BUILD_X509)
+log(BUILD_BLS)
 
 option(DEBUG_REDUCE "Print debug message for field reduction" OFF)
 option(DEBUG_NORM "Detect digit overflow" OFF)
@@ -223,7 +225,7 @@ install(FILES
   DESTINATION ${INSTALL_INCLUDESUBDIR}
 )
 
-if (BUILD_MPIN OR BUILD_WCC)
+if (BUILD_MPIN OR BUILD_WCC OR BUILD_BLS)
   amcl_configure_file_core(include/config_test.h.in include/config_test.h 
amcl_core_pbc_GEN_HDRS)
 
   target_sources(amcl_core PRIVATE src/pbc_support.c)
@@ -597,6 +599,60 @@ if(BUILD_WCC)
 endif()
 
 ##################################################
+# AMCL_BLS_*** Libraries
+##################################################
+if(BUILD_BLS)
+  foreach(curve ${AMCL_CURVE})
+    amcl_curve_field(TC "${curve}")
+    amcl_curve_field(CS "${curve}")
+
+    if(TARGET amcl_pairing_${TC})
+      if(CS STREQUAL "128")
+        amcl_configure_file_curve(include/bls.h.in include/bls_${TC}.h 
"${curve}" amcl_bls_${TC}_GEN_HDRS)
+        amcl_configure_file_curve(src/bls.c.in     src/bls_${TC}.c     
"${curve}" amcl_bls_${TC}_GEN_SRCS)
+      else(CS STREQUAL "128")
+        amcl_configure_file_curve(include/bls${CS}.h.in 
include/bls${CS}_${TC}.h "${curve}" amcl_bls_${TC}_GEN_HDRS)
+        amcl_configure_file_curve(src/bls${CS}.c.in     src/bls${CS}_${TC}.c   
  "${curve}" amcl_bls_${TC}_GEN_SRCS)
+      endif(CS STREQUAL "128")
+
+      message(STATUS "Build libamcl_bls_${TC}")
+      add_library(amcl_bls_${TC}
+        ${amcl_bls_${TC}_GEN_SRCS}
+      )
+      list(APPEND AMCL_LIBRARIES amcl_bls_${TC})
+
+      set_target_properties(amcl_bls_${TC} PROPERTIES
+        EXPORT_NAME bls_${TC}
+        VERSION ${AMCL_VERSION}
+        SOVERSION ${AMCL_SOVERSION}
+      )
+
+      target_include_directories(amcl_bls_${TC} PUBLIC
+        $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
+        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+        $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+      )
+
+      target_link_libraries(amcl_bls_${TC} PUBLIC
+        amcl_pairing_${TC}
+      )
+
+      install(TARGETS amcl_bls_${TC}
+        EXPORT AMCLTargets
+        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+      )
+
+      install(FILES
+        ${amcl_bls_${TC}_GEN_HDRS}
+        DESTINATION ${INSTALL_INCLUDESUBDIR}
+      )
+    endif()
+  endforeach()
+endif()
+
+##################################################
 # pkgconfig
 ##################################################
 foreach(lib ${AMCL_LIBRARIES})
diff --git a/Makefile b/Makefile
index 567aa7f..3755e34 100644
--- a/Makefile
+++ b/Makefile
@@ -186,6 +186,7 @@ ifeq ($(CMAKE_BUILD_TYPE),Coverage)
        -DAMCL_RSA=$(AMCL_RSA) \
        -DBUILD_MPIN=$(AMCL_BUILD_MPIN) \
        -DBUILD_WCC=$(AMCL_BUILD_WCC) \
+       -DBUILD_BLS=$(AMCL_BUILD_BLS) \
        -DBUILD_DOCS=$(AMCL_BUILD_DOCS) \
        -DAMCL_MAXPIN=$(AMCL_MAXPIN) \
        -DAMCL_PBLEN=$(AMCL_PBLEN) \
diff --git a/config.mk b/config.mk
index 6ecc02f..13941ce 100644
--- a/config.mk
+++ b/config.mk
@@ -3,7 +3,7 @@
 # size of chunk in bits which is wordlength of computer = 16, 32 or 64.  (see 
arch.h)
 WORD_SIZE:=64
 
-# Current choice of Elliptic Curve NIST256 C25519 ED25519 BRAINPOOL ANSSI 
NUMS256E NUMS256W NUMS384E NUMS384W NUMS512E NUMS512W HIFIVE GOLDILOCKS NIST384 
C41417 NIST521 BN254 BN254CX BLS383 FP256BN FP512BN BLS461
+# Current choice of Elliptic Curve ANSSI C25519 NIST521 BLS24 C41417 NUMS256E 
BLS381 ED25519 NUMS256W BLS383 FP256BN NUMS384E BLS461 FP512BN NUMS384W BLS48 
GOLDILOCKS NUMS512E BN254 HIFIVE NUMS512W BN254CX NIST256 SECP256K1 BRAINPOOL 
NIST384
 AMCL_CURVE:=ED25519,NIST256,GOLDILOCKS,BLS383
 
 # RSA security level: 2048 3072 4096
@@ -30,6 +30,9 @@ AMCL_BUILD_MPIN:=ON
 # Build WCC ON/OFF
 AMCL_BUILD_WCC:=ON
 
+# Build BLS ON/OFF
+AMCL_BUILD_BLS:=ON
+
 # Build Doxygen ON/OFF
 AMCL_BUILD_DOCS:=ON
 
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index e7c6467..14c2e10 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -46,6 +46,12 @@ foreach(curve ${AMCL_CURVE})
     target_link_libraries(testwcc_dta_${TC} PRIVATE amcl_wcc_${TC})
   endif()
 
+  if(TARGET amcl_bls_${TC})
+    amcl_configure_file_curve(testbls_ZZZ.c.in testbls_${TC}.c "${curve}" 
testbls_${TC}_GEN_SRCS)
+    add_executable(testbls_${TC} ${testbls_${TC}_GEN_SRCS})
+    target_link_libraries(testbls_${TC} PRIVATE amcl_bls_${TC})
+  endif()
+  
 endforeach()
 
 foreach(level ${AMCL_RSA})
diff --git a/examples/testbls_ZZZ.c.in b/examples/testbls_ZZZ.c.in
new file mode 100644
index 0000000..f84525e
--- /dev/null
+++ b/examples/testbls_ZZZ.c.in
@@ -0,0 +1,140 @@
+/*
+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.
+*/
+
+/* test driver and function exerciser for BLS Signature API Functions */
+
+/* Build executable after installation:
+
+  gcc -O0 -g ./testbls_ZZZ.c $(pkg-config --libs --cflags amcl) -o testbls_ZZZ
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "config_curve_ZZZ.h"
+#include "randapi.h"
+
+#if CURVE_SECURITY_ZZZ == 128
+#include "bls_ZZZ.h"
+#elif CURVE_SECURITY_ZZZ == 192
+#include "bls192_ZZZ.h"
+#elif CURVE_SECURITY_ZZZ == 256
+#include "bls256_ZZZ.h"
+#endif
+
+// Support multiple security levels
+#if CURVE_SECURITY_ZZZ == 128
+#define G2LEN 4*BFS_ZZZ
+#elif CURVE_SECURITY_ZZZ == 192
+#define G2LEN 8*BFS_ZZZ
+#elif CURVE_SECURITY_ZZZ == 256
+#define G2LEN 16*BFS_ZZZ
+#endif
+
+static char message[]="This is a test message";
+
+int bls(csprng *RNG)
+{
+    int rc;
+    char s[BGS_ZZZ];
+    char w[G2LEN];
+    char sig[BFS_ZZZ+1];
+    octet S= {0,sizeof(s),s};
+    octet W= {0,sizeof(w),w};
+    octet SIG= {0,sizeof(sig),sig};
+
+    BLS_ZZZ_KEY_PAIR_GENERATE(RNG,&S,&W);
+
+    printf("Private key: 0x");
+    OCT_output(&S);
+    printf("Public key: 0x");
+    OCT_output(&W);
+
+    BLS_ZZZ_SIGN(&SIG,message,&S);
+    printf("Signature: 0x");
+    OCT_output(&SIG);
+
+    rc=BLS_ZZZ_VERIFY(&SIG,message,&W);
+    if (rc==BLS_OK)
+    {
+        printf("Success: Signature is valid\n");
+    }
+    else
+    {
+        printf("Error: Invalid Signature\n");
+    }
+
+    // change the message
+    message[0]='Z';
+    printf("message %s\n", message);
+    rc=BLS_ZZZ_VERIFY(&SIG,message,&W);
+    if (rc==BLS_OK)
+    {
+        printf("Success: Signature is valid\n");
+    }
+    else
+    {
+        printf("Error: Invalid Signature\n");
+    }
+
+    // Change the signature
+    message[0]='T';
+    SIG.val[0]=5;
+    printf("message %s\n", message);
+    printf("Signature: 0x");
+    OCT_output(&SIG);
+    rc=BLS_ZZZ_VERIFY(&SIG,message,&W);
+    if (rc==BLS_OK)
+    {
+        printf("Success: Signature is valid\n");
+    }
+    else
+    {
+        printf("Error: Invalid Signature\n");
+    }
+
+    return rc;
+}
+
+
+int main()
+{
+#ifdef DEBUG
+    printf("%d bit build\n",CHUNK);
+#endif
+
+    // non random seed value
+    char seed[32] = {0};
+    octet SEED = {sizeof(seed),sizeof(seed),seed};
+    for (int i=0; i<32; i++) SEED.val[i]=i+1;
+    printf("SEED: ");
+    OCT_output(&SEED);
+    printf("\n");
+
+    // initialise random number generator
+    csprng RNG;
+    CREATE_CSPRNG(&RNG,&SEED);
+
+    printf("\nTesting BLS signature for curve ZZZ\n");
+    bls(&RNG);
+
+    KILL_CSPRNG(&RNG);
+}
+
+
diff --git a/examples/testmpin_ZZZ.c.in b/examples/testmpin_ZZZ.c.in
index 0d8827f..8de589b 100644
--- a/examples/testmpin_ZZZ.c.in
+++ b/examples/testmpin_ZZZ.c.in
@@ -22,7 +22,7 @@ under the License.
 
 /* Build executible after installation:
 
-  gcc -std=c99 -g ./testmpin.c -I/opt/amcl/include -L/opt/amcl/lib 
-lamcl_mpin_ZZZ -lamcl_pairing_ZZZ -lamcl_curve_ZZZ -lamcl_core -o testmpin_ZZZ
+  gcc -O0 -g ./testmpin_ZZZ.c $(pkg-config --libs --cflags amcl) -o 
testmpin_ZZZ
 
 */
 
diff --git a/examples/testwcc_ZZZ.c.in b/examples/testwcc_ZZZ.c.in
index c9a031e..7dd165e 100644
--- a/examples/testwcc_ZZZ.c.in
+++ b/examples/testwcc_ZZZ.c.in
@@ -21,7 +21,10 @@ under the License.
 /* Demonstrate WCC with one TA */
 
 /* Build executable after installation:
-   gcc -std=c99 -g testwcc_ZZZ.c -I/opt/amcl/include -L/opt/amcl/lib 
-lamcl_wcc_ZZZ -lamcl_pairing_ZZZ -lamcl_curve_ZZZ -lamcl_core_ZZZ -o 
testwcc_ZZZ */
+
+  gcc -O0 -g ./testwcc_ZZZ.c $(pkg-config --libs --cflags amcl) -o testwcc_ZZZ
+
+*/
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/include/bls.h.in b/include/bls.h.in
new file mode 100644
index 0000000..de179c8
--- /dev/null
+++ b/include/bls.h.in
@@ -0,0 +1,75 @@
+/*
+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.
+*/
+
+/**
+ * @file bls_ZZZ.h
+ * @author Mike Scott
+ * @date 28th Novemebr 2018
+ * @brief BLS Header file
+ *
+ * Allows some user configuration
+ * defines structures
+ * declares functions
+ *
+ */
+
+#ifndef BLS_ZZZ_H
+#define BLS_ZZZ_H
+
+#include "pair_ZZZ.h"
+
+/* Field size is assumed to be greater than or equal to group size */
+
+#define BGS_ZZZ MODBYTES_XXX  /**< BLS Group Size */
+#define BFS_ZZZ MODBYTES_XXX  /**< BLS Field Size */
+
+#define BLS_OK           0  /**< Function completed without error */
+#define BLS_FAIL       -1  /**< Point is NOT on the curve */
+
+/* BLS API functions */
+
+/**    @brief Generate Key Pair
+ *
+       @param RNG  Pointer to a cryptographically secure random number 
generator
+       @param S    Private key
+       @param W    Public Key. W = S*G, where G is fixed generator
+       @return     Zero for success or else an error code
+ */
+int BLS_ZZZ_KEY_PAIR_GENERATE(csprng *RNG,octet* S,octet *W);
+
+/**    @brief Calculate a signature
+ *
+       @param SIG  signature
+       @param m    message to be signed
+       @param S    Private key
+       @return     Zero for success or else an error code
+ */
+int BLS_ZZZ_SIGN(octet *SIG,char *m,octet *S);
+
+/**    @brief Verify a signature
+ *
+       @param SIG  signature
+       @param m    message whose signature is to be verified.
+       @param W    Public key
+       @return     Zero for success or else an error code
+ */
+int BLS_ZZZ_VERIFY(octet *SIG,char *m,octet *W);
+
+#endif
+
diff --git a/include/bls192.h.in b/include/bls192.h.in
new file mode 100644
index 0000000..8bd7fae
--- /dev/null
+++ b/include/bls192.h.in
@@ -0,0 +1,75 @@
+/*
+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.
+*/
+
+/**
+ * @file bls192_ZZZ.h
+ * @author Mike Scott
+ * @date 28th Novemebr 2018
+ * @brief BLS Header file
+ *
+ * Allows some user configuration
+ * defines structures
+ * declares functions
+ *
+ */
+
+#ifndef BLS_ZZZ_H
+#define BLS_ZZZ_H
+
+#include "pair192_ZZZ.h"
+
+/* Field size is assumed to be greater than or equal to group size */
+
+#define BGS_ZZZ MODBYTES_XXX  /**< BLS Group Size */
+#define BFS_ZZZ MODBYTES_XXX  /**< BLS Field Size */
+
+#define BLS_OK           0  /**< Function completed without error */
+#define BLS_FAIL       -1  /**< Point is NOT on the curve */
+
+/* BLS API functions */
+
+/**    @brief Generate Key Pair
+ *
+       @param RNG  Pointer to a cryptographically secure random number 
generator
+       @param S    Private key
+       @param W    Public Key. W = S*G, where G is fixed generator
+       @return     Zero for success or else an error code
+ */
+int BLS_ZZZ_KEY_PAIR_GENERATE(csprng *RNG,octet* S,octet *W);
+
+/**    @brief Calculate a signature
+ *
+       @param SIG  signature
+       @param m    message to be signed
+       @param S    Private key
+       @return     Zero for success or else an error code
+ */
+int BLS_ZZZ_SIGN(octet *SIG,char *m,octet *S);
+
+/**    @brief Verify a signature
+ *
+       @param SIG  signature
+       @param m    message whose signature is to be verified.
+       @param W    Public key
+       @return     Zero for success or else an error code
+ */
+int BLS_ZZZ_VERIFY(octet *SIG,char *m,octet *W);
+
+#endif
+
diff --git a/include/bls256.h.in b/include/bls256.h.in
new file mode 100644
index 0000000..977c4ee
--- /dev/null
+++ b/include/bls256.h.in
@@ -0,0 +1,75 @@
+/*
+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.
+*/
+
+/**
+ * @file bls256_ZZZ.h
+ * @author Mike Scott
+ * @date 28th Novemebr 2018
+ * @brief BLS Header file
+ *
+ * Allows some user configuration
+ * defines structures
+ * declares functions
+ *
+ */
+
+#ifndef BLS_ZZZ_H
+#define BLS_ZZZ_H
+
+#include "pair256_ZZZ.h"
+
+/* Field size is assumed to be greater than or equal to group size */
+
+#define BGS_ZZZ MODBYTES_XXX  /**< BLS Group Size */
+#define BFS_ZZZ MODBYTES_XXX  /**< BLS Field Size */
+
+#define BLS_OK           0  /**< Function completed without error */
+#define BLS_FAIL       -1  /**< Point is NOT on the curve */
+
+/* BLS API functions */
+
+/**    @brief Generate Key Pair
+ *
+       @param RNG  Pointer to a cryptographically secure random number 
generator
+       @param S    Private key
+       @param W    Public Key. W = S*G, where G is fixed generator
+       @return     Zero for success or else an error code
+ */
+int BLS_ZZZ_KEY_PAIR_GENERATE(csprng *RNG,octet* S,octet *W);
+
+/**    @brief Calculate a signature
+ *
+       @param SIG  signature
+       @param m    message to be signed
+       @param S    Private key
+       @return     Zero for success or else an error code
+ */
+int BLS_ZZZ_SIGN(octet *SIG,char *m,octet *S);
+
+/**    @brief Verify a signature
+ *
+       @param SIG  signature
+       @param m    message whose signature is to be verified.
+       @param W    Public key
+       @return     Zero for success or else an error code
+ */
+int BLS_ZZZ_VERIFY(octet *SIG,char *m,octet *W);
+
+#endif
+
diff --git a/include/ecp4.h.in b/include/ecp4.h.in
index 5a0b756..0f9addb 100644
--- a/include/ecp4.h.in
+++ b/include/ecp4.h.in
@@ -14,7 +14,7 @@ typedef struct
 //   int inf; /**< Infinity Flag */
     FP4_YYY x;   /**< x-coordinate of point */
     FP4_YYY y;   /**< y-coordinate of point */
-    FP4_YYY z;
+    FP4_YYY z;   /**< z-coordinate of point */
 } ECP4_ZZZ;
 
 
@@ -146,22 +146,6 @@ extern void ECP4_ZZZ_neg(ECP4_ZZZ *P);
  */
 extern void ECP4_ZZZ_reduce(ECP4_ZZZ *P);
 
-
-/**    @brief Doubles an ECP4 instance P and returns slope
- *
-       @param P ECP4 instance, on exit =2*P
-       @param lam FP4 instance, slope of line
- */
-//extern int ECP4_ZZZ_sdbl(ECP4_ZZZ *P,FP4_YYY *lam);
-/**    @brief Adds ECP4 instance Q to ECP4 instance P and returns slope
- *
-       @param P ECP4 instance, on exit =P+Q
-       @param Q ECP4 instance to be added to P
-       @param lam FP4 instance, slope of line
- */
-//extern int ECP4_ZZZ_sadd(ECP4_ZZZ *P,ECP4_ZZZ *Q,FP4_YYY *lam);
-
-
 /**    @brief Doubles an ECP4 instance P
  *
        @param P ECP4 instance, on exit =2*P
@@ -218,7 +202,7 @@ extern void ECP4_ZZZ_mul8(ECP4_ZZZ *P,ECP4_ZZZ *Q,BIG_XXX 
*b);
 /**    @brief Maps random BIG to curve point of correct order
  *
        @param P ECP4 instance of correct order
-       @param W OCTET byte array to be mapped
+       @param w OCTET byte array to be mapped
  */
 extern void ECP4_ZZZ_mapit(ECP4_ZZZ *P,octet *w);
 
@@ -229,4 +213,4 @@ extern void ECP4_ZZZ_mapit(ECP4_ZZZ *P,octet *w);
 extern void ECP4_ZZZ_generator(ECP4_ZZZ *G);
 
 
-#endif
\ No newline at end of file
+#endif
diff --git a/include/ecp8.h.in b/include/ecp8.h.in
index 2e3a786..d9bb3f6 100644
--- a/include/ecp8.h.in
+++ b/include/ecp8.h.in
@@ -160,22 +160,6 @@ extern void ECP8_ZZZ_neg(ECP8_ZZZ *P);
  */
 extern void ECP8_ZZZ_reduce(ECP8_ZZZ *P);
 
-
-/**    @brief Doubles an ECP8 instance P and returns slope
- *
-       @param P ECP8 instance, on exit =2*P
-       @param lam FP8 instance, slope of line
- */
-//extern int ECP8_ZZZ_sdbl(ECP8_ZZZ *P,FP8_YYY *lam);
-/**    @brief Adds ECP8 instance Q to ECP8 instance P and returns slope
- *
-       @param P ECP8 instance, on exit =P+Q
-       @param Q ECP8 instance to be added to P
-       @param lam FP8 instance, slope of line
- */
-//extern int ECP8_ZZZ_sadd(ECP8_ZZZ *P,ECP8_ZZZ *Q,FP8_YYY *lam);
-
-
 /**    @brief Doubles an ECP8 instance P
  *
        @param P ECP8 instance, on exit =2*P
@@ -232,7 +216,7 @@ extern void ECP8_ZZZ_mul16(ECP8_ZZZ *P,ECP8_ZZZ *Q,BIG_XXX 
*b);
 /**    @brief Maps random BIG to curve point of correct order
  *
        @param P ECP8 instance of correct order
-       @param W OCTET byte array to be mapped
+       @param w OCTET byte array to be mapped
  */
 extern void ECP8_ZZZ_mapit(ECP8_ZZZ *P,octet *w);
 
@@ -243,4 +227,4 @@ extern void ECP8_ZZZ_mapit(ECP8_ZZZ *P,octet *w);
 extern void ECP8_ZZZ_generator(ECP8_ZZZ *G);
 
 
-#endif
\ No newline at end of file
+#endif
diff --git a/include/fp24.h.in b/include/fp24.h.in
index 3a9fbd3..084437c 100644
--- a/include/fp24.h.in
+++ b/include/fp24.h.in
@@ -12,7 +12,7 @@ typedef struct
     FP8_YYY a; /**< first part of FP12 */
     FP8_YYY b; /**< second part of FP12 */
     FP8_YYY c; /**< third part of FP12 */
-    int type;
+    int type;  /**< Type */
 } FP24_YYY;
 
 extern const BIG_XXX Fra_YYY; /**< real part of BN curve Frobenius Constant */
diff --git a/include/fp48.h.in b/include/fp48.h.in
index 93dc50d..c155358 100644
--- a/include/fp48.h.in
+++ b/include/fp48.h.in
@@ -12,7 +12,7 @@ typedef struct
     FP16_YYY a; /**< first part of FP12 */
     FP16_YYY b; /**< second part of FP12 */
     FP16_YYY c; /**< third part of FP12 */
-    int type;
+    int type;   /**< Type */
 } FP48_YYY;
 
 extern const BIG_XXX Fra_YYY; /**< real part of BN curve Frobenius Constant */
diff --git a/include/mpin192.h.in b/include/mpin192.h.in
index c457bd2..6e58d14 100644
--- a/include/mpin192.h.in
+++ b/include/mpin192.h.in
@@ -18,7 +18,7 @@ under the License.
 */
 
 /**
- * @file mpin_ZZZ.h
+ * @file mpin192_ZZZ.h
  * @author Mike Scott and Kealan McCusker
  * @date 2nd June 2015
  * @brief M-Pin Header file
@@ -58,7 +58,13 @@ under the License.
 
 /* MPIN primitives */
 
-
+/**    @brief Generate Y=H(s,O), where s is epoch time, O is an octet, and 
H(.) is a hash function
+ *
+       @param h is the hash type
+       @param t is epoch time in seconds
+       @param O is an input octet
+       @param Y is the output octet
+*/
 void MPIN_ZZZ_GET_Y(int h,int t,octet *O,octet *Y);
 /**    @brief Extract a PIN number from a client secret
  *
diff --git a/include/mpin256.h.in b/include/mpin256.h.in
index 3307e57..3e8e71d 100644
--- a/include/mpin256.h.in
+++ b/include/mpin256.h.in
@@ -18,7 +18,7 @@ under the License.
 */
 
 /**
- * @file mpin_ZZZ.h
+ * @file mpin256_ZZZ.h
  * @author Mike Scott and Kealan McCusker
  * @date 2nd June 2015
  * @brief M-Pin Header file
@@ -58,7 +58,13 @@ under the License.
 
 /* MPIN primitives */
 
-
+/**    @brief Generate Y=H(s,O), where s is epoch time, O is an octet, and 
H(.) is a hash function
+ *
+       @param h is the hash type
+       @param t is epoch time in seconds
+       @param O is an input octet
+       @param Y is the output octet
+*/
 void MPIN_ZZZ_GET_Y(int h,int t,octet *O,octet *Y);
 /**    @brief Extract a PIN number from a client secret
  *
diff --git a/src/bls.c.in b/src/bls.c.in
new file mode 100644
index 0000000..277d3cd
--- /dev/null
+++ b/src/bls.c.in
@@ -0,0 +1,93 @@
+/*
+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.
+*/
+
+/* Boneh-Lynn-Shacham signature 128-bit API */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include "bls_ZZZ.h"
+
+/* hash a message to an ECP point, using SHA3 */
+
+static void BLS_HASHIT(ECP_ZZZ *P,char *m)
+{
+    int i;
+    sha3 hs;
+    char h[MODBYTES_XXX];
+    octet HM= {0,sizeof(h),h};
+    SHA3_init(&hs,SHAKE256);
+    for (i=0; m[i]!=0; i++) SHA3_process(&hs,m[i]);
+    SHA3_shake(&hs,HM.val,MODBYTES_XXX);
+    HM.len=MODBYTES_XXX;
+    ECP_ZZZ_mapit(P,&HM);
+}
+
+/* generate key pair, private key S, public key W */
+
+int BLS_ZZZ_KEY_PAIR_GENERATE(csprng *RNG,octet* S,octet *W)
+{
+    ECP2_ZZZ G;
+    BIG_XXX s,q;
+    BIG_XXX_rcopy(q,CURVE_Order_ZZZ);
+    ECP2_ZZZ_generator(&G);
+    BIG_XXX_randomnum(s,q,RNG);
+    BIG_XXX_toBytes(S->val,s);
+    S->len=MODBYTES_XXX;
+    PAIR_ZZZ_G2mul(&G,s);
+    ECP2_ZZZ_toOctet(W,&G);
+    return BLS_OK;
+}
+
+/* Sign message m using private key S to produce signature SIG */
+
+int BLS_ZZZ_SIGN(octet *SIG,char *m,octet *S)
+{
+    BIG_XXX s;
+    ECP_ZZZ D;
+    BLS_HASHIT(&D,m);
+    BIG_XXX_fromBytes(s,S->val);
+    PAIR_ZZZ_G1mul(&D,s);
+    ECP_ZZZ_toOctet(SIG,&D,true); /* compress output */
+    return BLS_OK;
+}
+
+/* Verify signature of message m, the signature SIG, and the public key W */
+
+int BLS_ZZZ_VERIFY(octet *SIG,char *m,octet *W)
+{
+    FP12_YYY v;
+    ECP2_ZZZ G,PK;
+    ECP_ZZZ D,HM;
+    BLS_HASHIT(&HM,m);
+    ECP_ZZZ_fromOctet(&D,SIG);
+    ECP2_ZZZ_generator(&G);
+    ECP2_ZZZ_fromOctet(&PK,W);
+    ECP_ZZZ_neg(&D);
+
+
+    PAIR_ZZZ_double_ate(&v,&G,&D,&PK,&HM);
+
+    PAIR_ZZZ_fexp(&v);
+
+    if (FP12_YYY_isunity(&v)) return BLS_OK;
+    return BLS_FAIL;
+}
+
diff --git a/src/bls192.c.in b/src/bls192.c.in
new file mode 100644
index 0000000..bab100c
--- /dev/null
+++ b/src/bls192.c.in
@@ -0,0 +1,91 @@
+/*
+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.
+*/
+
+/* Boneh-Lynn-Shacham signature 192-bit API */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include "bls192_ZZZ.h"
+
+/* hash a message to an ECP point, using SHA3 */
+
+static void BLS_HASHIT(ECP_ZZZ *P,char *m)
+{
+    int i;
+    sha3 hs;
+    char h[MODBYTES_XXX];
+    octet HM= {0,sizeof(h),h};
+    SHA3_init(&hs,SHAKE256);
+    for (i=0; m[i]!=0; i++) SHA3_process(&hs,m[i]);
+    SHA3_shake(&hs,HM.val,MODBYTES_XXX);
+    HM.len=MODBYTES_XXX;
+    ECP_ZZZ_mapit(P,&HM);
+}
+
+/* generate key pair, private key S, public key W */
+
+int BLS_ZZZ_KEY_PAIR_GENERATE(csprng *RNG,octet* S,octet *W)
+{
+    ECP4_ZZZ G;
+    BIG_XXX s,q;
+    BIG_XXX_rcopy(q,CURVE_Order_ZZZ);
+    ECP4_ZZZ_generator(&G);
+    BIG_XXX_randomnum(s,q,RNG);
+    BIG_XXX_toBytes(S->val,s);
+    S->len=MODBYTES_XXX;
+    PAIR_ZZZ_G2mul(&G,s);
+    ECP4_ZZZ_toOctet(W,&G);
+    return BLS_OK;
+}
+
+/* Sign message m using private key S to produce signature SIG */
+
+int BLS_ZZZ_SIGN(octet *SIG,char *m,octet *S)
+{
+    BIG_XXX s;
+    ECP_ZZZ D;
+    BLS_HASHIT(&D,m);
+    BIG_XXX_fromBytes(s,S->val);
+    PAIR_ZZZ_G1mul(&D,s);
+    ECP_ZZZ_toOctet(SIG,&D,true); /* compress output */
+    return BLS_OK;
+}
+
+/* Verify signature given message m, the signature SIG, and the public key W */
+
+int BLS_ZZZ_VERIFY(octet *SIG,char *m,octet *W)
+{
+    FP24_YYY v;
+    ECP4_ZZZ G,PK;
+    ECP_ZZZ D,HM;
+    BLS_HASHIT(&HM,m);
+    ECP_ZZZ_fromOctet(&D,SIG);
+    ECP4_ZZZ_generator(&G);
+    ECP4_ZZZ_fromOctet(&PK,W);
+    ECP_ZZZ_neg(&D);
+
+    PAIR_ZZZ_double_ate(&v,&G,&D,&PK,&HM);
+
+    PAIR_ZZZ_fexp(&v);
+    if (FP24_YYY_isunity(&v)) return BLS_OK;
+    return BLS_FAIL;
+}
+
diff --git a/src/bls256.c.in b/src/bls256.c.in
new file mode 100644
index 0000000..6b250d1
--- /dev/null
+++ b/src/bls256.c.in
@@ -0,0 +1,92 @@
+/*
+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.
+*/
+
+/* Boneh-Lynn-Shacham signature 256-bit API */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include "bls256_ZZZ.h"
+
+/* hash a message to an ECP point, using SHA3 */
+
+static void BLS_HASHIT(ECP_ZZZ *P,char *m)
+{
+    int i;
+    sha3 hs;
+    char h[MODBYTES_XXX];
+    octet HM= {0,sizeof(h),h};
+    SHA3_init(&hs,SHAKE256);
+    for (i=0; m[i]!=0; i++) SHA3_process(&hs,m[i]);
+    SHA3_shake(&hs,HM.val,MODBYTES_XXX);
+    HM.len=MODBYTES_XXX;
+    ECP_ZZZ_mapit(P,&HM);
+}
+
+/* generate key pair, private key S, public key W */
+
+int BLS_ZZZ_KEY_PAIR_GENERATE(csprng *RNG,octet* S,octet *W)
+{
+    ECP8_ZZZ G;
+    BIG_XXX s,q;
+    BIG_XXX_rcopy(q,CURVE_Order_ZZZ);
+    ECP8_ZZZ_generator(&G);
+    BIG_XXX_randomnum(s,q,RNG);
+    BIG_XXX_toBytes(S->val,s);
+    S->len=MODBYTES_XXX;
+    PAIR_ZZZ_G2mul(&G,s);
+    ECP8_ZZZ_toOctet(W,&G);
+    return BLS_OK;
+}
+
+/* Sign message m using private key S to produce signature SIG */
+
+int BLS_ZZZ_SIGN(octet *SIG,char *m,octet *S)
+{
+    BIG_XXX s;
+    ECP_ZZZ D;
+    BLS_HASHIT(&D,m);
+    BIG_XXX_fromBytes(s,S->val);
+    PAIR_ZZZ_G1mul(&D,s);
+    ECP_ZZZ_toOctet(SIG,&D,true); /* compress output */
+    return BLS_OK;
+}
+
+/* Verify signature given message m, the signature SIG, and the public key W */
+
+int BLS_ZZZ_VERIFY(octet *SIG,char *m,octet *W)
+{
+    FP48_YYY v;
+    ECP8_ZZZ G,PK;
+    ECP_ZZZ D,HM;
+    BLS_HASHIT(&HM,m);
+    ECP_ZZZ_fromOctet(&D,SIG);
+    ECP8_ZZZ_generator(&G);
+    ECP8_ZZZ_fromOctet(&PK,W);
+    ECP_ZZZ_neg(&D);
+
+    PAIR_ZZZ_double_ate(&v,&G,&D,&PK,&HM);
+
+    PAIR_ZZZ_fexp(&v);
+
+    if (FP48_YYY_isunity(&v)) return BLS_OK;
+    return BLS_FAIL;
+}
+
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index a192ab1..cf8f11d 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -204,6 +204,13 @@ foreach(curve ${AMCL_CURVE})
       amcl_curve_test(${curve} test_wcc_bad_receiver_key_${TC} 
test_wcc_bad_receiver_key_ZZZ.c.in amcl_wcc_${TC} "SUCCESS")
     endif()
 
+    ################################################
+    # BLS Tests
+    ################################################
+    if(BUILD_BLS)
+      amcl_curve_test(${curve} test_bls_${TC} test_bls_ZZZ.c.in amcl_bls_${TC} 
"SUCCESS")
+    endif()
+    
   endif()
 endforeach()
 
diff --git a/test/test_bls_ZZZ.c.in b/test/test_bls_ZZZ.c.in
new file mode 100644
index 0000000..c35c75b
--- /dev/null
+++ b/test/test_bls_ZZZ.c.in
@@ -0,0 +1,145 @@
+/*
+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.
+*/
+
+/* smoke test for BLS */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "config_curve_ZZZ.h"
+#include "randapi.h"
+
+#if CURVE_SECURITY_ZZZ == 128
+#include "bls_ZZZ.h"
+#elif CURVE_SECURITY_ZZZ == 192
+#include "bls192_ZZZ.h"
+#elif CURVE_SECURITY_ZZZ == 256
+#include "bls256_ZZZ.h"
+#endif
+
+// Support multiple security levels
+#if CURVE_SECURITY_ZZZ == 128
+#define G2LEN 4*BFS_ZZZ
+#elif CURVE_SECURITY_ZZZ == 192
+#define G2LEN 8*BFS_ZZZ
+#elif CURVE_SECURITY_ZZZ == 256
+#define G2LEN 16*BFS_ZZZ
+#endif
+
+static char message[]="This is a test message";
+
+int bls(csprng *RNG)
+{
+    int rc;
+    char s[BGS_ZZZ];
+    char w[G2LEN];
+    char sig[BFS_ZZZ+1];
+    octet S= {0,sizeof(s),s};
+    octet W= {0,sizeof(w),w};
+    octet SIG= {0,sizeof(sig),sig};
+
+    BLS_ZZZ_KEY_PAIR_GENERATE(RNG,&S,&W);
+
+    printf("Private key: 0x");
+    OCT_output(&S);
+    printf("Public key: 0x");
+    OCT_output(&W);
+
+    BLS_ZZZ_SIGN(&SIG,message,&S);
+    printf("Signature: 0x");
+    OCT_output(&SIG);
+
+    rc=BLS_ZZZ_VERIFY(&SIG,message,&W);
+    if (rc==BLS_OK)
+    {
+        printf("Test Passed valid Signature / message\n");
+    }
+    else
+    {
+        printf("Test Failed valid Signature / message\n");
+        return 1;
+    }
+
+    // change the message
+    message[0]='Z';
+    printf("message %s\n", message);
+    rc=BLS_ZZZ_VERIFY(&SIG,message,&W);
+    if (rc!=BLS_OK)
+    {
+        printf("Test Passed valid Signature / invalid message\n");
+    }
+    else
+    {
+        printf("Test Failed valid Signature / invalid message\n");
+        return 1;
+    }
+
+    // Invalid signature
+    message[0]='T';
+    SIG.val[0]=5;
+    printf("message %s\n", message);
+    printf("Signature: 0x");
+    OCT_output(&SIG);
+    rc=BLS_ZZZ_VERIFY(&SIG,message,&W);
+    if (rc!=BLS_OK)    
+    {
+        printf("Test Passed invalid Signature / valid message\n");
+    }
+    else
+    {
+        printf("Test Failed invalid Signature / valid message\n");
+        return 1;
+    }
+
+    return 0;
+}
+
+
+int main()
+{
+#ifdef DEBUG
+    printf("%d bit build\n",CHUNK);
+#endif
+
+    // non random seed value
+    char seed[32] = {0};
+    octet SEED = {sizeof(seed),sizeof(seed),seed};
+    for (int i=0; i<32; i++) SEED.val[i]=i+1;
+    printf("SEED: ");
+    OCT_output(&SEED);
+    printf("\n");
+
+    // initialise random number generator
+    csprng RNG;
+    CREATE_CSPRNG(&RNG,&SEED);
+
+    printf("\nTesting BLS signature for curve ZZZ\n");
+    int rc = bls(&RNG);
+    if (rc == 0)
+    {
+        printf("SUCCESS");
+    }
+    else
+    {
+        printf("FAILURE");
+    }
+
+    KILL_CSPRNG(&RNG);
+}
+
+
diff --git a/test/test_fp12_arithmetics_YYY.c.in 
b/test/test_fp12_arithmetics_YYY.c.in
index 97b993c..162001b 100644
--- a/test/test_fp12_arithmetics_YYY.c.in
+++ b/test/test_fp12_arithmetics_YYY.c.in
@@ -395,40 +395,40 @@ int main(int argc, char** argv)
             }
         }
         // Test s-multiplication for D-TYPE
-       /*
-        if (!strncmp(line,FP12smuldtypeline, strlen(FP12smuldtypeline)))
-        {
-            len = strlen(FP12smuldtypeline);
-            linePtr = line + len;
-            read_FP12_YYY(&FP12smul_dtype,linePtr);
-            FP12_YYY_copy(&FP12aux1,FP_12);
-            FP12_YYY_smul(&FP12aux1,&FP_12_smul_y_dtype,D_TYPE);
-            FP12_YYY_reduce(&FP12aux1);
-            FP12_YYY_norm(&FP12aux1);
-            if(!FP12_YYY_equals(&FP12aux1,&FP12smul_dtype))
+        /*
+            if (!strncmp(line,FP12smuldtypeline, strlen(FP12smuldtypeline)))
             {
-                printf("ERROR computing s-multiplication for D-TYPE, line 
%d\n",i);
-                exit(EXIT_FAILURE);
+                len = strlen(FP12smuldtypeline);
+                linePtr = line + len;
+                read_FP12_YYY(&FP12smul_dtype,linePtr);
+                FP12_YYY_copy(&FP12aux1,FP_12);
+                FP12_YYY_smul(&FP12aux1,&FP_12_smul_y_dtype,D_TYPE);
+                FP12_YYY_reduce(&FP12aux1);
+                FP12_YYY_norm(&FP12aux1);
+                if(!FP12_YYY_equals(&FP12aux1,&FP12smul_dtype))
+                {
+                    printf("ERROR computing s-multiplication for D-TYPE, line 
%d\n",i);
+                    exit(EXIT_FAILURE);
+                }
             }
-        }
 
-        // Test s-multiplication for M-TYPE
-        if (!strncmp(line,FP12smulmtypeline, strlen(FP12smulmtypeline)))
-        {
-            len = strlen(FP12smulmtypeline);
-            linePtr = line + len;
-            read_FP12_YYY(&FP12smul_mtype,linePtr);
-            FP12_YYY_copy(&FP12aux1,FP_12);
-            FP12_YYY_smul(&FP12aux1,&FP_12_smul_y_mtype,M_TYPE);
-            FP12_YYY_reduce(&FP12aux1);
-            FP12_YYY_norm(&FP12aux1);
-            if(!FP12_YYY_equals(&FP12aux1,&FP12smul_mtype))
+            // Test s-multiplication for M-TYPE
+            if (!strncmp(line,FP12smulmtypeline, strlen(FP12smulmtypeline)))
             {
-                printf("ERROR computing s-multiplication for M-TYPE, line 
%d\n",i);
-                exit(EXIT_FAILURE);
+                len = strlen(FP12smulmtypeline);
+                linePtr = line + len;
+                read_FP12_YYY(&FP12smul_mtype,linePtr);
+                FP12_YYY_copy(&FP12aux1,FP_12);
+                FP12_YYY_smul(&FP12aux1,&FP_12_smul_y_mtype,M_TYPE);
+                FP12_YYY_reduce(&FP12aux1);
+                FP12_YYY_norm(&FP12aux1);
+                if(!FP12_YYY_equals(&FP12aux1,&FP12smul_mtype))
+                {
+                    printf("ERROR computing s-multiplication for M-TYPE, line 
%d\n",i);
+                    exit(EXIT_FAILURE);
+                }
             }
-        }
-       */
+        */
         // Test inverse fuction
         if (!strncmp(line,FP12invline, strlen(FP12invline)))
         {
diff --git a/test/test_fp24_arithmetics_YYY.c.in 
b/test/test_fp24_arithmetics_YYY.c.in
index cdbbeb2..6e6c66c 100644
--- a/test/test_fp24_arithmetics_YYY.c.in
+++ b/test/test_fp24_arithmetics_YYY.c.in
@@ -368,35 +368,35 @@ int main(int argc, char** argv)
             }
         }
         // Test s-multiplication for D-TYPE
-       /*
-        if (!strncmp(line,FP24smuldtypeline, strlen(FP24smuldtypeline)))
-        {
-            len = strlen(FP24smuldtypeline);
-            linePtr = line + len;
-            read_FP24_YYY(&FP24smul_dtype,linePtr);
-            FP24_YYY_copy(&FP24aux1,FP_24);
-            FP24_YYY_smul(&FP24aux1,&FP_24_smul_y_dtype,D_TYPE);
-            if(!FP24_YYY_equals(&FP24aux1,&FP24smul_dtype))
+        /*
+            if (!strncmp(line,FP24smuldtypeline, strlen(FP24smuldtypeline)))
             {
-                printf("ERROR computing s-multiplication for D-TYPE, line 
%d\n",i);
-                exit(EXIT_FAILURE);
+                len = strlen(FP24smuldtypeline);
+                linePtr = line + len;
+                read_FP24_YYY(&FP24smul_dtype,linePtr);
+                FP24_YYY_copy(&FP24aux1,FP_24);
+                FP24_YYY_smul(&FP24aux1,&FP_24_smul_y_dtype,D_TYPE);
+                if(!FP24_YYY_equals(&FP24aux1,&FP24smul_dtype))
+                {
+                    printf("ERROR computing s-multiplication for D-TYPE, line 
%d\n",i);
+                    exit(EXIT_FAILURE);
+                }
             }
-        }
-        // Test s-multiplication for M-TYPE
-        if (!strncmp(line,FP24smulmtypeline, strlen(FP24smulmtypeline)))
-        {
-            len = strlen(FP24smulmtypeline);
-            linePtr = line + len;
-            read_FP24_YYY(&FP24smul_mtype,linePtr);
-            FP24_YYY_copy(&FP24aux1,FP_24);
-            FP24_YYY_smul(&FP24aux1,&FP_24_smul_y_mtype,M_TYPE);
-            if(!FP24_YYY_equals(&FP24aux1,&FP24smul_mtype))
+            // Test s-multiplication for M-TYPE
+            if (!strncmp(line,FP24smulmtypeline, strlen(FP24smulmtypeline)))
             {
-                printf("ERROR computing s-multiplication for M-TYPE, line 
%d\n",i);
-                exit(EXIT_FAILURE);
+                len = strlen(FP24smulmtypeline);
+                linePtr = line + len;
+                read_FP24_YYY(&FP24smul_mtype,linePtr);
+                FP24_YYY_copy(&FP24aux1,FP_24);
+                FP24_YYY_smul(&FP24aux1,&FP_24_smul_y_mtype,M_TYPE);
+                if(!FP24_YYY_equals(&FP24aux1,&FP24smul_mtype))
+                {
+                    printf("ERROR computing s-multiplication for M-TYPE, line 
%d\n",i);
+                    exit(EXIT_FAILURE);
+                }
             }
-        }
-       */
+        */
         // Test inverse fuction
         if (!strncmp(line,FP24invline, strlen(FP24invline)))
         {
diff --git a/test/test_fp_arithmetics_YYY.c.in 
b/test/test_fp_arithmetics_YYY.c.in
index 805c633..6709444 100644
--- a/test/test_fp_arithmetics_YYY.c.in
+++ b/test/test_fp_arithmetics_YYY.c.in
@@ -351,25 +351,25 @@ int main(int argc, char** argv)
             }
         }
         // modular exponentiation
-       /*
-        if (!strncmp(line,FPexpline, strlen(FPexpline)))
-        {
-            len = strlen(FPexpline);
-            linePtr = line + len;
-            read_FP_YYY(&FPexp,linePtr);
-            FP_YYY_copy(&supp,&FP_1);
-            FP_YYY_reduce(&supp);
-            FP_YYY_redc(bigsupp,&FP_2);
-            BIG_XXX_norm(bigsupp);
-            FP_YYY_pow(&supp,&supp,bigsupp);
-            FP_YYY_reduce(&supp);
-            if(!FP_YYY_equals(&supp,&FPexp))
+        /*
+            if (!strncmp(line,FPexpline, strlen(FPexpline)))
             {
-                printf("ERROR in modular exponentiation, line %d\n",i);
-                exit(EXIT_FAILURE);
+                len = strlen(FPexpline);
+                linePtr = line + len;
+                read_FP_YYY(&FPexp,linePtr);
+                FP_YYY_copy(&supp,&FP_1);
+                FP_YYY_reduce(&supp);
+                FP_YYY_redc(bigsupp,&FP_2);
+                BIG_XXX_norm(bigsupp);
+                FP_YYY_pow(&supp,&supp,bigsupp);
+                FP_YYY_reduce(&supp);
+                if(!FP_YYY_equals(&supp,&FPexp))
+                {
+                    printf("ERROR in modular exponentiation, line %d\n",i);
+                    exit(EXIT_FAILURE);
+                }
             }
-        }
-       */
+        */
     }
     fclose(fp);
 

Reply via email to