Microchip® Advanced Software Framework

sha1_routines.c File Reference

Software implementation of the SHA1 algorithm.

#include "sha1_routines.h"
#include <string.h>

Functions

void CL_hash (U8 *msg, int msgBytes, U8 *dest)
 Perform SHA1 hash of data in software. More...
 
void CL_hashFinal (CL_HashContext *ctx, U8 *dest)
 Complete the SHA1 hash in software and return the digest. More...
 
void CL_hashInit (CL_HashContext *ctx)
 Initialize context for performing SHA1 hash in software. More...
 
void CL_hashUpdate (CL_HashContext *ctx, const U8 *src, int nbytes)
 Add arbitrary data to a SHA1 hash. More...
 
void shaEngine (U32 *buf, U32 *h)
 

void CL_hash ( U8 msg,
int  msgBytes,
U8 dest 
)

Perform SHA1 hash of data in software.

Parameters
[in]msgData to be hashed
[in]msgBytesData size in bytes
[out]destDigest is returned here (20 bytes)

References CL_hashFinal(), CL_hashInit(), and CL_hashUpdate().

void CL_hashFinal ( CL_HashContext ctx,
U8 dest 
)

Complete the SHA1 hash in software and return the digest.

Parameters
[in]ctxHash context
[out]destDigest is returned here (20 bytes)

References CL_HashContext::buf, CL_HashContext::byteCount, CL_HashContext::byteCountHi, CL_HashContext::h, i, ptr, and shaEngine().

Referenced by atcac_sw_sha1_finish(), and CL_hash().

void CL_hashInit ( CL_HashContext ctx)

Initialize context for performing SHA1 hash in software.

Parameters
[in]ctxHash context

References CL_HashContext::h, and memcpy_P.

Referenced by atcac_sw_sha1_init(), and CL_hash().

void CL_hashUpdate ( CL_HashContext ctx,
const U8 src,
int  nbytes 
)

Add arbitrary data to a SHA1 hash.

Parameters
[in]ctxHash context
[in]srcData to be added to the hash
[in]nbytesData size in bytes

References CL_HashContext::buf, CL_HashContext::byteCount, CL_HashContext::byteCountHi, CL_HashContext::h, i, and shaEngine().

Referenced by atcac_sw_sha1_update(), and CL_hash().

void shaEngine ( U32 buf,
U32 h 
)

References leftRotate.

Referenced by CL_hashFinal(), and CL_hashUpdate().