libidav/crypto.h

changeset 150
37fb12574acd
parent 75
56962faf2b42
child 183
c238e0017257
--- a/libidav/crypto.h	Sat Oct 03 20:10:54 2015 +0200
+++ b/libidav/crypto.h	Sun Oct 04 15:57:40 2015 +0200
@@ -33,12 +33,19 @@
 #include <openssl/evp.h>
 #include <ucx/string.h>
 
+#ifdef __sun
+#include <sha2.h>
+#else
+#include <openssl/sha.h>
+#endif
+
 #ifdef	__cplusplus
 extern "C" {
 #endif
 
 typedef struct {
     EVP_CIPHER_CTX ctx;
+    SHA256_CTX     sha256;
     void           *stream;
     dav_write_func write;
     DavKey         *key;
@@ -49,6 +56,7 @@
 
 typedef struct {
     EVP_CIPHER_CTX ctx;
+    SHA256_CTX     sha256;
     void           *iv;
     size_t         ivlen;
     void           *stream;
@@ -68,8 +76,10 @@
 size_t aes_read(void *buf, size_t s, size_t n, AESEncrypter *enc);
 void aes_encrypter_close(AESEncrypter *enc);
 
-char* aes_encrypt(char *in, DavKey *key);
-char* aes_decrypt(char *in, DavKey *key);
+char* aes_encrypt(char *in, size_t len, DavKey *key);
+char* aes_decrypt(char *in, size_t *len, DavKey *key);
+
+void dav_get_hash(SHA256_CTX *sha256, char *buf);
 
 #ifdef	__cplusplus
 }

mercurial