Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix integer sizes for 64bit
  • Loading branch information
Gleb Dolgich committed Nov 3, 2010
1 parent 18c11bd commit 70554d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions objc/CFobLicVerifier.m
Expand Up @@ -128,7 +128,7 @@ - (BOOL)verify {
NSString *keyNoDashes = [regKeyBase32 stringByReplacingOccurrencesOfString:@"-" withString:@""];
// Need to pad up to the nearest number divisible by 8.
NSUInteger keyLength = [keyNoDashes length];
int paddedLength = keyLength%8 ? (keyLength/8 + 1)*8 : keyLength;
NSUInteger paddedLength = keyLength%8 ? (keyLength/8 + 1)*8 : keyLength;
NSString *keyBase32 = [keyNoDashes stringByPaddingToLength:paddedLength withString:@"=" startingAtIndex:0];
const char *keyBase32Utf8 = [keyBase32 UTF8String];
if (!keyBase32Utf8)
Expand All @@ -146,7 +146,7 @@ - (BOOL)verify {
// Produce a SHA-1 hash of the registration name string. This is what was signed during registration key generation.
NSData *digest = [regName sha1];
// Verify DSA signature.
int check = DSA_verify(0, [digest bytes], [digest length], sig, sigSize, dsa);
int check = DSA_verify(0, [digest bytes], (int)[digest length], sig, (int)sigSize, dsa);
result = check > 0;
// Cleanup
free(sig);
Expand Down
4 changes: 2 additions & 2 deletions objc/NSString+PECrypt.m
Expand Up @@ -37,7 +37,7 @@ - (NSString *)base64DecodeWithBreaks:(BOOL)lineBreaks {
if (!utf8)
return nil;
// Create an OpenSSL BIO buffer using UTF8 representation of the string.
BIO *mem = BIO_new_mem_buf((void *)utf8, strlen(utf8));
BIO *mem = BIO_new_mem_buf((void *)utf8, (int)strlen(utf8));
// Push a Base64 filter so that reading from the buffer decodes it.
BIO *b64 = BIO_new(BIO_f_base64());
if (!lineBreaks)
Expand All @@ -49,7 +49,7 @@ - (NSString *)base64DecodeWithBreaks:(BOOL)lineBreaks {
const int DECODE_BUF_SIZE = 512;
char inbuf[DECODE_BUF_SIZE];
int inlen;
while ((inlen = BIO_read(mem, inbuf, sizeof(inbuf))) > 0)
while ((inlen = BIO_read(mem, inbuf, (int)sizeof(inbuf))) > 0)
[data appendBytes: inbuf length: inlen];
unsigned char zeroByte[1] = {0};
[data appendBytes:zeroByte length:1]; // zero-terminate the string
Expand Down

0 comments on commit 70554d1

Please sign in to comment.