rainerkeller.de

Howto compile QCA and plugins for N900

2012-01-01

Environment setup

Setup the environment for the N900 as described here.

Compile QCA library

Download and extract the QCA sourcecode from the project webseite. Then create the following files in the top level sourcecode directory:

conf.pri

PREFIX = /usr
BINDIR = $$PREFIX/bin
INCDIR = $$PREFIX/include
LIBDIR = $$PREFIX/lib
DATADIR = $$PREFIX/share
CONFIG += release separate_debug_info
QMAKE_CFLAGS += -g
QMAKE_CXXFLAGS += -g
DEFINES += DATADIR=\\\"$$DATADIR/qca\\\"
prffiles.path = $$PREFIX/share/qt4/mkspecs/features
prffiles.files = crypto.prf
INSTALLS += prffiles
pcfiles.path = $$LIBDIR/pkgconfig
pcfiles.files = lib/pkgconfig/qca2.pc
INSTALLS += pcfiles
DEFINES += QCA_SYSTEMSTORE_PATH=\\\"/etc/ssl/certs/ca-certificates.crt\\\"

conf.prf

QCA_INCDIR = /usr/include
QCA_LIBDIR = /usr/lib
# prepend this file with QCA_INCDIR/QCA_LIBDIR definitions

# NOTE: any changes made to this file need to be tracked in qcm/qca.qcm

CONFIG *= qt

# if we are including crypto.prf from the qca tree (and not utilizing it as
# an installed qmake CONFIG feature), then point to the tree.  this allows our
# qca tree apps to build before qca itself is installed.
exists($$PWD/qca.pro) {
	QCA_INCDIR = $$PWD/include
	QCA_LIBDIR = $$PWD/lib
}

INCLUDEPATH += $$QCA_INCDIR/QtCrypto
LIBS += -L$$QCA_LIBDIR -lqca

lib/pkgconfig/qca2.pc

prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include/QtCrypto

Name: QCA
Description: Qt Cryptographic Architecture library
Version: 2.0.2
Requires: QtCore
Libs: -L${libdir} -lqca
Cflags: -I${includedir}
Now the sourcecode is ready for compilation:
qmake
make sub-src
make INSTALL_ROOT=$SYSROOT_DIR sub-src-install_subtargets install_prffiles install_pcfiles
The library is now installed in the sysroot directory of the SDK.

OpenSSL plugin

Download and extract the plugin sourcecode from the project webseite. When writing this the plugin version 2.0.0-beta3 required a patch to compile:

qca-ossl-no-whirlpool.patch

--- qca-ossl.cpp.orig	2011-03-30 12:08:04.000000000 +0200
+++ qca-ossl.cpp	2011-03-30 12:08:16.000000000 +0200
@@ -6597,9 +6597,6 @@
 #ifdef SHA512_DIGEST_LENGTH
  list += "sha512";
 #endif
-#ifdef OBJ_whirlpool
-	list += "whirlpool";
-#endif
  return list;
 }

@@ -6810,10 +6807,6 @@
    else if ( type == "sha512" )
      return new opensslHashContext( EVP_sha512(), this, type);
 #endif
-#ifdef OBJ_whirlpool
-		else if ( type == "whirlpool" )
-			return new opensslHashContext( EVP_whirlpool(), this, type);
-#endif
    else if ( type == "pbkdf1(sha1)" )
      return new opensslPbkdf1Context( EVP_sha1(), this, type );
    else if ( type == "pbkdf1(md2)" )
Create this file in the toplevel of the sourcecode directory:

conf.pri

DEFINES += OSSL_097
LIBS += -lssl -lcrypto
CONFIG += release separate_debug_info
CONFIG += crypto
target.path=/usr/lib/plugins/crypto
INSTALLS += target
INCLUDEPATH += $$(SYSROOT_DIR)/usr/include/QtCrypto
Now the sourcecode is ready for compilation:
qmake
make
make INSTALL_ROOT=$SYSROOT_DIR install
The plugin is now installed in the sysroot directory of the SDK.

GnuPG plugin

Download and extract the plugin sourcecode from the project webseite. Then create this file in the toplevel of the sourcecode directory:

conf.pri

CONFIG += release separate_debug_info
CONFIG += crypto
target.path=/usr/lib/plugins/crypto
INSTALLS += target
INCLUDEPATH += $$(SYSROOT_DIR)/usr/include/QtCrypto
Now the sourcecode is ready for compilation:
qmake
make
make INSTALL_ROOT=$SYSROOT_DIR install
The plugin is now installed in the sysroot directory of the SDK.

Installation on the N900

The correct way would be creation a package for installation. But I will only describe how to 'manually' install the libraries on the target.

The library and plugins have to be copied to the target with ssh:

ssh root@n900 "mkdir -p /usr/lib/qt4/plugins/crypto"
scp $SYSROOT_DIR/usr/lib/qt4/plugins/crypto/libqca-*.so root@n900:/usr/lib/qt4/plugins/crypto
scp $SYSROOT_DIR/usr/lib/libqca.so.2.0.2 root@n900:/usr/lib
ssh root@n900 "ln -s libqca.so.2.0.2 /usr/lib/libqca.so.2"
Now QCA is ready for use.

Anbieterkennzeichnung
Datenschutzhinweis

This work is licensed under a
Creative Commons Attribution-ShareAlike 4.0 International License.