00001
00002
00003
00004
00005 #ifndef _SCAPI_H
00006 #define _SCAPI_H
00007
00008 #ifdef __cplusplus
00009 extern "C" {
00010 #endif
00011
00012
00013
00014
00015 #define SNMP_TRANS_AUTHLEN_HMACMD5 128
00016 #define SNMP_TRANS_AUTHLEN_HMACSHA1 160
00017
00018 #define SNMP_TRANS_AUTHLEN_HMAC96 96
00019
00020 #define SNMP_TRANS_PRIVLEN_1DES 64
00021 #define SNMP_TRANS_PRIVLEN_1DES_IV 64
00022
00023 #define SNMP_TRANS_PRIVLEN_AES 128
00024 #define SNMP_TRANS_PRIVLEN_AES_IV 128
00025 #define SNMP_TRANS_AES_PADSIZE 128
00026 #define SNMP_TRANS_PRIVLEN_AES128 128
00027 #define SNMP_TRANS_PRIVLEN_AES128_IV 128
00028 #define SNMP_TRANS_AES_AES128_PADSIZE 128
00029
00030
00031
00032
00033 int sc_get_properlength(const oid * hashtype,
00034 u_int hashtype_len);
00035 int sc_get_proper_priv_length(const oid * privtype,
00036 u_int privtype_len);
00037
00038 int sc_init(void);
00039 int sc_shutdown(int majorID, int minorID, void *serverarg,
00040 void *clientarg);
00041
00042 int sc_random(u_char * buf, size_t * buflen);
00043
00044 int sc_generate_keyed_hash(const oid * authtype,
00045 size_t authtypelen,
00046 u_char * key, u_int keylen,
00047 u_char * message, u_int msglen,
00048 u_char * MAC, size_t * maclen);
00049
00050 int sc_check_keyed_hash(const oid * authtype,
00051 size_t authtypelen, u_char * key,
00052 u_int keylen, u_char * message,
00053 u_int msglen, u_char * MAC,
00054 u_int maclen);
00055
00056 int sc_encrypt(const oid * privtype, size_t privtypelen,
00057 u_char * key, u_int keylen,
00058 u_char * iv, u_int ivlen,
00059 u_char * plaintext, u_int ptlen,
00060 u_char * ciphertext, size_t * ctlen);
00061
00062 int sc_decrypt(const oid * privtype, size_t privtypelen,
00063 u_char * key, u_int keylen,
00064 u_char * iv, u_int ivlen,
00065 u_char * ciphertext, u_int ctlen,
00066 u_char * plaintext, size_t * ptlen);
00067
00068 int sc_hash(const oid * hashtype, size_t hashtypelen,
00069 u_char * buf, size_t buf_len,
00070 u_char * MAC, size_t * MAC_len);
00071
00072 int sc_get_transform_type(oid * hashtype,
00073 u_int hashtype_len,
00074 int (**hash_fn) (const int mode,
00075 void **context,
00076 const u_char *
00077 data,
00078 const int
00079 data_len,
00080 u_char **
00081 digest,
00082 size_t *
00083 digest_len));
00084
00085
00086
00087
00088
00089 #define _SCAPI_NOT_CONFIGURED \
00090 { \
00091 snmp_log(LOG_ERR, "Encryption support not enabled.\n"); \
00092 DEBUGMSGTL(("scapi", "SCAPI not configured")); \
00093 return SNMPERR_SC_NOT_CONFIGURED; \
00094 }
00095
00096
00097
00098
00099 #ifdef USE_INTERNAL_MD5
00100 #define INTERNAL_MD5 1
00101 #endif
00102
00103 #ifdef __cplusplus
00104 }
00105 #endif
00106 #endif