Security Scol plugin
fltrimpl.h
1#ifndef CRYPTOPP_FLTRIMPL_H
2#define CRYPTOPP_FLTRIMPL_H
3
4#if CRYPTOPP_MSC_VERSION
5# pragma warning(push)
6# pragma warning(disable: 4100)
7#endif
8
9#if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
10# pragma GCC diagnostic push
11# pragma GCC diagnostic ignored "-Wunused-value"
12#endif
13
14#define FILTER_BEGIN \
15 switch (m_continueAt) \
16 { \
17 case 0: \
18 m_inputPosition = 0;
19
20#define FILTER_END_NO_MESSAGE_END_NO_RETURN \
21 break; \
22 default: \
23 CRYPTOPP_ASSERT(false); \
24 }
25
26#define FILTER_END_NO_MESSAGE_END \
27 FILTER_END_NO_MESSAGE_END_NO_RETURN \
28 return 0;
29
30/*
31#define FILTER_END \
32 case -1: \
33 if (messageEnd && Output(-1, NULLPTR, 0, messageEnd, blocking)) \
34 return 1; \
35 FILTER_END_NO_MESSAGE_END
36*/
37
38#define FILTER_OUTPUT3(site, statement, output, length, messageEnd, channel) \
39 {\
40 case site: \
41 statement; \
42 if (Output(site, output, length, messageEnd, blocking, channel)) \
43 return STDMAX(size_t(1), length-m_inputPosition);\
44 }
45
46#define FILTER_OUTPUT2(site, statement, output, length, messageEnd) \
47 FILTER_OUTPUT3(site, statement, output, length, messageEnd, DEFAULT_CHANNEL)
48
49#define FILTER_OUTPUT(site, output, length, messageEnd) \
50 FILTER_OUTPUT2(site, 0, output, length, messageEnd)
51
52#define FILTER_OUTPUT_BYTE(site, output) \
53 FILTER_OUTPUT(site, &(const byte &)(byte)output, 1, 0)
54
55#define FILTER_OUTPUT2_MODIFIABLE(site, statement, output, length, messageEnd) \
56 {\
57 /* fall through */ \
58 case site: \
59 statement; \
60 if (OutputModifiable(site, output, length, messageEnd, blocking)) \
61 return STDMAX(size_t(1), length-m_inputPosition);\
62 }
63
64#define FILTER_OUTPUT_MODIFIABLE(site, output, length, messageEnd) \
65 FILTER_OUTPUT2_MODIFIABLE(site, 0, output, length, messageEnd)
66
67#define FILTER_OUTPUT2_MAYBE_MODIFIABLE(site, statement, output, length, messageEnd, modifiable) \
68 {\
69 /* fall through */ \
70 case site: \
71 statement; \
72 if (modifiable ? OutputModifiable(site, output, length, messageEnd, blocking) : Output(site, output, length, messageEnd, blocking)) \
73 return STDMAX(size_t(1), length-m_inputPosition);\
74 }
75
76#define FILTER_OUTPUT_MAYBE_MODIFIABLE(site, output, length, messageEnd, modifiable) \
77 FILTER_OUTPUT2_MAYBE_MODIFIABLE(site, 0, output, length, messageEnd, modifiable)
78
79#if CRYPTOPP_MSC_VERSION
80# pragma warning(pop)
81#endif
82
83#if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
84# pragma GCC diagnostic pop
85#endif
86
87#endif