Overview
Comment: | OFSecureData: Add constant-time isEqual: |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
68c8c02e80c28af1931f5abe897d7c4d |
User & Date: | js on 2018-06-24 19:53:13 |
Other Links: | manifest | tags |
Context
2018-06-24
| ||
22:08 | Rename -[listenWith{BackLog -> Backlog}:] check-in: 3cd89fa8ba user: js tags: trunk | |
19:53 | OFSecureData: Add constant-time isEqual: check-in: 68c8c02e80 user: js tags: trunk | |
2018-06-23
| ||
20:15 | ofarc: Fix double newline in output check-in: 14dcc4929a user: js tags: trunk | |
Changes
Modified src/OFSecureData.h from [ac5cf895db] to [bc7ed72611].
︙ | ︙ | |||
87 88 89 90 91 92 93 94 95 96 97 98 99 100 | * @param itemSize The size of a single item in the OFSecureData in bytes * @param count The number of zero items the OFSecureData should contain * @return An initialized OFSecureData */ - (instancetype)initWithItemSize: (size_t)itemSize count: (size_t)count; /*! * @brief Zeroes the data. */ - (void)zero; #ifdef OF_HAVE_FILES - (instancetype)initWithContentsOfFile: (OFString *)path OF_UNAVAILABLE; | > > > > > > > > > > > | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | * @param itemSize The size of a single item in the OFSecureData in bytes * @param count The number of zero items the OFSecureData should contain * @return An initialized OFSecureData */ - (instancetype)initWithItemSize: (size_t)itemSize count: (size_t)count; /*! * @brief Checks the OFSecureData for equality to another object. * * If the specified object is a subclass of @ref OFData, the comparison is * performed in constant time. * * @param object The object which should be tested for equality * @return A boolean whether the OFSecureData is equal to the specified object */ - (bool)isEqual: (nullable id)object; /*! * @brief Zeroes the data. */ - (void)zero; #ifdef OF_HAVE_FILES - (instancetype)initWithContentsOfFile: (OFString *)path OF_UNAVAILABLE; |
︙ | ︙ |
Modified src/OFSecureData.m from [1f55e2f307] to [431c3bcd83].
︙ | ︙ | |||
452 453 454 455 456 457 458 459 460 461 462 463 464 465 | - (id)mutableCopy { return [[OFSecureData alloc] initWithItems: _items itemSize: _itemSize count: _count]; } - (OFString *)description { return @"<OFSecureData>"; } - (OFString *)stringRepresentation | > > > > > > > > > > > > > > > > > > > > > | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 | - (id)mutableCopy { return [[OFSecureData alloc] initWithItems: _items itemSize: _itemSize count: _count]; } - (bool)isEqual: (id)object { OFData *otherData; unsigned char diff; if (![object isKindOfClass: [OFData class]]) return false; otherData = object; if (otherData->_count != _count || otherData->_itemSize != _itemSize) return false; diff = 0; for (size_t i = 0; i < _count * _itemSize; i++) diff |= otherData->_items[i] ^ _items[i]; return (diff == 0); } - (OFString *)description { return @"<OFSecureData>"; } - (OFString *)stringRepresentation |
︙ | ︙ |