1 /* 2 * netutil.h - CC31xx/CC32xx Host Driver Implementation 3 * 4 * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/ 5 * 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 14 * Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the 17 * distribution. 18 * 19 * Neither the name of Texas Instruments Incorporated nor the names of 20 * its contributors may be used to endorse or promote products derived 21 * from this software without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 * 35 */ 36 37 #ifndef __NETUTIL_H__ 38 #define __NETUTIL_H__ 39 40 /*****************************************************************************/ 41 /* Include files */ 42 /*****************************************************************************/ 43 #include <ti/drivers/net/wifi/simplelink.h> 44 45 #ifdef __cplusplus 46 extern "C" { 47 #endif 48 49 /*! 50 \defgroup NetUtil 51 \short Networking related commands and configuration 52 53 */ 54 55 /*! 56 57 \addtogroup NetUtil 58 @{ 59 60 */ 61 62 /*****************************************************************************/ 63 /* Macro declarations */ 64 /*****************************************************************************/ 65 66 /* Set/get options */ 67 #define SL_NETUTIL_CRYPTO_PUBLIC_KEY (1) 68 #define SL_NETUTIL_CRYPTO_PUBLIC_KEY_INFO (2) 69 #define SL_NETUTIL_TRUE_RANDOM (3) 70 71 /* Commands */ 72 #define SL_NETUTIL_CRYPTO_CMD_CREATE_CERT (1) 73 #define SL_NETUTIL_CRYPTO_CMD_SIGN_MSG (2) 74 #define SL_NETUTIL_CRYPTO_CMD_VERIFY_MSG (3) 75 #define SL_NETUTIL_CRYPTO_CMD_TEMP_KEYS (4) 76 #define SL_NETUTIL_CRYPTO_CMD_INSTALL_OP (5) 77 #define SL_NETUTIL_CMD_ARP_LOOKUP (6) 78 79 /*****************************************************************************/ 80 /* Errors returned from the general error async event */ 81 /*****************************************************************************/ 82 83 84 /*****************************************************************************/ 85 /* Structure/Enum declarations */ 86 /*****************************************************************************/ 87 88 typedef struct 89 { 90 _u8 *pOutputValues; 91 _u16 *pOutputLen; 92 _i16 Status; 93 }_SlNetUtilCmdData_t; 94 95 /* Defines the size of the buffer that will be allocated */ 96 /* (on the stack) by the sl_UtilsCmd API. */ 97 #define SL_NETUTIL_CMD_BUFFER_SIZE (256) 98 99 /* Enumeration of Signature types */ 100 #define SL_NETUTIL_CRYPTO_SIG_SHAwDSA (0) 101 #define SL_NETUTIL_CRYPTO_SIG_MD2wRSA (1) 102 #define SL_NETUTIL_CRYPTO_SIG_MD5wRSA (2) 103 #define SL_NETUTIL_CRYPTO_SIG_SHAwRSA (3) 104 #define SL_NETUTIL_CRYPTO_SIG_SHAwECDSA (4) 105 #define SL_NETUTIL_CRYPTO_SIG_SHA256wRSA (5) 106 #define SL_NETUTIL_CRYPTO_SIG_SHA256wECDSA (6) 107 #define SL_NETUTIL_CRYPTO_SIG_SHA384wRSA (7) 108 #define SL_NETUTIL_CRYPTO_SIG_SHA384wECDSA (8) 109 #define SL_NETUTIL_CRYPTO_SIG_SHA512wRSA (9) 110 #define SL_NETUTIL_CRYPTO_SIG_SHA512wECDSA (10) 111 #define SL_NETUTIL_CRYPTO_SIG_DIGESTwECDSA (11) 112 /* Add more signature-Types here */ 113 114 /* Digest length definitions */ 115 #define SL_NETUTIL_CRYPTO_DGST_MD2_LEN_BYTES (16) 116 #define SL_NETUTIL_CRYPTO_DGST_MD5_LEN_BYTES (16) 117 #define SL_NETUTIL_CRYPTO_DGST_SHA_LEN_BYTES (20) 118 #define SL_NETUTIL_CRYPTO_DGST_SHA256_LEN_BYTES (32) 119 #define SL_NETUTIL_CRYPTO_DGST_SHA384_LEN_BYTES (48) 120 #define SL_NETUTIL_CRYPTO_DGST_SHA512_LEN_BYTES (64) 121 122 123 /* Enumeration of Create-Certificate sub-commands */ 124 #define SL_NETUTIL_CRYPTO_CERT_INIT (1) 125 #define SL_NETUTIL_CRYPTO_CERT_SIGN_AND_SAVE (2) 126 #define SL_NETUTIL_CRYPTO_CERT_VER (3) 127 #define SL_NETUTIL_CRYPTO_CERT_SERIAL (4) 128 #define SL_NETUTIL_CRYPTO_CERT_SIG_TYPE (5) 129 #define SL_NETUTIL_CRYPTO_CSR_SIGN_AND_SAVE (6) 130 #if 0 /* reserved for Issuer information - currently not supported */ 131 #define SL_NETUTIL_CRYPTO_CERT_ISSUER_COUNTRY (6) 132 #define SL_NETUTIL_CRYPTO_CERT_ISSUER_STATE (7) 133 #define SL_NETUTIL_CRYPTO_CERT_ISSUER_LOCALITY (8) 134 #define SL_NETUTIL_CRYPTO_CERT_ISSUER_SUR (9) 135 #define SL_NETUTIL_CRYPTO_CERT_ISSUER_ORG (10) 136 #define SL_NETUTIL_CRYPTO_CERT_ISSUER_ORG_UNIT (11) 137 #define SL_NETUTIL_CRYPTO_CERT_ISSUER_COMMON_NAME (12) 138 #define SL_NETUTIL_CRYPTO_CERT_ISSUER_EMAIL (13) 139 #endif /* End - issuer information */ 140 #define SL_NETUTIL_CRYPTO_CERT_DAYS_VALID (14) 141 #define SL_NETUTIL_CRYPTO_CERT_SUBJECT_COUNTRY (15) 142 #define SL_NETUTIL_CRYPTO_CERT_SUBJECT_STATE (16) 143 #define SL_NETUTIL_CRYPTO_CERT_SUBJECT_LOCALITY (17) 144 #define SL_NETUTIL_CRYPTO_CERT_SUBJECT_SUR (18) 145 #define SL_NETUTIL_CRYPTO_CERT_SUBJECT_ORG (19) 146 #define SL_NETUTIL_CRYPTO_CERT_SUBJECT_ORG_UNIT (20) 147 #define SL_NETUTIL_CRYPTO_CERT_SUBJECT_COMMON_NAME (21) 148 #define SL_NETUTIL_CRYPTO_CERT_SUBJECT_EMAIL (22) 149 #define SL_NETUTIL_CRYPTO_CERT_IS_CA (23) 150 151 152 /* Enumeration of "Temp-Keys" commands */ 153 #define SL_NETUTIL_CRYPTO_TEMP_KEYS_CREATE (1) 154 #define SL_NETUTIL_CRYPTO_TEMP_KEYS_REMOVE (2) 155 156 /* Enumeration of "Install/Uninstall" sub-commands */ 157 #define SL_NETUTIL_CRYPTO_INSTALL_SUB_CMD (1) 158 #define SL_NETUTIL_CRYPTO_UNINSTALL_SUB_CMD (2) 159 160 161 /* The reserved key for IOT Usage */ 162 #define SL_NETUTIL_CRYPTO_SERVICES_IOT_RESERVED_INDEX (0) 163 164 /* The Temporary key for FS Usage */ 165 #define SL_NETUTIL_CRYPTO_FS_TEMP_KEYS_OBJ_ID (1) 166 167 168 /**********************************************/ 169 /* Public Key Info Structures and Definitions */ 170 /**********************************************/ 171 172 /* Enumeration of Elliptic Curve "named" curves */ 173 #define SL_NETUTIL_CRYPTO_EC_NAMED_CURVE_NONE (0) 174 #define SL_NETUTIL_CRYPTO_EC_NAMED_CURVE_SECP256R1 (1) 175 176 /* PLACE HOLDER for future definitions of custom-curve parameters */ 177 typedef struct 178 { 179 _u8 Padding[4]; 180 } SlNetUtilCryptoEcCustomCurveParam_t; 181 182 183 /* Union holding the Elliptic Curve parameters. */ 184 typedef union 185 { 186 _u8 NamedCurveParams; /* parameters for named-curve (the curve identifier) */ 187 SlNetUtilCryptoEcCustomCurveParam_t CustomCurveParams; /* parameters for custom curves */ 188 } SlNetUtilCryptoEcCurveParams_u; 189 190 191 /* ?curve-type? definitions */ 192 #define SL_NETUTIL_CRYPTO_EC_CURVE_TYPE_NAMED (1) /* ECC Named Curve type */ 193 #define SL_NETUTIL_CRYPTO_EC_CURVE_TYPE_CUSTOM (2) /* ECC Custom curve type */ 194 195 196 /* Enumeration of the supported public-key algorithms */ 197 #define SL_NETUTIL_CRYPTO_PUB_KEY_ALGO_NONE (0) 198 #define SL_NETUTIL_CRYPTO_PUB_KEY_ALGO_EC (1) 199 200 201 /* Structure for holding the Elliptic Curve Key parameters */ 202 typedef struct 203 { 204 _u8 CurveType; /* defines curve type - custom or named */ 205 SlNetUtilCryptoEcCurveParams_u CurveParams; /* specific parameters of the curve (depends on curve_type) */ 206 } SlNetUtilCryptoEcKeyParams_t; 207 208 /* Union for holding the Public Key parameters, depends on key algorithm */ 209 typedef union 210 { 211 212 SlNetUtilCryptoEcKeyParams_t EcParams; /* parameters for Elliptic Curve key */ 213 214 /* add containers for other key types and algos here*/ 215 } SlNetUtilCryptoPubKeyParams_u; 216 217 /* structure for holding all the meta-data about a key-pair */ 218 typedef struct 219 { 220 _u8 KeyAlgo; 221 SlNetUtilCryptoPubKeyParams_u KeyParams; 222 _u8 KeyFileNameLen; 223 _u8 CertFileNameLen; 224 }SlNetUtilCryptoPubKeyInfo_t; 225 226 /********************************************/ 227 /* NetUtil-Crypto Cmd "Attributes" structures */ 228 /********************************************/ 229 /* structure for holding all the attributes for a "Sign" Command */ 230 typedef struct 231 { 232 _u32 ObjId; 233 _u32 SigType; 234 _u32 Flags; 235 } SlNetUtilCryptoCmdSignAttrib_t; 236 237 238 /* structure for holding all the attributes for a "Verify" Command */ 239 typedef struct 240 { 241 _u32 ObjId; 242 _u32 SigType; 243 _u32 Flags; 244 _u16 MsgLen; 245 _u16 SigLen; 246 } SlNetUtilCryptoCmdVerifyAttrib_t; 247 248 /* structure for holding all the attributes for a "Create Certificate" Command */ 249 typedef struct 250 { 251 _u32 ObjId; 252 _u32 Flags; 253 _u16 SubCmd; 254 } SlNetUtilCryptoCmdCreateCertAttrib_t; 255 256 /* structure for holding all the attributes for "Key management" Commands: */ 257 /* Temp-Key (create and delete), Install and un-Install. */ 258 typedef struct 259 { 260 _u32 ObjId; 261 _u32 Flags; 262 _u16 SubCmd; 263 } SlNetUtilCryptoCmdKeyMgnt_t; 264 265 /* structure for holding all the attributes for a "SL_NETUTIL_CMD_ARP_LOOKUP" Command */ 266 typedef struct 267 { 268 _u16 NumOfRetries; /* number of retires for ARP request, range 1-20 */ 269 _u16 Timeout; /* timeout between ARP requests, range 10-500 mSec , 10 mSec resolution*/ 270 }NetUtilCmdArpLookupAttrib_t; 271 272 273 /******************************************************************************/ 274 /* Type declarations */ 275 /******************************************************************************/ 276 277 /*****************************************************************************/ 278 /* Function prototypes */ 279 /*****************************************************************************/ 280 281 /*! 282 \brief Function for setting configurations of utilities 283 284 \param[in] Option Identifier of the specific "set" operation to perform 285 \param[in] ObjID ID of the relevant object that this set operation will be performed on 286 \param[in] ValueLen Length of the value parameter 287 \param[in] pValues Pointer to the buffer holding the configurations values 288 289 \return Zero on success, or negative error code on failure 290 \sa sl_NetUtilGet sl_NetUtilCmd 291 \note 292 \warning 293 */ 294 #if _SL_INCLUDE_FUNC(sl_NetUtilSet) 295 _i32 sl_NetUtilSet(const _u16 Option, const _u32 ObjID, const _u8 *pValues, const _u16 ValueLen); 296 #endif 297 298 /*! 299 \brief Function for getting configurations of utilities 300 \param[in] Option Identifier of the specific "get" operation to perform 301 - <b>SL_NETUTIL_CRYPTO_PUBLIC_KEY</b> \n 302 Used to retrieve the public key from an installed key-pair. \n 303 Saved in a certain index. 304 - <b>SL_NETUTIL_TRUE_RANDOM</b> \n 305 Generates a random number using the internal TRNG of the NWP. \n 306 \param[in] ObjID ID of the relevant object that this set operation will be performed on 307 \param[in,out] pValueLen Pointer to the length of the value parameter\n 308 On input - provides the length of the buffer that the application allocates, and 309 will hold the output\n 310 On output - provides the actual length of the received data 311 \param[out] pValues Pointer to the buffer that the application allocates, and will hold 312 the received data. 313 \return Zero on success, or negative error code on failure. 314 \sa sl_NetUtilSet sl_NetUtilCmd 315 \note 316 \warning 317 \par Examples 318 - SL_NETUTIL_CRYPTO_PUBLIC_KEY: 319 \code 320 int16_t Status; 321 uint8_t configOpt = 0; 322 uint32_t objId = 0; 323 uint16_t configLen = 0; 324 uint8_t key_buf[256]; 325 326 configOpt = SL_NETUTIL_CRYPTO_PUBLIC_KEY; 327 328 objId = 1; 329 configLen = 255; 330 //get the Public key 331 Status = sl_NetUtilGet(configOpt, objId, key_buf, &configLen); 332 \endcode 333 334 - SL_NETUTIL_TRUE_RANDOM: 335 \code 336 uint32_t randNum; 337 int32_t len = sizeof(uint32_t); 338 339 sl_NetUtilGet(SL_NETUTIL_TRUE_RANDOM, 0, (uint8_t *)&randNum, &len); 340 \endcode 341 <br> 342 */ 343 #if _SL_INCLUDE_FUNC(sl_NetUtilGet) 344 _i16 sl_NetUtilGet(const _u16 Option, const _u32 ObjID, _u8 *pValues, _u16 *pValueLen); 345 #endif 346 347 /*! 348 \brief Function for performing utilities-related commands 349 \param[in] Cmd Identifier of the specific Command to perform 350 - <b>SL_NETUTIL_CRYPTO_CMD_INSTALL_OP</b> \n 351 Install / Uninstall key pairs in one or more of the crypto utils 352 key-pair management mechanism. \n 353 Key Must be an ECC key-pair using SECP256R1 curve and already programmed to file system, 354 in DER format.\n 355 Key installation is persistent. 356 - <b>SL_NETUTIL_CRYPTO_CMD_TEMP_KEYS</b> \n 357 Creates or removes a temporary key pair. \n 358 Key pair is created internally by the NWP. 359 Key pair is not persistent over power cycle. 360 - <b>SL_NETUTIL_CRYPTO_CMD_SIGN_MSG</b> \n 361 Signs with a digital signature a data buffer using ECDSA algorithm. \n 362 - <b>SL_NETUTIL_CRYPTO_CMD_VERIFY_MSG</b> \n 363 Verify a digital signature given with a data buffer using ECDSA algorithm. \n 364 - <b>SL_NETUTIL_CMD_ARP_LOOKUP</b> \n 365 Mapping MAC address to IPv4 or IPv6 address. \n 366 \param[in] pAttrib Pointer to the buffer holding the Attribute values 367 \param[in] AttribLen Length of the Attribute-values 368 \param[in] pInputValues Pointer to the buffer holding the input-value 369 \param[in] InputLen Length of the input-value 370 \param[out] pOutputValues Pointer to the buffer that the application allocates, and will hold the received data. 371 \param[in,out] pOutputLen Length of the output-value \n 372 On input - provides the length of the buffer that the application allocates, and 373 will hold the output\n 374 On output - provides the actual length of the received output-values 375 \return Zero on success, or negative error code on failure 376 \sa sl_NetUtilGet sl_NetUtilSet 377 \note The host driver API sl_NetUtilCmd is not valid for use with the CC3220R device. \n 378 The SL_NETUTIL_CMD_ARP_LOOKUP cmd is only valid for the CC3235S/SF devices. 379 \warning 380 \par Examples 381 382 - SL_NETUTIL_CRYPTO_CMD_INSTALL_OP (install / uninstall crypto keys): 383 \code 384 // Install a key 385 SlNetUtilCryptoCmdKeyMgnt_t keyAttrib; 386 SlNetUtilCryptoPubKeyInfo_t *pInfoKey; 387 uint8_t name[FILE_NAME_SIZE]; 388 int32_t Status; 389 int16_t resultLen; 390 391 keyAttrib.ObjId = 5; // Key would be stored at index 5 392 keyAttrib.SubCmd = SL_NETUTIL_CRYPTO_INSTALL_SUB_CMD; 393 pInfoKey->KeyAlgo = SL_NETUTIL_CRYPTO_PUB_KEY_ALGO_EC; 394 pInfoKey->KeyParams.EcParams.CurveType = SL_NETUTIL_CRYPTO_EC_CURVE_TYPE_NAMED; //ECC curve 395 pInfoKey->KeyParams.EcParams.CurveParams.NamedCurveParams = SL_NETUTIL_CRYPTO_EC_NAMED_CURVE_SECP256R1; // SECP256R1 curve only. 396 397 pInfoKey->CertFileNameLen = 0; 398 name = ((uint8_t *)pInfoKey) + sizeof(SlNetUtilCryptoPubKeyInfo_t); 399 name += pInfoKey->CertFileNameLen; 400 strcpy((char *)name, "extkey.der"); // Private key name in file system. 401 pInfoKey->KeyFileNameLen = strlen("extkey.der")+1; 402 403 Status = sl_NetUtilCmd(SL_NETUTIL_CRYPTO_CMD_INSTALL_OP, 404 (uint8_t *)&keyAttrib, sizeof(SlNetUtilCryptoCmdKeyMgnt_t), 405 (uint8_t *)pInfo, 406 sizeof(SlNetUtilCryptoPubKeyInfo_t) + pInfoKey->KeyFileNameLen, 407 NULL, &resultLen); 408 409 // Uninstall the Key: 410 resultLen = 0; 411 keyAttrib.ObjId = 5; 412 keyAttrib.SubCmd = SL_NETUTIL_CRYPTO_UNINSTALL_SUB_CMD; 413 414 Status = sl_NetUtilCmd(SL_NETUTIL_CRYPTO_CMD_INSTALL_OP, (uint8_t *)&keyAttrib, 415 sizeof(SlNetUtilCryptoCmdKeyMgnt_t), NULL, 0 , NULL, &resultLen); 416 \endcode 417 418 - SL_NETUTIL_CRYPTO_CMD_TEMP_KEYS, (Create a temporary key ): 419 \code 420 421 SlNetUtilCryptoCmdKeyMgnt_t keyAttrib; 422 int32_t Status; 423 uint16_t resultLen; 424 keyAttrib.ObjId = 1; // key index is 1 425 keyAttrib.SubCmd = SL_NETUTIL_CRYPTO_TEMP_KEYS_CREATE; 426 427 Status = sl_NetUtilCmd(SL_NETUTIL_CRYPTO_CMD_TEMP_KEYS, 428 (uint8_t *)&keyAttrib, sizeof(SlNetUtilCryptoCmdKeyMgnt_t), 429 NULL, 0 , NULL, &resultLen); 430 \endcode 431 432 - SL_NETUTIL_CRYPTO_CMD_TEMP_KEYS, (Create a temporary key ): 433 \code 434 435 SlNetUtilCryptoCmdKeyMgnt_t keyAttrib; 436 int32_t Status; 437 uint16_t resultLen; 438 keyAttrib.ObjId = 1; // key index is 1 439 keyAttrib.SubCmd = SL_NETUTIL_CRYPTO_TEMP_KEYS_CREATE; 440 441 Status = sl_NetUtilCmd(SL_NETUTIL_CRYPTO_CMD_TEMP_KEYS, 442 (uint8_t *)&keyAttrib, sizeof(SlNetUtilCryptoCmdKeyMgnt_t), 443 NULL, 0 , NULL, &resultLen); 444 \endcode 445 446 - SL_NETUTIL_CRYPTO_CMD_SIGN_MSG, (Sign a data buffer): 447 \code 448 int32_t Status; 449 int32_t configLen; 450 uint8_t messageBuff[1500]; 451 uint8_t sig_buf[256]; // This buffer shall contain the digital signature. 452 SlNetUtilCryptoCmdSignAttrib_t signAttrib; 453 454 signAttrib.Flags = 0; 455 signAttrib.ObjId = 3; 456 signAttrib.SigType = SL_NETUTIL_CRYPTO_SIG_SHAwECDSA; // this is the only type supported 457 configLen = 255; 458 459 Status = sl_NetUtilCmd(SL_NETUTIL_CRYPTO_CMD_SIGN_MSG, (uint8_t *)&signAttrib, 460 sizeof(SlNetUtilCryptoCmdSignAttrib_t), 461 messageBuff, sizeof(messageBuf), sig_buf, &configLen); 462 \endcode 463 464 - SL_NETUTIL_CRYPTO_CMD_VERIFY_MSG, (Verify a data buffer): 465 \code 466 467 int32_t Status; 468 int32_t configLen; 469 uint8_t verifyBuf[2048]; 470 uint8_t messageBuff[1500]; 471 uint8_t sig_buf[256]; // This buffer contains the digital signature. 472 int32_t verifyResult; 473 SlNetUtilCryptoCmdVerifyAttrib_t verAttrib; 474 475 memcpy(verifyBuf, messageBuf, sizeof(messageBuf)); // copy the message to verify buffer. 476 memcpy(verifyBuf + sizeof(messageBuff), sig_buf, configLen); // Append the signature to message buffer. 477 478 verAttrib.Flags = 0; 479 verAttrib.ObjId = 3; 480 verAttrib.SigType = SL_NETUTIL_CRYPTO_SIG_SHAwECDSA; // this is the only type supported, if other hash algorithm 481 // is wanted, SL_NETUTIL_CRYPTO_SIG_DIGESTwECDSA is used and 482 // the verifyBuf should be the digest and MsgLen should be 483 // the digest size 484 verAttrib.MsgLen = sizeof(messageBuff); 485 verAttrib.SigLen = configLen; 486 configLen = 255; 487 resultLen = 4; 488 489 Status = sl_NetUtilCmd(SL_NETUTIL_CRYPTO_CMD_VERIFY_MSG, (uint8_t *)&verAttrib, 490 sizeof(SlNetUtilCryptoCmdVerifyAttrib_t), 491 verifyBuf, sizeof(messageBuf) + configLen, 492 (uint8_t *)&verifyResult , &resultLen); 493 \endcode 494 <br> 495 496 \endcode 497 498 - SL_NETUTIL_CMD_ARP_LOOKUP, (Mapping MAC address to IPv4 or IPv6 address), CC3235S/SF devices only: 499 \code 500 501 NetUtilCmdArpLookupAttrib_t arpAttr; 502 _u32 ipv4; 503 _u8 macAddr[6]; 504 _u16 outLen = sizeof(macAddr); 505 _i16 status; 506 507 ipv4 = SL_IPV4_VAL(192,168,178,43); 508 arpAttr.NumOfRetries = 3; 509 arpAttr.Timeout = 50; 510 511 status = sl_NetUtilCmd(SL_NETUTIL_CMD_ARP_LOOKUP, (uint8_t *)&arpAttr, sizeof(arpAttr), (_u8*)&ipv4 , sizeof(ipv4), macAddr,&outLen); 512 if(status != 0) 513 { 514 // MAC was not found 515 } 516 else 517 { 518 // IP address mapped to MAC 519 } 520 521 \endcode 522 <br> 523 524 525 526 */ 527 #if _SL_INCLUDE_FUNC(sl_NetUtilCmd) 528 _i16 sl_NetUtilCmd(const _u16 Cmd, const _u8 *pAttrib, const _u16 AttribLen, 529 const _u8 *pInputValues, const _u16 InputLen, 530 _u8 *pOutputValues,_u16 *pOutputLen ); 531 #endif 532 533 /*! 534 535 Close the Doxygen group. 536 @} 537 538 */ 539 540 541 #ifdef __cplusplus 542 } 543 #endif /* __cplusplus */ 544 545 #endif /* __NETUTIL_H__ */ 546 547 548