lurumdare
2019-09-12 e0b24b27d8aa83ef197488406f649b2af2abc3b7
src/library/os/os.c
@@ -1,8 +1,7 @@
//#include <stdlib.h>
#include <stdio.h>
#include "../base/logger.h"
#include "os.h"
#include "../base/logger.h"
#include "public-key.h"
#include <stdio.h>
#ifndef _MSC_VER
@@ -140,7 +139,7 @@
      // container by specifying a container name and setting the 
      // CRYPT_NEWKEYSET flag.
      LOG_INFO("Error in AcquireContext 0x%08x \n", GetLastError());
      if (NTE_BAD_KEYSET == GetLastError()) {
      if (NTE_BAD_KEYSET == (long)GetLastError()) {
         if (!CryptAcquireContext(&hProv, "license++verify",
               MS_ENHANCED_PROV, PROV_RSA_FULL,
               CRYPT_NEWKEYSET | CRYPT_VERIFYCONTEXT)) {
@@ -170,7 +169,7 @@
      return FUNC_RET_ERROR;
   }
   if (!CryptHashData(hHash, stringToVerify, (DWORD) strlen(stringToVerify), 0)) {
   if (!CryptHashData(hHash, (const BYTE*)stringToVerify, (DWORD) strlen(stringToVerify), 0)) {
      LOG_ERROR("Error in hashing data 0x%08x ", GetLastError());
      CryptDestroyHash(hHash);
      CryptReleaseContext(hProv, 0);
@@ -180,7 +179,7 @@
   LOG_DEBUG("Lenght %d, hashed Data: [%s]", strlen(stringToVerify), stringToVerify);
   printHash(&hHash);
#endif
   sigBlob = unbase64(signatureB64, (int) strlen(signatureB64), &dwSigLen);
   sigBlob = unbase64(signatureB64, (int) strlen(signatureB64), (int*)&dwSigLen);
   LOG_DEBUG("raw signature lenght %d", dwSigLen);
   if (!CryptVerifySignature(hHash, sigBlob, dwSigLen, hKey, NULL, 0)) {
      LOG_ERROR("Signature not validated!  0x%08x ", GetLastError());