First complete compile.

This commit is contained in:
Ren RenJuan 2013-12-31 23:36:05 +00:00
parent ffd2ba5ebb
commit b03d692d5c
2 changed files with 17 additions and 16 deletions

View File

@ -48,7 +48,7 @@ test_execs = $(subst .o,,$(test_objs))
calc_deps = \ calc_deps = \
$(CC) -MT '$(build_obj_dir)/$(basename $(notdir $@)).o $@' -MF $@ -MM $(CPPFLAGS) $(INCLUDE_DIR) $< $(CC) -MT '$(build_obj_dir)/$(basename $(notdir $@)).o $@' -MF $@ -MM $(CPPFLAGS) $(INCLUDE_DIR) $<
all: dirs $(objs) $(BUILD_LIB_DIR)/libAusreg_EPP_toolkit.so all: dirs $(objs) $(BUILD_LIB_DIR)/AusRegEPPTK.so
%.d: %.c %.d: %.c
$(calc_deps) $(calc_deps)
@ -103,14 +103,15 @@ dirs:
-mkdir -p $(BUILD_LIB_DIR) -mkdir -p $(BUILD_LIB_DIR)
-mkdir -p $(BUILD_OBJ_DIR) -mkdir -p $(BUILD_OBJ_DIR)
$(BUILD_LIB_DIR)/libAusreg_EPP_toolkit.so: $(objs) AusRegEPPTK.so:
$(BUILD_LIB_DIR)/AusRegEPPTK.so: $(objs)
$(CXX) $(LDFLAGS) $(SHARED_CXXFLAGS) -shared $^ -o $@ $(CXX) $(LDFLAGS) $(SHARED_CXXFLAGS) -shared $^ -o $@
doc: doc:
doxygen etc/Doxyfile doxygen etc/Doxyfile
clean: clean:
$(RM) $(objs) $(BUILD_LIB_DIR)/libAusreg_EPP_toolkit.so *~ $(RM) $(objs) $(BUILD_LIB_DIR)/AusRegEPPTK.so *~
$(RM) -r $(BUILD_OBJ_DIR) $(RM) -r $(BUILD_OBJ_DIR)
$(RM) -r $(BUILD_LIB_DIR) $(RM) -r $(BUILD_LIB_DIR)

View File

@ -32,36 +32,36 @@ TLSContext::TLSContext(const string& private_key_file,
{ {
SSL_load_error_strings(); SSL_load_error_strings();
SSL_library_init(); SSL_library_init();
SSL_METHOD *meth = TLSv1_client_method(); const SSL_METHOD *meth = TLSv1_client_method();
if (meth == NULL) if (meth == NULL)
throw SSLException("Error initialising SSL method"); throw SSLException("Error initialising SSL method");
// SSL Context // SSL Context
SSL_CTX *local_ctx = SSL_CTX_new(meth); const SSL_CTX *local_ctx = SSL_CTX_new(meth);
if (local_ctx == NULL) if (local_ctx == NULL)
{ {
throw SSLException ("Error initialising SSL context"); throw SSLException ("Error initialising SSL context");
} }
// SSL Ciphers // SSL Ciphers
int i = SSL_CTX_set_cipher_list(local_ctx, "TLSv1"); int i = SSL_CTX_set_cipher_list((SSL_CTX*)local_ctx, "TLSv1");
if (i == -1) if (i == -1)
{ {
SSL_CTX_free(local_ctx); SSL_CTX_free((SSL_CTX *)local_ctx);
throw SSLException( throw SSLException(
"There was a problem initialising the SSL cipher list"); "There was a problem initialising the SSL cipher list");
} }
SSL_CTX_set_default_passwd_cb_userdata(local_ctx, SSL_CTX_set_default_passwd_cb_userdata((SSL_CTX *)local_ctx,
static_cast<void*>(const_cast<char*>(password.c_str()))); static_cast<void*>(const_cast<char*>(password.c_str())));
SSL_CTX_set_default_passwd_cb(local_ctx, getPassword); SSL_CTX_set_default_passwd_cb((SSL_CTX *)local_ctx, getPassword);
i = SSL_CTX_use_PrivateKey_file(local_ctx, i = SSL_CTX_use_PrivateKey_file((SSL_CTX *)local_ctx,
private_key_file.c_str(), private_key_file.c_str(),
SSL_FILETYPE_PEM); SSL_FILETYPE_PEM);
if (i == -1) if (i == -1)
{ {
SSL_CTX_free(local_ctx); SSL_CTX_free((SSL_CTX *)local_ctx);
throw SSLException( throw SSLException(
"There was a problem initialising SSL the private key '" "There was a problem initialising SSL the private key '"
+ private_key_file + "'"); + private_key_file + "'");
@ -69,23 +69,23 @@ TLSContext::TLSContext(const string& private_key_file,
// Load the public certificate for our key. // Load the public certificate for our key.
// Replace with // Replace with
i = SSL_CTX_use_certificate_chain_file(local_ctx, cert_file.c_str()); i = SSL_CTX_use_certificate_chain_file((SSL_CTX *)local_ctx, cert_file.c_str());
if (i == -1) if (i == -1)
{ {
SSL_CTX_free(local_ctx); SSL_CTX_free((SSL_CTX *)local_ctx);
throw SSLException("Error loading cert_file '" + cert_file + "'"); throw SSLException("Error loading cert_file '" + cert_file + "'");
} }
// Load the CA certificate(s) // Load the CA certificate(s)
i = SSL_CTX_load_verify_locations (local_ctx, ca_file.c_str(), NULL); i = SSL_CTX_load_verify_locations ((SSL_CTX *)local_ctx, ca_file.c_str(), NULL);
if (i == -1) if (i == -1)
{ {
SSL_CTX_free(local_ctx); SSL_CTX_free((SSL_CTX *)local_ctx);
throw EPPException ("Could not load CA file '" + ca_file +"'"); throw EPPException ("Could not load CA file '" + ca_file +"'");
} }
ctx = local_ctx; ctx = (SSL_CTX *)local_ctx;
} }