@@ -101,7 +101,7 @@ chacha_encrypt_bytes(chacha_ctx *x,const u8 *m,u8 *c,u32 bytes)
101101 u32 j0 , j1 , j2 , j3 , j4 , j5 , j6 , j7 , j8 , j9 , j10 , j11 , j12 , j13 , j14 , j15 ;
102102 u8 * ctarget = NULL ;
103103 u8 tmp [64 ];
104- u_int i ;
104+ unsigned int i ;
105105
106106 if (!bytes ) return ;
107107
@@ -603,6 +603,7 @@ arc4random_uniform(uint32_t upper_bound)
603603 */
604604
605605#include <sys/types.h>
606+ #include <stdint.h>
606607
607608/* Function for Feistel Networks */
608609
@@ -614,12 +615,12 @@ arc4random_uniform(uint32_t upper_bound)
614615#define BLFRND (s ,p ,i ,j ,n ) (i ^= F(s,j) ^ (p)[n])
615616
616617void
617- Blowfish_encipher (blf_ctx * c , u_int32_t * xl , u_int32_t * xr )
618+ Blowfish_encipher (blf_ctx * c , uint32_t * xl , uint32_t * xr )
618619{
619- u_int32_t Xl ;
620- u_int32_t Xr ;
621- u_int32_t * s = c -> S [0 ];
622- u_int32_t * p = c -> P ;
620+ uint32_t Xl ;
621+ uint32_t Xr ;
622+ uint32_t * s = c -> S [0 ];
623+ uint32_t * p = c -> P ;
623624
624625 Xl = * xl ;
625626 Xr = * xr ;
@@ -639,12 +640,12 @@ Blowfish_encipher(blf_ctx *c, u_int32_t *xl, u_int32_t *xr)
639640}
640641
641642void
642- Blowfish_decipher (blf_ctx * c , u_int32_t * xl , u_int32_t * xr )
643+ Blowfish_decipher (blf_ctx * c , uint32_t * xl , uint32_t * xr )
643644{
644- u_int32_t Xl ;
645- u_int32_t Xr ;
646- u_int32_t * s = c -> S [0 ];
647- u_int32_t * p = c -> P ;
645+ uint32_t Xl ;
646+ uint32_t Xr ;
647+ uint32_t * s = c -> S [0 ];
648+ uint32_t * p = c -> P ;
648649
649650 Xl = * xl ;
650651 Xr = * xr ;
@@ -942,13 +943,13 @@ Blowfish_initstate(blf_ctx *c)
942943 * c = initstate ;
943944}
944945
945- u_int32_t
946- Blowfish_stream2word (const u_int8_t * data , u_int16_t databytes ,
947- u_int16_t * current )
946+ uint32_t
947+ Blowfish_stream2word (const uint8_t * data , uint16_t databytes ,
948+ uint16_t * current )
948949{
949- u_int8_t i ;
950- u_int16_t j ;
951- u_int32_t temp ;
950+ uint8_t i ;
951+ uint16_t j ;
952+ uint32_t temp ;
952953
953954 temp = 0x00000000 ;
954955 j = * current ;
@@ -964,14 +965,14 @@ Blowfish_stream2word(const u_int8_t *data, u_int16_t databytes,
964965}
965966
966967void
967- Blowfish_expand0state (blf_ctx * c , const u_int8_t * key , u_int16_t keybytes )
968+ Blowfish_expand0state (blf_ctx * c , const uint8_t * key , uint16_t keybytes )
968969{
969- u_int16_t i ;
970- u_int16_t j ;
971- u_int16_t k ;
972- u_int32_t temp ;
973- u_int32_t datal ;
974- u_int32_t datar ;
970+ uint16_t i ;
971+ uint16_t j ;
972+ uint16_t k ;
973+ uint32_t temp ;
974+ uint32_t datal ;
975+ uint32_t datar ;
975976
976977 j = 0 ;
977978 for (i = 0 ; i < BLF_N + 2 ; i ++ ) {
@@ -1001,15 +1002,15 @@ Blowfish_expand0state(blf_ctx *c, const u_int8_t *key, u_int16_t keybytes)
10011002}
10021003
10031004void
1004- Blowfish_expandstate (blf_ctx * c , const u_int8_t * data , u_int16_t databytes ,
1005- const u_int8_t * key , u_int16_t keybytes )
1005+ Blowfish_expandstate (blf_ctx * c , const uint8_t * data , uint16_t databytes ,
1006+ const uint8_t * key , uint16_t keybytes )
10061007{
1007- u_int16_t i ;
1008- u_int16_t j ;
1009- u_int16_t k ;
1010- u_int32_t temp ;
1011- u_int32_t datal ;
1012- u_int32_t datar ;
1008+ uint16_t i ;
1009+ uint16_t j ;
1010+ uint16_t k ;
1011+ uint32_t temp ;
1012+ uint32_t datal ;
1013+ uint32_t datar ;
10131014
10141015 j = 0 ;
10151016 for (i = 0 ; i < BLF_N + 2 ; i ++ ) {
@@ -1044,7 +1045,7 @@ Blowfish_expandstate(blf_ctx *c, const u_int8_t *data, u_int16_t databytes,
10441045}
10451046
10461047void
1047- blf_key (blf_ctx * c , const u_int8_t * k , u_int16_t len )
1048+ blf_key (blf_ctx * c , const uint8_t * k , uint16_t len )
10481049{
10491050 /* Initialize S-boxes and subkeys with Pi */
10501051 Blowfish_initstate (c );
@@ -1054,10 +1055,10 @@ blf_key(blf_ctx *c, const u_int8_t *k, u_int16_t len)
10541055}
10551056
10561057void
1057- blf_enc (blf_ctx * c , u_int32_t * data , u_int16_t blocks )
1058+ blf_enc (blf_ctx * c , uint32_t * data , uint16_t blocks )
10581059{
1059- u_int32_t * d ;
1060- u_int16_t i ;
1060+ uint32_t * d ;
1061+ uint16_t i ;
10611062
10621063 d = data ;
10631064 for (i = 0 ; i < blocks ; i ++ ) {
@@ -1067,10 +1068,10 @@ blf_enc(blf_ctx *c, u_int32_t *data, u_int16_t blocks)
10671068}
10681069
10691070void
1070- blf_dec (blf_ctx * c , u_int32_t * data , u_int16_t blocks )
1071+ blf_dec (blf_ctx * c , uint32_t * data , uint16_t blocks )
10711072{
1072- u_int32_t * d ;
1073- u_int16_t i ;
1073+ uint32_t * d ;
1074+ uint16_t i ;
10741075
10751076 d = data ;
10761077 for (i = 0 ; i < blocks ; i ++ ) {
@@ -1080,10 +1081,10 @@ blf_dec(blf_ctx *c, u_int32_t *data, u_int16_t blocks)
10801081}
10811082
10821083void
1083- blf_ecb_encrypt (blf_ctx * c , u_int8_t * data , u_int32_t len )
1084+ blf_ecb_encrypt (blf_ctx * c , uint8_t * data , uint32_t len )
10841085{
1085- u_int32_t l , r ;
1086- u_int32_t i ;
1086+ uint32_t l , r ;
1087+ uint32_t i ;
10871088
10881089 for (i = 0 ; i < len ; i += 8 ) {
10891090 l = data [0 ] << 24 | data [1 ] << 16 | data [2 ] << 8 | data [3 ];
@@ -1102,10 +1103,10 @@ blf_ecb_encrypt(blf_ctx *c, u_int8_t *data, u_int32_t len)
11021103}
11031104
11041105void
1105- blf_ecb_decrypt (blf_ctx * c , u_int8_t * data , u_int32_t len )
1106+ blf_ecb_decrypt (blf_ctx * c , uint8_t * data , uint32_t len )
11061107{
1107- u_int32_t l , r ;
1108- u_int32_t i ;
1108+ uint32_t l , r ;
1109+ uint32_t i ;
11091110
11101111 for (i = 0 ; i < len ; i += 8 ) {
11111112 l = data [0 ] << 24 | data [1 ] << 16 | data [2 ] << 8 | data [3 ];
@@ -1124,10 +1125,10 @@ blf_ecb_decrypt(blf_ctx *c, u_int8_t *data, u_int32_t len)
11241125}
11251126
11261127void
1127- blf_cbc_encrypt (blf_ctx * c , u_int8_t * iv , u_int8_t * data , u_int32_t len )
1128+ blf_cbc_encrypt (blf_ctx * c , uint8_t * iv , uint8_t * data , uint32_t len )
11281129{
1129- u_int32_t l , r ;
1130- u_int32_t i , j ;
1130+ uint32_t l , r ;
1131+ uint32_t i , j ;
11311132
11321133 for (i = 0 ; i < len ; i += 8 ) {
11331134 for (j = 0 ; j < 8 ; j ++ )
@@ -1149,11 +1150,11 @@ blf_cbc_encrypt(blf_ctx *c, u_int8_t *iv, u_int8_t *data, u_int32_t len)
11491150}
11501151
11511152void
1152- blf_cbc_decrypt (blf_ctx * c , u_int8_t * iva , u_int8_t * data , u_int32_t len )
1153+ blf_cbc_decrypt (blf_ctx * c , uint8_t * iva , uint8_t * data , uint32_t len )
11531154{
1154- u_int32_t l , r ;
1155- u_int8_t * iv ;
1156- u_int32_t i , j ;
1155+ uint32_t l , r ;
1156+ uint8_t * iv ;
1157+ uint32_t i , j ;
11571158
11581159 iv = data + len - 16 ;
11591160 data = data + len - 8 ;
@@ -1249,8 +1250,8 @@ blf_cbc_decrypt(blf_ctx *c, u_int8_t *iva, u_int8_t *data, u_int32_t len)
12491250#define BCRYPT_SALTSPACE (7 + (BCRYPT_MAXSALT * 4 + 2) / 3 + 1)
12501251#define BCRYPT_HASHSPACE 61
12511252
1252- static int encode_base64 (char * , const u_int8_t * , size_t );
1253- static int decode_base64 (u_int8_t * , size_t , const char * );
1253+ static int encode_base64 (char * , const uint8_t * , size_t );
1254+ static int decode_base64 (uint8_t * , size_t , const char * );
12541255
12551256/*
12561257 * Generates a salt for this version of crypt.
@@ -1286,13 +1287,13 @@ bcrypt_hashpass(const char *key, const char *salt, char *encrypted,
12861287 size_t encryptedlen )
12871288{
12881289 blf_ctx state ;
1289- u_int32_t rounds , i , k ;
1290- u_int16_t j ;
1290+ uint32_t rounds , i , k ;
1291+ uint16_t j ;
12911292 size_t key_len ;
1292- u_int8_t salt_len , logr , minor ;
1293- u_int8_t ciphertext [4 * BCRYPT_WORDS ] = "OrpheanBeholderScryDoubt" ;
1294- u_int8_t csalt [BCRYPT_MAXSALT ];
1295- u_int32_t cdata [BCRYPT_WORDS ];
1293+ uint8_t salt_len , logr , minor ;
1294+ uint8_t ciphertext [4 * BCRYPT_WORDS ] = "OrpheanBeholderScryDoubt" ;
1295+ uint8_t csalt [BCRYPT_MAXSALT ];
1296+ uint32_t cdata [BCRYPT_WORDS ];
12961297
12971298 if (encryptedlen < BCRYPT_HASHSPACE )
12981299 goto inval ;
@@ -1308,7 +1309,7 @@ bcrypt_hashpass(const char *key, const char *salt, char *encrypted,
13081309 /* Check for minor versions */
13091310 switch ((minor = salt [1 ])) {
13101311 case 'a' :
1311- key_len = (u_int8_t )(strlen (key ) + 1 );
1312+ key_len = (uint8_t )(strlen (key ) + 1 );
13121313 break ;
13131314 case 'b' :
13141315 /* strlen() returns a size_t, but the function calls
@@ -1352,9 +1353,9 @@ bcrypt_hashpass(const char *key, const char *salt, char *encrypted,
13521353 /* Setting up S-Boxes and Subkeys */
13531354 Blowfish_initstate (& state );
13541355 Blowfish_expandstate (& state , csalt , salt_len ,
1355- (u_int8_t * ) key , key_len );
1356+ (uint8_t * ) key , key_len );
13561357 for (k = 0 ; k < rounds ; k ++ ) {
1357- Blowfish_expand0state (& state , (u_int8_t * ) key , key_len );
1358+ Blowfish_expand0state (& state , (uint8_t * ) key , key_len );
13581359 Blowfish_expand0state (& state , csalt , salt_len );
13591360 }
13601361
@@ -1464,10 +1465,10 @@ _bcrypt_autorounds(void)
14641465/*
14651466 * internal utilities
14661467 */
1467- static const u_int8_t Base64Code [] =
1468+ static const uint8_t Base64Code [] =
14681469"./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" ;
14691470
1470- static const u_int8_t index_64 [128 ] = {
1471+ static const uint8_t index_64 [128 ] = {
14711472 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 ,
14721473 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 ,
14731474 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 ,
@@ -1488,11 +1489,11 @@ static const u_int8_t index_64[128] = {
14881489 * read buflen (after decoding) bytes of data from b64data
14891490 */
14901491static int
1491- decode_base64 (u_int8_t * buffer , size_t len , const char * b64data )
1492+ decode_base64 (uint8_t * buffer , size_t len , const char * b64data )
14921493{
1493- u_int8_t * bp = buffer ;
1494- const u_int8_t * p = (const u_int8_t * )b64data ;
1495- u_int8_t c1 , c2 , c3 , c4 ;
1494+ uint8_t * bp = buffer ;
1495+ const uint8_t * p = (const uint8_t * )b64data ;
1496+ uint8_t c1 , c2 , c3 , c4 ;
14961497
14971498 while (bp < buffer + len ) {
14981499 c1 = CHAR64 (* p );
@@ -1531,11 +1532,11 @@ decode_base64(u_int8_t *buffer, size_t len, const char *b64data)
15311532 * This works without = padding.
15321533 */
15331534static int
1534- encode_base64 (char * b64buffer , const u_int8_t * data , size_t len )
1535+ encode_base64 (char * b64buffer , const uint8_t * data , size_t len )
15351536{
1536- u_int8_t * bp = (u_int8_t * )b64buffer ;
1537- const u_int8_t * p = data ;
1538- u_int8_t c1 , c2 ;
1537+ uint8_t * bp = (uint8_t * )b64buffer ;
1538+ const uint8_t * p = data ;
1539+ uint8_t c1 , c2 ;
15391540
15401541 while (p < data + len ) {
15411542 c1 = * p ++ ;
@@ -2144,7 +2145,7 @@ explicit_bzero(void *p, size_t n)
21442145 * Indirect memset through a volatile pointer to hopefully avoid
21452146 * dead-store optimisation eliminating the call.
21462147 */
2147- static void (* volatile ssh_memset )(void * , int , size_t ) = memset ;
2148+ static void * (* volatile ssh_memset )(void * , int , size_t ) = memset ;
21482149
21492150void
21502151explicit_bzero (void * p , size_t n )
@@ -3290,6 +3291,7 @@ getprogname(void)
32903291 */
32913292
32923293#include <sys/types.h>
3294+ #include <stdint.h>
32933295#include <stdlib.h>
32943296#include <string.h>
32953297
0 commit comments