Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1237)

Side by Side Diff: fusl/src/crypt/crypt_des.c

Issue 1706293003: [fusl] Remove some more tabs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: apptest rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fusl/src/crypt/crypt_blowfish.c ('k') | fusl/src/malloc/malloc.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This version has been further modified by Rich Felker, primary author 2 * This version has been further modified by Rich Felker, primary author
3 * and maintainer of musl libc, to remove table generation code and 3 * and maintainer of musl libc, to remove table generation code and
4 * replaced all runtime-generated constant tables with static-initialized 4 * replaced all runtime-generated constant tables with static-initialized
5 * tables in the binary, in the interest of minimizing non-shareable 5 * tables in the binary, in the interest of minimizing non-shareable
6 * memory usage and stack size requirements. 6 * memory usage and stack size requirements.
7 */ 7 */
8 /* 8 /*
9 * This version is derived from the original implementation of FreeSec 9 * This version is derived from the original implementation of FreeSec
10 * (release 1.1) by David Burren. I've made it reentrant, reduced its memory 10 * (release 1.1) by David Burren. I've made it reentrant, reduced its memory
(...skipping 28 matching lines...) Expand all
39 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 39 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
40 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 40 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
41 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 41 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
42 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 42 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
43 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 43 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
45 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 45 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
46 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 46 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47 * SUCH DAMAGE. 47 * SUCH DAMAGE.
48 * 48 *
49 *» $Owl: Owl/packages/glibc/crypt_freesec.c,v 1.6 2010/02/20 14:45:06 solar 49 * $Owl: Owl/packages/glibc/crypt_freesec.c,v 1.6 2010/02/20 14:45:06 solar
50 *Exp $ 50 *Exp $
51 *» $Id: crypt.c,v 1.15 1994/09/13 04:58:49 davidb Exp $ 51 * $Id: crypt.c,v 1.15 1994/09/13 04:58:49 davidb Exp $
52 * 52 *
53 * This is an original implementation of the DES and the crypt(3) interfaces 53 * This is an original implementation of the DES and the crypt(3) interfaces
54 * by David Burren. It has been heavily re-worked by Solar Designer. 54 * by David Burren. It has been heavily re-worked by Solar Designer.
55 */ 55 */
56 56
57 #include <stdint.h> 57 #include <stdint.h>
58 #include <string.h> 58 #include <string.h>
59 59
60 struct expanded_key { 60 struct expanded_key {
61 uint32_t l[16], r[16]; 61 uint32_t l[16], r[16];
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 while (q <= &keybuf[sizeof(keybuf) - 1]) { 837 while (q <= &keybuf[sizeof(keybuf) - 1]) {
838 *q++ = *key << 1; 838 *q++ = *key << 1;
839 if (*key) 839 if (*key)
840 key++; 840 key++;
841 } 841 }
842 __des_setkey(keybuf, &ekey); 842 __des_setkey(keybuf, &ekey);
843 843
844 if (*setting == _PASSWORD_EFMT1) { 844 if (*setting == _PASSWORD_EFMT1) {
845 /* 845 /*
846 * "new"-style: 846 * "new"-style:
847 *» setting - underscore, 4 chars of count, 4 chars of salt 847 * setting - underscore, 4 chars of count, 4 chars of salt
848 *» key - unlimited characters 848 * key - unlimited characters
849 */ 849 */
850 for (i = 1, count = 0; i < 5; i++) { 850 for (i = 1, count = 0; i < 5; i++) {
851 uint32_t value = ascii_to_bin(setting[i]); 851 uint32_t value = ascii_to_bin(setting[i]);
852 if (ascii64[value] != setting[i]) 852 if (ascii64[value] != setting[i])
853 return NULL; 853 return NULL;
854 count |= value << (i - 1) * 6; 854 count |= value << (i - 1) * 6;
855 } 855 }
856 if (!count) 856 if (!count)
857 return NULL; 857 return NULL;
858 858
(...skipping 17 matching lines...) Expand all
876 *q++ ^= *key++ << 1; 876 *q++ ^= *key++ << 1;
877 __des_setkey(keybuf, &ekey); 877 __des_setkey(keybuf, &ekey);
878 } 878 }
879 879
880 memcpy(output, setting, 9); 880 memcpy(output, setting, 9);
881 output[9] = '\0'; 881 output[9] = '\0';
882 p = (unsigned char*)output + 9; 882 p = (unsigned char*)output + 9;
883 } else { 883 } else {
884 /* 884 /*
885 * "old"-style: 885 * "old"-style:
886 *» setting - 2 chars of salt 886 * setting - 2 chars of salt
887 *» key - up to 8 characters 887 * key - up to 8 characters
888 */ 888 */
889 count = 25; 889 count = 25;
890 890
891 if (ascii_is_unsafe(setting[0]) || ascii_is_unsafe(setting[1])) 891 if (ascii_is_unsafe(setting[0]) || ascii_is_unsafe(setting[1]))
892 return NULL; 892 return NULL;
893 893
894 salt = (ascii_to_bin(setting[1]) << 6) | ascii_to_bin(setting[0]); 894 salt = (ascii_to_bin(setting[1]) << 6) | ascii_to_bin(setting[0]);
895 895
896 output[0] = setting[0]; 896 output[0] = setting[0];
897 output[1] = setting[1]; 897 output[1] = setting[1];
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 * use the same stack locations, which makes the second call overwrite 953 * use the same stack locations, which makes the second call overwrite
954 * the first call's sensitive data on the stack and makes it more 954 * the first call's sensitive data on the stack and makes it more
955 * likely that any alignment related issues would be detected. 955 * likely that any alignment related issues would be detected.
956 */ 956 */
957 p = _crypt_extended_r_uut(test_key, test_setting, test_buf); 957 p = _crypt_extended_r_uut(test_key, test_setting, test_buf);
958 if (p && !strcmp(p, test_hash) && retval) 958 if (p && !strcmp(p, test_hash) && retval)
959 return retval; 959 return retval;
960 960
961 return (setting[0] == '*') ? "x" : "*"; 961 return (setting[0] == '*') ? "x" : "*";
962 } 962 }
OLDNEW
« no previous file with comments | « fusl/src/crypt/crypt_blowfish.c ('k') | fusl/src/malloc/malloc.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698