zoukankan      html  css  js  c++  java
  • ollvm 使用——“Cannot open /dev/random”错误的解决方法

    找到

    obfuscator-llvm-4.0libTransformsObfuscationCryptoUtils.cpp

    这个文件,

    新增两个头文件

    #include <windows.h>
    #include <wincrypt.h>

    bool CryptoUtils::prng_seed() 

    找到这个函数

    把整个函数体全部注释掉后,新增代码

     1     bool bRet = false;
     2     do 
     3     {
     4         HCRYPTPROV Rnd;
     5         LPCSTR UserName = "MyKeyContainer";
     6         if (CryptAcquireContextA(&Rnd, UserName, NULL, PROV_RSA_FULL, 0))
     7         {
     8 
     9         }
    10         else
    11         {
    12             break;
    13         }
    14 
    15         if (CryptGenRandom(Rnd, 16, (BYTE*)key))
    16         {
    17             bRet = true;
    18         }
    19         else
    20         {
    21             break;
    22         }
    23 
    24         if (CryptReleaseContext(Rnd, 0))
    25         {
    26 
    27         }
    28         else
    29         {
    30             break;
    31         }
    32     } while (false);
    33     if (bRet)
    34     {
    35         memset(ctr, 0, 16);
    36 
    37         // Once the seed is there, we compute the
    38         // AES128 key-schedule
    39         aes_compute_ks(ks, key);
    40 
    41         seeded = true;
    42     }
    43     else
    44     {
    45         errs() << "Windows CryptGenRandom Error 
    ";
    46     }

    保证能取到随机数即可,

    重新编译,会重新编90+个工程,

    然后就不会再出错误了

  • 相关阅读:
    fiddler的使用
    redis pipeline
    redis hash map
    redis队列的实现
    PHP-redis中文文档-命令
    websocket
    c++之socket,阻塞模式
    Django上传文件和修改date格式
    通过字符串导入模块
    'CSRFCheck' object has no attribute 'process_request' 报错
  • 原文地址:https://www.cnblogs.com/suanguade/p/10913303.html
Copyright © 2011-2022 走看看