shishi-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

shishi/lib crypto-ctx.c


From: shishi-commit
Subject: shishi/lib crypto-ctx.c
Date: Tue, 23 Sep 2003 18:56:13 -0400

CVSROOT:        /cvsroot/shishi
Module name:    shishi
Branch:         
Changes by:     Simon Josefsson <address@hidden>        03/09/23 18:56:13

Modified files:
        lib            : crypto-ctx.c 

Log message:
        Fix API.
        Doc fix.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/lib/crypto-ctx.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: shishi/lib/crypto-ctx.c
diff -u shishi/lib/crypto-ctx.c:1.1 shishi/lib/crypto-ctx.c:1.2
--- shishi/lib/crypto-ctx.c:1.1 Tue Sep 23 18:31:59 2003
+++ shishi/lib/crypto-ctx.c     Tue Sep 23 18:56:13 2003
@@ -20,7 +20,6 @@
  */
 
 #include "internal.h"
-#include "crypto.h"
 
 struct Shishi_crypto
 {
@@ -32,12 +31,34 @@
   size_t ivlen;
 };
 
+/**
+ * shishi_crypto:
+ * @handle: shishi handle as allocated by shishi_init().
+ * @key: key to encrypt with.
+ * @keyusage: integer specifying what this key will encrypt/decrypt.
+ * @etype: integer specifying what cipher to use.
+ * @iv: input array with initialization vector
+ * @ivlen: size of input array with initialization vector.
+ *
+ * Initialize a crypto context.  This store a key, keyusage,
+ * encryption type and initialization vector in a "context", and the
+ * caller can then use this context to perform encryption via
+ * shishi_crypto_encrypt() and decryption via shishi_crypto_encrypt()
+ * without supplying all those details again.  The functions also
+ * takes care of propagating the IV between calls.
+ *
+ * When the application no longer need to use the context, it should
+ * deallocate resources associated with it by calling
+ * shishi_crypto_done().
+ *
+ * Return value: Return a newly allocated crypto context.
+ **/
 Shishi_crypto *
-shishi_crypto_init (Shishi * handle,
-                   Shishi_key * key,
-                   int keyusage,
-                   int32_t etype,
-                   const char * iv, size_t ivlen)
+shishi_crypto (Shishi * handle,
+              Shishi_key * key,
+              int keyusage,
+              int32_t etype,
+              const char * iv, size_t ivlen)
 {
   Shishi_crypto *ctx;
   int rc;
@@ -58,6 +79,24 @@
   return ctx;
 }
 
+/**
+ * shishi_crypto_encrypt:
+ * @ctx: crypto context as returned by shishi_crypto().
+ * @in: input array with data to encrypt.
+ * @inlen: size of input array with data to encrypt.
+ * @out: output array with newly allocated encrypted data.
+ * @outlen: output variable with size of newly allocated output array.
+ *
+ * Encrypt data, using information (e.g., key and initialization
+ * vector) from context.  The IV is updated inside the context after
+ * this call.
+ *
+ * When the application no longer need to use the context, it should
+ * deallocate resources associated with it by calling
+ * shishi_crypto_done().
+ *
+ * Return value: Returns %SHISHI_OK iff successful.
+ **/
 int
 shishi_crypto_encrypt (Shishi_crypto * ctx,
                       const char *in, size_t inlen,
@@ -82,6 +121,24 @@
   return rc;
 }
 
+/**
+ * shishi_crypto_decrypt:
+ * @ctx: crypto context as returned by shishi_crypto().
+ * @in: input array with data to decrypt.
+ * @inlen: size of input array with data to decrypt.
+ * @out: output array with newly allocated decrypted data.
+ * @outlen: output variable with size of newly allocated output array.
+ *
+ * Decrypt data, using information (e.g., key and initialization
+ * vector) from context.  The IV is updated inside the context after
+ * this call.
+ *
+ * When the application no longer need to use the context, it should
+ * deallocate resources associated with it by calling
+ * shishi_crypto_done().
+ *
+ * Return value: Returns %SHISHI_OK iff successful.
+ **/
 int
 shishi_crypto_decrypt (Shishi_crypto * ctx,
                       const char *in, size_t inlen,
@@ -106,6 +163,12 @@
   return rc;
 }
 
+/**
+ * shishi_crypto_close:
+ * @ctx: crypto context as returned by shishi_crypto().
+ *
+ * Deallocate resources associated with the crypto context.
+ **/
 void
 shishi_crypto_close (Shishi_crypto * ctx)
 {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]