diff options
| author | Steve Langasek <steve.langasek@canonical.com> | 2014-10-06 17:17:33 -0700 |
|---|---|---|
| committer | Steve Langasek <steve.langasek@canonical.com> | 2014-10-06 17:17:33 -0700 |
| commit | 59945b252e76a601fc6bbf43fb49f8a8f0d0c9a9 (patch) | |
| tree | 70e8a684bf6b3480abf1504e7befb1f8f955d962 /Cryptlib/Cipher/CryptTdes.c | |
| parent | 5fc0e7f624b64f40d5d4694e35f8c967a7317902 (diff) | |
| parent | 72bb39c0237f8bcc3afa8b623e8b097eec6d69cd (diff) | |
| download | efi-boot-shim-59945b252e76a601fc6bbf43fb49f8a8f0d0c9a9.tar.gz efi-boot-shim-59945b252e76a601fc6bbf43fb49f8a8f0d0c9a9.zip | |
Merge upstream version 0.7
Diffstat (limited to 'Cryptlib/Cipher/CryptTdes.c')
| -rw-r--r-- | Cryptlib/Cipher/CryptTdes.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/Cryptlib/Cipher/CryptTdes.c b/Cryptlib/Cipher/CryptTdes.c index 8213718b..f89094a5 100644 --- a/Cryptlib/Cipher/CryptTdes.c +++ b/Cryptlib/Cipher/CryptTdes.c @@ -37,7 +37,7 @@ TdesGetContextSize ( Initializes user-supplied memory as TDES context for subsequent use.
This function initializes user-supplied memory pointed by TdesContext as TDES context.
- In addtion, it sets up all TDES key materials for subsequent encryption and decryption
+ In addition, it sets up all TDES key materials for subsequent encryption and decryption
operations.
There are 3 key options as follows:
KeyLength = 64, Keying option 1: K1 == K2 == K3 (Backward compatibility with DES)
@@ -76,9 +76,9 @@ TdesInit ( KeySchedule = (DES_key_schedule *) TdesContext;
//
- //
+ // If input Key is a weak key, return error.
//
- if (DES_is_weak_key ((const_DES_cblock *) Key)) {
+ if (DES_is_weak_key ((const_DES_cblock *) Key) == 1) {
return FALSE;
}
@@ -90,7 +90,7 @@ TdesInit ( return TRUE;
}
- if (DES_is_weak_key ((const_DES_cblock *) Key + 8)) {
+ if (DES_is_weak_key ((const_DES_cblock *) Key + 8) == 1) {
return FALSE;
}
@@ -101,7 +101,7 @@ TdesInit ( return TRUE;
}
- if (DES_is_weak_key ((const_DES_cblock *) Key + 16)) {
+ if (DES_is_weak_key ((const_DES_cblock *) Key + 16) == 1) {
return FALSE;
}
@@ -275,7 +275,11 @@ TdesCbcEncrypt ( //
// Check input parameters.
//
- if (TdesContext == NULL || Input == NULL || (InputSize % TDES_BLOCK_SIZE) != 0 || Ivec == NULL || Output == NULL) {
+ if (TdesContext == NULL || Input == NULL || (InputSize % TDES_BLOCK_SIZE) != 0) {
+ return FALSE;
+ }
+
+ if (Ivec == NULL || Output == NULL || InputSize > INT_MAX) {
return FALSE;
}
@@ -339,7 +343,11 @@ TdesCbcDecrypt ( //
// Check input parameters.
//
- if (TdesContext == NULL || Input == NULL || (InputSize % TDES_BLOCK_SIZE) != 0 || Ivec == NULL || Output == NULL) {
+ if (TdesContext == NULL || Input == NULL || (InputSize % TDES_BLOCK_SIZE) != 0) {
+ return FALSE;
+ }
+
+ if (Ivec == NULL || Output == NULL || InputSize > INT_MAX) {
return FALSE;
}
|
