Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nemo-gtkhash] Compilation Error #149

Open
jean-christophe-manciot opened this issue Jan 20, 2016 · 20 comments
Open

[nemo-gtkhash] Compilation Error #149

jean-christophe-manciot opened this issue Jan 20, 2016 · 20 comments

Comments

@jean-christophe-manciot
./autogen.sh
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
        --with-gtk=3.0 \
        --enable-gcrypt \
        --enable-libcrypto \
        --enable-polarssl \
        --enable-nettle \
        --enable-nss \
        --enable-mhash \
        --enable-nemo
make

leads to:

CC hash_la-hash-lib-crypto.lo
hash-lib-crypto.c: In function 'gtkhash_hash_lib_crypto_get_md':
hash-lib-crypto.c:54:11: error: implicit declaration of function 'EVP_mdc2' [-Werror=implicit-function-declaration]
return EVP_mdc2();
^
hash-lib-crypto.c:54:11: warning: return makes pointer from integer without a cast [-Wint-conversion]

Whole log:
nemo-gtkhash compilation error.txt

@EduardDopler
Copy link
Contributor

It builds fine on my mashine. Could you try to install libssl-dev and recompile it? I think there is a dependency missing.

@jean-christophe-manciot
Copy link
Author

I already have this dependency installed, as wall as these others (with the -dev where applicable):
nemo,libglib2.0-0,libgtk-3-0,zlib1g,libgcrypt,libcrypto++9v5,libpolarssl7,libnettle6,libnss3,libmhash2,thunar

@EduardDopler
Copy link
Contributor

In my pull request I added a cleaned up version of the compilation files. Do you mind testing that version? You can find it here.
I run the build process via dpkg-buildpackage from inside the extension's directory and the build passes on my Mint 17.2 and 17.3. So does my PPA on various Ubuntu versions.

@jean-christophe-manciot
Copy link
Author

Exactly the same error with your sources.
My system is Ubuntu Server 15.10 Linux 4.2.0-25-generic #30-Ubuntu SMP Mon Jan 18 12:31:50 UTC 2016 x86_64

@EduardDopler
Copy link
Contributor

Could you please upload your buildlog from your last build with my updated sources? I will compare it to mine and try to find differences.

@jean-christophe-manciot
Copy link
Author

@EduardDopler
Copy link
Contributor

I am no autoconf expert but if I run the same command you do, I get the same error.
But if I build everything via dpkg-buildpackage everything compiles just fine.
The log shows that the dpkg tool calls configure differently:

dh_auto_configure -- \
                  --with-gtk=3.0 \
                  --disable-gtkhash \
                  --enable-mhash \
                  --enable-gcrypt \
                  --enable-nemo
./configure --build=x86_64-linux-gnu \
            --prefix=/usr \
            --includedir=\${prefix}/include \
            --mandir=\${prefix}/share/man \
            --infodir=\${prefix}/share/info \
            --sysconfdir=/etc \
            --localstatedir=/var \
            --libdir=\${prefix}/lib/x86_64-linux-gnu \
            --libexecdir=\${prefix}/lib/x86_64-linux-gnu \
            --disable-maintainer-mode \
            --disable-dependency-tracking \
            --with-gtk=3.0 \
            --disable-gtkhash \
            --enable-mhash \
            --enable-gcrypt \
            --enable-nemo

@jean-christophe-manciot
Copy link
Author

Your configure options mask the issue, because of the lack of "--enable-libcrypto" option; that's why the file "hash-lib-crypto.c" is not compiled so you don't encounter the error.

Now , something is strange with your automatically generated configure options: you build a package called 'nemo-gtkhash" and you "--disable-gtkhash"....

With the following options, most of the hash functions are supported with very few exceptions and everything compiles correctly:

./autogen.sh
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
        --with-gtk=3.0 \
        --enable-gcrypt \
        --enable-nettle \
        --enable-mhash \
        --enable-nemo \
        --disable-schemas-compile

Supported Hash Functions:

MD2 nettle,mhash
MD4 gcrypt,nettle,mhash
MD5 gcrypt,nettle,glib_checksums,mhash
MD6-224 internal_md6
MD6-256 internal_md6
MD6-384 internal_md6
MD6-512 internal_md6
SHA0
SHA1 gcrypt,nettle,glib_checksums,mhash
SHA224 gcrypt,nettle,mhash
SHA256 gcrypt,nettle,glib_checksums,mhash
SHA384 gcrypt,nettle,mhash
SHA512 gcrypt,nettle,mhash
SHA3-224 nettle
SHA3-256 nettle
SHA3-384 nettle
SHA3-512 nettle
RIPEMD128 mhash
RIPEMD160 gcrypt,nettle,mhash
RIPEMD256 mhash
RIPEMD320 mhash
TIGER128 mhash
TIGER160 mhash
TIGER192 gcrypt,mhash
WHIRLPOOL gcrypt,mhash
HAVAL128-3 mhash
HAVAL160-3 mhash
HAVAL192-3 mhash
HAVAL224-3 mhash
HAVAL256-3 mhash
GOST nettle,mhash
SNEFRU128 mhash
SNEFRU256 mhash
MDC2
CRC32 zlib
ADLER32 zlib

With your configure options, no SHA3 hash features are supported.
I had to add the "-disable-schemas-compile" option to be able to install the package alongside nemo's.
If you are aware of another way to avoid the interference with nemo's schemas, I'd be very glad to hear about it.

Everything works fine in the properties/Digests tab; I haven't figured out what the HMAC button is for, since entering the official hash on its left side automatically checks out without the need to press any more button (except the hash of course to compute the digests).

@jean-christophe-manciot
Copy link
Author

BTW, I compiled linux-mint sources in https://github.com/linuxmint/nemo-extensions.

@EduardDopler
Copy link
Contributor

Okay, a few things.
Firsty, you're of course right about masking the problem due to not using "--enable-libcrypto". Anyway, I was able to found the root of all evil: hash-lib-crypto.c includes <openssl/evp.h> which defines EVP_mdc2 only if OPENSSL_NO_MDC2 isn't set. But in my stock version of <openssl/opensslconf.h> which that file includes, this setting was set. I guess, OpenSSL considers this algorithm being still patented, which is not the case anymore. The only way I found to address that was to define OPENSSL_DOING_MAKEDEPEND before including <openssl/evp.h> in hash-lib-crypto.c:28:

#ifndef OPENSSL_DOING_MAKEDEPEND
    #define OPENSSL_DOING_MAKEDEPEND
#endif
#include <openssl/evp.h>

This forces opensslconf.h to skip setting OPENSSL_NO_MDC2 and hence EVP_mdc2 is defined.
I consider this a dirty workaround but this way, we can compile everything with --enable-libcrypto.


Secondly, --disable-gtkhash prevents from compiling the original gtkhash package which is a standalone version we don't need for nemo-gtkhash to work as the latter comes with its own GUI.


I will change the default build options for dpkg-buildpackage in the debian/rules file and add it to my version and my pull request. What do you think of the following:

  --disable-gtkhash
  --with-gtk=3.0
  --enable-gcrypt
  --enable-nettle
  --enable-mhash
  --enable-nemo
  --enable-libcrypto

I didn't understand what you meant by

[…] to be able to install the package alongside nemo's.

Could you please elaborate it for me?


Finally, with my changes, I have the following hash functions support now:

Interfaces ..
gtkhash no (gtk+-3.0)
gtkhash-nautilus no
gtkhash-nemo yes
gtkhash-thunar no
Supported Hash Functions ..
MD2 nettle,mhash
MD4 gcrypt,libcrypto,nettle,mhash
MD5 gcrypt,libcrypto,nettle,glib_checksums,mhash
MD6-224 internal_md6
MD6-256 internal_md6
MD6-384 internal_md6
MD6-512 internal_md6
SHA0 libcrypto
SHA1 gcrypt,libcrypto,nettle,glib_checksums,mhash
SHA224 gcrypt,nettle,mhash
SHA256 gcrypt,nettle,glib_checksums,mhash
SHA384 gcrypt,nettle,mhash
SHA512 gcrypt,nettle,mhash
SHA3-224 nettle
SHA3-256 nettle
SHA3-384 nettle
SHA3-512 nettle
RIPEMD128 mhash
RIPEMD160 gcrypt,libcrypto,nettle,mhash
RIPEMD256 mhash
RIPEMD320 mhash
TIGER128 mhash
TIGER160 mhash
TIGER192 gcrypt,mhash
WHIRLPOOL gcrypt,mhash
HAVAL128-3 mhash
HAVAL160-3 mhash
HAVAL192-3 mhash
HAVAL224-3 mhash
HAVAL256-3 mhash
GOST nettle,mhash
SNEFRU128 mhash
SNEFRU256 mhash
MDC2 libcrypto
CRC32 zlib
ADLER32 zlib

@EduardDopler
Copy link
Contributor

Okay, I just noticed that overriding the EVP setting isn't a good idea as it will build, though it won't run on systems with such an OpenSSL version where mdc2 was deactivated. So I plead for removing MDC2 support completely from this extension.
The following code checks if OpenSSL disabled MDC2 support and if so, turns the called function into NULL, hash-lib-crypto.c:28:

#include <openssl/evp.h>
#ifdef OPENSSL_NO_MDC2
    #define EVP_mdc2() NULL
#endif

@EduardDopler
Copy link
Contributor

As for your question about the HMAC button: HMACs are used for generating a keyed version of a Hash. I was unfamiliar with it, too, but Stackexchange helped.

@jean-christophe-manciot
Copy link
Author

  • Ok for your configure options, + the paths --prefix=/usr --sysconfdir=/etc --localstatedir=/var
  • Regarding MDC2, I agree with you which means that libcrypto is not needed in the configure options as well; SHA0 is not used anymore, anyway.
  • Regarding "[…] to be able to install the package alongside nemo's", I install the package using checkinstall, which is a quick and not perfect way to do it. When it tries to install the package it has built, it stops at an error stating that it cannot overwrite nemo's schemas.
    The only way around is to install it with "dpkg -i --force-overwrite nemo-gtkhash*.deb"
    If you know a more correct way than checkinstall with the same level of simplicity to build the package, I'd be very glad to hear about it.
  • Hitting the HMAC button does not seem to have any action other than greying it.
  • Last but not least, you have a very nice way of presenting your comments. I should investigate about enhanced editing, but it's yet again another set of commands specific to github, instead of presenting them in a more human UI... But that's another story.

EduardDopler added a commit to EduardDopler/nemo-extensions that referenced this issue Jan 22, 2016
When building with libcrypto enabled, we can encounter an error due to
OpenSSL is often built with MDC2 algorithm support disabled. To avoid
it, we now check for OpenSSL's OPENSSL_NO_MDC2 being set and if so, MDC2
is disabled by returning NULL instead of the actual function call.

Besides, nettle support is now enabled by default. This adds SHA3
hashing.

This fixes linuxmint#149
@EduardDopler
Copy link
Contributor

I wouldn't add the path information as this is often done by the building system and/or the maintainer, if I get it right. For users building their own packages (like you do), the option is still available by passing the paths to autoconf/configure like always.

You are right for libcrypto, I disabled it by default.

I updated my fork, my pull request and my PPA according to these changes. Thank you for your help!

Concerning the build process, the Debian way would be to run fakeroot debian/rules binary. Running autoconf or configure before should be appreciated by that call. I just tried to build everything that way and it worked fine. But as I said, I use dpkg-buildpackage normally.

On this machine, the HMAC button works as expected: Enabling it activates a password text field where one can enter a passphrase for the HMAC hash calculation.

@jean-christophe-manciot
Copy link
Author

OK, you're welcome and thanks for your contribution.

@jean-christophe-manciot
Copy link
Author

I tried to "dpkg-buildpackage" nemo, but there's an issue during compilation: linuxmint/nemo#1079
Nemo's developers seem to be overwhelmed with issues, and since nemo-gtkhash depends on some packages built under nemo, I won't be able to try & build your fork with dpkg-buildpackage anytime soon.

@EduardDopler
Copy link
Contributor

@jean-christophe-manciot I don't know about the error when compiling nemo because neither am I a developer on that nor do I compile nemo myself. I use the stock nemo from Rosa's package repository. With that, nemo-gtkhash (and other extensions) work great.

@jean-christophe-manciot
Copy link
Author

Good for you, there's no equivalent to Rosa in Ubuntu world as far as I know. That's why I started to publicly offer some useful up-to-date packages on GitHub. I do such a thing because all packages available on Ubuntu official repositories and Launchpad are outdated.
So, I don't need to be a developer to compile a package, especially such as Nemo which provides all debian tools; BTW, that is rare.
For example, what will you do the day you need a package which is not available on Rosa, such as libvirt/virt-manager suite for Linux Mint? ;)

@EduardDopler
Copy link
Contributor

No hard feelings, please ;)
Actually this isn't even the place to discuss it but since GitHub has no other place for discussions, this must do.
Okay, now I understand your motivation, thanks. I really don't know about the errors you mention. I haven't compiled nemo myself yet, I just needed a kind-of up-to-date version to be on Launchpad. Launchpad was able to compile it on all Ubuntu versions. So I hope your error gets resolved somehow.

@jean-christophe-manciot
Copy link
Author

No hard feelings, please ;)

I'm surprised you say that, I feel none of these. So we're cool ;) Sorry if I sounded otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants