All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Thomas Petazzoni
	<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Allen Martin <amartin-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [tegrarcm PATCH] Don't assume cryptopp is system-wide installed
Date: Tue, 19 Apr 2016 16:32:46 -0600	[thread overview]
Message-ID: <5716B20E.8050607@wwwdotorg.org> (raw)
In-Reply-To: <1461097517-21626-1-git-send-email-thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

On 04/19/2016 02:25 PM, Thomas Petazzoni wrote:
> The current build system adds "-isystem /usr/include/$(CRYPTOLIB)" to
> AM_CPPFLAGS, but this is wrong because cryptopp might not be installed
> in this location. Instead, the build system should simply include
> <cryptopp/...> or <crypto++/...> and rely on the compiler include
> path.
>
> The tricky part is that it can be <cryptopp/...> or <crypto++/...>. To
> solve this, we use a solution similar to the one used in
> https://github.com/bingmann/crypto-speedtest/blob/master/m4/cryptopp.m4
> and
> https://github.com/bingmann/crypto-speedtest/blob/master/src/speedtest_cryptopp.cpp:
> the configure script fills in a variable called
> CRYPTOLIB_HEADER_PREFIX, and we use that in the C++ code to include
> the right header file.
>
> It is worth mentioning that doing #include
> <CRYPTOLIB_HEADER_PREFIX/foobar.h> doesn't work, and we have to use an
> intermediate #define'd constant to overcome this C preprocessor
> limitation.

I think this looks conceptually OK. CC += Allen to double-check since he 
wrote the original cryptopp autoconf support.

Could you please re-spin this on top of the latest git commits? There's 
a new file rsa-pss.cpp that needs to be updated too. Without that, this 
patch causes compile failures.

> diff --git a/src/aes-cmac.cpp b/src/aes-cmac.cpp

> -#include "cryptlib.h"
> -using CryptoPP::Exception;
> +#define CRYPTOPP_INCLUDE_CRYPTLIB	<CRYPTOLIB_HEADER_PREFIX/cryptlib.h>
> +#define CRYPTOPP_INCLUDE_CMAC		<CRYPTOLIB_HEADER_PREFIX/cmac.h>
> +#define CRYPTOPP_INCLUDE_AES		<CRYPTOLIB_HEADER_PREFIX/aes.h>
> +#define CRYPTOPP_INCLUDE_HEX		<CRYPTOLIB_HEADER_PREFIX/hex.h>
> +#define CRYPTOPP_INCLUDE_FILTERS	<CRYPTOLIB_HEADER_PREFIX/filters.h>
> +#define CRYPTOPP_INCLUDE_SECBLOCK	<CRYPTOLIB_HEADER_PREFIX/secblock.h>
>
> -#include "cmac.h"
> -using CryptoPP::CMAC;
> +#include CRYPTOPP_INCLUDE_CRYPTLIB
> +#include CRYPTOPP_INCLUDE_CMAC
> +#include CRYPTOPP_INCLUDE_AES
> +#include CRYPTOPP_INCLUDE_HEX
> +#include CRYPTOPP_INCLUDE_FILTERS
> +#include CRYPTOPP_INCLUDE_SECBLOCK

It'd be nice to avoid re-ordering everything; just edit the existing 
lines in place. That'd make the diff smaller, and make it more obvious 
that the only thing changing is the include filenames and not the using 
statements.

  parent reply	other threads:[~2016-04-19 22:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19 20:25 [tegrarcm PATCH] Don't assume cryptopp is system-wide installed Thomas Petazzoni
     [not found] ` <1461097517-21626-1-git-send-email-thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-04-19 22:32   ` Stephen Warren [this message]
     [not found]     ` <5716B20E.8050607-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2016-04-19 22:50       ` Allen Martin
2016-04-19 23:57       ` Allen Martin
     [not found]         ` <20160419235745.GA28796-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-04-20  9:27           ` Thomas Petazzoni
     [not found]             ` <20160420112735.16eca48a-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-04-21 18:13               ` Allen Martin
     [not found]                 ` <20160421181359.GA17433-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-04-21 19:24                   ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5716B20E.8050607@wwwdotorg.org \
    --to=swarren-3lzwwm7+weoh9zmkesr00q@public.gmane.org \
    --cc=amartin-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.