Lines 35-42
Link Here
|
35 |
#include <openssl/rand.h> |
35 |
#include <openssl/rand.h> |
36 |
#include "crypto_backend.h" |
36 |
#include "crypto_backend.h" |
37 |
|
37 |
|
38 |
static int crypto_backend_initialised = 0; |
|
|
39 |
|
40 |
struct crypt_hash { |
38 |
struct crypt_hash { |
41 |
EVP_MD_CTX *md; |
39 |
EVP_MD_CTX *md; |
42 |
const EVP_MD *hash_id; |
40 |
const EVP_MD *hash_id; |
Lines 49-54
struct crypt_hmac {
Link Here
|
49 |
int hash_len; |
47 |
int hash_len; |
50 |
}; |
48 |
}; |
51 |
|
49 |
|
|
|
50 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) |
51 |
static int crypto_backend_initialised = 0; |
52 |
|
52 |
int crypt_backend_init(struct crypt_device *ctx) |
53 |
int crypt_backend_init(struct crypt_device *ctx) |
53 |
{ |
54 |
{ |
54 |
if (crypto_backend_initialised) |
55 |
if (crypto_backend_initialised) |
Lines 59-73
int crypt_backend_init(struct crypt_device *ctx)
Link Here
|
59 |
crypto_backend_initialised = 1; |
60 |
crypto_backend_initialised = 1; |
60 |
return 0; |
61 |
return 0; |
61 |
} |
62 |
} |
62 |
|
63 |
#else |
63 |
uint32_t crypt_backend_flags(void) |
64 |
int crypt_backend_init(struct crypt_device *ctx) |
64 |
{ |
65 |
{ |
65 |
return 0; |
66 |
return 0; |
66 |
} |
67 |
} |
|
|
68 |
#endif |
67 |
|
69 |
|
68 |
const char *crypt_backend_version(void) |
70 |
|
|
|
71 |
uint32_t crypt_backend_flags(void) |
69 |
{ |
72 |
{ |
70 |
return SSLeay_version(SSLEAY_VERSION); |
73 |
return 0; |
71 |
} |
74 |
} |
72 |
|
75 |
|
73 |
/* |
76 |
/* |
Lines 105-112
static void HMAC_CTX_free(HMAC_CTX *md)
Link Here
|
105 |
HMAC_CTX_cleanup(md); |
108 |
HMAC_CTX_cleanup(md); |
106 |
free(md); |
109 |
free(md); |
107 |
} |
110 |
} |
|
|
111 |
|
112 |
#define OPENSSL_VERSION SSLEAY_VERSION |
113 |
const char *OpenSSL_version(int t) |
114 |
{ |
115 |
return SSLeay_version(t); |
116 |
} |
108 |
#endif |
117 |
#endif |
109 |
|
118 |
|
|
|
119 |
const char *crypt_backend_version(void) |
120 |
{ |
121 |
return OpenSSL_version(OPENSSL_VERSION); |
122 |
} |
123 |
|
124 |
|
110 |
/* HASH */ |
125 |
/* HASH */ |
111 |
int crypt_hash_size(const char *name) |
126 |
int crypt_hash_size(const char *name) |
112 |
{ |
127 |
{ |
113 |
- |
|
|