-
Notifications
You must be signed in to change notification settings - Fork 457
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
Libtomcrypt armv8 aarch64 troubles #160
Comments
You approach is basically what I would do.
|
So you didn't include any libtommatch source files? crypto/libtommath/bn_mp_neg.c |
I did, it is in The libtomcrypt (a subset) is in |
i found rsa_import return 7, which is CRYPT_INVALID_PACKET. But i'm using the exactly same private_rsa array of libtomcrypt-subset/main.c. And it is where return INVALID_PACKET. Do you have any clue? By the way. how much memory does |
now i use a is the contents of sig.bin. Signature that i generate by using such command And what argument should i pass to |
I found that even i do exactly what libtomcrypt-subset/main.c do, it's still invalid. |
regarding the integration of ltm you could also just use pre_gen/mpi.c, so you only have 1 file which also helps with the library size IIRC (you probably should update it (call |
if your binary is 900 KB, you're doing something wrong. i've written an ircbot using wolfSSL for ssl connection, and the entire binary when static linked against musl libc is ~140 KB with heavy size optimization settings (
|
Thanks for helping me. I will try to figure out where is wrong. @karel-m it's really a wonderful library |
After debugging, i found where is going wrong. Exactly same key array and data array runs well on linux PC but fail on my ARM board. So i add debug log and found As you can see, all the big numbers are truncated. Why would this happen? PC:key->N:B7FBCDE320B827E34F0D13C40EC5C8ABBC13F0288D9A7C16731ED3E5D4C2D7798804FDF3938BE1FA0868DAE6788F30B5530679BFCFE00661238D8E9FC32588C676F964A575F4438CCC97EF2D4476C3655BD5DA7E50AABFDB998D3235181D9A1EDCBCF49F866DDF6BF2856318EDC49BDF151BD2ED7B438945029A3A73755682D0B0669915FA3317DD7D57D06F51A34921460BA7CF3CD83CB7B5F62195DBBE4E5BA876BB41D3DC3D29C07317A190D205853C6A081D1807E7FCC271C1EA811B105D855C2DF1608ED5E6393EE7739F8B04E271652D68D37BC9D975E614BCC71E77E1E051BA9E51EE9D3E55E1A5BA05FCF18620E96F4A5B21717239165BA135FB5041 My Board:key->N:DC49BDF151BD2ED7B438945029A3A73755682D0B0669915FA3317DD7D57D06F51A34921460BA7CF3CD83CB7B5F62195DBBE4E5BA876BB41D3DC3D29C07317A190D205853C6A081D1807E7FCC271C1EA811B105D855C2DF1608ED5E6393EE7739F8B04E271652D68D37BC9D975E614BCC71E77E1E051BA9E51EE9D3E55E1A5BA05FCF18620E96F4A5B21717239165BA135FB5041 |
Could you try to replace https://github.com/libtom/libtomcrypt/blob/fix/109-alternative-approach/src/headers/tomcrypt_cfg.h As for your board it is ARM/32bit right? |
one gotcha of the ARM ABI is that it defaults to unsigned char, which is quite exceptional and breaks many assumptions. you can see if that's the issue by using |
It's armv8 aarch64. Neither I'will update what i found in late comment BTW, @karel-m Could give me some hints why you give me a |
If you compile the library (libtomcrypt + libtommath) with |
On X86_X64, when reading this one PC |
Try to patch
|
another case of broken CPP assumptions ... |
Well, no warnings at all because i always set As for patch Information for references:
|
In QEMU + Debian/ARM64 I am not able to reproduce the failure neither with
I have tested my https://github.com/karel-m/libtomcrypt-subset
IMO There must be something special|strange|different about your ARM board. |
Then would mind giving me some idea? Where can i add more debug logs to check where is going wrong? |
did you already try to run @karel-m 's code unaltered ? if that passes the tests, the bug is likely in your code. |
I print all number before Here is part of result Original number is As I'm still taking further investigation, and will feedback if i found where is wrong. |
Finally i worked it out. Code on my original board is messy, And standard library implementation is ridiculous. Another thing is that, Anyway ,case closed. Thanks for helping me.! |
Ad Ad |
|
Regarding 2 I've a patch that I wasn't able to test yet (I wrote the patch as some pre TLS implementations also used that format of pkcs#1v1.5) |
Thanks. |
I've pushed to feature/pkcs1ssl, feel free to try it out |
Thanks for creating such elegant crypt library. It's just the thing that i want.
But i found some difficult on transplanting it. I have a hardware which only have 512 KB memory to use.
And the only two functions i need are "rsa_import" "and rsa_decrypt". So i just include "rsa_decrypt_key.c" and "rsa_import.c", and then whenever i found "undefined references", i will include corresponding source file.
Finally it passes compiling, but i found the final library is 900KB, libtommatch is already 700KB. Is there any chance for me to shrink it? And how can i do it?
The text was updated successfully, but these errors were encountered: