- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我是 HElib 的新手,目前正在测试 AES 的同态解密功能。作为测试的一部分,我手动输入 AES key 、纯文本和相应密文的测试值。然后我将密文传递给同态解密函数以获得纯文本的同态加密。这段测试代码似乎工作正常,直到昨天早上它在调用同态解密函数时出错,提示 Illegal instruction ( core dumped )。未能在测试代码中找到根本原因,我尝试运行 github 存储库中给出的 Test_AES 程序,但它也无法运行。过去,当我遇到这个问题时,关闭 VM 并重新启动它会有所帮助。我试图调试我的测试代码但没有成功。非常感谢您在调试方面的任何帮助。
Pasting the code here :
uint8_t key[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
uint8_t input[]={51,51,48,48,48,48,48,48,48,48,48,48,48,48,48,48};
uint8_t cipher[]= {201,133,214,86,19,4,199,214,206,13,152,237,236,11,241,25,108,192,10,102,210,173,131,255,215,110,154,43,202,216,154,1};
//manually adding the test values
Vec<uint8_t> aesCtxt(INIT_SIZE, nBlocks16);
Vec<uint8_t> ptxt(INIT_SIZE, nBlocks16);
for (long i=0;i<ptxt.length();i++)
ptxt.put(i,input[i]);
Vec<uint8_t> aesKey(INIT_SIZE, 16); // AES-128
for (long i=0;i<aesKey.length();i++)
aesKey.put(i,key[i]);
Vec<uint8_t> tmpBytes(INIT_SIZE, nBlocks*16);
for (long i=0;i<tmpBytes.length();i++)
tmpBytes.put(i,cipher[i]);
cerr << " cipher = "; printState(tmpBytes);
cout<< "going to encrypt AES key";
vector< Ctxt > encryptedAESkey;
hAES.encryptAESkey(encryptedAESkey, aesKey, publicKey);
//going to homomorphically decrypt to get Homomorphic encryption of (ptxt)
Vec encodedBytes;
encode4AES(encodedBytes, tmpBytes, hAES.getEA()); // encode as HE plaintext
vector< Ctxt > doublyEncrypted_AES_x;
--------->fails here and shows Illegal instruction (core dumped ).< --------------
// Allocate space for the output ciphertexts, initialized to zero
doublyEncrypted_AES_x.resize(encodedBytes.length(), Ctxt(ZeroCtxtLike,encryptedAESkey[0]));
cout<<"Dummy encrypt";
for (long i=0; i<(long)doublyEncrypted_AES_x.size(); i++) // encode ptxt as HE ctxt
doublyEncrypted_AES_x[i].DummyEncrypt(encodedBytes[i]);
hAES.homAESdec(doublyEncrypted_AES_x, encryptedAESkey); // do the real work
提前致谢!
编辑:添加 Valgrind 输出:
==2653== Memcheck, a memory error detector
==2653== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==2653== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==2653== Command: ./Test_AES_x
==2653==
*** Test_AES: c=3, L=42, B=23, boot=0, packed=1, m=771 (=[771]), gens=[5], ords=[-32]
computing key-independent tables...done in 1.08 seconds
27 primes (21 ctxt/6 special), total bitsize=855.929, security level: -107.015
32 slots (2 blocks) per ctxt
computing key-dependent tables...done in 10.368 seconds
computing AES tables...ptxt length32AES key added input = [c9 85 d6 56 13 4 c7 d6 ce d 98 ed ec b f1 19 6c c0 a 66 d2 ad 83 ff d7 6e 9a 2b ca d8 9a 1 ]going to encrypt AES keyentered funcHE encodedd as plaintextcalling func
vex amd64->IR: unhandled instruction bytes: 0xF3 0x4C 0xF 0x38 0xF6 0x57 0x28 0x66
vex amd64->IR: REX=1 REX.W=1 REX.R=1 REX.X=0 REX.B=0
vex amd64->IR: VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=0F38
vex amd64->IR: PFX.66=0 PFX.F2=0 PFX.F3=1
==2653== valgrind: Unrecognised instruction at address 0x4e5e0f2.
==2653== at 0x4E5E0F2: __gmpn_addmul_1 (in /usr/local/lib/libgmp.so.10.3.2)
==2653== by 0x54F5D2: _ntl_gaorsmul_1(_ntl_gbigint_body*, long, long, _ntl_gbigint_body**) (lip.cpp:8200)
==2653== by 0x42F7E3: MulAddTo (ZZ.h:507)
==2653== by 0x42F7E3: operator() (DoubleCRT.cpp:730)
==2653== by 0x42F7E3: relaxed_exec_index<DoubleCRT::toPoly(NTL::ZZX&, const IndexSet&, bool) const::__lambda5> (BasicThreadPool.h:521)
==2653== by 0x42F7E3: DoubleCRT::toPoly(NTL::ZZX&, IndexSet const&, bool) const (DoubleCRT.cpp:741)
==2653== by 0x431BC9: toPoly (DoubleCRT.cpp:759)
==2653== by 0x431BC9: DoubleCRT::addPrimes(IndexSet const&) (DoubleCRT.cpp:322)
==2653== by 0x4332D0: DoubleCRT::breakIntoDigits(std::vector<DoubleCRT, std::allocator<DoubleCRT> >&, long) const (DoubleCRT.cpp:301)
==2653== by 0x446C05: Ctxt::keySwitchPart(CtxtPart const&, KeySwitch const&) (Ctxt.cpp:467)
==2653== by 0x446F89: Ctxt::reLinearize(long) (Ctxt.cpp:416)
==2653== by 0x44829D: Ctxt::smartAutomorph(long) (Ctxt.cpp:1008)
==2653== by 0x451DB7: EncryptedArrayDerived<PA_GF2>::rotate1D(Ctxt&, long, long, bool) const (EncryptedArray.cpp:97)
==2653== by 0x41111D: decRowShift(Ctxt&, std::vector<DoubleCRT, std::allocator<DoubleCRT> > const&, EncryptedArrayDerived<PA_GF2> const&) (homAES.cpp:713)
==2653== by 0x4132E9: HomAES::homAESdec(std::vector<Ctxt, std::allocator<Ctxt> >&, std::vector<Ctxt, std::allocator<Ctxt> > const&) const (homAES.cpp:316)
==2653== by 0x406567: main (Test_AES.cpp:248)
==2653== Your program just tried to execute an instruction that Valgrind
==2653== did not recognise. There are two possible reasons for this.
==2653== 1. Your program has a bug and erroneously jumped to a non-code
==2653== location. If you are running Memcheck and you just saw a
==2653== warning about a bad jump, it's probably your program's fault.
==2653== 2. The instruction is legitimate but Valgrind doesn't handle it,
==2653== i.e. it's Valgrind's fault. If you think this is the case or
==2653== you are not sure, please let us know and we'll try to fix it.
==2653== Either way, Valgrind will now raise a SIGILL signal which will
==2653== probably kill your program.
==2653==
==2653== Process terminating with default action of signal 4 (SIGILL)
==2653== Illegal opcode at address 0x4E5E0F2
==2653== at 0x4E5E0F2: __gmpn_addmul_1 (in /usr/local/lib/libgmp.so.10.3.2)
==2653== by 0x54F5D2: _ntl_gaorsmul_1(_ntl_gbigint_body*, long, long, _ntl_gbigint_body**) (lip.cpp:8200)
==2653== by 0x42F7E3: MulAddTo (ZZ.h:507)
==2653== by 0x42F7E3: operator() (DoubleCRT.cpp:730)
==2653== by 0x42F7E3: relaxed_exec_index<DoubleCRT::toPoly(NTL::ZZX&, const IndexSet&, bool) const::__lambda5> (BasicThreadPool.h:521)
==2653== by 0x42F7E3: DoubleCRT::toPoly(NTL::ZZX&, IndexSet const&, bool) const (DoubleCRT.cpp:741)
==2653== by 0x431BC9: toPoly (DoubleCRT.cpp:759)
==2653== by 0x431BC9: DoubleCRT::addPrimes(IndexSet const&) (DoubleCRT.cpp:322)
==2653== by 0x4332D0: DoubleCRT::breakIntoDigits(std::vector<DoubleCRT, std::allocator<DoubleCRT> >&, long) const (DoubleCRT.cpp:301)
==2653== by 0x446C05: Ctxt::keySwitchPart(CtxtPart const&, KeySwitch const&) (Ctxt.cpp:467)
==2653== by 0x446F89: Ctxt::reLinearize(long) (Ctxt.cpp:416)
==2653== by 0x44829D: Ctxt::smartAutomorph(long) (Ctxt.cpp:1008)
==2653== by 0x451DB7: EncryptedArrayDerived<PA_GF2>::rotate1D(Ctxt&, long, long, bool) const (EncryptedArray.cpp:97)
==2653== by 0x41111D: decRowShift(Ctxt&, std::vector<DoubleCRT, std::allocator<DoubleCRT> > const&, EncryptedArrayDerived<PA_GF2> const&) (homAES.cpp:713)
==2653== by 0x4132E9: HomAES::homAESdec(std::vector<Ctxt, std::allocator<Ctxt> >&, std::vector<Ctxt, std::allocator<Ctxt> > const&) const (homAES.cpp:316)
==2653== by 0x406567: main (Test_AES.cpp:248)
Dummy encryptHE dummy encrypt ==2653==
==2653== HEAP SUMMARY:
==2653== in use at exit: 26,478,071 bytes in 16,450 blocks
==2653== total heap usage: 183,015 allocs, 166,565 frees, 110,651,486 bytes allocated
==2653==
==2653== LEAK SUMMARY:
==2653== definitely lost: 0 bytes in 0 blocks
==2653== indirectly lost: 0 bytes in 0 blocks
==2653== possibly lost: 24,531,862 bytes in 9,564 blocks
==2653== still reachable: 1,946,209 bytes in 6,886 blocks
==2653== suppressed: 0 bytes in 0 blocks
==2653== Rerun with --leak-check=full to see details of leaked memory
==2653==
==2653== For counts of detected and suppressed errors, rerun with: -v
==2653== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Illegal instruction (core dumped)
lscpu:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 2
On-line CPU(s) list: 0,1
Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 63
Stepping: 2
CPU MHz: 2394.420
BogoMIPS: 4788.84
Hypervisor vendor: Microsoft
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 30720K
NUMA node0 CPU(s): 0,1
/proc/cpu信息
处理器 0:
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm invpcid_single kaiser fsgsbase bmi1 avx2 smep bmi2 erms invpcid xsaveopt
处理器 1:
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm invpcid_single kaiser fsgsbase bmi1 avx2 smep bmi2 erms invpcid xsaveopt`
最佳答案
我在 __gmpn_addmul_1(这是 GMP 库)中遇到了非法指令的类似错误。它在云虚拟电脑上。使用 GMP 的程序工作正常,但在我收到此错误后重新启动 VPC。我相信 VPC 处理器架构已针对新的重启进行了更改。我通过从配置阶段重建 libgmp 解决了这个问题(当检测到 proc arch 时)
关于c++ - 非法指令(核心转储)HElib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52743262/
我正在尝试在现有指令的基础上构建一个新指令,但我在我的过程中停止了。加载页面时,我面临以下错误: Multiple directives [directive#1, directive#2] aski
我是 angularjs 世界的新手,我只需要在数字类型的输入中输入从 1 到 10 的数字。不使用 HTML5 的 min 和 max 属性 我在 Jquery 中找到了一个示例,能否帮我将其转换为
我想使用 ionic与 Material 设计。我被困在使用带有自定义 CSS 的 ionic 指令和 angular-material 之间。 我读过使用 ionic 指令我们得到了很多高效的特性,
我创建了以下代码: var node = document.getElementById('TreeList'); var keys = Object.keys(model[0]); var trac
在 AngularJs 中没有提供 ng-enabled 指令。是否有任何适当的理由不在框架中提供该指令,因为当您可以使用 ng- 时,我们同时拥有 ng-show 和 ng-hide隐藏来实现我们的
我最近制作的程序有问题。基本上,它是 John Conway 人生游戏的简单版本,但它运行不正常。问题出在读取单元格及其邻居的状态并决定该单元格的 future 状态的代码中。这是代码的一部分(有点长
Dockerfile reference关于 FROM 指令的内容如下: FROM can appear multiple times within a single Dockerfile in or
我一直在尝试理解指令中孤立作用域和继承作用域之间的区别。这是我准备让自己理解的一个例子: HTML Inside isolated scope directive: {{m
知道如何从指令内部访问属性值吗? angular.module('portal.directives', []) .directive('languageFlag', ['$r
我正在通过将 c 程序与其等价的汇编程序进行比较来学习汇编。 这是代码。 .file "ex3.c" .section .rodata .LC0: .string "I am %d
我正在尝试写一个 Jenkinsfile并行执行一系列步骤。目标是拥有两个 agents (又名。 nodes )。一个应该进行 Windows 构建,另一个应该进行 linux 构建。但是,我不希望
我想知道为什么指令 FYL2XP1在 x86 架构上精确计算数学公式 y · log2(x + 1)。 这个公式有什么特别之处? 最佳答案 y操作数通常是编译时常量,暂时忘记 x + 1 . 自 lo
这个问题已经有答案了: Parameterize an SQL IN clause (41 个回答) 已关闭 8 年前。 第一个声明: Select GroupMember FROM Group 结果
我从 this question fork 并编辑了一个 plunker 我想做的是在数据加载后更新/填充 SELECT 元素(组合框),但有些事情不对劲。我检索数据,它位于 SELECT 元素的范围
我想创建一个简单的 markdown 指令,它接受元素中的一些内容,解析它并用 html 替换它。 所以这样: #Heading 或这个(其中 $scope.heading = '#Heading';
我对 Ansible 还很陌生,对于我对 local_action 指令的理解有一个简单的问题。 这是否意味着该命令完全在本地执行?假设你有这样的东西: local_action: command w
我有以下 HTML: ... ... 以及以下指令: myApp.directive('specialInput', ['$timeout', function($timeout)
如何在 .htaccess 中创建 Apache 指令强制文件 .mp4和 .pdf去下载?目前它们出现在浏览器窗口中。相反,我希望出现一个下载文件对话框。 最佳答案 将以下内容添加到 .htacce
我的问题是关于 C 中的 fork() 指令。我有以下程序: void main(){ int result, status; result = fork(); if(result=
我想要一个类似于 ng-model 的属性指令。我只想另外将一个输入字段值绑定(bind)到一个范围变量(只是在一个方向输入字段 ->范围变量)。所以我刚刚尝试了这个指令,但无论如何我都无法调用该指令
我是一名优秀的程序员,十分优秀!