Skip to content
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

README on MPIs #354

Open
mg262 opened this issue Mar 5, 2018 · 3 comments
Open

README on MPIs #354

mg262 opened this issue Mar 5, 2018 · 3 comments

Comments

@mg262
Copy link

mg262 commented Mar 5, 2018

Hi,

Thanks for the great library! The docs say:

As of v1.06 of the library, the build process has been moved to two steps for the typical LibTomCrypt
application. This is because LibTomCrypt no longer provides a math API on its own and
relies on third party libraries (such as LibTomMath, GnuMP, or TomsFastMath).

This bit isn't clear from the README -- when first playing with the library, I wasn't sure whether the math libs were optional or not. If you had a chance to add a sentence on that, I think it could help new users.

@J08nY
Copy link
Collaborator

J08nY commented Mar 22, 2018

Agreed, was bitten by this as well when trying out LibTomCrypt for the first time.

@sjaeckel
Copy link
Member

Sorry, it true... you're not the first ones who had those problems... but I don't really know how to describe what is missing as information.
Now that you've figured out what is missing, could you please make a proposal? I'll happily update the README & documentation!

@aewag
Copy link

aewag commented Dec 12, 2020

I really struggled as well to understand this. For me the main thing I didn't see/understand was that i had to set the ltc_mp actively. For me this was especially hard to grasp as SHA256 worked without (I later read in the manual that the MP is only needed for the PK crypto, which makes totally sense). It may already explicitly stated in the manual and I simply overread it, but if not, this is something I think is valuable for someone being unfamiliar with ltc.

My minimal dummy working example using libtomcrypt with tomsfastmath is:

libtomcrypt-minimal/
├── build.sh
├── libtomcrypt
├── main.c
└── tomsfastmath

build.sh

cd tomsfastmath
make
cd ..
cd libtomcrypt
make CFLAGS="-DLTC_EASY -DTFM_DESC -I../tomsfastmath/src/headers" EXTRALIBS="../tomsfastmath/libtfm.a"
cd ..
gcc main.c -g -DTFM_DESC -DUSE_TFM -o main -Ilibtomcrypt/src/headers -Llibtomcrypt/libtomcrypt -Itomsfastmath/src/headers libtomcrypt/libtomcrypt.a tomsfastmath/libtfm.a

main.c

#include <stdio.h>
#include "tomcrypt.h"

const unsigned char pk[] = {0x00, 0x00, 0x00, 0x00};
unsigned long pk_len = 4;


void main(void) {
    ltc_mp = tfm_desc;
    printf("Start\n");
    hash_state md;
    sha256_init(&md);
    printf("SHA256 done\n");
    rsa_key key;
    rsa_import(pk, pk_len, &key);
    printf("RSA done\n");
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants