1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/freebl/des.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,43 @@ 1.4 +/* 1.5 + * des.h 1.6 + * 1.7 + * header file for DES-150 library 1.8 + * 1.9 + * This Source Code Form is subject to the terms of the Mozilla Public 1.10 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.11 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.12 + 1.13 +#ifndef _DES_H_ 1.14 +#define _DES_H_ 1 1.15 + 1.16 +#include "blapi.h" 1.17 + 1.18 +typedef unsigned char BYTE; 1.19 +typedef unsigned int HALF; 1.20 + 1.21 +#define HALFPTR(x) ((HALF *)(x)) 1.22 +#define SHORTPTR(x) ((unsigned short *)(x)) 1.23 +#define BYTEPTR(x) ((BYTE *)(x)) 1.24 + 1.25 +typedef enum { 1.26 + DES_ENCRYPT = 0x5555, 1.27 + DES_DECRYPT = 0xAAAA 1.28 +} DESDirection; 1.29 + 1.30 +typedef void DESFunc(struct DESContextStr *cx, BYTE *out, const BYTE *in, 1.31 + unsigned int len); 1.32 + 1.33 +struct DESContextStr { 1.34 + /* key schedule, 16 internal keys, each with 8 6-bit parts */ 1.35 + HALF ks0 [32]; 1.36 + HALF ks1 [32]; 1.37 + HALF ks2 [32]; 1.38 + HALF iv [2]; 1.39 + DESDirection direction; 1.40 + DESFunc *worker; 1.41 +}; 1.42 + 1.43 +void DES_MakeSchedule( HALF * ks, const BYTE * key, DESDirection direction); 1.44 +void DES_Do1Block( HALF * ks, const BYTE * inbuf, BYTE * outbuf); 1.45 + 1.46 +#endif