diff options
author | Andrew Bartlett <abartlet@samba.org> | 2009-11-13 10:51:14 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-11-13 23:19:05 +1100 |
commit | 4f8ba5ad6ac9b7153b0e13654e59f47e67b3f608 (patch) | |
tree | ca189d440b0a298cdcb3769d994828508dcd2e76 /source4/heimdal/lib/hcrypto | |
parent | 5bc87c14a1f5b45ed86e7ff9663f5f0aa2f70094 (diff) | |
download | samba-4f8ba5ad6ac9b7153b0e13654e59f47e67b3f608.tar.gz samba-4f8ba5ad6ac9b7153b0e13654e59f47e67b3f608.tar.bz2 samba-4f8ba5ad6ac9b7153b0e13654e59f47e67b3f608.zip |
s4:heimdal: import lorikeet-heimdal-200911122202 (commit 9291fd2d101f3eecec550178634faa94ead3e9a1)
Diffstat (limited to 'source4/heimdal/lib/hcrypto')
-rw-r--r-- | source4/heimdal/lib/hcrypto/evp-cc.c | 14 | ||||
-rw-r--r-- | source4/heimdal/lib/hcrypto/hmac.c | 3 | ||||
-rw-r--r-- | source4/heimdal/lib/hcrypto/rand-unix.c | 4 |
3 files changed, 19 insertions, 2 deletions
diff --git a/source4/heimdal/lib/hcrypto/evp-cc.c b/source4/heimdal/lib/hcrypto/evp-cc.c index 1bf8ca8af9..15b3479f8e 100644 --- a/source4/heimdal/lib/hcrypto/evp-cc.c +++ b/source4/heimdal/lib/hcrypto/evp-cc.c @@ -296,6 +296,7 @@ EVP_cc_aes_256_cbc(void) * */ +#ifdef COMMONCRYPTO_SUPPORTS_RC2 static int cc_rc2_cbc_init(EVP_CIPHER_CTX *ctx, const unsigned char * key, @@ -305,6 +306,7 @@ cc_rc2_cbc_init(EVP_CIPHER_CTX *ctx, struct cc_key *cc = ctx->cipher_data; return init_cc_key(encp, kCCAlgorithmRC2, key, ctx->cipher->key_len, iv, &cc->href); } +#endif /** * The RC2 cipher type - common crypto @@ -318,6 +320,7 @@ cc_rc2_cbc_init(EVP_CIPHER_CTX *ctx, const EVP_CIPHER * EVP_cc_rc2_cbc(void) { +#ifdef COMMONCRYPTO_SUPPORTS_RC2 static const EVP_CIPHER rc2_cbc = { 0, kCCBlockSizeRC2, @@ -334,6 +337,9 @@ EVP_cc_rc2_cbc(void) NULL }; return &rc2_cbc; +#else + return NULL; +#endif } /** @@ -348,6 +354,7 @@ EVP_cc_rc2_cbc(void) const EVP_CIPHER * EVP_cc_rc2_40_cbc(void) { +#ifdef COMMONCRYPTO_SUPPORTS_RC2 static const EVP_CIPHER rc2_40_cbc = { 0, kCCBlockSizeRC2, @@ -364,6 +371,9 @@ EVP_cc_rc2_40_cbc(void) NULL }; return &rc2_40_cbc; +#else + return NULL; +#endif } @@ -379,6 +389,7 @@ EVP_cc_rc2_40_cbc(void) const EVP_CIPHER * EVP_cc_rc2_64_cbc(void) { +#ifdef COMMONCRYPTO_SUPPORTS_RC2 static const EVP_CIPHER rc2_64_cbc = { 0, kCCBlockSizeRC2, @@ -395,6 +406,9 @@ EVP_cc_rc2_64_cbc(void) NULL }; return &rc2_64_cbc; +#else + return NULL; +#endif } /** diff --git a/source4/heimdal/lib/hcrypto/hmac.c b/source4/heimdal/lib/hcrypto/hmac.c index 282dc38113..dcd836d0be 100644 --- a/source4/heimdal/lib/hcrypto/hmac.c +++ b/source4/heimdal/lib/hcrypto/hmac.c @@ -121,7 +121,8 @@ HMAC_Init_ex(HMAC_CTX *ctx, for (i = 0, p = ctx->opad; i < keylen; i++) p[i] ^= ((const unsigned char *)key)[i]; - ctx->ctx = EVP_MD_CTX_create(); + if (ctx->ctx == NULL) + ctx->ctx = EVP_MD_CTX_create(); EVP_DigestInit_ex(ctx->ctx, ctx->md, ctx->engine); EVP_DigestUpdate(ctx->ctx, ctx->ipad, EVP_MD_block_size(ctx->md)); diff --git a/source4/heimdal/lib/hcrypto/rand-unix.c b/source4/heimdal/lib/hcrypto/rand-unix.c index 2bfa265fa4..fcad39f1de 100644 --- a/source4/heimdal/lib/hcrypto/rand-unix.c +++ b/source4/heimdal/lib/hcrypto/rand-unix.c @@ -95,8 +95,10 @@ unix_bytes(unsigned char *outdata, int size) ssize_t count; int once = 0; - if (size <= 0) + if (size < 0) return 0; + else if (size == 0) + return 1; HEIMDAL_MUTEX_lock(&random_mutex); if (random_fd == -1) { |