3 * Dummy SNMPv3 functions.
7 * Copyright (c) 2016 Elias Oenal.
10 * Redistribution and use in source and binary forms, with or without modification,
11 * are permitted provided that the following conditions are met:
13 * 1. Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 * 3. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
22 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
24 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
32 * Author: Elias Oenal <lwip@eliasoenal.com>
33 * Dirk Ziegelmeier <dirk@ziegelmeier.net>
36 #include "lwip/apps/snmpv3.h"
37 #include "snmpv3_priv.h"
41 #if LWIP_SNMP && LWIP_SNMP_V3
44 * @param username is a pointer to a string.
45 * @param auth_algo is a pointer to u8_t. The implementation has to set this if user was found.
46 * @param auth_key is a pointer to a pointer to a string. Implementation has to set this if user was found.
47 * @param priv_algo is a pointer to u8_t. The implementation has to set this if user was found.
48 * @param priv_key is a pointer to a pointer to a string. Implementation has to set this if user was found.
51 snmpv3_get_user(const char* username, u8_t *auth_algo, u8_t *auth_key, u8_t *priv_algo, u8_t *priv_key)
53 const char* engine_id;
56 if(strlen(username) == 0) {
60 if(memcmp(username, "lwip", 4) != 0) {
64 snmpv3_get_engine_id(&engine_id, &engine_id_len);
66 if(auth_key != NULL) {
67 snmpv3_password_to_key_sha((const u8_t*)"maplesyrup", 10,
68 (const u8_t*)engine_id, engine_id_len,
70 *auth_algo = SNMP_V3_AUTH_ALGO_SHA;
72 if(priv_key != NULL) {
73 snmpv3_password_to_key_sha((const u8_t*)"maplesyrup", 10,
74 (const u8_t*)engine_id, engine_id_len,
76 *priv_algo = SNMP_V3_PRIV_ALGO_DES;
82 * Get engine ID from persistence
87 snmpv3_get_engine_id(const char **id, u8_t *len)
89 *id = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02";
94 * Store engine ID in persistence
99 snmpv3_set_engine_id(const char *id, u8_t len)
102 LWIP_UNUSED_ARG(len);
107 * Get engine boots from persistence. Must be increased on each boot.
111 snmpv3_get_engine_boots(void)
117 * Store engine boots in persistence
121 snmpv3_set_engine_boots(u32_t boots)
123 LWIP_UNUSED_ARG(boots);
128 * Once the timer reaches 2147483647 it gets reset to zero and the
129 * engine boot ups get incremented.
132 snmpv3_get_engine_time(void)
138 * Reset current engine time to 0
141 snmpv3_reset_engine_time(void)
145 #endif /* LWIP_SNMP && LWIP_SNMP_V3 */