open-license-manager
2014-10-13 61dc2ca65959f92bec3a646c3fb81c23aaf4947f
resolved warnings
2个文件已修改
15 ■■■■ 已修改文件
src/library/os/win/os-win.c 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tools/base_lib/win/CryptoHelperWindows.cpp 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/os/win/os-win.c
@@ -2,6 +2,7 @@
#include <iphlpapi.h>
//definition of size_t
#include <stdlib.h>
#include <stdio.h>
//#include "../../base/base64.h"
#include "../../base/logger.h"
#include"../os.h"
@@ -182,7 +183,7 @@
    DWORD dwHashLen;
    DWORD dwHashLenSize = sizeof(DWORD);
    char* hashStr;
    int i;
    unsigned int i;
    if (CryptGetHashParam(*hHash, HP_HASHSIZE, (BYTE *) &dwHashLen,
            &dwHashLenSize, 0)) {
@@ -257,7 +258,7 @@
        return FUNC_RET_ERROR;
    }
    if (!CryptHashData(hHash, stringToVerify, strlen(stringToVerify), 0)) {
    if (!CryptHashData(hHash, stringToVerify, (DWORD) strlen(stringToVerify), 0)) {
        LOG_ERROR("Error in hashing data 0x%08x ", GetLastError());
        CryptDestroyHash(hHash);
        CryptReleaseContext(hProv, 0);
@@ -267,7 +268,7 @@
    LOG_DEBUG("Lenght %d, hashed Data: [%s]", strlen(stringToVerify), stringToVerify);
    printHash(&hHash);
#endif
    sigBlob = unbase64(signatureB64, strlen(signatureB64), &dwSigLen);
    sigBlob = unbase64(signatureB64, (int) strlen(signatureB64), &dwSigLen);
    LOG_DEBUG("raw signature lenght %d", dwSigLen);
    if (!CryptVerifySignature(hHash, sigBlob, dwSigLen, hKey, NULL, 0)) {
        LOG_ERROR("Signature not validated!  0x%08x ", GetLastError());
src/tools/base_lib/win/CryptoHelperWindows.cpp
@@ -181,7 +181,7 @@
    DWORD dwHashLen;
    DWORD dwHashLenSize = sizeof(DWORD);
    char* hashStr;
    int i;
    unsigned int i;
    if (CryptGetHashParam(*hHash, HP_HASHSIZE, (BYTE *) &dwHashLen,
            &dwHashLenSize, 0)) {
@@ -201,20 +201,18 @@
const string CryptoHelperWindows::signString(const void* privateKey,
        size_t pklen, const string& license) const {
    BYTE *pbBuffer = (BYTE *) license.c_str();
    DWORD dwBufferLen = strlen((char *) pbBuffer);
    DWORD dwBufferLen = (DWORD)strlen((char *)pbBuffer);
    HCRYPTHASH hHash;
    HCRYPTKEY hKey;
    BYTE *pbKeyBlob;
    BYTE *pbSignature;
    DWORD dwSigLen;
    DWORD dwBlobLen;
    DWORD strLen;
    //-------------------------------------------------------------------
    // Acquire a cryptographic provider context handle.
    if (!CryptImportKey(m_hCryptProv, (const BYTE *) privateKey, pklen, 0, 0,
    if (!CryptImportKey(m_hCryptProv, (const BYTE *) privateKey, (DWORD) pklen, 0, 0,
            &hKey)) {
        throw logic_error(
                string("Error in importing the PrivateKey ")