mirror of
https://github.com/jakcron/nstool
synced 2024-12-25 14:11:14 +00:00
[crypto] Properly define sAesXts128Key
This commit is contained in:
parent
2ff4ea8037
commit
dec7c50cc4
1 changed files with 25 additions and 2 deletions
|
@ -42,8 +42,31 @@ namespace aes
|
||||||
|
|
||||||
struct sAesXts128Key
|
struct sAesXts128Key
|
||||||
{
|
{
|
||||||
sAes128Key key1;
|
uint8_t key[2][kAes128KeySize];
|
||||||
sAes128Key key2;
|
|
||||||
|
void set(const uint8_t key_0[kAes128KeySize], const uint8_t key_1[kAes128KeySize])
|
||||||
|
{
|
||||||
|
memcpy(this->key[0], key_0, kAes128KeySize);
|
||||||
|
memcpy(this->key[1], key_1, kAes128KeySize);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool compare(const sAesXts128Key& other) const
|
||||||
|
{
|
||||||
|
return memcmp(this->key[0], other.key[0], kAes128KeySize) == 0 && memcmp(this->key[1], other.key[1], kAes128KeySize) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator=(const sAesXts128Key& other)
|
||||||
|
{
|
||||||
|
set(other.key[0], other.key[1]);
|
||||||
|
}
|
||||||
|
bool operator==(const sAesXts128Key& other) const
|
||||||
|
{
|
||||||
|
return compare(other);
|
||||||
|
}
|
||||||
|
bool operator!=(const sAesXts128Key& other) const
|
||||||
|
{
|
||||||
|
return !compare(other);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sAesIvCtr
|
struct sAesIvCtr
|
||||||
|
|
Loading…
Reference in a new issue