-
Notifications
You must be signed in to change notification settings - Fork 37
/
crypto_polarssl.h
39 lines (26 loc) · 1.14 KB
/
crypto_polarssl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef __crypto_polarssl_h
#define __crypto_polarssl_h
#ifndef CONFIG
#define CONFIG "config.h"
#endif // CONFIG
#include CONFIG
#include <polarssl/version.h>
#include "crypto.h"
#if POLARSSL_VERSION_NUMBER >= 0x01030000
#include <polarssl/sha256.h>
#define Sha256(d, l, h) sha256(d, l, h, 0)
#define Sha256HmacCtx sha256_context
#define Sha256HmacInit(c, k, l) ( sha256_hmac_starts(c, k, l, 0), !0 )
#define Sha256HmacUpdate(c, d, l) ( sha256_hmac_update(c, d, l), !0 )
#define Sha256HmacFinish(c, h) ( sha256_hmac_finish(c, h), !0 )
#define Sha256Hmac(k, d, l, h) ( sha256_hmac(k, 16, d, l, h, FALSE), !0 )
#else // POLARSSL_VERSION_NUMBER
#include <polarssl/sha2.h>
#define Sha256(d, l, h) sha2(d, l, h, 0)
#define Sha256HmacCtx sha2_context
#define Sha256HmacInit(c, k, l) ( sha2_hmac_starts(c, k, l, 0), !0 )
#define Sha256HmacUpdate(c, d, l) ( sha2_hmac_update(c, d, l), !0 )
#define Sha256HmacFinish(c, h) ( sha2_hmac_finish(c, h), !0 )
#define Sha256Hmac(k, d, l, h) ( sha2_hmac(k, 16, d, l, h, FALSE), !0 )
#endif // POLARSSL_VERSION_NUMBER
#endif // __crypto_polarssl_h