File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 3
3
#include <string.h>
4
4
#include <openssl/sha.h>
5
5
6
+ #if defined(_MSC_VER )
7
+ #define __align (boundary , type ) __declspec(align(boundary)) type
8
+ #else
9
+ #define __align (boundary , type ) type __attribute__((aligned(boundary)))
10
+ #endif
11
+
6
12
inline void encodeb64 (const unsigned char * pch , char * buff )
7
13
{
8
14
const char * pbase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" ;
@@ -33,9 +39,9 @@ inline void encodeb64(const unsigned char* pch, char* buff)
33
39
34
40
void sha1_hash (const char * input , char * output , uint32_t len )
35
41
{
36
- char str [38 ] __attribute__(( aligned ( 32 )) ); // 26 + 11 + 1
37
- uint32_t prehash [5 ] __attribute__(( aligned ( 32 )) );
38
- uint32_t hash [5 ] __attribute__(( aligned ( 32 )) ) = { 0 };
42
+ __align ( 32 , char str [38 ]); // 26 + 11 + 1
43
+ __align ( 32 , uint32_t prehash [5 ]);
44
+ __align ( 32 , uint32_t hash [5 ]) = { 0 };
39
45
int i = 0 ;
40
46
SHA_CTX ctx ;
41
47
SHA1_Init (& ctx );
You can’t perform that action at this time.
0 commit comments