/* -*-c-*-
*
- * $Id: des3.c,v 1.1 1999/09/03 08:41:11 mdw Exp $
+ * $Id: des3.c,v 1.3 2004/04/08 01:36:15 mdw Exp $
*
* Implementation of double- and triple-DES
*
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: des3.c,v $
- * Revision 1.1 1999/09/03 08:41:11 mdw
- * Initial import.
- *
- */
-
/*----- Header files ------------------------------------------------------*/
#include <assert.h>
#include "des-base.h"
#include "des.h"
#include "des3.h"
+#include "gcipher.h"
+
+/*----- Global variables --------------------------------------------------*/
+
+const octet des3_keysz[] = { KSZ_SET, 21, 7, 8, 14, 16, 24, 0 };
/*----- Main code ---------------------------------------------------------*/
* Returns: ---
*
* Use: Initializes a DES key buffer. The key buffer may have length
- * 7, 8, 14, 16, 21, or 24. These correspond to one, two or
- * three DES keys, either packed or unpacked (i.e., still
- * containing parity bits).
+ * 7, 8, 14, 16, 21, or 24. These correspond to one, two or
+ * three DES keys, either packed or unpacked (i.e., still
+ * containing parity bits).
*/
void des3_init(des3_ctx *k, const void *buf, size_t sz)
size_t step;
const octet *p = buf;
- assert(((void)("des3 key length must be one of 7, 8, 14, 16, 21 or 24"),
- (sz % 7 == 0 || sz % 8 == 0) && sz < 25));
+ KSZ_ASSERT(des3, sz);
if (sz % 7 == 0)
step = 7;