WE310F5  39.00.000
M2MB CRYPTO SHA

This section describes the M2MB APIs to perform various cryptographic operations. More...

INT32 m2mb_sha512_init (M2M_SHA_HANDLE *ctx)
 Initializes handle for a new cryptographic operation of algorith SHA512. More...
 
INT32 m2mb_sha512_deinit (M2M_SHA_HANDLE ctx)
 De-initializes specified cryptographic handle of algorith SHA512. More...
 
INT32 m2mb_sha512_update (M2M_SHA_HANDLE ctx, VOID *chunk, UINT32 chunkSize)
 Accumulates message data of algorith SHA512 for hashing. More...
 
INT32 m2mb_sha512_final (M2M_SHA_HANDLE ctx, VOID *hash, UINT32 *hashSize)
 Finalizes the message digest of algorith SHA512. More...
 
INT32 m2mb_sha384_init (M2M_SHA_HANDLE *ctx)
 Initializes handle for a new cryptographic operation of algorith SHA384. More...
 
INT32 m2mb_sha384_deinit (M2M_SHA_HANDLE ctx)
 De-initializes specified cryptographic handle of algorith SHA384. More...
 
INT32 m2mb_sha384_update (M2M_SHA_HANDLE ctx, VOID *chunk, UINT32 chunkSize)
 Accumulates message data of algorith SHA384 for hashing. More...
 
INT32 m2mb_sha384_final (M2M_SHA_HANDLE ctx, VOID *hash, UINT32 *hashSize)
 Finalizes the message digest of algorith SHA384. More...
 
INT32 m2mb_sha224_init (M2M_SHA_HANDLE *ctx)
 Initializes handle for a new cryptographic operation of algorith SHA224. More...
 
INT32 m2mb_sha224_deinit (M2M_SHA_HANDLE ctx)
 De-initializes specified cryptographic handle of algorith SHA224. More...
 
INT32 m2mb_sha224_update (M2M_SHA_HANDLE ctx, VOID *chunk, UINT32 chunkSize)
 Accumulates message data of algorith SHA224 for hashing. More...
 
INT32 m2mb_sha224_final (M2M_SHA_HANDLE ctx, VOID *hash, UINT32 *hashSize)
 Finalizes the message digest of algorith SHA224. More...
 
INT32 m2mb_sha256_init (M2M_SHA_HANDLE *ctx)
 Initializes handle for a new cryptographic operation of algorith SHA256. More...
 
INT32 m2mb_sha256_deinit (M2M_SHA_HANDLE ctx)
 De-initializes specified cryptographic handle of algorith SHA256. More...
 
INT32 m2mb_sha256_update (M2M_SHA_HANDLE ctx, VOID *chunk, UINT32 chunkSize)
 Accumulates message data of algorith SHA256 for hashing. More...
 
INT32 m2mb_sha256_final (M2M_SHA_HANDLE ctx, VOID *hash, UINT32 *hashSize)
 Finalizes the message digest of algorith SHA256. More...
 
INT32 m2mb_sha1_init (M2M_SHA_HANDLE *ctx)
 Initializes handle for a new cryptographic operation of algorith SHA1. More...
 
INT32 m2mb_sha1_deinit (M2M_SHA_HANDLE ctx)
 De-initializes specified cryptographic handle of algorith SHA1. More...
 
INT32 m2mb_sha1_update (M2M_SHA_HANDLE ctx, VOID *chunk, UINT32 chunkSize)
 Accumulates message data of algorith SHA1 for hashing. More...
 
INT32 m2mb_sha1_final (M2M_SHA_HANDLE ctx, VOID *hash, UINT32 *hashSize)
 Finalizes the message digest of algorith SHA1. More...
 

Detailed Description

This section describes the M2MB APIs to perform various cryptographic operations.

Function Documentation

◆ m2mb_sha1_deinit()

INT32 m2mb_sha1_deinit ( M2M_SHA_HANDLE  ctx)

De-initializes specified cryptographic handle of algorith SHA1.

Deallocates all resources associated with an operation handle. After this function is called, the operation handle is no longer valid. All cryptographic material in the operation is destroyed.

Parameters
[in]ctxSHA handle
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha1_deinit(M2M_SHA_HANDLE ctx);

int main()
{
INT32 ret;
ret=m2mb_sha1_deinit(&hdl1);
return ret;
}

◆ m2mb_sha1_final()

INT32 m2mb_sha1_final ( M2M_SHA_HANDLE  ctx,
VOID hash,
UINT32 hashSize 
)

Finalizes the message digest of algorith SHA1.

inalizes the message digest operation and produces the message hash.

Parameters
[in]ctx
SHA handle.
[out]hash
Output buffer filled with the message hash.
[in,out]hashSize
Size of the hash buffer in bytes (in). Length of the computed hash in bytes (out).
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha1_final(M2M_SHA_HANDLE ctx, VOID *hash, UINT32 *hashSize);

int main()
{
INT32 ret;
UINT32 len=100;
UINT8 hash[300] = {0};
ret=m2mb_sha1_final(hdl1, hash, &len);
return ret;
}

◆ m2mb_sha1_init()

INT32 m2mb_sha1_init ( M2M_SHA_HANDLE ctx)

Initializes handle for a new cryptographic operation of algorith SHA1.

Allocates a handle for a new cryptographic operation. If this function does not return with 0, there is no valid handle value.

Parameters
[out]ctxPointer to hold SHA handle
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha1_init(M2M_SHA_HANDLE *ctx);

int main()
{
INT32 ret;
ret=m2mb_sha1_init(&hdl1);
return ret;
}

◆ m2mb_sha1_update()

INT32 m2mb_sha1_update ( M2M_SHA_HANDLE  ctx,
VOID chunk,
UINT32  chunkSize 
)

Accumulates message data of algorith SHA1 for hashing.

The message does not have to be block aligned. Subsequent calls to this function are possible.

Parameters
[in]ctx
SHA handle.
[in]chunk
Chunk of data to be hashed.
[in]chunkSize
Length of the chunk in bytes.
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha1_update(M2M_SHA_HANDLE ctx, VOID *chunk, UINT32 chunkSize);

int main()
{
INT32 ret;
UINT8 msg1[128] = {0};
ret=m2mb_sha1_update(hdl1, msg1, 32);
return ret;
}

◆ m2mb_sha224_deinit()

INT32 m2mb_sha224_deinit ( M2M_SHA_HANDLE  ctx)

De-initializes specified cryptographic handle of algorith SHA224.

Deallocates all resources associated with an operation handle. After this function is called, the operation handle is no longer valid. All cryptographic material in the operation is destroyed.

Parameters
[in]ctxSHA handle
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha224_deinit(M2M_SHA_HANDLE ctx);

int main()
{
INT32 ret;
ret=m2mb_sha224_deinit(&hdl1);
return ret;
}

◆ m2mb_sha224_final()

INT32 m2mb_sha224_final ( M2M_SHA_HANDLE  ctx,
VOID hash,
UINT32 hashSize 
)

Finalizes the message digest of algorith SHA224.

inalizes the message digest operation and produces the message hash.

Parameters
[in]ctx
SHA handle.
[out]hash
Output buffer filled with the message hash.
[in,out]hashSize
Size of the hash buffer in bytes (in). Length of the computed hash in bytes (out).
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha224_final(M2M_SHA_HANDLE ctx, VOID *hash, UINT32 *hashSize);

int main()
{
INT32 ret;
UINT32 len=100;
UINT8 hash[300] = {0};
ret=m2mb_sha224_final(hdl1, hash, &len);
return ret;
}

◆ m2mb_sha224_init()

INT32 m2mb_sha224_init ( M2M_SHA_HANDLE ctx)

Initializes handle for a new cryptographic operation of algorith SHA224.

Allocates a handle for a new cryptographic operation. If this function does not return with 0, there is no valid handle value.

Parameters
[out]ctxPointer to hold SHA handle
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha224_init(M2M_SHA_HANDLE *ctx);

int main()
{
INT32 ret;
ret=m2mb_sha224_init(&hdl1);
return ret;
}

◆ m2mb_sha224_update()

INT32 m2mb_sha224_update ( M2M_SHA_HANDLE  ctx,
VOID chunk,
UINT32  chunkSize 
)

Accumulates message data of algorith SHA224 for hashing.

The message does not have to be block aligned. Subsequent calls to this function are possible.

Parameters
[in]ctx
SHA handle.
[in]chunk
Chunk of data to be hashed.
[in]chunkSize
Length of the chunk in bytes.
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha224_update(M2M_SHA_HANDLE ctx, VOID *chunk, UINT32 chunkSize);

int main()
{
INT32 ret;
UINT8 msg1[128] = {0};
ret=m2mb_sha224_update(hdl1, msg1, 32);
return ret;
}

◆ m2mb_sha256_deinit()

INT32 m2mb_sha256_deinit ( M2M_SHA_HANDLE  ctx)

De-initializes specified cryptographic handle of algorith SHA256.

Deallocates all resources associated with an operation handle. After this function is called, the operation handle is no longer valid. All cryptographic material in the operation is destroyed.

Parameters
[in]ctxSHA handle
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha256_deinit(M2M_SHA_HANDLE ctx);

int main()
{
INT32 ret;
ret=m2mb_sha256_deinit(&hdl1);
return ret;
}

◆ m2mb_sha256_final()

INT32 m2mb_sha256_final ( M2M_SHA_HANDLE  ctx,
VOID hash,
UINT32 hashSize 
)

Finalizes the message digest of algorith SHA256.

inalizes the message digest operation and produces the message hash.

Parameters
[in]ctx
SHA handle.
[out]hash
Output buffer filled with the message hash.
[in,out]hashSize
Size of the hash buffer in bytes (in). Length of the computed hash in bytes (out).
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha256_final(M2M_SHA_HANDLE ctx, VOID *hash, UINT32 *hashSize);

int main()
{
INT32 ret;
UINT32 len=100;
UINT8 hash[300] = {0};
ret=m2mb_sha256_final(hdl1, hash, &len);
return ret;
}

◆ m2mb_sha256_init()

INT32 m2mb_sha256_init ( M2M_SHA_HANDLE ctx)

Initializes handle for a new cryptographic operation of algorith SHA256.

Allocates a handle for a new cryptographic operation. If this function does not return with 0, there is no valid handle value.

Parameters
[out]ctxPointer to hold SHA handle
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha256_init(M2M_SHA_HANDLE *ctx);

int main()
{
INT32 ret;
ret=m2mb_sha256_init(&hdl1);
return ret;
}

◆ m2mb_sha256_update()

INT32 m2mb_sha256_update ( M2M_SHA_HANDLE  ctx,
VOID chunk,
UINT32  chunkSize 
)

Accumulates message data of algorith SHA256 for hashing.

The message does not have to be block aligned. Subsequent calls to this function are possible.

Parameters
[in]ctx
SHA handle.
[in]chunk
Chunk of data to be hashed.
[in]chunkSize
Length of the chunk in bytes.
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha256_update(M2M_SHA_HANDLE ctx, VOID *chunk, UINT32 chunkSize);

int main()
{
INT32 ret;
UINT8 msg1[128] = {0};
ret=m2mb_sha256_update(hdl1, msg1, 32);
return ret;
}

◆ m2mb_sha384_deinit()

INT32 m2mb_sha384_deinit ( M2M_SHA_HANDLE  ctx)

De-initializes specified cryptographic handle of algorith SHA384.

Deallocates all resources associated with an operation handle. After this function is called, the operation handle is no longer valid. All cryptographic material in the operation is destroyed.

Parameters
[in]ctxSHA handle
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha384_deinit(M2M_SHA_HANDLE ctx);

int main()
{
INT32 ret;
ret=m2mb_sha384_deinit(&hdl1);
return ret;
}

◆ m2mb_sha384_final()

INT32 m2mb_sha384_final ( M2M_SHA_HANDLE  ctx,
VOID hash,
UINT32 hashSize 
)

Finalizes the message digest of algorith SHA384.

inalizes the message digest operation and produces the message hash.

Parameters
[in]ctx
SHA handle.
[out]hash
Output buffer filled with the message hash.
[in,out]hashSize
Size of the hash buffer in bytes (in). Length of the computed hash in bytes (out).
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha384_final(M2M_SHA_HANDLE ctx, VOID *hash, UINT32 *hashSize);

int main()
{
INT32 ret;
UINT32 len=100;
UINT8 hash[300] = {0};
ret=m2mb_sha384_final(hdl1, hash, &len);
return ret;
}

◆ m2mb_sha384_init()

INT32 m2mb_sha384_init ( M2M_SHA_HANDLE ctx)

Initializes handle for a new cryptographic operation of algorith SHA384.

Allocates a handle for a new cryptographic operation. If this function does not return with 0, there is no valid handle value.

Parameters
[out]ctxPointer to hold SHA handle
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha384_init(M2M_SHA_HANDLE *ctx);

int main()
{
INT32 ret;
ret=m2mb_sha384_init(&hdl1);
return ret;
}

◆ m2mb_sha384_update()

INT32 m2mb_sha384_update ( M2M_SHA_HANDLE  ctx,
VOID chunk,
UINT32  chunkSize 
)

Accumulates message data of algorith SHA384 for hashing.

The message does not have to be block aligned. Subsequent calls to this function are possible.

Parameters
[in]ctx
SHA handle.
[in]chunk
Chunk of data to be hashed.
[in]chunkSize
Length of the chunk in bytes.
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha384_update(M2M_SHA_HANDLE ctx, VOID *chunk, UINT32 chunkSize);

int main()
{
INT32 ret;
UINT8 msg1[128] = {0};
ret=m2mb_sha384_update(hdl1, msg1, 32);
return ret;
}

◆ m2mb_sha512_deinit()

INT32 m2mb_sha512_deinit ( M2M_SHA_HANDLE  ctx)

De-initializes specified cryptographic handle of algorith SHA512.

Deallocates all resources associated with an operation handle. After this function is called, the operation handle is no longer valid. All cryptographic material in the operation is destroyed.

Parameters
[in]ctxSHA handle.
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha512_deinit(M2M_SHA_HANDLE ctx);

int main()
{
INT32 ret;
ret=m2mb_sha512_deinit(&hdl1);
return ret;
}

◆ m2mb_sha512_final()

INT32 m2mb_sha512_final ( M2M_SHA_HANDLE  ctx,
VOID hash,
UINT32 hashSize 
)

Finalizes the message digest of algorith SHA512.

inalizes the message digest operation and produces the message hash.

Parameters
[in]ctx
SHA handle.
[out]hash
Output buffer filled with the message hash.
[in,out]hashSize
Size of the hash buffer in bytes (in). Length of the computed hash in bytes (out).
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha512_final(M2M_SHA_HANDLE ctx, VOID *hash, UINT32 *hashSize);

int main()
{
INT32 ret;
UINT32 len=100;
UINT8 hash[300] = {0};
ret=m2mb_sha512_final(hdl1, hash, &len);
return ret;
}

◆ m2mb_sha512_init()

INT32 m2mb_sha512_init ( M2M_SHA_HANDLE ctx)

Initializes handle for a new cryptographic operation of algorith SHA512.

Allocates a handle for a new cryptographic operation. If this function does not return with 0, there is no valid handle value.

Parameters
[out]ctxPointer to hold SHA handle.
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha512_init(M2M_SHA_HANDLE *ctx);

int main()
{
INT32 ret;
ret=m2mb_sha512_init(&hdl1);
return ret;
}

◆ m2mb_sha512_update()

INT32 m2mb_sha512_update ( M2M_SHA_HANDLE  ctx,
VOID chunk,
UINT32  chunkSize 
)

Accumulates message data of algorith SHA512 for hashing.

The message does not have to be block aligned. Subsequent calls to this function are possible.

Parameters
[in]ctx
SHA handle.
[in]chunk
Chunk of data to be hashed.
[in]chunkSize
Length of the chunk in bytes.
Returns
0 on success. Error code on failure.
Note
<Notes>

m2mb_sha512_update(M2M_SHA_HANDLE ctx, VOID *chunk, UINT32 chunkSize);

int main()
{
INT32 ret;
UINT8 msg1[128] = {0};
ret=m2mb_sha512_update(hdl1, msg1, 32);
return ret;
}