-
Notifications
You must be signed in to change notification settings - Fork 2
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
About the examples of this project #1
Comments
Thank you very much for trying our tool! Sorry for this late reply.
Annotating the line is not a good idea, since curve25519.c depends on the file ec_lcl.h. You may refer to Makefile to find the correct dependencies required to compile curve25519.c.
In fact, as you know, we can only compile a whole file. The .ll files for single functions (e.g. curve25519_fe51_add.ll) are extracted manually from the generated .ll file (curve25519.ll).
The suffixes are added manually by ourselves.
Yes, you are right. As stated in our ASE paper (Verifying Arithmetic in Cryptographic C Programs), llvm2cryptoline targets arithmetic functions in cryptographic programs. These functions are normally sequential programs. Sometimes they contain trivial loops which can be unwound. So, yes, llvm2cryptoline currently does not support branching or loops. At the LLVM IR level, precisely speaking, llvm2cryptoline can only translate a single basic block. Here is some more information that might be helpful. The syntax of the CryptoLine language has changed. The syntax used in examples of this repository is not updated yet. Precisely, the openssl examples use the legacy syntax of CryptoLine, the boringssl/curve25519 examples use the untyped syntax of CryptoLine, and the nss examples use the latest syntax. The dev branch of llvm2cryptoline generates .cl file in the latest syntax. But we have no time to update all the examples yet. To verify the .cl files in deprecated syntax, you can use the CryptoLine version before commit c366621a6ea1407830340fdd9be5df1e250761e5. Option "-legacy" or "-untyped" is needed. |
I've done the conversion from C code to LLVM IR to CL myself, but some cases have failed. And I find that you can compile only one of these functions when you convert C code to LLVM IR. How do you do that?
Example:
curve25519.c -> curve25519_fe51_add.ll
But I only can get the curve25519.ll by using the command (clang -S -emit-llvm curve25519.c), and get a error "fatal error: 'ec_lcl.h' file not found". So I decide to annotate this line of code, then I can generate a .ll file successfully, but when I translate it, I get a message like "IR file is corrupted or does not exist.".
So I want to ask you what command do you use to compile only the specified function?
I found that you have two .cl files to verify the function, xxx_auto.cl is converted from LLVM IR, and after you add pre- and postcondition to the xxx_auto.cl, it becomes the xxx_tuned.cl. However, after I translate the .ll to .cl by myself, the file does not have the auto suffix. So I wonder if you have changed the suffix by yourself, or does the tool have other support that I do not use?
I found some problem in the translation detail.
C code:
LLVM IR:
Cryptoline:
The Cryptoline code only translates the first eight line(br label %4) in the LLVM IR. And this truncation occurs in the IR code because of the if judgment or for loop. Therefore, I want to ask you, is the validation code not allowed to contain these keywords? Or I have some problems using the translate command.
If you have free time, please give me some help. I am so interested in this. Thank you very much.
The text was updated successfully, but these errors were encountered: