From 887fdb7ba126f280682699d19bcc2931e9c3602d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 13 Apr 2011 14:40:27 +1000 Subject: [PATCH] s4-test: added a test for E_deshash() this particularly checks the boundary conditions near passwords of length 14 characters Pair-Programmed-With: Andrew Bartlett Autobuild-User: Andrew Tridgell Autobuild-Date: Wed Apr 13 07:31:55 CEST 2011 on sn-devel-104 --- source4/torture/auth/smbencrypt.c | 70 +++++++++++++++++++++++++++++++ source4/torture/local/local.c | 1 + source4/torture/wscript_build | 2 +- 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 source4/torture/auth/smbencrypt.c diff --git a/source4/torture/auth/smbencrypt.c b/source4/torture/auth/smbencrypt.c new file mode 100644 index 00000000000..79c90eb0561 --- /dev/null +++ b/source4/torture/auth/smbencrypt.c @@ -0,0 +1,70 @@ +/* + Unix SMB/CIFS implementation. + + tests for smbencrypt code + + Copyright (C) Andrew Tridgell 2011 + Copyright (C) Andrew Bartlett 2011 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "includes.h" +#include "libcli/auth/libcli_auth.h" +#include "torture/torture.h" +#include "torture/auth/proto.h" + +static bool torture_deshash(struct torture_context *tctx) +{ + struct { + const char *input; + uint8_t output[16]; + bool should_pass; + } testcases[] = { + { "", + { 0xAA, 0xD3, 0xB4, 0x35, 0xB5, 0x14, 0x04, 0xEE, + 0xAA, 0xD3, 0xB4, 0x35, 0xB5, 0x14, 0x04, 0xEE }, true}, + { "abcdefgh", + { 0xE0, 0xC5, 0x10, 0x19, 0x9C, 0xC6, 0x6A, 0xBD, + 0x5A, 0xCD, 0xCD, 0x7C, 0x24, 0x7F, 0xA8, 0x3A }, true}, + { "0123456789abc", + { 0x56, 0x45, 0xF1, 0x3F, 0x50, 0x08, 0x82, 0xB2, + 0x50, 0x79, 0x8A, 0xE6, 0x33, 0x38, 0xAF, 0xE9 }, true}, + { "0123456789abcd", + { 0x56, 0x45, 0xF1, 0x3F, 0x50, 0x08, 0x82, 0xB2, + 0x1A, 0xC3, 0x88, 0x4B, 0x83, 0x32, 0x45, 0x40 }, true}, + { "0123456789abcde", + { 0x56, 0x45, 0xF1, 0x3F, 0x50, 0x08, 0x82, 0xB2, + 0x1A, 0xC3, 0x88, 0x4B, 0x83, 0x32, 0x45, 0x40 }, false}, + }; + int i; + for (i=0; i