tests: be more elaborate about what was expected
[awesomized/libmemcached] / src / libhashkit / hashkit.cc
index 46cf6368a0dc747d25f2ec4647c9da5f23b557c4..63b7f62edc5897b5f320314ac497369ccf54bb6d 100644 (file)
 
 #include "libhashkit/common.h"
 
-#ifdef WITH_OPENSSL
-#  include <openssl/evp.h>
-#endif
-
 static inline void _hashkit_init(hashkit_st *self) {
   self->base_hash.function = hashkit_one_at_a_time;
   self->base_hash.context = NULL;
@@ -27,7 +23,7 @@ static inline void _hashkit_init(hashkit_st *self) {
   self->distribution_hash.context = NULL;
 
   self->flags.is_base_same_distributed = true;
-  self->_cryptographic_context = NULL;
+  self->_key = NULL;
 }
 
 static inline hashkit_st *_hashkit_create(hashkit_st *self) {
@@ -56,26 +52,11 @@ hashkit_st *hashkit_create(hashkit_st *self) {
   return self;
 }
 
-#ifdef WITH_OPENSSL
-static void cryptographic_context_free(encryption_context_t *context) {
-  EVP_CIPHER_CTX_free(context->encryption_context);
-  EVP_CIPHER_CTX_free(context->decryption_context);
-  free(context);
-}
-#endif
-
 void hashkit_free(hashkit_st *self) {
-#ifdef WITH_OPENSSL
-  if (self and self->_cryptographic_context) {
-    cryptographic_context_free((encryption_context_t *)self->_cryptographic_context);
-    self->_cryptographic_context = NULL;
-  }
-#else
-  if (self and self->_cryptographic_context) {
-    free(self->_cryptographic_context);
-    self->_cryptographic_context = NULL;
+  if (self and self->_key) {
+    aes_free_key((aes_key_t *) self->_key);
+    self->_key = NULL;
   }
-#endif
 
   if (hashkit_is_allocated(self)) {
     free(self);
@@ -98,21 +79,7 @@ hashkit_st *hashkit_clone(hashkit_st *destination, const hashkit_st *source) {
   destination->base_hash = source->base_hash;
   destination->distribution_hash = source->distribution_hash;
   destination->flags = source->flags;
-#ifdef WITH_OPENSSL
-  if (destination->_cryptographic_context) {
-    cryptographic_context_free((encryption_context_t *)destination->_cryptographic_context);
-    destination->_cryptographic_context = NULL;
-  }
-  if (source->_cryptographic_context) {
-    destination->_cryptographic_context =
-        aes_clone_cryptographic_context(((encryption_context_t *) source->_cryptographic_context));
-    if (destination->_cryptographic_context) {
-      
-    }
-  }
-#else
-  destination->_cryptographic_context = aes_clone_key(static_cast<aes_key_t *>(source->_cryptographic_context));
-#endif
+  destination->_key = aes_clone_key((aes_key_t *) source->_key);
 
   return destination;
 }