2
0

Fix build warnings.

This commit is contained in:
Maarten Billemont 2017-08-28 23:48:24 -04:00
parent 74f9f1ca00
commit e364f5159b
4 changed files with 81 additions and 84 deletions

View File

@ -364,7 +364,9 @@ const char *mpw_vstr(const char *format, va_list args) {
return NULL; return NULL;
do { do {
int len = vsnprintf( str_str, str_str_max, format, args ); size_t len = (size_t)vsnprintf( str_str, str_str_max, format, args );
if ((int)len < 0)
return NULL;
if (len < str_str_max) if (len < str_str_max)
break; break;

View File

@ -78,8 +78,6 @@
DA3B8453190FC86F00246EEA /* NSManagedObject+Pearl.h in Headers */ = {isa = PBXBuildFile; fileRef = DA3B8451190FC86F00246EEA /* NSManagedObject+Pearl.h */; }; DA3B8453190FC86F00246EEA /* NSManagedObject+Pearl.h in Headers */ = {isa = PBXBuildFile; fileRef = DA3B8451190FC86F00246EEA /* NSManagedObject+Pearl.h */; };
DA3B8456190FC89700246EEA /* MPFixable.m in Sources */ = {isa = PBXBuildFile; fileRef = DA3B8454190FC89700246EEA /* MPFixable.m */; }; DA3B8456190FC89700246EEA /* MPFixable.m in Sources */ = {isa = PBXBuildFile; fileRef = DA3B8454190FC89700246EEA /* MPFixable.m */; };
DA3BCFCD19BD09E0006B2681 /* SourceCodePro-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = DA3BCFCC19BD09E0006B2681 /* SourceCodePro-Regular.otf */; }; DA3BCFCD19BD09E0006B2681 /* SourceCodePro-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = DA3BCFCC19BD09E0006B2681 /* SourceCodePro-Regular.otf */; };
DA456CA11F53056000D54152 /* bcrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = DA456CA01F53056000D54152 /* bcrypt.c */; };
DA456CA41F5307B700D54152 /* blowfish.c in Sources */ = {isa = PBXBuildFile; fileRef = DA456CA31F5307B700D54152 /* blowfish.c */; };
DA4DA1D91564471A00F6F596 /* libjrswizzle.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DAC6326C148680650075AEA5 /* libjrswizzle.a */; }; DA4DA1D91564471A00F6F596 /* libjrswizzle.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DAC6326C148680650075AEA5 /* libjrswizzle.a */; };
DA4DAE941A7D8117003E5423 /* MPAlgorithmV3.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4DAE921A7D8117003E5423 /* MPAlgorithmV3.m */; }; DA4DAE941A7D8117003E5423 /* MPAlgorithmV3.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4DAE921A7D8117003E5423 /* MPAlgorithmV3.m */; };
DA4DAE951A7D8117003E5423 /* MPTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4DAE931A7D8117003E5423 /* MPTypes.m */; }; DA4DAE951A7D8117003E5423 /* MPTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4DAE931A7D8117003E5423 /* MPTypes.m */; };
@ -2755,9 +2753,7 @@
DA5180CA19FF2F9200A587E9 /* MPAlgorithmV2.m in Sources */, DA5180CA19FF2F9200A587E9 /* MPAlgorithmV2.m in Sources */,
93D39F833DEC1C89B2F795AC /* MPSitesWindowController.m in Sources */, 93D39F833DEC1C89B2F795AC /* MPSitesWindowController.m in Sources */,
DA67742F1A4746AF004F356A /* mpw-types.c in Sources */, DA67742F1A4746AF004F356A /* mpw-types.c in Sources */,
DA456CA41F5307B700D54152 /* blowfish.c in Sources */,
93D390C676DF52DA7E459F19 /* MPSitesWindow.m in Sources */, 93D390C676DF52DA7E459F19 /* MPSitesWindow.m in Sources */,
DA456CA11F53056000D54152 /* bcrypt.c in Sources */,
DA26861D1EBFD7A40001E37E /* MPGeneratedSiteEntity+CoreDataClass.m in Sources */, DA26861D1EBFD7A40001E37E /* MPGeneratedSiteEntity+CoreDataClass.m in Sources */,
93D39784E725A34D1EE3FB3B /* MPInitialWindowController.m in Sources */, 93D39784E725A34D1EE3FB3B /* MPInitialWindowController.m in Sources */,
93D394C4254EEB45FB335AFB /* MPSitesTableView.m in Sources */, 93D394C4254EEB45FB335AFB /* MPSitesTableView.m in Sources */,

View File

@ -32,7 +32,6 @@
*/ */
#include <sys/types.h> #include <sys/types.h>
#include <blf.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <pwd.h> #include <pwd.h>
@ -40,6 +39,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include "blf.h"
#include "blowfish.c" #include "blowfish.c"
/* This implementation is adaptable to current computing power. /* This implementation is adaptable to current computing power.
@ -55,8 +56,6 @@
#define BCRYPT_SALTSPACE (7 + (BCRYPT_MAXSALT * 4 + 2) / 3 + 1) #define BCRYPT_SALTSPACE (7 + (BCRYPT_MAXSALT * 4 + 2) / 3 + 1)
#define BCRYPT_HASHSPACE 61 #define BCRYPT_HASHSPACE 61
char *bcrypt_gensalt(u_int8_t);
static int encode_base64(char *, const u_int8_t *, size_t); static int encode_base64(char *, const u_int8_t *, size_t);
static int decode_base64(u_int8_t *, size_t, const char *); static int decode_base64(u_int8_t *, size_t, const char *);
@ -80,8 +79,8 @@ bcrypt_initsalt(int log_rounds, uint8_t *salt, size_t saltbuflen) {
else if (log_rounds > 31) else if (log_rounds > 31)
log_rounds = 31; log_rounds = 31;
snprintf( salt, saltbuflen, "$2b$%2.2u$", log_rounds ); snprintf( (char *)salt, saltbuflen, "$2b$%2.2u$", log_rounds );
encode_base64( salt + 7, csalt, sizeof( csalt ) ); encode_base64( (char *)salt + 7, csalt, sizeof( csalt ) );
return 0; return 0;
} }
@ -90,7 +89,7 @@ bcrypt_initsalt(int log_rounds, uint8_t *salt, size_t saltbuflen) {
* the core bcrypt function * the core bcrypt function
*/ */
static int static int
bcrypt_hashpass(const char *key, const char *salt, char *encrypted, bcrypt_hashpass(const char *key, const uint8_t *salt, char *encrypted,
size_t encryptedlen) { size_t encryptedlen) {
blf_ctx state; blf_ctx state;
@ -149,20 +148,20 @@ bcrypt_hashpass(const char *key, const char *salt, char *encrypted,
/* Discard num rounds + "$" identifier */ /* Discard num rounds + "$" identifier */
salt += 3; salt += 3;
if (strlen( salt ) * 3 / 4 < BCRYPT_MAXSALT) if (strlen( (char *)salt ) * 3 / 4 < BCRYPT_MAXSALT)
goto inval; goto inval;
/* We dont want the base64 salt but the raw data */ /* We dont want the base64 salt but the raw data */
if (decode_base64( csalt, BCRYPT_MAXSALT, salt )) if (decode_base64( csalt, BCRYPT_MAXSALT, (char *)salt ))
goto inval; goto inval;
salt_len = BCRYPT_MAXSALT; salt_len = BCRYPT_MAXSALT;
/* Setting up S-Boxes and Subkeys */ /* Setting up S-Boxes and Subkeys */
Blowfish_initstate( &state ); Blowfish_initstate( &state );
Blowfish_expandstate( &state, csalt, salt_len, Blowfish_expandstate( &state, csalt, salt_len,
(u_int8_t *)key, key_len ); (u_int8_t *)key, (u_int16_t)key_len );
for (k = 0; k < rounds; k++) { for (k = 0; k < rounds; k++) {
Blowfish_expand0state( &state, (u_int8_t *)key, key_len ); Blowfish_expand0state( &state, (u_int8_t *)key, (u_int16_t)key_len );
Blowfish_expand0state( &state, csalt, salt_len ); Blowfish_expand0state( &state, csalt, salt_len );
} }
@ -202,10 +201,10 @@ bcrypt_hashpass(const char *key, const char *salt, char *encrypted,
/* /*
* user friendly functions * user friendly functions
*/ */
int static int
bcrypt_newhash(const char *pass, int log_rounds, char *hash, size_t hashlen) { bcrypt_newhash(const char *pass, int log_rounds, char *hash, size_t hashlen) {
char salt[BCRYPT_SALTSPACE]; uint8_t salt[BCRYPT_SALTSPACE];
if (bcrypt_initsalt( log_rounds, salt, sizeof( salt ) ) != 0) if (bcrypt_initsalt( log_rounds, salt, sizeof( salt ) ) != 0)
return -1; return -1;
@ -217,12 +216,12 @@ bcrypt_newhash(const char *pass, int log_rounds, char *hash, size_t hashlen) {
return 0; return 0;
} }
int static int
bcrypt_checkpass(const char *pass, const char *goodhash) { bcrypt_checkpass(const char *pass, const char *goodhash) {
char hash[BCRYPT_HASHSPACE]; char hash[BCRYPT_HASHSPACE];
if (bcrypt_hashpass( pass, goodhash, hash, sizeof( hash ) ) != 0) if (bcrypt_hashpass( pass, (const uint8_t *)goodhash, hash, sizeof( hash ) ) != 0)
return -1; return -1;
if (strlen( hash ) != strlen( goodhash ) || if (strlen( hash ) != strlen( goodhash ) ||
timingsafe_bcmp( hash, goodhash, strlen( goodhash ) ) != 0) { timingsafe_bcmp( hash, goodhash, strlen( goodhash ) ) != 0) {
@ -238,13 +237,13 @@ bcrypt_checkpass(const char *pass, const char *goodhash) {
* Measure this system's performance by measuring the time for 8 rounds. * Measure this system's performance by measuring the time for 8 rounds.
* We are aiming for something that takes around 0.1s, but not too much over. * We are aiming for something that takes around 0.1s, but not too much over.
*/ */
int static int
_bcrypt_autorounds(void) { _bcrypt_autorounds(void) {
struct timespec before, after; struct timespec before, after;
int r = 8; int r = 8;
char buf[_PASSWORD_LEN]; char buf[_PASSWORD_LEN];
int duration; time_t duration;
clock_gettime( CLOCK_THREAD_CPUTIME_ID, &before ); clock_gettime( CLOCK_THREAD_CPUTIME_ID, &before );
bcrypt_newhash( "testpassword", r, buf, sizeof( buf ) ); bcrypt_newhash( "testpassword", r, buf, sizeof( buf ) );
@ -289,7 +288,7 @@ static const u_int8_t index_64[128] = {
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 255, 255, 255, 255, 255 51, 52, 53, 255, 255, 255, 255, 255
}; };
#define CHAR64(c) ( (c) > 127 ? 255 : index_64[(c)]) #define CHAR64(c) ( (c) > 127 ? (u_int8_t)255 : index_64[(c)])
/* /*
* read buflen (after decoding) bytes of data from b64data * read buflen (after decoding) bytes of data from b64data
@ -298,7 +297,7 @@ static int
decode_base64(u_int8_t *buffer, size_t len, const char *b64data) { decode_base64(u_int8_t *buffer, size_t len, const char *b64data) {
u_int8_t *bp = buffer; u_int8_t *bp = buffer;
const u_int8_t *p = b64data; const u_int8_t *p = (u_int8_t *)b64data;
u_int8_t c1, c2, c3, c4; u_int8_t c1, c2, c3, c4;
while (bp < buffer + len) { while (bp < buffer + len) {
@ -311,7 +310,7 @@ decode_base64(u_int8_t *buffer, size_t len, const char *b64data) {
if (c2 == 255) if (c2 == 255)
return -1; return -1;
*bp++ = (c1 << 2) | ((c2 & 0x30) >> 4); *bp++ = (u_int8_t)((c1 << 2) | ((c2 & 0x30) >> 4));
if (bp >= buffer + len) if (bp >= buffer + len)
break; break;
@ -319,14 +318,14 @@ decode_base64(u_int8_t *buffer, size_t len, const char *b64data) {
if (c3 == 255) if (c3 == 255)
return -1; return -1;
*bp++ = ((c2 & 0x0f) << 4) | ((c3 & 0x3c) >> 2); *bp++ = (u_int8_t)(((c2 & 0x0f) << 4) | ((c3 & 0x3c) >> 2));
if (bp >= buffer + len) if (bp >= buffer + len)
break; break;
c4 = CHAR64( *(p + 3) ); c4 = CHAR64( *(p + 3) );
if (c4 == 255) if (c4 == 255)
return -1; return -1;
*bp++ = ((c3 & 0x03) << 6) | c4; *bp++ = (u_int8_t)(((c3 & 0x03) << 6) | c4);
p += 4; p += 4;
} }
@ -340,14 +339,14 @@ decode_base64(u_int8_t *buffer, size_t len, const char *b64data) {
static int static int
encode_base64(char *b64buffer, const u_int8_t *data, size_t len) { encode_base64(char *b64buffer, const u_int8_t *data, size_t len) {
u_int8_t *bp = b64buffer; u_int8_t *bp = (u_int8_t *)b64buffer;
const u_int8_t *p = data; const u_int8_t *p = data;
u_int8_t c1, c2; u_int8_t c1, c2;
while (p < data + len) { while (p < data + len) {
c1 = *p++; c1 = *p++;
*bp++ = Base64Code[(c1 >> 2)]; *bp++ = Base64Code[(c1 >> 2)];
c1 = (c1 & 0x03) << 4; c1 = (u_int8_t)((c1 & 0x03) << 4);
if (p >= data + len) { if (p >= data + len) {
*bp++ = Base64Code[c1]; *bp++ = Base64Code[c1];
break; break;
@ -355,7 +354,7 @@ encode_base64(char *b64buffer, const u_int8_t *data, size_t len) {
c2 = *p++; c2 = *p++;
c1 |= (c2 >> 4) & 0x0f; c1 |= (c2 >> 4) & 0x0f;
*bp++ = Base64Code[c1]; *bp++ = Base64Code[c1];
c1 = (c2 & 0x0f) << 2; c1 = (u_int8_t)((c2 & 0x0f) << 2);
if (p >= data + len) { if (p >= data + len) {
*bp++ = Base64Code[c1]; *bp++ = Base64Code[c1];
break; break;
@ -372,18 +371,18 @@ encode_base64(char *b64buffer, const u_int8_t *data, size_t len) {
/* /*
* classic interface * classic interface
*/ */
char * static u_int8_t *
bcrypt_gensalt(u_int8_t log_rounds) { bcrypt_gensalt(u_int8_t log_rounds) {
static char gsalt[BCRYPT_SALTSPACE]; static u_int8_t gsalt[BCRYPT_SALTSPACE];
bcrypt_initsalt( log_rounds, gsalt, sizeof( gsalt ) ); bcrypt_initsalt( log_rounds, gsalt, sizeof( gsalt ) );
return gsalt; return gsalt;
} }
char * static char *
bcrypt(const char *pass, const char *salt) { bcrypt(const char *pass, const u_int8_t *salt) {
static char gencrypted[BCRYPT_HASHSPACE]; static char gencrypted[BCRYPT_HASHSPACE];

View File

@ -44,7 +44,6 @@
#include <string.h> #include <string.h>
#endif #endif
#include <sys/types.h>
#include "blf.h" #include "blf.h"
#undef inline #undef inline
@ -537,17 +536,18 @@ blf_ecb_encrypt(blf_ctx *c, u_int8_t *data, u_int32_t len)
u_int32_t i; u_int32_t i;
for (i = 0; i < len; i += 8) { for (i = 0; i < len; i += 8) {
l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3]; l = (u_int32_t)data[0] << 24 | (u_int32_t)data[1] << 16 | (u_int32_t)data[2] << 8 | (u_int32_t)data[3];
r = data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]; l = (u_int32_t)data[0] << 24 | (u_int32_t)data[1] << 16 | (u_int32_t)data[2] << 8 | (u_int32_t)data[3];
r = (u_int32_t)data[4] << 24 | (u_int32_t)data[5] << 16 | (u_int32_t)data[6] << 8 | (u_int32_t)data[7];
Blowfish_encipher(c, &l, &r); Blowfish_encipher(c, &l, &r);
data[0] = l >> 24 & 0xff; data[0] = (u_int8_t)(l >> 24 & 0xff);
data[1] = l >> 16 & 0xff; data[1] = (u_int8_t)(l >> 16 & 0xff);
data[2] = l >> 8 & 0xff; data[2] = (u_int8_t)(l >> 8 & 0xff);
data[3] = l & 0xff; data[3] = (u_int8_t)(l & 0xff);
data[4] = r >> 24 & 0xff; data[4] = (u_int8_t)(r >> 24 & 0xff);
data[5] = r >> 16 & 0xff; data[5] = (u_int8_t)(r >> 16 & 0xff);
data[6] = r >> 8 & 0xff; data[6] = (u_int8_t)(r >> 8 & 0xff);
data[7] = r & 0xff; data[7] = (u_int8_t)(r & 0xff);
data += 8; data += 8;
} }
} }
@ -559,17 +559,17 @@ blf_ecb_decrypt(blf_ctx *c, u_int8_t *data, u_int32_t len)
u_int32_t i; u_int32_t i;
for (i = 0; i < len; i += 8) { for (i = 0; i < len; i += 8) {
l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3]; l = (u_int32_t)data[0] << 24 | (u_int32_t)data[1] << 16 | (u_int32_t)data[2] << 8 | (u_int32_t)data[3];
r = data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]; r = (u_int32_t)data[4] << 24 | (u_int32_t)data[5] << 16 | (u_int32_t)data[6] << 8 | (u_int32_t)data[7];
Blowfish_decipher(c, &l, &r); Blowfish_decipher(c, &l, &r);
data[0] = l >> 24 & 0xff; data[0] = (u_int8_t)(l >> 24 & 0xff);
data[1] = l >> 16 & 0xff; data[1] = (u_int8_t)(l >> 16 & 0xff);
data[2] = l >> 8 & 0xff; data[2] = (u_int8_t)(l >> 8 & 0xff);
data[3] = l & 0xff; data[3] = (u_int8_t)(l & 0xff);
data[4] = r >> 24 & 0xff; data[4] = (u_int8_t)(r >> 24 & 0xff);
data[5] = r >> 16 & 0xff; data[5] = (u_int8_t)(r >> 16 & 0xff);
data[6] = r >> 8 & 0xff; data[6] = (u_int8_t)(r >> 8 & 0xff);
data[7] = r & 0xff; data[7] = (u_int8_t)(r & 0xff);
data += 8; data += 8;
} }
} }
@ -583,17 +583,17 @@ blf_cbc_encrypt(blf_ctx *c, u_int8_t *iv, u_int8_t *data, u_int32_t len)
for (i = 0; i < len; i += 8) { for (i = 0; i < len; i += 8) {
for (j = 0; j < 8; j++) for (j = 0; j < 8; j++)
data[j] ^= iv[j]; data[j] ^= iv[j];
l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3]; l = (u_int32_t)data[0] << 24 | (u_int32_t)data[1] << 16 | (u_int32_t)data[2] << 8 | (u_int32_t)data[3];
r = data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]; r = (u_int32_t)data[4] << 24 | (u_int32_t)data[5] << 16 | (u_int32_t)data[6] << 8 | (u_int32_t)data[7];
Blowfish_encipher(c, &l, &r); Blowfish_encipher(c, &l, &r);
data[0] = l >> 24 & 0xff; data[0] = (u_int8_t)(l >> 24 & 0xff);
data[1] = l >> 16 & 0xff; data[1] = (u_int8_t)(l >> 16 & 0xff);
data[2] = l >> 8 & 0xff; data[2] = (u_int8_t)(l >> 8 & 0xff);
data[3] = l & 0xff; data[3] = (u_int8_t)(l & 0xff);
data[4] = r >> 24 & 0xff; data[4] = (u_int8_t)(r >> 24 & 0xff);
data[5] = r >> 16 & 0xff; data[5] = (u_int8_t)(r >> 16 & 0xff);
data[6] = r >> 8 & 0xff; data[6] = (u_int8_t)(r >> 8 & 0xff);
data[7] = r & 0xff; data[7] = (u_int8_t)(r & 0xff);
iv = data; iv = data;
data += 8; data += 8;
} }
@ -609,33 +609,33 @@ blf_cbc_decrypt(blf_ctx *c, u_int8_t *iva, u_int8_t *data, u_int32_t len)
iv = data + len - 16; iv = data + len - 16;
data = data + len - 8; data = data + len - 8;
for (i = len - 8; i >= 8; i -= 8) { for (i = len - 8; i >= 8; i -= 8) {
l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3]; l = (u_int32_t)data[0] << 24 | (u_int32_t)data[1] << 16 | (u_int32_t)data[2] << 8 | (u_int32_t)data[3];
r = data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]; r = (u_int32_t)data[4] << 24 | (u_int32_t)data[5] << 16 | (u_int32_t)data[6] << 8 | (u_int32_t)data[7];
Blowfish_decipher(c, &l, &r); Blowfish_decipher(c, &l, &r);
data[0] = l >> 24 & 0xff; data[0] = (u_int8_t)(l >> 24 & 0xff);
data[1] = l >> 16 & 0xff; data[1] = (u_int8_t)(l >> 16 & 0xff);
data[2] = l >> 8 & 0xff; data[2] = (u_int8_t)(l >> 8 & 0xff);
data[3] = l & 0xff; data[3] = (u_int8_t)(l & 0xff);
data[4] = r >> 24 & 0xff; data[4] = (u_int8_t)(r >> 24 & 0xff);
data[5] = r >> 16 & 0xff; data[5] = (u_int8_t)(r >> 16 & 0xff);
data[6] = r >> 8 & 0xff; data[6] = (u_int8_t)(r >> 8 & 0xff);
data[7] = r & 0xff; data[7] = (u_int8_t)(r & 0xff);
for (j = 0; j < 8; j++) for (j = 0; j < 8; j++)
data[j] ^= iv[j]; data[j] ^= iv[j];
iv -= 8; iv -= 8;
data -= 8; data -= 8;
} }
l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3]; l = (u_int32_t)data[0] << 24 | (u_int32_t)data[1] << 16 | (u_int32_t)data[2] << 8 | (u_int32_t)data[3];
r = data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]; r = (u_int32_t)data[4] << 24 | (u_int32_t)data[5] << 16 | (u_int32_t)data[6] << 8 | (u_int32_t)data[7];
Blowfish_decipher(c, &l, &r); Blowfish_decipher(c, &l, &r);
data[0] = l >> 24 & 0xff; data[0] = (u_int8_t)(l >> 24 & 0xff);
data[1] = l >> 16 & 0xff; data[1] = (u_int8_t)(l >> 16 & 0xff);
data[2] = l >> 8 & 0xff; data[2] = (u_int8_t)(l >> 8 & 0xff);
data[3] = l & 0xff; data[3] = (u_int8_t)(l & 0xff);
data[4] = r >> 24 & 0xff; data[4] = (u_int8_t)(r >> 24 & 0xff);
data[5] = r >> 16 & 0xff; data[5] = (u_int8_t)(r >> 16 & 0xff);
data[6] = r >> 8 & 0xff; data[6] = (u_int8_t)(r >> 8 & 0xff);
data[7] = r & 0xff; data[7] = (u_int8_t)(r & 0xff);
for (j = 0; j < 8; j++) for (j = 0; j < 8; j++)
data[j] ^= iva[j]; data[j] ^= iva[j];
} }