use hex encoder from roken
AES is enabled by default, remove ifdefs git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14653 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||||
|
|
||||||
#include "krb5_locl.h"
|
#include "krb5_locl.h"
|
||||||
|
#include <hex.h>
|
||||||
|
|
||||||
#ifdef HAVE_OPENSSL
|
#ifdef HAVE_OPENSSL
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
@@ -43,19 +44,11 @@ static int verbose = 0;
|
|||||||
static void
|
static void
|
||||||
hex_dump_data(krb5_data *data)
|
hex_dump_data(krb5_data *data)
|
||||||
{
|
{
|
||||||
unsigned char *p = data->data;
|
char *p;
|
||||||
int i, j;
|
|
||||||
|
|
||||||
for (i = j = 0; i < data->length; i++) {
|
hex_encode(data->data, data->length, &p);
|
||||||
printf("%02x ", p[i]);
|
printf("%s\n", p);
|
||||||
if (j > 15) {
|
free(p);
|
||||||
printf("\n");
|
|
||||||
j = 0;
|
|
||||||
} else
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
if (j != 0)
|
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@@ -68,7 +61,6 @@ struct {
|
|||||||
char *pbkdf2;
|
char *pbkdf2;
|
||||||
char *key;
|
char *key;
|
||||||
} keys[] = {
|
} keys[] = {
|
||||||
#ifdef ENABLE_AES
|
|
||||||
{
|
{
|
||||||
"password", "ATHENA.MIT.EDUraeburn", -1,
|
"password", "ATHENA.MIT.EDUraeburn", -1,
|
||||||
1,
|
1,
|
||||||
@@ -186,7 +178,6 @@ struct {
|
|||||||
"\x4b\x6d\x98\x39\xf8\x44\x06\xdf\x1f\x09\xcc\x16\x6d\xb4\xb8\x3c"
|
"\x4b\x6d\x98\x39\xf8\x44\x06\xdf\x1f\x09\xcc\x16\x6d\xb4\xb8\x3c"
|
||||||
"\x57\x18\x48\xb7\x84\xa3\xd6\xbd\xc3\x46\x58\x9a\x3e\x39\x3f\x9e"
|
"\x57\x18\x48\xb7\x84\xa3\xd6\xbd\xc3\x46\x58\x9a\x3e\x39\x3f\x9e"
|
||||||
},
|
},
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
"foo", "", -1,
|
"foo", "", -1,
|
||||||
0,
|
0,
|
||||||
@@ -229,7 +220,6 @@ string_to_key_test(krb5_context context)
|
|||||||
opaque.length = sizeof(iter);
|
opaque.length = sizeof(iter);
|
||||||
_krb5_put_int(iter, keys[i].iterations, 4);
|
_krb5_put_int(iter, keys[i].iterations, 4);
|
||||||
|
|
||||||
#ifdef ENABLE_AES
|
|
||||||
if (keys[i].pbkdf2) {
|
if (keys[i].pbkdf2) {
|
||||||
#ifdef HAVE_OPENSSL
|
#ifdef HAVE_OPENSSL
|
||||||
char keyout[32];
|
char keyout[32];
|
||||||
@@ -279,7 +269,6 @@ string_to_key_test(krb5_context context)
|
|||||||
|
|
||||||
krb5_free_keyblock_contents(context, &key);
|
krb5_free_keyblock_contents(context, &key);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
ret = krb5_string_to_key_data_salt_opaque (context, keys[i].enctype,
|
ret = krb5_string_to_key_data_salt_opaque (context, keys[i].enctype,
|
||||||
password, salt, opaque,
|
password, salt, opaque,
|
||||||
@@ -312,8 +301,6 @@ string_to_key_test(krb5_context context)
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_AES
|
|
||||||
|
|
||||||
struct enc_test {
|
struct enc_test {
|
||||||
size_t len;
|
size_t len;
|
||||||
char *input;
|
char *input;
|
||||||
@@ -597,9 +584,6 @@ encryption_test(krb5_context context, char *key, int keylen,
|
|||||||
return failed;
|
return failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ENABLE_AES */
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
krb_enc(krb5_context context,
|
krb_enc(krb5_context context,
|
||||||
krb5_crypto crypto,
|
krb5_crypto crypto,
|
||||||
@@ -688,7 +672,6 @@ struct {
|
|||||||
size_t plen;
|
size_t plen;
|
||||||
void *pdata;
|
void *pdata;
|
||||||
} krbencs[] = {
|
} krbencs[] = {
|
||||||
#ifdef ENABLE_AES
|
|
||||||
{
|
{
|
||||||
ETYPE_AES256_CTS_HMAC_SHA1_96,
|
ETYPE_AES256_CTS_HMAC_SHA1_96,
|
||||||
7,
|
7,
|
||||||
@@ -702,7 +685,6 @@ struct {
|
|||||||
16,
|
16,
|
||||||
"\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x74\x65\x73\x74\x2e\x0a"
|
"\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x74\x65\x73\x74\x2e\x0a"
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -800,12 +782,10 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
val |= string_to_key_test(context);
|
val |= string_to_key_test(context);
|
||||||
|
|
||||||
#ifdef ENABLE_AES
|
|
||||||
val |= encryption_test(context, aes_key1, 128,
|
val |= encryption_test(context, aes_key1, 128,
|
||||||
encs1, sizeof(encs1)/sizeof(encs1[0]));
|
encs1, sizeof(encs1)/sizeof(encs1[0]));
|
||||||
val |= encryption_test(context, aes_key2, 256,
|
val |= encryption_test(context, aes_key2, 256,
|
||||||
encs2, sizeof(encs2)/sizeof(encs2[0]));
|
encs2, sizeof(encs2)/sizeof(encs2[0]));
|
||||||
#endif
|
|
||||||
val |= krb_enc_test(context);
|
val |= krb_enc_test(context);
|
||||||
val |= random_to_key(context);
|
val |= random_to_key(context);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user