~ubuntu-branches/ubuntu/saucy/clamav/saucy-backports

« back to all changes in this revision

Viewing changes to libclamav/uniq.c

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-07-15 01:08:10 UTC
  • mfrom: (0.35.47 sid)
  • Revision ID: package-import@ubuntu.com-20140715010810-ru66ek4fun2iseba
Tags: 0.98.4+dfsg-2~ubuntu13.10.1
No-change backport to saucy (LP: #1341962)

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include <string.h>
30
30
#endif
31
31
 
 
32
#include <openssl/ssl.h>
 
33
#include <openssl/err.h>
 
34
#include "libclamav/crypto.h"
 
35
 
32
36
#include "uniq.h"
33
37
#include "others.h"
34
 
#include "md5.h"
35
38
 
36
39
struct uniq *uniq_init(uint32_t count) {
37
40
  struct uniq *U;
57
60
uint32_t uniq_add(struct uniq *U, const char *key, uint32_t key_len, char **rhash) {
58
61
  unsigned int i;
59
62
  uint8_t digest[16];
60
 
  cli_md5_ctx md5;
61
63
  struct UNIQMD5 *m = NULL;
62
64
 
63
 
  cli_md5_init(&md5);
64
 
  cli_md5_update(&md5, key, key_len);
65
 
  cli_md5_final(digest, &md5);
 
65
  cl_hash_data("md5", key, key_len, digest, NULL);
66
66
 
67
67
  if(U->items && U->md5s[U->idx[*digest]].md5[0]==*digest)
68
68
    for(m=&U->md5s[U->idx[*digest]]; m; m=m->next)
96
96
 
97
97
uint32_t uniq_get(struct uniq *U, const char *key, uint32_t key_len, char **rhash) {
98
98
  uint8_t digest[16];
99
 
  cli_md5_ctx md5;
100
99
  struct UNIQMD5 *m = NULL;
101
100
 
102
 
  cli_md5_init(&md5);
103
 
  cli_md5_update(&md5, key, key_len);
104
 
  cli_md5_final(digest, &md5);
 
101
  cl_hash_data("md5", key, key_len, digest, NULL);
105
102
 
106
103
  if(!U->items || U->md5s[U->idx[*digest]].md5[0]!=*digest)
107
104
    return 0;