-/* $OSSEC, os_crypto/blowfish_op.c, v0.2, 2005/09/17, Daniel B. Cid$ */
-
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* Foundation
*/
-/* v0.2 (2005/09/17): uchar fixes
- * v0.1 (2005/01/29)
- */
-
-/* OS_crypto/blowfish Library.
- * APIs for many crypto operations.
+/* OS_crypto/blowfish Library
+ * APIs for many crypto operations
*/
#include <stdio.h>
#include <string.h>
#include "blowfish.h"
-
#include "bf_op.h"
typedef unsigned char uchar;
-int OS_BF_Str(char *input, char *output, char *charkey,
- long size, short int action)
+
+int OS_BF_Str(const char *input, char *output, const char *charkey,
+ long size, short int action)
{
BF_KEY key;
- static unsigned char cbc_iv [8]={0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10};
+ static unsigned char cbc_iv [8] = {0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10};
unsigned char iv[8];
- memcpy(iv,cbc_iv,sizeof(iv));
+ memcpy(iv, cbc_iv, sizeof(iv));
- BF_set_key(&key, strlen(charkey), (uchar *)charkey);
+ BF_set_key(&key, (int)strlen(charkey), (const uchar *)charkey);
- BF_cbc_encrypt((uchar *)input, (uchar *)output, size,
- &key, iv, action);
+ BF_cbc_encrypt((const uchar *)input, (uchar *)output, (long)size,
+ &key, iv, action);
- return(1);
+ return (1);
}
-/* EOF */