CryptoAuthLib
Atmel CryptoAuthentication Library
sha1_routines.h
Go to the documentation of this file.
1 
42 #ifndef __SHA1_ROUTINES_DOT_H__
43 #define __SHA1_ROUTINES_DOT_H__
44 
45 #include <stdio.h>
46 #include <stdlib.h>
47 #include <stddef.h>
48 
49 #ifdef WIN32
50 #include <windows.h>
51 #include <assert.h>
52 #endif
53 
54 #include <stdint.h>
55 
56 
57 #ifndef U8
58 #define U8 uint8_t
59 #endif
60 
61 #ifndef U16
62 #define U16 uint16_t
63 #endif
64 
65 #ifndef U32
66 #define U32 uint32_t
67 #endif
68 
69 
70 #ifndef memcpy_P
71 #define memcpy_P memmove
72 #endif
73 
74 #ifndef strcpy_P
75 #define strcpy_P strcpy
76 #endif
77 
78 #ifndef _WDRESET
79 #define _WDRESET()
80 #define _NOP()
81 #endif
82 
83 typedef struct {
84  U32 h[20 / 4]; // Ensure it's word aligned
85  U32 buf[64 / 4]; // Ensure it's word aligned
89 
90 #define leftRotate(x, n) (x) = (((x) << (n)) | ((x) >> (32 - (n))))
91 
92 void shaEngine(U32 *buf, U32 *h);
93 void CL_hashInit(CL_HashContext *ctx);
94 void CL_hashUpdate(CL_HashContext *ctx, const U8 *src, int nbytes);
95 void CL_hashFinal(CL_HashContext *ctx, U8 *dest);
96 void CL_hash(U8 *msg, int msgBytes, U8 *dest);
97 
98 #endif // __SHA1_ROUTINES_DOT_H__
99 
void shaEngine(U32 *buf, U32 *h)
Definition: sha1_routines.c:187
void CL_hashInit(CL_HashContext *ctx)
Definition: sha1_routines.c:45
void CL_hashUpdate(CL_HashContext *ctx, const U8 *src, int nbytes)
Definition: sha1_routines.c:59
void CL_hash(U8 *msg, int msgBytes, U8 *dest)
Definition: sha1_routines.c:178
#define U32
Definition: sha1_routines.h:66
U32 byteCount
Definition: sha1_routines.h:86
#define U8
Definition: sha1_routines.h:58
U32 byteCountHi
Definition: sha1_routines.h:87
void CL_hashFinal(CL_HashContext *ctx, U8 *dest)
Definition: sha1_routines.c:117
Definition: sha1_routines.h:83