Fix building with `MBEDTLS_TEST_HOOKS` enabled

Fix building by adding `common.c` to the build scripts (both make and Cmake).

Also reworks the hook function pointer (also renamed to `err_add_hook`) to be
a static local to `common.c` with a setter function to set the pointer to a
checking function.

Signed-off-by: Chris Jones <christopher.jones@arm.com>
diff --git a/library/common.c b/library/common.c
index 9f901f0..4273600 100644
--- a/library/common.c
+++ b/library/common.c
@@ -17,11 +17,20 @@
  *  limitations under the License.
  */
 
+#include "common.h"
+
+#include <stddef.h>
+
 #if defined(MBEDTLS_TEST_HOOKS)
-void (*mbedtls_test_err_add_hook)( int, int, const char *, int );
-int mbedtls_err_add( int high, int low, const char *file, int line ) {
-    if( mbedtls_test_err_add_hook != NULL )
-        (*mbedtls_test_err_add_hook)( high, low, file, line );
+static void (*err_add_hook)( int, int, const char *, int );
+void mbedtls_set_err_add_hook(void *hook)
+{
+    err_add_hook = hook;
+}
+int mbedtls_err_add( int high, int low, const char *file, int line )
+{
+    if( err_add_hook != NULL )
+        (*err_add_hook)( high, low, file, line );
     return ( high + low );
 }
 #endif