Hey everyone,

I've gone through all the stuff. (not the special dll import stuff yet)

I could fix a few things without much trouble however there were three
issues that were outstanding.

 1. The destructor of AlgorithmParametersBase. It can throw under
    specific circumstances. However destructors are assumed not to throw
    and I think it's considered bad style if they do (there's no one to
    catch usually). Here's the code and how I disabled the warning for
    now (not in the proposed patch):

    virtual ~AlgorithmParametersBase()
        {
    #ifdef CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
                if (!std::uncaught_exception())
    #else
                try
    #endif
                {
                        //if (m_throwIfNotUsed && !m_used)
                        //      throw ParameterNotUsed(m_name);
                }
    #ifndef CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
                catch(...)
                {
                }
    #endif
        }

    I don't know how to properly handle the warning generated by this.
 2. We have the same issue with the destructor of ThreadLocalStorage. I
    don't know how to handle this one either. Here's the code in question:

    ThreadLocalStorage::~ThreadLocalStorage()
    {
    #ifdef HAS_WINTHREADS
        //if (!TlsFree(m_index))
        //      throw Err("TlsFree", GetLastError());
    #else
        int error = pthread_key_delete(m_index);
        if (error)
                throw Err("pthread_key_delete", error);
    #endif
    }

 3. Our network interface uses deprecated functions. They still work in
    VS 2015 but are deprecated and we get a warning. However, fixing
    this warning would either mean defining the silencing constant or
    migrating to the new API. The problem with the new API is that it
    requires Windows Vista at a minimum, meaning we'd drop support for
    Windows XP. So I'd say we stay with the old API as long as we can
    and migrate later hoping that XP won't be required than. Anyone
    knows of any cases where we actually have to provide (full) XP support?

So for my fixes (mainly type conversions), the patch is attached.
I can create a PR for the main repo on GitHub if necessary. (Fork repo:
https://github.com/DevJPM/cryptopp-1 Commit:
https://github.com/DevJPM/cryptopp-1/commit/2d5497a8b8666e051029440890a7809bd006700e
)
I don't know why the ptr_diff stuff got changed...

BR

JPM




Am 24.07.2015 um 23:11 schrieb Jeffrey Walton:
>
>
> On Friday, July 24, 2015 at 4:54:39 PM UTC-4, jean-pierre.muench wrote:
>
>     Hey everyone,
>
>     I've ran the build of our current GitHub hosted sources on my VS
>     2015 installation and found the following warnings (build related,
>     migration's a different story)
>
>
> Can you send that to me or make it a PasteBin?
>  
>
>     What I'll tackle tomorrow:
>     Try to apply the proposed fixes above, create up to 7 PRs for
>     GitHub (up to one for each change) and see what happens in the
>     crazy DLL-Import builds then.
>
>
> My personal feelings: The DLL-Import stuff is hosed. Don't waste too
> much time or effort on it.
>
> Its hosed because that particular subproject was stood up just for a
> FIPS 140-validation. The Testing Lab required a Security Boundary due
> to an Implementation Guidance (IG) doc from the Cryptographic Module
> Validation Program (CMVP). The security boundary was created by the
> exported interfaces from the DLL. So the DLL export/import stuff was
> cut-in. That's also why things like HexEncoders are missing, and
> non-FIPS algorithms are missing.
>
> I'm not opposed to a DLL or even a FIPS DLL. We just need to take the
> time to re-architect it so the existing pain points go away.
>
> Jeff
> -- 
> -- 
> 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.
> ---
> You received this message because you are subscribed to the Google
> Groups "Crypto++ Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected]
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout.

-- 
-- 
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.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
From 2d5497a8b8666e051029440890a7809bd006700e Mon Sep 17 00:00:00 2001
From: DevJPM <[email protected]>
Date: Sat, 25 Jul 2015 19:08:21 +0200
Subject: [PATCH] Fixed some warnings for VS 2015

fixed some type conversions issues
---
 dll.cpp      |  4 ++--
 nbtheory.cpp |  2 +-
 zdeflate.cpp | 14 ++++----------
 3 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/dll.cpp b/dll.cpp
index fadfe6a..a342f1b 100644
--- a/dll.cpp
+++ b/dll.cpp
@@ -82,14 +82,14 @@ static void SetNewAndDeleteFunctionPointers()
 
                hModule = HMODULE(mbi.AllocationBase);
 
-               PGetNewAndDelete pGetNewAndDelete = 
(PGetNewAndDelete)GetProcAddress(hModule, "GetNewAndDeleteForCryptoPP");
+               PGetNewAndDelete pGetNewAndDelete = 
static_cast<PGetNewAndDelete>(GetProcAddress(hModule, 
"GetNewAndDeleteForCryptoPP"));
                if (pGetNewAndDelete)
                {
                        pGetNewAndDelete(s_pNew, s_pDelete);
                        return;
                }
 
-               PSetNewAndDelete pSetNewAndDelete = 
(PSetNewAndDelete)GetProcAddress(hModule, "SetNewAndDeleteFromCryptoPP");
+               PSetNewAndDelete pSetNewAndDelete = 
static_cast<PSetNewAndDelete>(GetProcAddress(hModule, 
"SetNewAndDeleteFromCryptoPP"));
                if (pSetNewAndDelete)
                {
                        s_pNew = &New;
diff --git a/nbtheory.cpp b/nbtheory.cpp
index f4f53ac..f401663 100644
--- a/nbtheory.cpp
+++ b/nbtheory.cpp
@@ -37,7 +37,7 @@ struct NewPrimeTable
                primeTable.push_back(2);
                unsigned int testEntriesEnd = 1;
                
-               for (unsigned int p=3; p<=s_lastSmallPrime; p+=2)
+               for (word16 p=3; p<=s_lastSmallPrime; p+=2)
                {
                        unsigned int j;
                        for (j=1; j<testEntriesEnd; j++)
diff --git a/zdeflate.cpp b/zdeflate.cpp
index a4f20d4..d9cb8a7 100644
--- a/zdeflate.cpp
+++ b/zdeflate.cpp
@@ -8,7 +8,6 @@
 #include "pch.h"
 #include "zdeflate.h"
 #include <functional>
-#include <cstddef>     // ptrdiff_t
 
 #if _MSC_VER >= 1600
 // for make_unchecked_array_iterator
@@ -289,7 +288,7 @@ void Deflator::Reset(bool forceReset)
        m_detectSkip = 0;
 
        // m_prev will be initialized automaticly in InsertString
-       fill(m_head.begin(), m_head.end(), 0);
+       fill(m_head.begin(), m_head.end(), 0ui16);
 
        fill(m_literalCounts.begin(), m_literalCounts.end(), 0);
        fill(m_distanceCounts.begin(), m_distanceCounts.end(), 0);
@@ -407,12 +406,7 @@ unsigned int Deflator::LongestMatch(unsigned int 
&bestMatch) const
                        {
                                bestLength = len;
                                bestMatch = current;
-
-                               // TODO: should we throw here?
-                               const ptrdiff_t diff = scanEnd - scan;
-                               assert(diff >= 0);
-
-                               if (len == static_cast<unsigned int>(diff))
+                               if (len == (scanEnd - scan))
                                        break;
                        }
                }
@@ -645,8 +639,8 @@ void Deflator::EncodeBlock(bool eof, unsigned int blockType)
                assert(m_blockStart + m_blockLength <= m_byteBuffer.size());
                assert(m_blockLength <= 0xffff);
                FlushBitBuffer();
-               AttachedTransformation()->PutWord16(m_blockLength, 
LITTLE_ENDIAN_ORDER);
-               AttachedTransformation()->PutWord16(~m_blockLength, 
LITTLE_ENDIAN_ORDER);
+               
AttachedTransformation()->PutWord16(static_cast<word16>(m_blockLength), 
LITTLE_ENDIAN_ORDER);
+               
AttachedTransformation()->PutWord16(static_cast<word16>(~m_blockLength), 
LITTLE_ENDIAN_ORDER);
                AttachedTransformation()->Put(m_byteBuffer + m_blockStart, 
m_blockLength);
        }
        else

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to