4545#define  restrict 
4646#endif 
4747
48+ /* PHP change: Windows compatibility */ 
49+ #ifdef  _MSC_VER 
50+ # define  PHP_STATIC_RESTRICT 
51+ #else 
52+ # define  PHP_STATIC_RESTRICT  PHP_STATIC_RESTRICT
53+ #endif 
54+ 
4855/* 
4956 * Encode a length len*2 vector of (uint32_t) into a length len*8 vector of 
5057 * (uint8_t) in big-endian form. 
@@ -132,9 +139,9 @@ static const uint32_t Krnd[64] = {
132139 * the 512-bit input block to produce a new state. 
133140 */ 
134141static  void 
135- SHA256_Transform (uint32_t  state [static  restrict  8 ],
136-     const  uint8_t  block [static  restrict  64 ],
137-     uint32_t  W [static  restrict  64 ], uint32_t  S [static  restrict  8 ])
142+ SHA256_Transform (uint32_t  state [PHP_STATIC_RESTRICT  8 ],
143+     const  uint8_t  block [PHP_STATIC_RESTRICT  64 ],
144+     uint32_t  W [PHP_STATIC_RESTRICT   64 ], uint32_t  S [PHP_STATIC_RESTRICT  8 ])
138145{
139146	int  i ;
140147
@@ -203,7 +210,7 @@ static const uint8_t PAD[64] = {
203210
204211/* Add padding and terminating bit-count. */ 
205212static  void 
206- SHA256_Pad (SHA256_CTX  *  ctx , uint32_t  tmp32 [static  restrict  72 ])
213+ SHA256_Pad (SHA256_CTX  *  ctx , uint32_t  tmp32 [PHP_STATIC_RESTRICT  72 ])
207214{
208215	size_t  r ;
209216
@@ -257,7 +264,7 @@ SHA256_Init(SHA256_CTX * ctx)
257264 */ 
258265static  void 
259266_SHA256_Update (SHA256_CTX  *  ctx , const  void  *  in , size_t  len ,
260-     uint32_t  tmp32 [static  restrict  72 ])
267+     uint32_t  tmp32 [PHP_STATIC_RESTRICT  72 ])
261268{
262269	uint32_t  r ;
263270	const  uint8_t  *  src  =  in ;
@@ -315,7 +322,7 @@ SHA256_Update(SHA256_CTX * ctx, const void * in, size_t len)
315322 */ 
316323static  void 
317324_SHA256_Final (uint8_t  digest [32 ], SHA256_CTX  *  ctx ,
318-     uint32_t  tmp32 [static  restrict  72 ])
325+     uint32_t  tmp32 [PHP_STATIC_RESTRICT  72 ])
319326{
320327
321328	/* Add padding. */ 
@@ -367,8 +374,8 @@ SHA256_Buf(const void * in, size_t len, uint8_t digest[32])
367374 */ 
368375static  void 
369376_HMAC_SHA256_Init (HMAC_SHA256_CTX  *  ctx , const  void  *  _K , size_t  Klen ,
370-     uint32_t  tmp32 [static  restrict  72 ], uint8_t  pad [static  restrict  64 ],
371-     uint8_t  khash [static  restrict  32 ])
377+     uint32_t  tmp32 [PHP_STATIC_RESTRICT   72 ], uint8_t  pad [PHP_STATIC_RESTRICT  64 ],
378+     uint8_t  khash [PHP_STATIC_RESTRICT  32 ])
372379{
373380	const  uint8_t  *  K  =  _K ;
374381	size_t  i ;
@@ -420,7 +427,7 @@ HMAC_SHA256_Init(HMAC_SHA256_CTX * ctx, const void * _K, size_t Klen)
420427 */ 
421428static  void 
422429_HMAC_SHA256_Update (HMAC_SHA256_CTX  *  ctx , const  void  *  in , size_t  len ,
423-     uint32_t  tmp32 [static  restrict  72 ])
430+     uint32_t  tmp32 [PHP_STATIC_RESTRICT  72 ])
424431{
425432
426433	/* Feed data to the inner SHA256 operation. */ 
@@ -447,7 +454,7 @@ HMAC_SHA256_Update(HMAC_SHA256_CTX * ctx, const void * in, size_t len)
447454 */ 
448455static  void 
449456_HMAC_SHA256_Final (uint8_t  digest [32 ], HMAC_SHA256_CTX  *  ctx ,
450-     uint32_t  tmp32 [static  restrict  72 ], uint8_t  ihash [static  restrict  32 ])
457+     uint32_t  tmp32 [PHP_STATIC_RESTRICT   72 ], uint8_t  ihash [PHP_STATIC_RESTRICT  32 ])
451458{
452459
453460	/* Finish the inner SHA256 operation. */ 
@@ -500,8 +507,8 @@ HMAC_SHA256_Buf(const void * K, size_t Klen, const void * in, size_t len,
500507
501508/* Add padding and terminating bit-count, but don't invoke Transform yet. */ 
502509static  int 
503- SHA256_Pad_Almost (SHA256_CTX  *  ctx , uint8_t  len [static  restrict  8 ],
504-     uint32_t  tmp32 [static  restrict  72 ])
510+ SHA256_Pad_Almost (SHA256_CTX  *  ctx , uint8_t  len [PHP_STATIC_RESTRICT  8 ],
511+     uint32_t  tmp32 [PHP_STATIC_RESTRICT  72 ])
505512{
506513	uint32_t  r ;
507514
0 commit comments