no message

This commit is contained in:
Peter 2017-04-18 19:52:37 +03:00
parent 333b5c0ffc
commit 4cf9a68a19
4 changed files with 17 additions and 3 deletions

View File

@ -20,7 +20,7 @@ typedef struct {
- (void)addIncomingBytes:(NSUInteger)incomingBytes interface:(MTNetworkUsageManagerInterface)interface; - (void)addIncomingBytes:(NSUInteger)incomingBytes interface:(MTNetworkUsageManagerInterface)interface;
- (void)addOutgoingBytes:(NSUInteger)outgoingBytes interface:(MTNetworkUsageManagerInterface)interface; - (void)addOutgoingBytes:(NSUInteger)outgoingBytes interface:(MTNetworkUsageManagerInterface)interface;
- (void)resetKeys:(NSArray<NSNumber *> *)keys completion:(void (^)())completion; - (void)resetKeys:(NSArray<NSNumber *> *)keys setKeys:(NSDictionary<NSNumber *, NSNumber *> *)setKeys completion:(void (^)())completion;
- (MTSignal *)currentStatsForKeys:(NSArray<NSNumber *> *)keys; - (MTSignal *)currentStatsForKeys:(NSArray<NSNumber *> *)keys;
@end @end

View File

@ -103,13 +103,17 @@ static int offsetForInterface(MTNetworkUsageCalculationInfo *info, MTNetworkUsag
}]; }];
} }
- (void)resetKeys:(NSArray<NSNumber *> *)keys completion:(void (^)())completion { - (void)resetKeys:(NSArray<NSNumber *> *)keys setKeys:(NSDictionary<NSNumber *, NSNumber *> *)setKeys completion:(void (^)())completion {
[_queue dispatchOnQueue:^{ [_queue dispatchOnQueue:^{
if (_map) { if (_map) {
for (NSNumber *key in keys) { for (NSNumber *key in keys) {
int64_t *ptr = (int64_t *)(_map + [key intValue] * 8); int64_t *ptr = (int64_t *)(_map + [key intValue] * 8);
*ptr = 0; *ptr = 0;
} }
[setKeys enumerateKeysAndObjectsUsingBlock:^(NSNumber *key, NSNumber *value, __unused BOOL *stop) {
int64_t *ptr = (int64_t *)(_map + [key intValue] * 8);
*ptr = [value longLongValue];
}];
if (completion) { if (completion) {
completion(); completion();
} }

View File

@ -305,10 +305,16 @@ NSData *MTExp(NSData *base, NSData *exp, NSData *modulus)
{ {
BN_CTX *ctx = BN_CTX_new(); BN_CTX *ctx = BN_CTX_new();
BIGNUM *bnBase = BN_bin2bn(base.bytes, (int)base.length, NULL); BIGNUM *bnBase = BN_bin2bn(base.bytes, (int)base.length, NULL);
BN_set_flags(bnBase, BN_FLG_CONSTTIME);
BIGNUM *bnExp = BN_bin2bn(exp.bytes, (int)exp.length, NULL); BIGNUM *bnExp = BN_bin2bn(exp.bytes, (int)exp.length, NULL);
BN_set_flags(bnExp, BN_FLG_CONSTTIME);
BIGNUM *bnModulus = BN_bin2bn(modulus.bytes, (int)modulus.length, NULL); BIGNUM *bnModulus = BN_bin2bn(modulus.bytes, (int)modulus.length, NULL);
BN_set_flags(bnModulus, BN_FLG_CONSTTIME);
BIGNUM *bnRes = BN_new(); BIGNUM *bnRes = BN_new();
BN_set_flags(bnModulus, BN_FLG_CONSTTIME);
BN_mod_exp(bnRes, bnBase, bnExp, bnModulus, ctx); BN_mod_exp(bnRes, bnBase, bnExp, bnModulus, ctx);

View File

@ -1765,8 +1765,12 @@ static const NSUInteger MTMaxUnacknowledgedMessageCount = 64;
int32_t messageDataLength = 0; int32_t messageDataLength = 0;
[decryptedData getBytes:&messageDataLength range:NSMakeRange(28, 4)]; [decryptedData getBytes:&messageDataLength range:NSMakeRange(28, 4)];
if (messageDataLength < 0 || messageDataLength > (int32_t)decryptedData.length) if (messageDataLength < 0 || messageDataLength > (int32_t)decryptedData.length) {
#if MTProtoV2
__unused NSData *result = MTSha256(decryptedData);
#endif
return nil; return nil;
}
#if MTProtoV2 #if MTProtoV2
int xValue = 8; int xValue = 8;