suricata
util-crypt.h
Go to the documentation of this file.
1
/* Copyright (C) 2007-2012 Open Information Security Foundation
2
*
3
* You can copy, redistribute or modify this Program under the terms of
4
* the GNU General Public License version 2 as published by the Free
5
* Software Foundation.
6
*
7
* This program is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
* GNU General Public License for more details.
11
*
12
* You should have received a copy of the GNU General Public License
13
* version 2 along with this program; if not, write to the Free Software
14
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15
* 02110-1301, USA.
16
*/
17
18
/**
19
* \file
20
*
21
* \author Roliers Jean-Paul <popof.fpn@gmail.co>
22
*
23
* Implements cryptographic functions.
24
* Based on the libtomcrypt library ( http://libtom.org/?page=features&newsitems=5&whatfile=crypt )
25
*/
26
27
#ifndef UTIL_CRYPT_H_
28
#define UTIL_CRYPT_H_
29
30
#include "
suricata-common.h
"
31
32
/* Ratio of output bytes to input bytes for Base64 Encoding is 4:3, hence the
33
* required output bytes are 4 * ceil(input_len / 3) and an additional byte
34
* for storing the NULL pointer.
35
* */
36
#define BASE64_BUFFER_SIZE(x) ((4 * ((x) + 2) / 3) + 1)
37
38
typedef
enum
{
39
SC_BASE64_OK
,
40
SC_BASE64_INVALID_ARG
,
41
SC_BASE64_OVERFLOW
,
42
43
}
CryptId
;
44
45
int
Base64Encode
(
const
unsigned
char
*in,
unsigned
long
inlen,
unsigned
char
*out,
unsigned
long
*outlen);
46
47
#endif
/* UTIL_CRYPT_H_ */
SC_BASE64_OVERFLOW
@ SC_BASE64_OVERFLOW
Definition:
util-crypt.h:41
SC_BASE64_INVALID_ARG
@ SC_BASE64_INVALID_ARG
Definition:
util-crypt.h:40
CryptId
CryptId
Definition:
util-crypt.h:38
SC_BASE64_OK
@ SC_BASE64_OK
Definition:
util-crypt.h:39
suricata-common.h
Base64Encode
int Base64Encode(const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen)
Definition:
util-crypt.c:35
src
util-crypt.h
Generated on Mon Mar 1 2021 23:30:44 for suricata by
1.8.18