Procházet zdrojové kódy

Merge branch 'feature/wiener' into fix/posix

Michele Orrù před 11 roky
rodič
revize
f3fa5efd0f

+ 5 - 1
configure.ac

@@ -25,4 +25,8 @@ AC_FUNC_ERROR_AT_LINE
 AC_FUNC_MALLOC
 #AC_CHECK_FUNCS([dup2 setlocale strdup])
 
-AC_OUTPUT([Makefile src/Makefile src/questions/Makefile src/apps/Makefile src/questions/tests/Makefile ])
+AC_OUTPUT([Makefile
+           src/Makefile src/questions/Makefile
+           src/apps/Makefile
+           src/tests/Makefile src/questions/tests/Makefile
+])

+ 1 - 1
src/Makefile.am

@@ -1,4 +1,4 @@
-SUBDIRS = questions/ apps/
+SUBDIRS = questions/ apps/ tests/
 
 CC = clang
 

+ 0 - 3
src/include/qa/qa.h

@@ -11,9 +11,6 @@ struct qa_conf {
 };
 
 
-extern BIO* bio_out;
-extern BIO* bio_err;
-
 int qa_init(const struct qa_conf* args);
 
 X509* get_local_cert(const char *src);

+ 5 - 2
src/include/qa/qa_sock.h

@@ -1,9 +1,12 @@
 #ifndef _QA_SOCK_H_
 #define _QA_SOCK_H_
 
-#include "qa.h"
+#include "qa/qa.h"
 
-int init_client(const struct qa_conf *options);
+extern BIO* bio_out;
+extern BIO* bio_err;
+
+int init_client(const char *host, const char *port);
 
 int host_port(char *uri, char **host, char **service);
 

+ 7 - 0
src/qa_sock.c

@@ -14,10 +14,17 @@
 #include <openssl/ssl.h>
 
 #include "qa/qa.h"
+#include "qa/qa_sock.h"
 
 #define SOCKET_PROTOCOL 0
 #define INVALID_SOCKET  (-1)
 
+/** BIO wrapper around stdout */
+BIO* bio_out;
+/** BIO wrapper around srderr */
+BIO* bio_err;
+
+
 /**
  * \brief Converts a uri into a tuple {host, service}.
  *

+ 1 - 1
src/questions/Makefile.am

@@ -1,4 +1,4 @@
-SUBDIRS = tests
+SUBDIRS = tests/
 
 AM_CFLAGS = -I ../include/
 AM_LDFLAGS = -lssl -lcrypto

+ 0 - 1
src/questions/tests/Makefile.am

@@ -5,7 +5,6 @@ AM_LDFLAGS = -lcrypto -lssl -L ../libquestions.a
 check_PROGRAMS = test_qstrings test_qarith
 
 test_qstrings_SOURCES = test_qstrings.c
-
 test_qarith_SOURCES = test_qarith.c
 
 TESTS = test_qstrings test_qarith

+ 7 - 0
src/questions/wiener.c

@@ -1,5 +1,12 @@
 /**
  * \file wiener.c
+ * \brief An implementation of Wiener's Attack using bignums.
+ *
+ * Wiener's atttack states that:
+ * given N = pq the public modulus, the couple e, d . ed ≡ 1 (mod φ(N))
+ * respectively the private and public exponent,
+ * given p < q < 2p and d < ⅓ ⁴√N,
+ * one can efficently recover d knowing only <N, e>.
  *
  */
 #include <math.h>

+ 2 - 2
src/tests/test_qa_sock.c

@@ -7,8 +7,8 @@
 #include <openssl/ssl.h>
 #include <openssl/x509.h>
 
-#include "qa.h"
-#include "qa_sock.h"
+#include "qa/qa.h"
+#include "qa/qa_sock.h"
 
 FILE* ferr;