diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/des/set_key.c | 24 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/des/set_key.c | 24 |
2 files changed, 20 insertions, 28 deletions
diff --git a/src/lib/libcrypto/des/set_key.c b/src/lib/libcrypto/des/set_key.c index bb8270beba..1901ecd647 100644 --- a/src/lib/libcrypto/des/set_key.c +++ b/src/lib/libcrypto/des/set_key.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: set_key.c,v 1.17 2014/06/12 15:49:28 deraadt Exp $ */ | 1 | /* $OpenBSD: set_key.c,v 1.18 2014/10/12 20:48:58 miod Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -136,20 +136,16 @@ static const DES_cblock weak_keys[NUM_WEAK_KEY]={ | |||
| 136 | {0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE}, | 136 | {0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE}, |
| 137 | {0xFE,0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1}}; | 137 | {0xFE,0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1}}; |
| 138 | 138 | ||
| 139 | int DES_is_weak_key(const_DES_cblock *key) | 139 | int |
| 140 | { | 140 | DES_is_weak_key(const_DES_cblock *key) |
| 141 | int i; | 141 | { |
| 142 | unsigned int i; | ||
| 142 | 143 | ||
| 143 | for (i=0; i<NUM_WEAK_KEY; i++) | 144 | for (i = 0; i < NUM_WEAK_KEY; i++) |
| 144 | /* Added == 0 to comparison, I obviously don't run | 145 | if (memcmp(weak_keys[i], key, sizeof(DES_cblock)) == 0) |
| 145 | * this section very often :-(, thanks to | 146 | return 1; |
| 146 | * engineering@MorningStar.Com for the fix | 147 | return 0; |
| 147 | * eay 93/06/29 | 148 | } |
| 148 | * Another problem, I was comparing only the first 4 | ||
| 149 | * bytes, 97/03/18 */ | ||
| 150 | if (memcmp(weak_keys[i],key,sizeof(DES_cblock)) == 0) return(1); | ||
| 151 | return(0); | ||
| 152 | } | ||
| 153 | 149 | ||
| 154 | /* NOW DEFINED IN des_local.h | 150 | /* NOW DEFINED IN des_local.h |
| 155 | * See ecb_encrypt.c for a pseudo description of these macros. | 151 | * See ecb_encrypt.c for a pseudo description of these macros. |
diff --git a/src/lib/libssl/src/crypto/des/set_key.c b/src/lib/libssl/src/crypto/des/set_key.c index bb8270beba..1901ecd647 100644 --- a/src/lib/libssl/src/crypto/des/set_key.c +++ b/src/lib/libssl/src/crypto/des/set_key.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: set_key.c,v 1.17 2014/06/12 15:49:28 deraadt Exp $ */ | 1 | /* $OpenBSD: set_key.c,v 1.18 2014/10/12 20:48:58 miod Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -136,20 +136,16 @@ static const DES_cblock weak_keys[NUM_WEAK_KEY]={ | |||
| 136 | {0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE}, | 136 | {0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE}, |
| 137 | {0xFE,0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1}}; | 137 | {0xFE,0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1}}; |
| 138 | 138 | ||
| 139 | int DES_is_weak_key(const_DES_cblock *key) | 139 | int |
| 140 | { | 140 | DES_is_weak_key(const_DES_cblock *key) |
| 141 | int i; | 141 | { |
| 142 | unsigned int i; | ||
| 142 | 143 | ||
| 143 | for (i=0; i<NUM_WEAK_KEY; i++) | 144 | for (i = 0; i < NUM_WEAK_KEY; i++) |
| 144 | /* Added == 0 to comparison, I obviously don't run | 145 | if (memcmp(weak_keys[i], key, sizeof(DES_cblock)) == 0) |
| 145 | * this section very often :-(, thanks to | 146 | return 1; |
| 146 | * engineering@MorningStar.Com for the fix | 147 | return 0; |
| 147 | * eay 93/06/29 | 148 | } |
| 148 | * Another problem, I was comparing only the first 4 | ||
| 149 | * bytes, 97/03/18 */ | ||
| 150 | if (memcmp(weak_keys[i],key,sizeof(DES_cblock)) == 0) return(1); | ||
| 151 | return(0); | ||
| 152 | } | ||
| 153 | 149 | ||
| 154 | /* NOW DEFINED IN des_local.h | 150 | /* NOW DEFINED IN des_local.h |
| 155 | * See ecb_encrypt.c for a pseudo description of these macros. | 151 | * See ecb_encrypt.c for a pseudo description of these macros. |
