![]() |
TrustCore SDK NanoCrypto API reference
version 7.0
|
Header file for the Nanocrypto SHA1 API. More...
Go to the source code of this file.
Functions | |
MOC_EXTERN MSTATUS | SHA1_allocDigest (MOC_HASH(hwAccelDescr hwAccelCtx) BulkCtx *pp_context) |
Allocate SHA1 operation context data structure. More... | |
MOC_EXTERN MSTATUS | SHA1_cloneCtx (MOC_HASH(hwAccelDescr hwAccelCtx) shaDescr *pDest, shaDescr *pSrc) |
Makes a clone of a previously allocated SHA1_CTX . More... | |
MOC_EXTERN MSTATUS | SHA1_completeDigest (MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte *pData, ubyte4 dataLen, ubyte *pShaOutput) |
Calculate single item's SHA1 digest value (with a single function call). More... | |
MOC_EXTERN MSTATUS | SHA1_finalDigest (MOC_HASH(hwAccelDescr hwAccelCtx) shaDescr *p_shaContext, ubyte *pShaOutput) |
Calculate final SHA1 digest value. More... | |
MOC_EXTERN MSTATUS | SHA1_freeDigest (MOC_HASH(hwAccelDescr hwAccelCtx) BulkCtx *pp_context) |
Free (delete) SHA1 operation context data structure. More... | |
MOC_EXTERN MSTATUS | SHA1_initDigest (MOC_HASH(hwAccelDescr hwAccelCtx) shaDescr *p_shaContext) |
Initialize SHA1 operation context data structure. More... | |
MOC_EXTERN MSTATUS | SHA1_updateDigest (MOC_HASH(hwAccelDescr hwAccelCtx) shaDescr *p_shaContext, const ubyte *pData, ubyte4 dataLen) |
Calculate and update intermediate SHA1 digest value. More... | |
Header file for the Nanocrypto SHA1 API.
For documentation for this file's functions, see sha1.c.
MOC_EXTERN MSTATUS SHA1_allocDigest | ( | MOC_HASH(hwAccelDescr hwAccelCtx) BulkCtx * | pp_context | ) |
This function allocates a context data structure for SHA1 operations.
Although applications can allocate the structure directly, it's recommended that this function be used to ensure future portability.
FIPS Approved | ![]() |
Suite B Algorithm | ![]() |
Flowchart | SHA1 |
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. But... what does the user specify? In the 5.3.1 docs, we just said that this was "Reserved for future use." Ditto this for all sha1.{c,h} functions. |
pp_context | On return, pointer to address of allocated context data structure. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.sha1.c
MOC_EXTERN MSTATUS SHA1_cloneCtx | ( | MOC_HASH(hwAccelDescr hwAccelCtx) shaDescr * | pDest, |
shaDescr * | pSrc | ||
) |
Makes a clone of a previously allocated SHA1_CTX
.
pDest | Pointer to an already allocated destination context. |
pSrc | Pointer to the context to be copied. |
OK
(0) if successful, otherwise a negative number error code from merrors.h. MOC_EXTERN MSTATUS SHA1_completeDigest | ( | MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte * | pData, |
ubyte4 | dataLen, | ||
ubyte * | pShaOutput | ||
) |
This function calculates an SHA1 digest value for a single item.
pShaOutput
parameter is large enough (at least SHA1_RESULT_SIZE(20) bytes); otherwise, buffer overflow will occur.FIPS Approved | ![]() |
Suite B Algorithm | ![]() |
Flowchart | SHA1 |
There are no flag dependencies to enable this function.
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
pData | Pointer to data to hash or digest. |
dataLen | Number of bytes of data to hash or digest (pData ). |
pShaOutput | On return, pointer to resultant SHA1 digest value. (The calling function must allocate sufficient memory — at least SHA1_RESULT_SIZE(20) bytes — for the pShaOutput ; otherwise buffer overflow will occur.) |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.sha1.c
MOC_EXTERN MSTATUS SHA1_finalDigest | ( | MOC_HASH(hwAccelDescr hwAccelCtx) shaDescr * | p_shaContext, |
ubyte * | pShaOutput | ||
) |
This function calculates the final SHA1 digest value. Applications must call this function after completing their calls to SHA1_updateDigest().
FIPS Approved | ![]() |
Suite B Algorithm | ![]() |
Flowchart | SHA1 |
There are no flag dependencies to enable this function.
pShaOutput
parameter is large enough (at least SHA1_RESULT_SIZE(20) bytes); otherwise, buffer overflow will occur.hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
pContext | Pointer to SHA1 context. |
pOutput | On return, pointer to final SHA1 digest value. (The calling function must allocate sufficient memory — at least SHA1_RESULT_SIZE(20) bytes — for the resulting pShaOutput ; otherwise buffer overflow will occur.) |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.sha1.c
MOC_EXTERN MSTATUS SHA1_freeDigest | ( | MOC_HASH(hwAccelDescr hwAccelCtx) BulkCtx * | pp_context | ) |
This function frees (deletes) a SHA1 operation context data structure.
FIPS Approved | ![]() |
Suite B Algorithm | ![]() |
Flowchart | SHA1 |
There are no flag dependencies to enable this function.
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
pp_context | Pointer to address of context to free (delete). |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.sha1.c
MOC_EXTERN MSTATUS SHA1_initDigest | ( | MOC_HASH(hwAccelDescr hwAccelCtx) shaDescr * | p_shaContext | ) |
This function initializes an SHA1 context data structure. Applications should call this function before beginning the hashing operation.
shaDescr *
) before calling this function.FIPS Approved | ![]() |
Suite B Algorithm | ![]() |
Flowchart | SHA1 |
There are no flag dependencies to enable this function.
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
p_shaContext | Pointer to SHA1 context to initialize. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.sha1.c
MOC_EXTERN MSTATUS SHA1_updateDigest | ( | MOC_HASH(hwAccelDescr hwAccelCtx) shaDescr * | p_shaContext, |
const ubyte * | pData, | ||
ubyte4 | dataLen | ||
) |
This function calculates an intermediate SHA1 digest value.
Applications can repeatedly call this function to calculate digests for different data items. Every time this function is called, the intermediate digest value is stored within the SHA1 context data structure.
FIPS Approved | ![]() |
Suite B Algorithm | ![]() |
Flowchart | SHA1 |
There are no flag dependencies to enable this function.
hwAccelCtx | If a hardware acceleration flag is defined, this macro expands to an additional parameter, "hwAccelDescr hwAccelCtx". Otherwise, this macro resolves to nothing. |
p_shaContext | Pointer to SHA1 context. |
pData | Pointer to data to hash or digest. |
dataLen | Number of bytes of data to hash or digest (pData ). |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.sha1.c