Introduction
227
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
Crypto Utilities
messageBuf,
sizeof
(messageBuf), buf, &configLen);
if
(0 > Status)
{
/* error */
}
/* now verify the buffer */
memcpy(verifyBuf, messageBuf,
sizeof
(messageBuf));
memcpy(ver
sizeof
(messageBuf), buf, configLen);
verAttrib.Flags = 0;
verAttrib.ObjId = 3;
verAttrib.SigType = SL_NETUTIL_CRYPTO_SIG_SHAwECDSA;
/* this is the only type supported */
verAttrib.MsgLen =
sizeof
(messageBuf);
verAttrib.SigLen = configLen;
/* use the created keys to verify the signature from the previous step */
resultLen = 4;
Status = sl_NetUtilCmd(SL_NETUTIL_CRYPTO_CMD_VERIFY_MSG, (_u8 *)&verAttrib,
sizeof
(SlNetUtilCryptoCmdVerifyAttrib_t),
verifyBuf,
sizeof
(messageBuf) + configLen,
(_u8 *)&verifyResult , &resultLen);
if
(0 > Status)
{
/* error */
}
16.1.1.6 True Random Number
Retrieve a buffer of true random numbers from the networking subsystem. Maximum buffer length is 172
bytes for each retrieval. if the requested length exceeds 172 bytes, it is trimmed to 172 bytes.
Status = sl_NetUtilGet(SL_NETUTIL_TRUE_RANDOM,0,buffer,&len);
16.1.2 Limitations and Constraints
•
Mechanism supports a total of eight keys, where index 0 is reserved for the constant key-pair.
•
Only ECC keys using the SECP256R1 curve are supported.
•
Index management is a host application responsibility; find free index or retrieve index list are not
provided.
•
For signing and verifying operations, the buffer size is limited to 1.5KB.
16.1.3 Errors
lists the common errors.
Table 16-2. Common Errors
Error Code
Value
Comments
SL_ERROR_NETUTIL_CRYPTO_GENERAL
-12289
An unspecified general error has
occurred.
SL_ERROR_NETUTIL_CRYPTO_INVALID_INDEX
-12290
The provided index is out of the valid
range.
SL_ERROR_NETUTIL_CRYPTO_INVALID_PARAM
-12291
One of the provided parameters is invalid
or illegal.
SL_ERROR_NETUTIL_CRYPTO_MEM_ALLOC
-12292
A memory-allocation failure has occurred.
SL_ERROR_NETUTIL_CRYPTO_INVALID_DB_VER
-12293
Not in use
SL_ERROR_NETUTIL_CRYPTO_UNSUPPORTED_OPTIO
N
-12294
One of the provided parameters requires
an unsupported capability or option.
SL_ERROR_NETUTIL_CRYPTO_BUFFER_TOO_SMALL
-12295
The buffer provided by the host-
application is not large enough to contain
the returned output.