File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
crypto/openssl_mbedtls_wrapper/mbedtls Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 22
22
* Included Files
23
23
****************************************************************************/
24
24
25
+ #include <mbedtls/sha1.h>
25
26
#include <openssl/sha.h>
26
27
27
28
/****************************************************************************
28
29
* Public Functions
29
30
****************************************************************************/
30
31
32
+ int SHA1_Init (SHA_CTX * sha )
33
+ {
34
+ mbedtls_sha1_init ((mbedtls_sha1_context * )sha );
35
+ mbedtls_sha1_starts ((mbedtls_sha1_context * )sha );
36
+ return 0 ;
37
+ }
38
+
39
+ int SHA1_Update (SHA_CTX * sha , const void * data , size_t len )
40
+ {
41
+ return mbedtls_sha1_update ((mbedtls_sha1_context * )sha , data , len );
42
+ }
43
+
44
+ int SHA1_Final (uint8_t out [SHA_DIGEST_LENGTH ], SHA_CTX * sha )
45
+ {
46
+ return mbedtls_sha1_finish ((mbedtls_sha1_context * )sha ,
47
+ (unsigned char * )out );
48
+ }
49
+
50
+ uint8_t * SHA1 (const uint8_t * data , size_t len ,
51
+ uint8_t out [SHA_DIGEST_LENGTH ])
52
+ {
53
+ if (mbedtls_sha1 (data , len , out ) != 0 )
54
+ {
55
+ return NULL ;
56
+ }
57
+
58
+ return out ;
59
+ }
60
+
31
61
int SHA256_Init (SHA256_CTX * sha )
32
62
{
33
63
return 0 ;
You can’t perform that action at this time.
0 commit comments