summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/des/set_key.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/des/set_key.c')
-rw-r--r--src/lib/libcrypto/des/set_key.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/lib/libcrypto/des/set_key.c b/src/lib/libcrypto/des/set_key.c
index 3004cc3ab3..c0806d593c 100644
--- a/src/lib/libcrypto/des/set_key.c
+++ b/src/lib/libcrypto/des/set_key.c
@@ -64,8 +64,12 @@
64 * 1.0 First working version 64 * 1.0 First working version
65 */ 65 */
66#include "des_locl.h" 66#include "des_locl.h"
67#ifdef OPENSSL_FIPS
68#include <openssl/fips.h>
69#endif
70
67 71
68OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key,0) /* defaults to false */ 72OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key); /* defaults to false */
69 73
70static const unsigned char odd_parity[256]={ 74static const unsigned char odd_parity[256]={
71 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, 75 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14,
@@ -336,7 +340,7 @@ int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule)
336 340
337void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule) 341void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule)
338 { 342 {
339 static const int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0}; 343 static int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0};
340 register DES_LONG c,d,t,s,t2; 344 register DES_LONG c,d,t,s,t2;
341 register const unsigned char *in; 345 register const unsigned char *in;
342 register DES_LONG *k; 346 register DES_LONG *k;
@@ -349,6 +353,10 @@ void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule)
349 k = &schedule->ks->deslong[0]; 353 k = &schedule->ks->deslong[0];
350 in = &(*key)[0]; 354 in = &(*key)[0];
351 355
356#ifdef OPENSSL_FIPS
357 FIPS_selftest_check();
358#endif
359
352 c2l(in,c); 360 c2l(in,c);
353 c2l(in,d); 361 c2l(in,d);
354 362
@@ -405,3 +413,4 @@ void des_fixup_key_parity(des_cblock *key)
405 des_set_odd_parity(key); 413 des_set_odd_parity(key);
406 } 414 }
407*/ 415*/
416