~7-luca/skylable/master

« back to all changes in this revision

Viewing changes to libsxclient/src/vcrypto.h

  • Committer: Alberto Wu
  • Date: 2015-10-29 16:39:50 UTC
  • Revision ID: git-v1:4d0837a887d92ed148e87a6e7bb7f4096046dc98
Allow building with valgrind hints (--enable-vghints)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 */
19
19
 
20
20
#include "sxlog.h"
 
21
#ifdef ENABLE_VGHINTS
 
22
#include "valgrind/memcheck.h"
 
23
#endif
21
24
 
22
25
int sxi_crypto_check_ver(struct sxi_logger *l);
23
26
 
42
45
 
43
46
void sxi_report_crypto(sxc_client_t *sx);
44
47
 
45
 
int sxi_rand_bytes(unsigned char *d, int len);
46
 
int sxi_rand_pseudo_bytes(unsigned char *d, int len);
 
48
int sxi_rand_bytes_impl(unsigned char *d, int len);
 
49
int sxi_rand_pseudo_bytes_impl(unsigned char *d, int len);
 
50
#ifdef ENABLE_VGHINTS
 
51
static __inline__ int sxi_rand_bytes(unsigned char *dest, int size) {
 
52
    int ret = sxi_rand_bytes_impl(dest, size);
 
53
    if(!ret)
 
54
        VALGRIND_MAKE_MEM_DEFINED(dest, size);
 
55
    return ret;
 
56
}
 
57
static __inline__ int sxi_rand_pseudo_bytes(unsigned char *dest, int size) {
 
58
    int ret = sxi_rand_pseudo_bytes_impl(dest, size);
 
59
    if(!ret)
 
60
        VALGRIND_MAKE_MEM_DEFINED(dest, size);
 
61
    return ret;
 
62
}
 
63
#else
 
64
#define sxi_rand_bytes sxi_rand_bytes_impl
 
65
#define sxi_rand_pseudo_bytes sxi_rand_pseudo_bytes_impl
 
66
#endif
 
67
 
47
68
void sxi_rand_cleanup(void);
48
69
 
49
70
int sxi_sha1_calc(const void *salt, unsigned salt_len, const void *buffer, unsigned int len, unsigned char *hash);