00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #ifndef IDEA_H
00047 #define IDEA_H
00048
00049 #include "snmp_pp/config_snmp_pp.h"
00050
00051 #ifdef SNMP_PP_NAMESPACE
00052 namespace Snmp_pp {
00053 #endif
00054
00055 #ifdef _USE_IDEA
00056
00057 typedef unsigned short word16;
00058 typedef unsigned int word32;
00059
00060 typedef struct
00061 {
00062 word16 key_schedule[52];
00063 } IDEAContext;
00064
00065
00066 void idea_set_key(IDEAContext *c, const unsigned char key[16]);
00067
00068
00069 void idea_destroy_context(IDEAContext *c);
00070
00071
00072 void idea_transform(IDEAContext *c, word32 l, word32 r, word32 *output);
00073
00074
00075
00076
00077
00078 void idea_cfb_encrypt(IDEAContext *c, unsigned char *iv, unsigned char *dest,
00079 const unsigned char *src, unsigned int len);
00080
00081
00082
00083
00084
00085
00086 void idea_cfb_decrypt(IDEAContext *c, unsigned char *iv, unsigned char *dest,
00087 const unsigned char *src, unsigned int len);
00088
00089 #endif
00090 #endif
00091
00092 #ifdef SNMP_PP_NAMESPACE
00093 };
00094 #endif
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111 #ifdef SNMP_PP_NAMESPACE
00112 namespace Snmp_pp {
00113 #endif
00114
00115 #ifndef GETPUT_H
00116 #define GETPUT_H
00117
00118
00119
00120 #define GET_32BIT(cp) (((unsigned long)(unsigned char)(cp)[0] << 24) | \
00121 ((unsigned long)(unsigned char)(cp)[1] << 16) | \
00122 ((unsigned long)(unsigned char)(cp)[2] << 8) | \
00123 ((unsigned long)(unsigned char)(cp)[3]))
00124
00125 #define GET_16BIT(cp) (((unsigned long)(unsigned char)(cp)[0] << 8) | \
00126 ((unsigned long)(unsigned char)(cp)[1]))
00127
00128 #define PUT_32BIT(cp, value) do { \
00129 (cp)[0] = (value) >> 24; \
00130 (cp)[1] = (value) >> 16; \
00131 (cp)[2] = (value) >> 8; \
00132 (cp)[3] = (value); } while (0)
00133
00134 #define PUT_16BIT(cp, value) do { \
00135 (cp)[0] = (value) >> 8; \
00136 (cp)[1] = (value); } while (0)
00137
00138
00139
00140 #define GET_32BIT_LSB_FIRST(cp) \
00141 (((unsigned long)(unsigned char)(cp)[0]) | \
00142 ((unsigned long)(unsigned char)(cp)[1] << 8) | \
00143 ((unsigned long)(unsigned char)(cp)[2] << 16) | \
00144 ((unsigned long)(unsigned char)(cp)[3] << 24))
00145
00146 #define GET_16BIT_LSB_FIRST(cp) \
00147 (((unsigned long)(unsigned char)(cp)[0]) | \
00148 ((unsigned long)(unsigned char)(cp)[1] << 8))
00149
00150 #define PUT_32BIT_LSB_FIRST(cp, value) do { \
00151 (cp)[0] = (value); \
00152 (cp)[1] = (value) >> 8; \
00153 (cp)[2] = (value) >> 16; \
00154 (cp)[3] = (value) >> 24; } while (0)
00155
00156 #define PUT_16BIT_LSB_FIRST(cp, value) do { \
00157 (cp)[0] = (value); \
00158 (cp)[1] = (value) >> 8; } while (0)
00159
00160 #ifdef SNMP_PP_NAMESPACE
00161 };
00162 #endif
00163
00164 #endif
00165