1

我正在尝试将 LibTomCrypt 库与 Contiki OS 一起使用,但它根本不起作用。我收到错误:致命:不是有效的对象名称 HEAD。我已使用以下代码在我的客户端文件中计算哈希。

 unsigned char* hashSHA1(const char* input, unsigned long inputSize) {
    //Initial
    unsigned char* hashResult = (unsigned char*)malloc(sha1_desc.hashsize);
    //Initialize a state variable for the hash
    hash_state md;
    sha1_init(&md);
    //Process the text - remember you can call process() multiple times
    sha1_process(&md, (const unsigned char*) input, inputSize);
    //Finish the hash calculation
    sha1_done(&md, hashResult);
    // Return the result
    return hashResult;
}

然后我在 send_packet() 中调用它。我已经添加了头文件

`#include <tomcrypt.h>` 

现在在 Makefile 中,我不确定如何添加路径。我检查了一些可能的方法,例如,尝试使用 libtomcrypt 库(rsa 公钥生成)时出现 Contiki mote 类型创建错误,并且我添加了以下几行:

    PROJECT_SOURCEFILES += sha1.c
    MODULES += ./libtomcrypt-develop
    PROJECT_LIBRARIES+= $(CONTIKI)/libtomcrypt-develop/libtomcrypt.a

(这里libtomcrypt-develop是包含LibTomCrypt库的文件夹的名称)根据我的理解,我猜Makefile有问题。有人可以找出Makefile中的问题吗?

4

0 回答 0