示例#1
0
文件: key.c 项目: aloisdg/pcp
/*  same as above but for imported pbp keys */
char *pcp_getpubkeyid(pcp_pubkey_t *k) {
  uint32_t s, p;
  p = jen_hash(k->pub, LBOXPUB, JEN_PSALT);
  s = jen_hash(k->edpub, LEDPUB, JEN_SSALT);
  char *id = ucmalloc(17);
  snprintf(id, 17, "%08X%08X", p, s);
  return id;
}
示例#2
0
static HM_RET_E hm_gen_hash_from_buf (
   HM_CTXT_X *px_hm_ctxt,
   uint8_t *puc_buf,
   uint32_t ui_buf_size,
   uint32_t *pui_hash)
{
   HM_RET_E e_error = eHM_RET_FAILURE;
   uint32_t ui_hash = 0;

   if ((NULL == px_hm_ctxt) || (NULL == puc_buf) || (NULL == pui_hash))
   {
      HM_LOG_MED("Invalid Args");
      e_error = eHM_RET_INVALID_ARGS;
      goto CLEAN_RETURN;
   }

   ui_hash = jen_hash (puc_buf, ui_buf_size, 0);

   ui_hash = ui_hash % px_hm_ctxt->x_init_params.ui_hm_table_size;
   *pui_hash = ui_hash;
   e_error = eHM_RET_SUCCESS;
CLEAN_RETURN:
   return e_error;
}