Go to the documentation of this file.
31 #ifndef _SNMP_AGENT_USM_H
32 #define _SNMP_AGENT_USM_H
41 #ifndef SNMP_TIME_WINDOW
42 #define SNMP_TIME_WINDOW 150
43 #elif (SNMP_TIME_WINDOW < 1)
44 #error SNMP_TIME_WINDOW parameter is not valid
48 #ifndef SNMP_MD5_SUPPORT
49 #define SNMP_MD5_SUPPORT ENABLED
50 #elif (SNMP_MD5_SUPPORT != ENABLED && SNMP_MD5_SUPPORT != DISABLED)
51 #error SNMP_MD5_SUPPORT parameter is not valid
55 #ifndef SNMP_SHA1_SUPPORT
56 #define SNMP_SHA1_SUPPORT ENABLED
57 #elif (SNMP_SHA1_SUPPORT != ENABLED && SNMP_SHA1_SUPPORT != DISABLED)
58 #error SNMP_SHA1_SUPPORT parameter is not valid
62 #ifndef SNMP_SHA224_SUPPORT
63 #define SNMP_SHA224_SUPPORT DISABLED
64 #elif (SNMP_SHA224_SUPPORT != ENABLED && SNMP_SHA224_SUPPORT != DISABLED)
65 #error SNMP_SHA224_SUPPORT parameter is not valid
69 #ifndef SNMP_SHA256_SUPPORT
70 #define SNMP_SHA256_SUPPORT DISABLED
71 #elif (SNMP_SHA256_SUPPORT != ENABLED && SNMP_SHA256_SUPPORT != DISABLED)
72 #error SNMP_SHA256_SUPPORT parameter is not valid
76 #ifndef SNMP_SHA384_SUPPORT
77 #define SNMP_SHA384_SUPPORT DISABLED
78 #elif (SNMP_SHA384_SUPPORT != ENABLED && SNMP_SHA384_SUPPORT != DISABLED)
79 #error SNMP_SHA384_SUPPORT parameter is not valid
83 #ifndef SNMP_SHA512_SUPPORT
84 #define SNMP_SHA512_SUPPORT DISABLED
85 #elif (SNMP_SHA512_SUPPORT != ENABLED && SNMP_SHA512_SUPPORT != DISABLED)
86 #error SNMP_SHA512_SUPPORT parameter is not valid
90 #ifndef SNMP_DES_SUPPORT
91 #define SNMP_DES_SUPPORT ENABLED
92 #elif (SNMP_DES_SUPPORT != ENABLED && SNMP_DES_SUPPORT != DISABLED)
93 #error SNMP_DES_SUPPORT parameter is not valid
97 #ifndef SNMP_AES_SUPPORT
98 #define SNMP_AES_SUPPORT ENABLED
99 #elif (SNMP_AES_SUPPORT != ENABLED && SNMP_AES_SUPPORT != DISABLED)
100 #error SNMP_AES_SUPPORT parameter is not valid
104 #if (SNMP_MD5_SUPPORT == ENABLED)
109 #if (SNMP_SHA1_SUPPORT == ENABLED)
114 #if (SNMP_SHA224_SUPPORT == ENABLED)
119 #if (SNMP_SHA256_SUPPORT == ENABLED)
124 #if (SNMP_SHA384_SUPPORT == ENABLED)
129 #if (SNMP_SHA512_SUPPORT == ENABLED)
134 #if (SNMP_DES_SUPPORT == ENABLED)
140 #if (SNMP_AES_SUPPORT == ENABLED)
146 #if (SNMP_SHA512_SUPPORT == ENABLED)
147 #define SNMP_MAX_KEY_SIZE 64
148 #elif (SNMP_SHA384_SUPPORT == ENABLED)
149 #define SNMP_MAX_KEY_SIZE 48
150 #elif (SNMP_SHA256_SUPPORT == ENABLED)
151 #define SNMP_MAX_KEY_SIZE 32
152 #elif (SNMP_SHA224_SUPPORT == ENABLED)
153 #define SNMP_MAX_KEY_SIZE 28
154 #elif (SNMP_SHA1_SUPPORT == ENABLED)
155 #define SNMP_MAX_KEY_SIZE 20
157 #define SNMP_MAX_KEY_SIZE 16
161 #if (SNMP_SHA512_SUPPORT == ENABLED)
162 #define SNMP_MAX_TRUNCATED_MAC_SIZE 48
163 #elif (SNMP_SHA384_SUPPORT == ENABLED)
164 #define SNMP_MAX_TRUNCATED_MAC_SIZE 32
165 #elif (SNMP_SHA256_SUPPORT == ENABLED)
166 #define SNMP_MAX_TRUNCATED_MAC_SIZE 24
167 #elif (SNMP_SHA224_SUPPORT == ENABLED)
168 #define SNMP_MAX_TRUNCATED_MAC_SIZE 16
169 #elif (SNMP_SHA1_SUPPORT == ENABLED)
170 #define SNMP_MAX_TRUNCATED_MAC_SIZE 12
172 #define SNMP_MAX_TRUNCATED_MAC_SIZE 12
176 #if (SNMP_DES_SUPPORT == ENABLED)
177 #define SNMP_MSG_ENCRYPTION_OVERHEAD 8
179 #define SNMP_MSG_ENCRYPTION_OVERHEAD 0
299 #if (SNMP_V3_SUPPORT == ENABLED)
SnmpUserEntry * snmpFindUserEntry(SnmpAgentContext *context, const char_t *name, size_t length)
Search the user table for a given user name.
@ SNMP_SECURITY_MODEL_ANY
Any.
@ SNMP_AUTH_PROTOCOL_MD5
HMAC-MD5-96.
@ SNMP_SECURITY_MODEL_V1
SNMPv1.
#define SNMP_MAX_KEY_SIZE
error_t snmpGenerateKey(SnmpAuthProtocol authProtocol, const char_t *password, SnmpKey *key)
Password to key algorithm.
@ SNMP_KEY_FORMAT_LOCALIZED
Localized key.
@ SNMP_KEY_FORMAT_NONE
Unspecified key format.
error_t snmpAuthIncomingMessage(const SnmpUserEntry *user, SnmpMessage *message)
Authenticate incoming SNMP message.
SnmpKey localizedPrivKey
Localized privacy key.
SnmpSecurityModel
Security models.
error_t snmpAuthOutgoingMessage(const SnmpUserEntry *user, SnmpMessage *message)
Authenticate outgoing SNMP message.
void snmpRefreshEngineTime(SnmpAgentContext *context)
Refresh SNMP engine time.
@ SNMP_AUTH_PROTOCOL_SHA224
HMAC-SHA-224-128.
SnmpAccess mode
Access mode.
const uint8_t usmStatsNotInTimeWindowsObject[10]
SHA-1 (Secure Hash Algorithm 1)
SnmpKeyFormat
SNMP key format.
@ SNMP_AUTH_PROTOCOL_SHA384
HMAC-SHA-384-256.
error_t snmpLocalizeKey(SnmpAuthProtocol authProtocol, const uint8_t *engineId, size_t engineIdLen, SnmpKey *key, SnmpKey *localizedKey)
Key localization algorithm.
SHA-512 (Secure Hash Algorithm 512)
void snmpChangeKey(const HashAlgo *hashAlgo, const uint8_t *random, const uint8_t *delta, SnmpKey *key)
Change secret key.
const uint8_t usmStatsUnknownUserNamesObject[10]
@ SNMP_SECURITY_MODEL_USM
User-based security model.
const HashAlgo * snmpGetHashAlgo(SnmpAuthProtocol authProtocol)
Get the hash algorithm to be used for a given authentication protocol.
SNMP agent (Simple Network Management Protocol)
const uint8_t usmStatsUnknownEngineIdsObject[10]
@ SNMP_SECURITY_MODEL_TSM
Transport security model.
size_t publicValueLen
Length of the public value.
SnmpKey localizedAuthKey
Localized authentication key.
@ SNMP_PRIV_PROTOCOL_NONE
No privacy.
#define SNMP_MAX_USER_NAME_LEN
@ SNMP_KEY_FORMAT_TEXT
ASCII password.
AES (Advanced Encryption Standard)
const uint8_t usmStatsUnsupportedSecLevelsObject[10]
@ SNMP_SECURITY_LEVEL_NO_AUTH_NO_PRIV
@ SNMP_MSG_FLAG_REPORTABLE
@ SNMP_AUTH_PROTOCOL_SHA256
HMAC-SHA-256-192.
const uint8_t usmStatsDecryptionErrorsObject[10]
General definitions for cryptographic algorithms.
@ SNMP_AUTH_PROTOCOL_SHA1
HMAC-SHA-1-96.
SnmpMessageFlags
Message flags.
@ SNMP_AUTH_PROTOCOL_SHA512
HMAC-SHA-512-384.
void snmpCloneSecurityParameters(SnmpUserEntry *user, const SnmpUserEntry *cloneFromUser)
Clone security parameters.
@ SNMP_SECURITY_LEVEL_AUTH_PRIV
SHA-384 (Secure Hash Algorithm 384)
#define SNMP_MAX_PUBLIC_VALUE_SIZE
Cipher Block Chaining (CBC) mode.
DES (Data Encryption Standard)
MibRowStatus status
Status of the user.
error_t snmpDecryptData(const SnmpUserEntry *user, SnmpMessage *message)
Data decryption.
SHA-256 (Secure Hash Algorithm 256)
SnmpAuthProtocol authProtocol
Authentication protocol.
Common definitions for MIB modules.
error_t snmpCheckSecurityParameters(const SnmpUserEntry *user, SnmpMessage *message, const uint8_t *engineId, size_t engineIdLen)
Check security parameters.
MD5 (Message-Digest Algorithm)
const uint8_t usmStatsWrongDigestsObject[10]
error_t snmpCheckEngineTime(SnmpAgentContext *context, SnmpMessage *message)
Replay protection.
SnmpKey rawAuthKey
Raw authentication key.
error_t snmpEncryptData(const SnmpUserEntry *user, SnmpMessage *message, uint64_t *salt)
Data encryption.
SnmpPrivProtocol privProtocol
Privacy protocol.
SnmpSecurityLevel
Security levels.
Common interface for hash algorithms.
size_t snmpGetMacLength(SnmpAuthProtocol authProtocol)
Get the length of the truncated MAC for a given authentication protocol.
@ SNMP_SECURITY_MODEL_V2C
SNMPv2c.
@ SNMP_PRIV_PROTOCOL_AES
AES-128-CFB.
@ SNMP_AUTH_PROTOCOL_NONE
No authentication.
Cipher Feedback (CFB) mode.
@ SNMP_KEY_FORMAT_RAW
Raw key.
SnmpUserEntry * snmpCreateUserEntry(SnmpAgentContext *context)
Create a new user entry.
SnmpKey rawPrivKey
Raw privacy key.
@ SNMP_PRIV_PROTOCOL_DES
DES-CBC.
@ SNMP_SECURITY_LEVEL_AUTH_NO_PRIV
SHA-224 (Secure Hash Algorithm 224)