Refactor the dns_open_connection code so that duplicate code is removed and ensure...
[sfrench/samba-autobuild/.git] / lib / crypto / arcfour.c
index 94196fa1ee136953f7881a1ec86c059437fd9200..d310649e702e39dbd194552e1efc7014614bb140 100644 (file)
@@ -19,8 +19,8 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "includes.h"
-#include "lib/crypto/crypto.h"
+#include "replace.h"
+#include "../lib/crypto/arcfour.h"
 
 /* initialise the arcfour sbox with key */
 _PUBLIC_ void arcfour_init(struct arcfour_state *state, const DATA_BLOB *key) 
@@ -81,11 +81,12 @@ _PUBLIC_ void arcfour_crypt_blob(uint8_t *data, int len, const DATA_BLOB *key)
 */
 _PUBLIC_ void arcfour_crypt(uint8_t *data, const uint8_t keystr[16], int len)
 {
-       DATA_BLOB key = data_blob(keystr, 16);
-       
-       arcfour_crypt_blob(data, len, &key);
+       uint8_t keycopy[16];
+       DATA_BLOB key = { .data = keycopy, .length = sizeof(keycopy) };
 
-       data_blob_free(&key);
+       memcpy(keycopy, keystr, sizeof(keycopy));
+
+       arcfour_crypt_blob(data, len, &key);
 }