git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1292 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1997-03-08 07:18:02 +00:00
parent 8538e51a32
commit e15d0f8622
2 changed files with 81 additions and 0 deletions

27
lib/krb5/checksum.c Normal file
View File

@@ -0,0 +1,27 @@
#include <krb5_locl.h>
#include <krb5_error.h>
#include "md4.h"
krb5_error_code
krb5_create_checksum (krb5_context context,
krb5_cksumtype type,
void *ptr,
size_t len,
Checksum *result)
{
struct md4 m;
if (type != CKSUMTYPE_RSA_MD4)
abort ();
result->cksumtype = CKSUMTYPE_RSA_MD4;
result->checksum.length = 16;
result->checksum.data = malloc(16);
if (result->checksum.data == NULL)
return ENOMEM;
md4_init(&m);
md4_update(&m, ptr, len);
md4_finito (&m, result->checksum.data);
return 0;
}