/** *\brief set the specified section's specified key's value to the specified value *\param cfg : the config file structure *\param section : the section name *\param key : the key name *\param value : the value of the key *\date 2008/04/03 *\return NULL if don't exist the key in specified section,or return the specified value */ char *setConfigString(struct configFile *cfg, char *section, char *key, char *value) { unsigned val;//by enya bucket *ptr;//by enya struct hash_table *hashSection; hashSection = (struct hash_table*)hashLookup(section, cfg->sections); if (!hashSection) { printf("do not exit section %s\n",section); return NULL; } val = hashHash(key) % hashSection->size; //by enya if (NULL == (hashSection->table)[val]) return NULL; for (ptr = (hashSection->table)[val]; NULL != ptr; ptr = ptr->next) { if (0 == stricmp(key, ptr->key)) { if (strlen(value) > strlen((char*)ptr->data)) { ptr->data = realloc(ptr->data, strlen(value) + 1); if (ptr->data == NULL) { printf("out of memory\n"); exit(-1); } } strcpy((char*)ptr->data, value); return (char*)ptr->data; } } return NULL; }
WOLFSSL_API int wc_Sha256Hash(const byte* data, word32 len, byte*hash) { return hashHash(data, len, hash, SHAMD5_ALGO_SHA256, SHA256_DIGEST_SIZE) ; }
WOLFSSL_API int wc_Md5Hash(const byte*data, word32 len, byte*hash) { return hashHash(data, len, hash, SHAMD5_ALGO_MD5, MD5_DIGEST_SIZE) ; }