Re: [PATCH, resent] fix openssl headers conflicting with custom SHA1 implementations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 30, 2008 at 01:51:22PM -0700, Shawn O. Pearce wrote:

> Yea, its a bit ugly due to the rats nest of system includes.
> Right now I don't see how we can include your patch, it breaks a
> major platform for us.  But obviously my "fix" is also bogus and
> won't get ARM working again.
> 
> Any other ideas we can try?  'cause I don't have any right now.  :-|

I think you have an inherent conflict. Using openssl is going to end up
including their SHA definition, and we clearly can't include both..
Right now, you are trying to find a way to squeak by because imap-send
is the only thing that uses openssl, and it doesn't actually need our
SHA definition. But any solution that exploits that characteristic is
prone to failing later, when something _does_ need both of them.

You _could_ do something hack-ish like defining HEADER_SHA_H to avoid
theirs being loaded, but:

  1. You are relying on their header guard never changing.

  2. This actually leaves room for subtle problems, since some code
     thinks a SHA_CTX is defined one way, and other code thinks it is
     defined another way. If one piece of code passes a SHA_CTX to the
     other (say another part of openssl), you risk invoking nasal
     demons.

So I think the right way is probably to use a level of indirection. Turn
the ARM implementation into

  void ARM_SHA1_Init()

and

  #define SHA1_Init ARM_SHA1_Init

making sure not to allow such a macro to be in effect when including
openssl. This is similar to the way we override compat functions.

You can make it even simpler by just having all code call git_SHA1_Init,
and that will expand to whichever implementation has been chosen.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux