# HG changeset patch # User Olaf Wintermann # Date 1443895854 -7200 # Node ID 509e9e1cbdccce2c69a58aa01847d20d71bbb31a # Parent f21ee22170bf2e084b0b9bf1368a5857a2fa1730 implemented password key support for Solaris 10 diff -r f21ee22170bf -r 509e9e1cbdcc libidav/utils.c --- a/libidav/utils.c Sat Oct 03 19:55:43 2015 +0200 +++ b/libidav/utils.c Sat Oct 03 20:10:54 2015 +0200 @@ -49,6 +49,9 @@ #include "crypto.h" #include "webdav.h" +#ifdef __sun +#include +#endif time_t util_parse_creationdate(char *str) { // example: 2012-11-29T21:35:35Z @@ -453,14 +456,20 @@ } void util_generate_key(DavKey *key, char *password) { - //key->data = malloc(SHA256_DIGEST_LENGTH); - //key->length = SHA256_DIGEST_LENGTH; + key->data = malloc(SHA256_DIGEST_LENGTH); + key->length = SHA256_DIGEST_LENGTH; key->type = DAV_KEY_AES256; - - //SHA256_CTX sha256; - //SHA256_Init(&sha256); - //SHA256_Update(&sha256, password, strlen(password)); - //SHA256_Final(key->data, &sha256); +#ifdef __sun + SHA256_CTX sha256; + SHA256Init(&sha256); + SHA256Update(&sha256, password, strlen(password)); + SHA256Final(key->data, &sha256); +#else + SHA256_CTX sha256; + SHA256_Init(&sha256); + SHA256_Update(&sha256, password, strlen(password)); + SHA256_Final(key->data, &sha256); +#endif } char* util_key_input(DavContext *ctx, DavKey *key) { diff -r f21ee22170bf -r 509e9e1cbdcc suncc.mk --- a/suncc.mk Sat Oct 03 19:55:43 2015 +0200 +++ b/suncc.mk Sat Oct 03 20:10:54 2015 +0200 @@ -33,7 +33,7 @@ CFLAGS = -g -c -xc99 -D_REENTRANT COFLAGS = -o -LDFLAGS = +LDFLAGS = -lmd LOFLAGS = -o ARFLAGS = -r RMFLAGS = -f