So after fighting with this for a few days, I think I'm going to give
up, and tell our customers we can't give them a version of our apps
which uses the FIPS certified version of cryptopp.

The option 2 solution doesn't work, because the function never gets
called. I have no idea if this is a loading order issue, or a naming/
calling convention issue, or something else; there is no working
example I can find of this method (the dll.cpp shows the calling usage
from within the DLL, but not how to define it within an application).

Even if I could get that working, I can't explicitly define new/delete
without dynamically linking MFC, because of conflicts. I also can't
figure out the syntax to use placement new to use the allocator from
cryptopp to create object to pass to the DLL. Basically, it appears to
be unusable without static linking everything, or dynamic linking
everything.

On Aug 23, 11:17 am, "Jeffrey Walton" <[EMAIL PROTECTED]> wrote:
> Hi Nick,
>
> > (unless I'm missing something).
>
> I believe you have not found the correct hoop to jump through. Perhaps
> create a second project which uses Crypto++ as a static Dll that
> imports the missing functions. Create this project as a DLL, and place
> the header in it's own namespace. I've never tried it myself at this
> point, but I've pondered the solution in the past.
>
> > There doesn't seem to be a way to make this
> > work without dynamically linking
>
> I beleive you are correct... Mixing and matching (though required) is
> diffcult to do.
>
> In the past I had a Document/View architecture. The Doc/View
> architecture used an iterator to to enumerate docs. However, becuse
> STL/Crypto++ had the same named iterators, all hell broke loose.
>
> In the end, I used a linker switch (NODEFAULTLIB) to ease the pain.
> However, I would get obscure errors every now and again. For example,
> If the EXE were copied to a Network drive and run from the location, a
> Date/Time control would not initialize properly and crash the
> application. 
> Seehttp://groups.google.com/group/microsoft.public.vc.mfc/browse_thread/...
>
> Sorry I could not be of more help.
>
> Jeff
>
> On 8/23/07, Nick42 <[EMAIL PROTECTED]> wrote:
>
>
>
> > This doesn't appear to work if I'm linking to the MFC library
> > statically also, as I get conflicts with the new and delete symbols
> > already defined (in this case, within the MFC library). There doesn't
> > seem to be a way to make this work without dynamically linking
> > everything (unless I'm missing something).
>
> > - Nick
>
> > On Aug 22, 7:05 pm, "Wei Dai" <[EMAIL PROTECTED]> wrote:
> > > If you're using a static C++ runtime library, then you have to use "method
> > > 2" as the Readme.txt says:
>
> > > 2.  Crypto++ can tell the calling application what heap to use. This 
> > > method
> > >     is required when the calling application uses a statically linked C++
> > > Run
> > >     Time Library. (Method 1 does not work in this case because the 
> > > Crypto++
> > > DLL
> > >     is initialized before the calling application's heap is initialized.)
>
> > > This means you need to use "SetNewAndDeleteFromCryptoPP", which has an
> > > example in dlltest.cpp.
>
> > > ----- Original Message -----
> > > From: "Nick42" <[EMAIL PROTECTED]>
> > > To: "Crypto++ Users" <[EMAIL PROTECTED]>
> > > Sent: Wednesday, August 22, 2007 4:30 PM
> > > Subject: Re: Question about FIPS dll usage and util functions
>
> > > > Thanks for the response... I saw this after I posted, and got it
> > > > working (well, linking at least), but I have a followup question:
>
> > > > I have not been able to get the memory management working. I am
> > > > statically linking the C runtime, and have tried defining
> > > > GetNewAndDeleteForCryptoPP, but I'm not sure how it needs to be
> > > > defined such that cryptopp can pick it up, and I can't find any
> > > > example of how to define it in the cryptest project. I would prefer to
> > > > tell cryptopp the new/delete functions to use, in case in the future I
> > > > have other libraries linking this way, to prevent conflicts.
>
> > > > Is there example code on how to implement this function somewhere, or
> > > > any magic, or something which will not work with how I'm trying to use
> > > > it?
>
> > > > Also, as a side note, I get the following error compiling the cryptdll
> > > > project from the 5.3 FIPS code with VS2005:
> > > > 2>.\integer.cpp(88) : error C2244:
> > > > 'CryptoPP::AlignedAllocator<T>::allocate' : unable to match function
> > > > definition to an existing declaration
> > > > 2>        [...]\cryptopp_5_3_fips\include\integer.h(44) : see
> > > > declaration of 'CryptoPP::AlignedAllocator<T>::allocate'
> > > > 2>        definition
> > > > 2>        'AllocatorBase<T>::pointer
> > > > CryptoPP::AlignedAllocator<T>::allocate(CryptoPP::AlignedAllocator<T>::size_type,const
> > > > void *)'
> > > > 2>        existing declarations
> > > > 2>        'T
> > > > *CryptoPP::AlignedAllocator<T>::allocate(CryptoPP::AlignedAllocator<T>::size_type,const
> > > > void *)'
>
> > > > Not a big deal since I want to use the FIPS certified pre-compiled DLL
> > > > anyway, but thought I'd post it in case it's not a known issue.
>
> > > > - Nick
>
> > > > On Aug 20, 5:07 pm, "Wei Dai" <[EMAIL PROTECTED]> wrote:
> > > >> You can build a static library that contains only code that are not in
> > > >> the
> > > >> DLL, by building the "DLL-Import Debug" or "DLL-Import Release"
> > > >> configuration instead of the "Debug" or "Release" configuration. Then 
> > > >> you
> > > >> can link your application with both the DLL and the static library.
>
> > > >> ----- Original Message -----
> > > >> From: "Nick42" <[EMAIL PROTECTED]>
> > > >> To: "Crypto++ Users" <[EMAIL PROTECTED]>
> > > >> Sent: Monday, August 20, 2007 4:28 PM
> > > >> Subject: Question about FIPS dll usage and util functions
>
> > > >> > I've been using crypto++ as a static lib for a while, and am trying 
> > > >> > to
> > > >> > convert to use as a FIPS certified dll. However, only some of the
> > > >> > objects are included in the FIPS dll, and we are using some of the
> > > >> > others also, which is causing linking to fail.
>
> > > >> > Is there a suggested way to link both the FIPS certified dll and the
> > > >> > extra utility code? I didn't see a lib with only the utility code. 
> > > >> > Has
> > > >> > anyone else attempted this, and/or is there something easy I'm 
> > > >> > missing?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [EMAIL PROTECTED]
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---

Reply via email to