| OLD | NEW |
| 1 /* crypto/bf/bf_skey.c */ | 1 /* crypto/bf/bf_skey.c */ |
| 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 * |
| 5 * This package is an SSL implementation written | 5 * This package is an SSL implementation written |
| 6 * by Eric Young (eay@cryptsoft.com). | 6 * by Eric Young (eay@cryptsoft.com). |
| 7 * The implementation was written so as to conform with Netscapes SSL. | 7 * The implementation was written so as to conform with Netscapes SSL. |
| 8 * | 8 * |
| 9 * This library is free for commercial and non-commercial use as long as | 9 * This library is free for commercial and non-commercial use as long as |
| 10 * the following conditions are aheared to. The following conditions | 10 * the following conditions are aheared to. The following conditions |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 * | 52 * |
| 53 * The licence and distribution terms for any publically available version or | 53 * The licence and distribution terms for any publically available version or |
| 54 * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 * derivative of this code cannot be changed. i.e. this code cannot simply be |
| 55 * copied and put under another distribution licence | 55 * copied and put under another distribution licence |
| 56 * [including the GNU Public Licence.] | 56 * [including the GNU Public Licence.] |
| 57 */ | 57 */ |
| 58 | 58 |
| 59 #include <stdio.h> | 59 #include <stdio.h> |
| 60 #include <string.h> | 60 #include <string.h> |
| 61 #include <openssl/blowfish.h> | 61 #include <openssl/blowfish.h> |
| 62 #include <openssl/crypto.h> | |
| 63 #ifdef OPENSSL_FIPS | |
| 64 #include <openssl/fips.h> | |
| 65 #endif | |
| 66 | |
| 67 #include "bf_locl.h" | 62 #include "bf_locl.h" |
| 68 #include "bf_pi.h" | 63 #include "bf_pi.h" |
| 69 | 64 |
| 70 FIPS_NON_FIPS_VCIPHER_Init(BF) | 65 void BF_set_key(BF_KEY *key, int len, const unsigned char *data) |
| 71 { | 66 { |
| 72 int i; | 67 int i; |
| 73 BF_LONG *p,ri,in[2]; | 68 BF_LONG *p,ri,in[2]; |
| 74 const unsigned char *d,*end; | 69 const unsigned char *d,*end; |
| 75 | 70 |
| 76 | 71 |
| 77 memcpy(key,&bf_init,sizeof(BF_KEY)); | 72 memcpy(key,&bf_init,sizeof(BF_KEY)); |
| 78 p=key->P; | 73 p=key->P; |
| 79 | 74 |
| 80 if (len > ((BF_ROUNDS+2)*4)) len=(BF_ROUNDS+2)*4; | 75 if (len > ((BF_ROUNDS+2)*4)) len=(BF_ROUNDS+2)*4; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 107 |
| 113 p=key->S; | 108 p=key->S; |
| 114 for (i=0; i<4*256; i+=2) | 109 for (i=0; i<4*256; i+=2) |
| 115 { | 110 { |
| 116 BF_encrypt(in,key); | 111 BF_encrypt(in,key); |
| 117 p[i ]=in[0]; | 112 p[i ]=in[0]; |
| 118 p[i+1]=in[1]; | 113 p[i+1]=in[1]; |
| 119 } | 114 } |
| 120 } | 115 } |
| 121 | 116 |
| OLD | NEW |