-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The way to use AES. #10
Comments
When trying to use the AES intrinsics (as https://github.com/frasercrmck/llvm-leg/blob/master/test/CodeGen/X86/aes_intrinsics.ll), I found for now the llvmcall only accepts array ABI such as julia> function aesenc(x::Tuple{UInt64, UInt64}, y::Tuple{UInt64, UInt64})
Base.llvmcall(("""declare <2 x i64> @llvm.x86.aesni.aesenc(<2 x i64>, <2 x i64>)""","""
%3 = call <2 x i64> @llvm.x86.aesni.aesenc(<2 x i64> %0, <2 x i64> %1)
ret <2 x i64> %3"""), Tuple{UInt64, UInt64}, Tuple{Tuple{UInt64, UInt64}, Tuple{UInt64, UInt64}}, x, y)
end
aesenc (generic function with 1 method)
julia> aesenc((1 % UInt64, 1 % UInt64), (1 % UInt64, 1 % UInt64))
ERROR: error compiling aesenc: Failed to parse LLVM Assembly:
julia: llvmcall:5:58: error: '%0' defined with type '[2 x i64]'
%3 = call <2 x i64> @llvm.x86.aesni.aesenc(<2 x i64> %0, <2 x i64> %1)
^
in eval(::Module, ::Any) at ./boot.jl:231
in macro expansion at ./REPL.jl:92 [inlined]
in (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:46 |
Sorry we haven't had a chance to chat recently, I've been travelling a lot. The distinction here is between what LLVM terms vectors and arrays. From what I understand (which may well be wrong), vectors are what can be used with SIMD instructions, whereas arrays are more general structs. In 0.5 you can use
|
Thanks, that's what I need. |
AES encryption is an important part of the RNGs for secure use. There are some methods to use AES:
It would be better if we can directly use AES-NI on the most kinds of CPU, so I'm also wondering how will llvm do with this? Anyway, OpenSSL should have been already optimized about such things.
The text was updated successfully, but these errors were encountered: