Thanks for reporting this. See attached patch for my preferred fix. The 
Crypto++ license allows modifications to the source code, so of course 
you're not voiding it by making modifications.

BTW, it's part of the C standard for <stdlib.h> to contain malloc and free. 
Why does QNX put them in <malloc.h> instead?

----- Original Message ----- 
From: "kody0" <[EMAIL PROTECTED]>
To: "Crypto++ Users" <[EMAIL PROTECTED]>
Sent: Tuesday, August 14, 2007 6:20 AM
Subject: Missing headers for memcpy_s in QNX 6


>
> I've tried to compile the cryptopp library under QNX 6 but it failed
> with the following errors:
>
> <code>
> C:/QNX630/host/win32/x86/usr/bin/ntoppc-gcc-3.3.5 -BC:/QNX630/host/
> win32/x86/usr/ntoppc/bin  -c -o algebra.o -DUNIX -fPIC -DPPC -
> D__BIGENDIAN__               -O0 -g -DMG_DEBUG -Wall -Wno-format -Wno-
> unused-function -DQNX -Dunix -DFALCON  -D__BIG_ENDIAN__ -D__unix__ -
> pipe -DOSTYPE=qnx -I. -IC:/QNX630/target/qnx6/usr/include -IC:/QNX630/
> target/qnx6/usr/include/cpp -IC:/QNX630/target/qnx6/usr/include/cpp/
> c   algebra.cpp
> In file included from secblock.h:7,
>                 from integer.h:7,
>                 from algebra.cpp:9:
> misc.h: In function `void CryptoPP::memcpy_s(void*, unsigned int,
> const void*,
>   unsigned int)':
> misc.h:159: error: `memcpy' undeclared (first use this function)
> misc.h:159: error: (Each undeclared identifier is reported only once
> for each
>   function it appears in.)
> misc.h: In function `void CryptoPP::memmove_s(void*, unsigned int,
> const void*,
>   unsigned int)':
> misc.h:166: error: `memmove' undeclared (first use this function)
> secblock.h: In member function `void CryptoPP::AllocatorWithCleanup<T,
>   T_Align16>::deallocate(void*, typename
>   CryptoPP::AllocatorBase<T>::size_type) [with T = word32, bool
> T_Align16 =
>   false]':
> secblock.h:298:   instantiated from `CryptoPP::SecBlock<T,
> A>::~SecBlock() [with T = word, A = CryptoPP::AllocatorWithCl
> eanup<word32, false>]'
> integer.h:224:   instantiated from here
> secblock.h:142: error: `free' undeclared (first use this function)
> make[2]: *** [../../../bin_qnx_ppc_mg7000/lic/licmgr/cryptopp/
> algebra.o] Error 1
> make[2]: Leaving directory `T:/NaMX/depot/user/dbeaulieu/NAMX/2.0/lic/
> licmgr/cryptopp'
> make[1]: *** [lic/licmgr/cryptopp.dir] Error 2
> make[1]: Leaving directory `T:/NaMX/depot/user/dbeaulieu/NAMX/2.0'
> </code>
>
> It complains that it cannot find the headers file for both the free
> and the memcpy function. This is happening in the memcpy_s function.
> QNX 6 doesn't have these function available so the
> __STDC_WANT_SECURE_LIB__ define equals 0 (or is undefined).
>
> To make the library compile, I've added this two headers in the misc.h
> header file:
>
> <code>
> #ifdef QNX
> // memcpy function and free includes
> #include <string.h>
> #include <malloc.h>
> #endif
> </code>
>
> Afterwards, the library compiles successfully. But it is unclear to me
> whether there is a better way of doing this... Maybe I am missing a
> preprocessor define that would include these? Also does this void the
> license if I plan to use it in a commercial product?
>
> Thanks
>
>
> > 

--~--~---------~--~----~------------~-------~--~----~
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.
-~----------~----~----~----~------~----~------~--~---

Index: misc.h
===================================================================
--- misc.h      (revision 379)
+++ misc.h      (working copy)
@@ -3,6 +3,7 @@
 
 #include "cryptlib.h"
 #include "smartptr.h"
+#include <string.h>            // for memcpy and memmove
 
 #ifdef _MSC_VER
        #include <stdlib.h>
Index: secblock.h
===================================================================
--- secblock.h  (revision 379)
+++ secblock.h  (working copy)
@@ -5,10 +5,9 @@
 
 #include "config.h"
 #include "misc.h"
-#include <string.h>            // CodeWarrior doesn't have memory.h
 #include <assert.h>
 
-#if defined(CRYPTOPP_MEMALIGN_AVAILABLE) || 
defined(CRYPTOPP_MM_MALLOC_AVAILABLE)
+#if defined(CRYPTOPP_MEMALIGN_AVAILABLE) || 
defined(CRYPTOPP_MM_MALLOC_AVAILABLE) || defined(QNX)
        #include <malloc.h>
 #else
        #include <stdlib.h>

Reply via email to