File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 7
7
8
8
#include "include/concatkdf_int.h"
9
9
10
+
11
+ #ifdef _WIN32
12
+ #include <Winsock2.h>
13
+ #include <malloc.h>
14
+ #else
10
15
#include <arpa/inet.h>
16
+ #include <alloca.h>
17
+ #endif
11
18
#include <openssl/evp.h>
12
19
#include <string.h>
13
20
#include <cjose/base64.h>
14
21
#include <cjose/util.h>
15
22
23
+ #ifdef _WIN32
24
+ #define STACK_ALLOC _alloca
25
+ #else
26
+ #define STACK_ALLOC alloca
27
+ #endif
28
+
16
29
////////////////////////////////////////////////////////////////////////////////
17
30
static uint8_t * _apply_uint32 (const uint32_t value , uint8_t * buffer )
18
31
{
@@ -139,7 +152,7 @@ uint8_t *cjose_concatkdf_derive(const size_t keylen,
139
152
uint8_t counter [4 ];
140
153
_apply_uint32 (idx , counter );
141
154
142
- uint8_t hash [ hashlen ] ;
155
+ uint8_t * hash = STACK_ALLOC ( hashlen * sizeof ( uint8_t )) ;
143
156
if (1 != EVP_DigestInit_ex (ctx , dgst , NULL ) ||
144
157
1 != EVP_DigestUpdate (ctx , counter , sizeof (counter )) ||
145
158
1 != EVP_DigestUpdate (ctx , ikm , ikmLen ) ||
You can’t perform that action at this time.
0 commit comments