GOST support. OpenSSL, xmlsec - c++

Im writing xml signing utility using C++ to run on Linux (only). And I need support of GOST, GOST2012.
I'm using xmlSecOpenSSLKeyDataGost2001Id, xmlSecOpenSSLKeyDataGostR3410_2012_256Id, xmlSecOpenSSLKeyDataGostR3410_2012_512Id in xmlSecKeyDataCreate() function.
Code compiles fine. But during link I'm getting error about undefined references to xmlSecOpenSSLKeyDataGost2001GetKlass,
xmlSecOpenSSLKeyDataGostR3410_2012_256GetKlass, xmlSecOpenSSLKeyDataGostR3410_2012_512GetKlass.
Should I add some specific library to add support of these methods?
Thanks.

I've got it.
All you need to do is to build xmlsec library with --enable-gost and --enable-gost2012 flags. Then you need to configure your project to use newly built libraries (or install them).

Related

Where are array_ops.h and other C++ headers?

I'm writing a C++ application in TensorFlow 1.6. I'm able to run Python files with no problems and have compiled the C++ examples that also run just fine, so I think I've set up TensorFlow correctly.
I've started a new project that builds with no errors using plain C++. I'm now trying to construct Placeholder(), the docs say I need to #include <array_ops.h>, but it can't be located during compile. I did sudo find / -name "array_ops.h" and the only match was a file in ~/.cache/bazel.
Is there an extra build/configure step needed to install the C++ header files referred to in the docs?
Solved
This is a bug in the documentation for 1.6. The #includes listed in the API are not needed for calling some (many?) constructors.

Custom Python build - time.so: undefined symbol: PyExc_ValueError

All,
I'm working on a new C++ project for an embedded system. Part of the system is some legacy Python code that we'll need to interface too. I've already prototyped a C++ to Python interface using the various PyImport_ImportModule functions etc. provided by Python, and tested this on my host system (Ubuntu 64 bit 17.04).
However, the build system in the new project also tries to build all dependencies, so it builds Python 2.7.13 from source. The problem I am seeing is the interface code that used to work with the host system Python is not working with the newly built from source Python. The error I am seeing is "time.so: undefined symbol: PyExc_ValueError", and the .py file I'm trying to call from C++ does import time as one of the first few lines. I checked and time.so is present in the custom built Python and I did update LD_LIBRARY_PATH to include it, but this didn't help. At the end of the build for Python I do see these warnings, so perhaps one of them is relevant?
Python build finished, but the necessary bits to build these modules were not found:
_bsddb _sqlite3 _ssl
_tkinter bsddb185 bz2
dbm dl gdbm
imageop readline sunaudiodev
zlib
Can anyone suggest what to try next? We are not enabling any special options or using any non standard flags in the Python we're building from source (perhaps some extra settings are required)?
This is usually happening to either:
clean build required or
wrong libpython lib being linked. I would suggest to start with trying clean build and then double check your linking flags (make sure you build for Python-2.7 and link to Python-2.7 and not to say Python-3.* etc).
Also, please see this discussion, it looks like a very similar issue: https://www.panda3d.org/forums/viewtopic.php?t=13222
Edit: this also might be relevant: undefined symbol: PyExc_ImportError when embedding Python in C

Electron crashes with C++ addon using openssl library

I am trying to run with Electron a C++ addon that links to the openssl library. When the C++ code tries to access the library I get an exception: Procedure not found. I found another similar question here, but I could not manage to make it work, as the original poster said it would. I tried to link to a static compiled library from here, specifically libeay32MT.lib but when running under Electron it still crashes.
In bindings.gyp I have the library added like this:
"-l$(OPENSSL_ROOT)/lib/libeay32MT.lib"
Any ideas how I can make this work?
I managed to find the problem: I was also linking to node.lib inside the bindings.gyp. It wasn't necessary, but I "inherited" it from the Visual Studio proj file, where the node.lib was mandatory in order to compile the addon for node.
After removing the unnecessary library link to node.lib from the bindings.gyp the electron app worked just fine.

How to use the Emscripten toolchain with biicode?

How can I add an Emscripten compilation target for my program using biicode. I would like to do a "bii cpp:configure" or a build with params, that would build my C/C++ source code using the downloaded Emscripten SDK (emsdk) or the installed Emscripten (from a package manager).
So you want to #include a emscripten header in your code and get the library? I would suggest to write a block that acts as a proxy and manage to download and install the prebuilt packages, as they seem quite good. This can be done in a several ways:
Write block with a hook, which is a script in python. You have for example the OpenCV one here: http://www.biicode.com/diego/opencv . That will install it to a biicode predefined location, which can be accessed in the CMakeLists.txt via a cmake variable ${BIICODE_ENV_DIR} . You can use that variable to define and link libraries.
You should add the headers you want to include in your block, so you can actually #include things, and have biicode retrieve things. Do not forget to add the hook to the biicode.conf [hooks] section
Write a block with a cmake script. In CMake it is also possible to retrieve and install files. In this case you can just write and INCLUDE(youruser/yourblock/yourcmakescript) in the CMakeLists.txt of the block that wants to "consume" and use emscripten. That file will be handle exactly the same as C/C++ files, they will appear initially as unresolved in "bii deps" and can be resolved with "bii find" or adding the block to the [requirements] section.
I initially recommend this as the library seems a bit complex to build, it does not have standard CMakeLists.txt, but custom configures.
EDIT: Now I see with your comments that this is not what you actually want, but to use a custom compilation (cross compilation to js) toolchain. This can be actually done using custom toolchains: http://docs.biicode.com/c++/building.html#using-a-custom-tool-chain
This could require some mastery of both CMake and the emscripten toolchain. The integration of this toolchains is a little bit tricky now, it is being revamped and will be released in a few weeks.
Note that the rest of the answer is still valid, you can easily write a block with a hook that manages to install the emscripten tool from binaries.

Using OpenSSL's CMS implementation in C++

So my project today has been to create a C++ class that consolidates a lot of our commonly used crypto tasks. Got lots of things working but ran into a bit of a snag here. For reference, I'm using XCode 3.2.5 on OS 10.6.5.
I'm attempting to utilize some of OpenSSL's CMS functions. OpenSSL's MAN Page for one of the functions I'm trying to use mentions it was included in version 0.9.8. That's the version XCode let me import without having to do anything out of the ordinary (Target -> General -> Add Linked Library). Yet with that added XCode tells me it can't find openssl/cms.h.
So thinking maybe there's some disparity between the OS X version 0.9.8 and the one on OpenSSLs page, I downloaded the source for 1.0.0c and built it. After it was built, I added libcrypto.a and libssl.a to my project as linked libraries and added "some/dirs/openssl-1.0.0c/include/**" as a header search path. Now it can find openssl/cms.h but I get a linking error on any CMS function I call.
Has anyone done this successfully? Any help would be appreciate.
Thanks!
So what I ended up doing was to create a new SDK and calling,
./Configure darwin64-x86_64-cc --prefix=/path/to/sdk/usr --openssldir=/System/Library/OpenSSL enable-cms shared
To update the version of OpenSSL included in that SDK. That's seemed to work.