PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LCOV - code coverage report
Current view: top level - ext/hash - hash_whirlpool.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 277 277 100.0 %
Date: 2022-01-21 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :   +----------------------------------------------------------------------+
       3             :   | PHP Version 7                                                        |
       4             :   +----------------------------------------------------------------------+
       5             :   | Copyright (c) 1997-2018 The PHP Group                                |
       6             :   +----------------------------------------------------------------------+
       7             :   | This source file is subject to version 3.01 of the PHP license,      |
       8             :   | that is bundled with this package in the file LICENSE, and is        |
       9             :   | available through the world-wide-web at the following url:           |
      10             :   | http://www.php.net/license/3_01.txt                                  |
      11             :   | If you did not receive a copy of the PHP license and are unable to   |
      12             :   | obtain it through the world-wide-web, please send a note to          |
      13             :   | license@php.net so we can mail you a copy immediately.               |
      14             :   +----------------------------------------------------------------------+
      15             :   | Authors: Michael Wallner <mike@php.net>                              |
      16             :   |          Sara Golemon <pollita@php.net>                              |
      17             :   +----------------------------------------------------------------------+
      18             : */
      19             : 
      20             : /* $Id$ */
      21             : 
      22             : #include "php_hash.h"
      23             : 
      24             : /*
      25             :  * TODO: simplify Update and Final, those look ridiculously complex
      26             :  * Mike, 2005-11-23
      27             :  */
      28             : 
      29             : #include "php_hash_whirlpool.h"
      30             : #include "php_hash_whirlpool_tables.h"
      31             : 
      32             : #define DIGESTBYTES 64
      33             : #define DIGESTBITS  (8*DIGESTBYTES) /* 512 */
      34             : 
      35             : #define WBLOCKBYTES 64
      36             : #define WBLOCKBITS  (8*WBLOCKBYTES) /* 512 */
      37             : 
      38             : #define LENGTHBYTES 32
      39             : #define LENGTHBITS  (8*LENGTHBYTES) /* 256 */
      40             : 
      41        1055 : static void WhirlpoolTransform(PHP_WHIRLPOOL_CTX *context)
      42             : {
      43             :     int i, r;
      44             :     uint64_t K[8];        /* the round key */
      45             :     uint64_t block[8];    /* mu(buffer) */
      46             :     uint64_t state[8];    /* the cipher state */
      47             :     uint64_t L[8];
      48        1055 :     unsigned char *buffer = context->buffer.data;
      49             : 
      50             :     /*
      51             :      * map the buffer to a block:
      52             :      */
      53        9495 :     for (i = 0; i < 8; i++, buffer += 8) {
      54        8440 :         block[i] =
      55       16880 :             (((uint64_t)buffer[0]        ) << 56) ^
      56       16880 :             (((uint64_t)buffer[1] & 0xffL) << 48) ^
      57       16880 :             (((uint64_t)buffer[2] & 0xffL) << 40) ^
      58       16880 :             (((uint64_t)buffer[3] & 0xffL) << 32) ^
      59       16880 :             (((uint64_t)buffer[4] & 0xffL) << 24) ^
      60       16880 :             (((uint64_t)buffer[5] & 0xffL) << 16) ^
      61       16880 :             (((uint64_t)buffer[6] & 0xffL) <<  8) ^
      62        8440 :             (((uint64_t)buffer[7] & 0xffL)      );
      63             :     }
      64             :     /*
      65             :      * compute and apply K^0 to the cipher state:
      66             :      */
      67        1055 :     state[0] = block[0] ^ (K[0] = context->state[0]);
      68        1055 :     state[1] = block[1] ^ (K[1] = context->state[1]);
      69        1055 :     state[2] = block[2] ^ (K[2] = context->state[2]);
      70        1055 :     state[3] = block[3] ^ (K[3] = context->state[3]);
      71        1055 :     state[4] = block[4] ^ (K[4] = context->state[4]);
      72        1055 :     state[5] = block[5] ^ (K[5] = context->state[5]);
      73        1055 :     state[6] = block[6] ^ (K[6] = context->state[6]);
      74        1055 :     state[7] = block[7] ^ (K[7] = context->state[7]);
      75             :     /*
      76             :      * iterate over all rounds:
      77             :      */
      78       11605 :     for (r = 1; r <= R; r++) {
      79             :         /*
      80             :          * compute K^r from K^{r-1}:
      81             :          */
      82       10550 :         L[0] =
      83       21100 :             C0[(int)(K[0] >> 56)       ] ^
      84       21100 :             C1[(int)(K[7] >> 48) & 0xff] ^
      85       21100 :             C2[(int)(K[6] >> 40) & 0xff] ^
      86       21100 :             C3[(int)(K[5] >> 32) & 0xff] ^
      87       21100 :             C4[(int)(K[4] >> 24) & 0xff] ^
      88       21100 :             C5[(int)(K[3] >> 16) & 0xff] ^
      89       21100 :             C6[(int)(K[2] >>  8) & 0xff] ^
      90       21100 :             C7[(int)(K[1]      ) & 0xff] ^
      91       10550 :             rc[r];
      92       10550 :         L[1] =
      93       21100 :             C0[(int)(K[1] >> 56)       ] ^
      94       21100 :             C1[(int)(K[0] >> 48) & 0xff] ^
      95       21100 :             C2[(int)(K[7] >> 40) & 0xff] ^
      96       21100 :             C3[(int)(K[6] >> 32) & 0xff] ^
      97       21100 :             C4[(int)(K[5] >> 24) & 0xff] ^
      98       21100 :             C5[(int)(K[4] >> 16) & 0xff] ^
      99       21100 :             C6[(int)(K[3] >>  8) & 0xff] ^
     100       10550 :             C7[(int)(K[2]      ) & 0xff];
     101       10550 :         L[2] =
     102       21100 :             C0[(int)(K[2] >> 56)       ] ^
     103       21100 :             C1[(int)(K[1] >> 48) & 0xff] ^
     104       21100 :             C2[(int)(K[0] >> 40) & 0xff] ^
     105       21100 :             C3[(int)(K[7] >> 32) & 0xff] ^
     106       21100 :             C4[(int)(K[6] >> 24) & 0xff] ^
     107       21100 :             C5[(int)(K[5] >> 16) & 0xff] ^
     108       21100 :             C6[(int)(K[4] >>  8) & 0xff] ^
     109       10550 :             C7[(int)(K[3]      ) & 0xff];
     110       10550 :         L[3] =
     111       21100 :             C0[(int)(K[3] >> 56)       ] ^
     112       21100 :             C1[(int)(K[2] >> 48) & 0xff] ^
     113       21100 :             C2[(int)(K[1] >> 40) & 0xff] ^
     114       21100 :             C3[(int)(K[0] >> 32) & 0xff] ^
     115       21100 :             C4[(int)(K[7] >> 24) & 0xff] ^
     116       21100 :             C5[(int)(K[6] >> 16) & 0xff] ^
     117       21100 :             C6[(int)(K[5] >>  8) & 0xff] ^
     118       10550 :             C7[(int)(K[4]      ) & 0xff];
     119       10550 :         L[4] =
     120       21100 :             C0[(int)(K[4] >> 56)       ] ^
     121       21100 :             C1[(int)(K[3] >> 48) & 0xff] ^
     122       21100 :             C2[(int)(K[2] >> 40) & 0xff] ^
     123       21100 :             C3[(int)(K[1] >> 32) & 0xff] ^
     124       21100 :             C4[(int)(K[0] >> 24) & 0xff] ^
     125       21100 :             C5[(int)(K[7] >> 16) & 0xff] ^
     126       21100 :             C6[(int)(K[6] >>  8) & 0xff] ^
     127       10550 :             C7[(int)(K[5]      ) & 0xff];
     128       10550 :         L[5] =
     129       21100 :             C0[(int)(K[5] >> 56)       ] ^
     130       21100 :             C1[(int)(K[4] >> 48) & 0xff] ^
     131       21100 :             C2[(int)(K[3] >> 40) & 0xff] ^
     132       21100 :             C3[(int)(K[2] >> 32) & 0xff] ^
     133       21100 :             C4[(int)(K[1] >> 24) & 0xff] ^
     134       21100 :             C5[(int)(K[0] >> 16) & 0xff] ^
     135       21100 :             C6[(int)(K[7] >>  8) & 0xff] ^
     136       10550 :             C7[(int)(K[6]      ) & 0xff];
     137       10550 :         L[6] =
     138       21100 :             C0[(int)(K[6] >> 56)       ] ^
     139       21100 :             C1[(int)(K[5] >> 48) & 0xff] ^
     140       21100 :             C2[(int)(K[4] >> 40) & 0xff] ^
     141       21100 :             C3[(int)(K[3] >> 32) & 0xff] ^
     142       21100 :             C4[(int)(K[2] >> 24) & 0xff] ^
     143       21100 :             C5[(int)(K[1] >> 16) & 0xff] ^
     144       21100 :             C6[(int)(K[0] >>  8) & 0xff] ^
     145       10550 :             C7[(int)(K[7]      ) & 0xff];
     146       10550 :         L[7] =
     147       21100 :             C0[(int)(K[7] >> 56)       ] ^
     148       21100 :             C1[(int)(K[6] >> 48) & 0xff] ^
     149       21100 :             C2[(int)(K[5] >> 40) & 0xff] ^
     150       21100 :             C3[(int)(K[4] >> 32) & 0xff] ^
     151       21100 :             C4[(int)(K[3] >> 24) & 0xff] ^
     152       21100 :             C5[(int)(K[2] >> 16) & 0xff] ^
     153       21100 :             C6[(int)(K[1] >>  8) & 0xff] ^
     154       10550 :             C7[(int)(K[0]      ) & 0xff];
     155       10550 :         K[0] = L[0];
     156       10550 :         K[1] = L[1];
     157       10550 :         K[2] = L[2];
     158       10550 :         K[3] = L[3];
     159       10550 :         K[4] = L[4];
     160       10550 :         K[5] = L[5];
     161       10550 :         K[6] = L[6];
     162       10550 :         K[7] = L[7];
     163             :         /*
     164             :          * apply the r-th round transformation:
     165             :          */
     166       10550 :         L[0] =
     167       21100 :             C0[(int)(state[0] >> 56)       ] ^
     168       21100 :             C1[(int)(state[7] >> 48) & 0xff] ^
     169       21100 :             C2[(int)(state[6] >> 40) & 0xff] ^
     170       21100 :             C3[(int)(state[5] >> 32) & 0xff] ^
     171       21100 :             C4[(int)(state[4] >> 24) & 0xff] ^
     172       21100 :             C5[(int)(state[3] >> 16) & 0xff] ^
     173       21100 :             C6[(int)(state[2] >>  8) & 0xff] ^
     174       21100 :             C7[(int)(state[1]      ) & 0xff] ^
     175       10550 :             K[0];
     176       10550 :         L[1] =
     177       21100 :             C0[(int)(state[1] >> 56)       ] ^
     178       21100 :             C1[(int)(state[0] >> 48) & 0xff] ^
     179       21100 :             C2[(int)(state[7] >> 40) & 0xff] ^
     180       21100 :             C3[(int)(state[6] >> 32) & 0xff] ^
     181       21100 :             C4[(int)(state[5] >> 24) & 0xff] ^
     182       21100 :             C5[(int)(state[4] >> 16) & 0xff] ^
     183       21100 :             C6[(int)(state[3] >>  8) & 0xff] ^
     184       21100 :             C7[(int)(state[2]      ) & 0xff] ^
     185       10550 :             K[1];
     186       10550 :         L[2] =
     187       21100 :             C0[(int)(state[2] >> 56)       ] ^
     188       21100 :             C1[(int)(state[1] >> 48) & 0xff] ^
     189       21100 :             C2[(int)(state[0] >> 40) & 0xff] ^
     190       21100 :             C3[(int)(state[7] >> 32) & 0xff] ^
     191       21100 :             C4[(int)(state[6] >> 24) & 0xff] ^
     192       21100 :             C5[(int)(state[5] >> 16) & 0xff] ^
     193       21100 :             C6[(int)(state[4] >>  8) & 0xff] ^
     194       21100 :             C7[(int)(state[3]      ) & 0xff] ^
     195       10550 :             K[2];
     196       10550 :         L[3] =
     197       21100 :             C0[(int)(state[3] >> 56)       ] ^
     198       21100 :             C1[(int)(state[2] >> 48) & 0xff] ^
     199       21100 :             C2[(int)(state[1] >> 40) & 0xff] ^
     200       21100 :             C3[(int)(state[0] >> 32) & 0xff] ^
     201       21100 :             C4[(int)(state[7] >> 24) & 0xff] ^
     202       21100 :             C5[(int)(state[6] >> 16) & 0xff] ^
     203       21100 :             C6[(int)(state[5] >>  8) & 0xff] ^
     204       21100 :             C7[(int)(state[4]      ) & 0xff] ^
     205       10550 :             K[3];
     206       10550 :         L[4] =
     207       21100 :             C0[(int)(state[4] >> 56)       ] ^
     208       21100 :             C1[(int)(state[3] >> 48) & 0xff] ^
     209       21100 :             C2[(int)(state[2] >> 40) & 0xff] ^
     210       21100 :             C3[(int)(state[1] >> 32) & 0xff] ^
     211       21100 :             C4[(int)(state[0] >> 24) & 0xff] ^
     212       21100 :             C5[(int)(state[7] >> 16) & 0xff] ^
     213       21100 :             C6[(int)(state[6] >>  8) & 0xff] ^
     214       21100 :             C7[(int)(state[5]      ) & 0xff] ^
     215       10550 :             K[4];
     216       10550 :         L[5] =
     217       21100 :             C0[(int)(state[5] >> 56)       ] ^
     218       21100 :             C1[(int)(state[4] >> 48) & 0xff] ^
     219       21100 :             C2[(int)(state[3] >> 40) & 0xff] ^
     220       21100 :             C3[(int)(state[2] >> 32) & 0xff] ^
     221       21100 :             C4[(int)(state[1] >> 24) & 0xff] ^
     222       21100 :             C5[(int)(state[0] >> 16) & 0xff] ^
     223       21100 :             C6[(int)(state[7] >>  8) & 0xff] ^
     224       21100 :             C7[(int)(state[6]      ) & 0xff] ^
     225       10550 :             K[5];
     226       10550 :         L[6] =
     227       21100 :             C0[(int)(state[6] >> 56)       ] ^
     228       21100 :             C1[(int)(state[5] >> 48) & 0xff] ^
     229       21100 :             C2[(int)(state[4] >> 40) & 0xff] ^
     230       21100 :             C3[(int)(state[3] >> 32) & 0xff] ^
     231       21100 :             C4[(int)(state[2] >> 24) & 0xff] ^
     232       21100 :             C5[(int)(state[1] >> 16) & 0xff] ^
     233       21100 :             C6[(int)(state[0] >>  8) & 0xff] ^
     234       21100 :             C7[(int)(state[7]      ) & 0xff] ^
     235       10550 :             K[6];
     236       10550 :         L[7] =
     237       21100 :             C0[(int)(state[7] >> 56)       ] ^
     238       21100 :             C1[(int)(state[6] >> 48) & 0xff] ^
     239       21100 :             C2[(int)(state[5] >> 40) & 0xff] ^
     240       21100 :             C3[(int)(state[4] >> 32) & 0xff] ^
     241       21100 :             C4[(int)(state[3] >> 24) & 0xff] ^
     242       21100 :             C5[(int)(state[2] >> 16) & 0xff] ^
     243       21100 :             C6[(int)(state[1] >>  8) & 0xff] ^
     244       21100 :             C7[(int)(state[0]      ) & 0xff] ^
     245       10550 :             K[7];
     246       10550 :         state[0] = L[0];
     247       10550 :         state[1] = L[1];
     248       10550 :         state[2] = L[2];
     249       10550 :         state[3] = L[3];
     250       10550 :         state[4] = L[4];
     251       10550 :         state[5] = L[5];
     252       10550 :         state[6] = L[6];
     253       10550 :         state[7] = L[7];
     254             :     }
     255             :     /*
     256             :      * apply the Miyaguchi-Preneel compression function:
     257             :      */
     258        1055 :     context->state[0] ^= state[0] ^ block[0];
     259        1055 :     context->state[1] ^= state[1] ^ block[1];
     260        1055 :     context->state[2] ^= state[2] ^ block[2];
     261        1055 :     context->state[3] ^= state[3] ^ block[3];
     262        1055 :     context->state[4] ^= state[4] ^ block[4];
     263        1055 :     context->state[5] ^= state[5] ^ block[5];
     264        1055 :     context->state[6] ^= state[6] ^ block[6];
     265        1055 :     context->state[7] ^= state[7] ^ block[7];
     266             : 
     267        1055 :         ZEND_SECURE_ZERO(state, sizeof(state));
     268        1055 : }
     269             : 
     270          21 : PHP_HASH_API void PHP_WHIRLPOOLInit(PHP_WHIRLPOOL_CTX *context)
     271             : {
     272          21 :         memset(context, 0, sizeof(*context));
     273          21 : }
     274             : 
     275          26 : PHP_HASH_API void PHP_WHIRLPOOLUpdate(PHP_WHIRLPOOL_CTX *context, const unsigned char *input, size_t len)
     276             : {
     277          26 :     uint64_t sourceBits = len * 8;
     278          26 :     int sourcePos    = 0; /* index of leftmost source unsigned char containing data (1 to 8 bits). */
     279          26 :     int sourceGap    = (8 - ((int)sourceBits & 7)) & 7; /* space on source[sourcePos]. */
     280          26 :     int bufferRem    = context->buffer.bits & 7; /* occupied bits on buffer[bufferPos]. */
     281          26 :     const unsigned char *source = input;
     282          26 :     unsigned char *buffer       = context->buffer.data;
     283          26 :     unsigned char *bitLength    = context->bitlength;
     284          26 :     int bufferBits   = context->buffer.bits;
     285          26 :     int bufferPos    = context->buffer.pos;
     286             :     uint32_t b, carry;
     287             :     int i;
     288             : 
     289             :     /*
     290             :      * tally the length of the added data:
     291             :      */
     292          26 :     uint64_t value = sourceBits;
     293          71 :     for (i = 31, carry = 0; i >= 0 && (carry != 0 || value != L64(0)); i--) {
     294          45 :         carry += bitLength[i] + ((uint32_t)value & 0xff);
     295          45 :         bitLength[i] = (unsigned char)carry;
     296          45 :         carry >>= 8;
     297          45 :         value >>= 8;
     298             :     }
     299             :     /*
     300             :      * process data in chunks of 8 bits (a more efficient approach would be to take whole-word chunks):
     301             :      */
     302       66330 :     while (sourceBits > 8) {
     303             :         /* N.B. at least source[sourcePos] and source[sourcePos+1] contain data. */
     304             :         /*
     305             :          * take a byte from the source:
     306             :          */
     307      132556 :         b = ((source[sourcePos] << sourceGap) & 0xff) |
     308       66278 :             ((source[sourcePos + 1] & 0xff) >> (8 - sourceGap));
     309             :         /*
     310             :          * process this byte:
     311             :          */
     312       66278 :         buffer[bufferPos++] |= (unsigned char)(b >> bufferRem);
     313       66278 :         bufferBits += 8 - bufferRem; /* bufferBits = 8*bufferPos; */
     314       66278 :         if (bufferBits == DIGESTBITS) {
     315             :             /*
     316             :              * process data block:
     317             :              */
     318        1018 :             WhirlpoolTransform(context);
     319             :             /*
     320             :              * reset buffer:
     321             :              */
     322        1018 :             bufferBits = bufferPos = 0;
     323             :         }
     324       66278 :         buffer[bufferPos] = (unsigned char) (b << (8 - bufferRem));
     325       66278 :         bufferBits += bufferRem;
     326             :         /*
     327             :          * proceed to remaining data:
     328             :          */
     329       66278 :         sourceBits -= 8;
     330       66278 :         sourcePos++;
     331             :     }
     332             :     /* now 0 <= sourceBits <= 8;
     333             :      * furthermore, all data (if any is left) is in source[sourcePos].
     334             :      */
     335          26 :     if (sourceBits > 0) {
     336          25 :         b = (source[sourcePos] << sourceGap) & 0xff; /* bits are left-justified on b. */
     337             :         /*
     338             :          * process the remaining bits:
     339             :          */
     340          25 :         buffer[bufferPos] |= b >> bufferRem;
     341             :     } else {
     342           1 :         b = 0;
     343             :     }
     344          26 :     if (bufferRem + sourceBits < 8) {
     345             :         /*
     346             :          * all remaining data fits on buffer[bufferPos],
     347             :          * and there still remains some space.
     348             :          */
     349           1 :         bufferBits += (int) sourceBits;
     350             :     } else {
     351             :         /*
     352             :          * buffer[bufferPos] is full:
     353             :          */
     354          25 :         bufferPos++;
     355          25 :         bufferBits += 8 - bufferRem; /* bufferBits = 8*bufferPos; */
     356          25 :         sourceBits -= 8 - bufferRem;
     357             :         /* now 0 <= sourceBits < 8;
     358             :          * furthermore, all data (if any is left) is in source[sourcePos].
     359             :          */
     360          25 :         if (bufferBits == DIGESTBITS) {
     361             :             /*
     362             :              * process data block:
     363             :              */
     364          13 :             WhirlpoolTransform(context);
     365             :             /*
     366             :              * reset buffer:
     367             :              */
     368          13 :             bufferBits = bufferPos = 0;
     369             :         }
     370          25 :         buffer[bufferPos] = (unsigned char) (b << (8 - bufferRem));
     371          25 :         bufferBits += (int)sourceBits;
     372             :     }
     373          26 :     context->buffer.bits   = bufferBits;
     374          26 :     context->buffer.pos    = bufferPos;
     375          26 : }
     376             : 
     377          20 : PHP_HASH_API void PHP_WHIRLPOOLFinal(unsigned char digest[64], PHP_WHIRLPOOL_CTX *context)
     378             : {
     379             :     int i;
     380          20 :     unsigned char *buffer      = context->buffer.data;
     381          20 :     unsigned char *bitLength   = context->bitlength;
     382          20 :     int bufferBits  = context->buffer.bits;
     383          20 :     int bufferPos   = context->buffer.pos;
     384             : 
     385             :     /*
     386             :      * append a '1'-bit:
     387             :      */
     388          20 :     buffer[bufferPos] |= 0x80U >> (bufferBits & 7);
     389          20 :     bufferPos++; /* all remaining bits on the current unsigned char are set to zero. */
     390             :     /*
     391             :      * pad with zero bits to complete (N*WBLOCKBITS - LENGTHBITS) bits:
     392             :      */
     393          20 :     if (bufferPos > WBLOCKBYTES - LENGTHBYTES) {
     394           4 :         if (bufferPos < WBLOCKBYTES) {
     395           4 :             memset(&buffer[bufferPos], 0, WBLOCKBYTES - bufferPos);
     396             :         }
     397             :         /*
     398             :          * process data block:
     399             :          */
     400           4 :         WhirlpoolTransform(context);
     401             :         /*
     402             :          * reset buffer:
     403             :          */
     404           4 :         bufferPos = 0;
     405             :     }
     406          20 :     if (bufferPos < WBLOCKBYTES - LENGTHBYTES) {
     407          20 :         memset(&buffer[bufferPos], 0, (WBLOCKBYTES - LENGTHBYTES) - bufferPos);
     408             :     }
     409          20 :     bufferPos = WBLOCKBYTES - LENGTHBYTES;
     410             :     /*
     411             :      * append bit length of hashed data:
     412             :      */
     413          20 :     memcpy(&buffer[WBLOCKBYTES - LENGTHBYTES], bitLength, LENGTHBYTES);
     414             :     /*
     415             :      * process data block:
     416             :      */
     417          20 :     WhirlpoolTransform(context);
     418             :     /*
     419             :      * return the completed message digest:
     420             :      */
     421         180 :     for (i = 0; i < DIGESTBYTES/8; i++) {
     422         160 :         digest[0] = (unsigned char)(context->state[i] >> 56);
     423         160 :         digest[1] = (unsigned char)(context->state[i] >> 48);
     424         160 :         digest[2] = (unsigned char)(context->state[i] >> 40);
     425         160 :         digest[3] = (unsigned char)(context->state[i] >> 32);
     426         160 :         digest[4] = (unsigned char)(context->state[i] >> 24);
     427         160 :         digest[5] = (unsigned char)(context->state[i] >> 16);
     428         160 :         digest[6] = (unsigned char)(context->state[i] >>  8);
     429         160 :         digest[7] = (unsigned char)(context->state[i]      );
     430         160 :         digest += 8;
     431             :     }
     432             : 
     433          20 :     ZEND_SECURE_ZERO(context, sizeof(*context));
     434          20 : }
     435             : 
     436             : const php_hash_ops php_hash_whirlpool_ops = {
     437             :         (php_hash_init_func_t) PHP_WHIRLPOOLInit,
     438             :         (php_hash_update_func_t) PHP_WHIRLPOOLUpdate,
     439             :         (php_hash_final_func_t) PHP_WHIRLPOOLFinal,
     440             :         (php_hash_copy_func_t) php_hash_copy,
     441             :         64,
     442             :         64,
     443             :         sizeof(PHP_WHIRLPOOL_CTX),
     444             :         1
     445             : };
     446             : 
     447             : /*
     448             :  * Local variables:
     449             :  * tab-width: 4
     450             :  * c-basic-offset: 4
     451             :  * End:
     452             :  * vim600: sw=4 ts=4 fdm=marker
     453             :  * vim<600: sw=4 ts=4
     454             :  */

Generated by: LCOV version 1.10

Generated at Fri, 21 Jan 2022 14:15:10 +0000 (7 days ago)

Copyright © 2005-2022 The PHP Group
All rights reserved.