]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Allow encryption and decryption that are not in-place only.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 3 Jul 2010 08:37:45 +0000 (10:37 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 3 Jul 2010 08:38:15 +0000 (10:38 +0200)
lib/crypto-api.c
lib/gnutls_cipher_int.c
lib/gnutls_cipher_int.h
lib/includes/gnutls/crypto.h
lib/libgnutls.map

index cad9914132a103a10fd93b7f00a91b58d5211d10..1e61e4181b6514ce0ea1a766c2ca7a7374a18f17 100644 (file)
@@ -101,6 +101,52 @@ gnutls_cipher_decrypt (gnutls_cipher_hd_t handle, void *ciphertext,
                                 ciphertextlen);
 }
 
+/**
+ * gnutls_cipher_encrypt2:
+ * @handle: is a #gnutls_cipher_hd_t structure.
+ * @text: the data to encrypt
+ * @textlen: The length of data to encrypt
+ * @ciphertext: the encrypted data
+ * @ciphertextlen: The available length for encrypted data
+ *
+ * This function will encrypt the given data using the algorithm
+ * specified by the context.
+ *
+ * Returns: Zero or a negative value on error.
+ *
+ * Since: 2.10.0
+ **/
+int
+gnutls_cipher_encrypt2 (gnutls_cipher_hd_t handle, void *text, size_t textlen,
+  void* ciphertext, size_t ciphertextlen)
+{
+  return _gnutls_cipher_encrypt2 ((cipher_hd_st *) handle, text, textlen, 
+    ciphertext, ciphertextlen);
+}
+
+/**
+ * gnutls_cipher_decrypt2:
+ * @handle: is a #gnutls_cipher_hd_t structure.
+ * @ciphertext: the data to encrypt
+ * @ciphertextlen: The length of data to encrypt
+ * @text: the decrypted data
+ * @textlen: The available length for decrypted data
+ *
+ * This function will decrypt the given data using the algorithm
+ * specified by the context.
+ *
+ * Returns: Zero or a negative value on error.
+ *
+ * Since: 2.10.0
+ **/
+int
+gnutls_cipher_decrypt2 (gnutls_cipher_hd_t handle, const void *ciphertext,
+                      size_t ciphertextlen, void* text, size_t textlen)
+{
+  return _gnutls_cipher_decrypt2 ((cipher_hd_st *) handle, ciphertext,
+                                ciphertextlen, text, textlen);
+}
+
 /**
  * gnutls_cipher_deinit:
  * @handle: is a #gnutls_cipher_hd_t structure.
index 4a830b8c19fcf27a0c76e29567758ee48c4d577d..023e459007162e7d9c9f8f73dfdb85b7c3db09b9 100644 (file)
@@ -113,6 +113,27 @@ int _gnutls_cipher_decrypt (const cipher_hd_st * handle, void *ciphertext,
   return 0;
 }
 
+int _gnutls_cipher_encrypt2 (const cipher_hd_st * handle, const void *text, int textlen,
+  void* ciphertext, int ciphertextlen)
+{
+  if (handle != NULL && handle->handle != NULL)
+    {
+      return handle->encrypt(handle->handle, text, textlen, ciphertext, ciphertextlen);
+    }
+  return 0;
+}
+
+int _gnutls_cipher_decrypt2 (const cipher_hd_st * handle, const void *ciphertext,
+                       int ciphertextlen, void* text, int textlen)
+{
+  if (handle != NULL && handle->handle != NULL)
+    {
+      return handle->decrypt(handle->handle, ciphertext, ciphertextlen, 
+       text, textlen);
+    }
+  return 0;
+}
+
 void _gnutls_cipher_deinit (cipher_hd_st * handle)
 {
   if (handle != NULL && handle->handle != NULL)
index 81950f10fabc19686a9233ca364dcb82db88dc30..3131746a12ebc7807df0918b9b2d0f5d3d660d8f 100644 (file)
@@ -50,6 +50,10 @@ int _gnutls_cipher_encrypt (const cipher_hd_st * handle, void *text,
                            int textlen);
 int _gnutls_cipher_decrypt (const cipher_hd_st * handle, void *ciphertext,
                            int ciphertextlen);
+int _gnutls_cipher_encrypt2 (const cipher_hd_st * handle, const void *text,
+                           int textlen, void* ciphertext, int ciphertextlen);
+int _gnutls_cipher_decrypt2 (const cipher_hd_st * handle, const void *ciphertext,
+                           int ciphertextlen, void* text, int textlen);
 void _gnutls_cipher_deinit (cipher_hd_st * handle);
 
 #endif /* GNUTLS_CIPHER_INT */
index 31352dd534909a96c76d816a2c0fbdc65cc4c285..d121490f0d84b9413e4502b52493bb620e4a5ce5 100644 (file)
@@ -35,6 +35,11 @@ int gnutls_cipher_encrypt (const gnutls_cipher_hd_t handle,
                           void *text, size_t textlen);
 int gnutls_cipher_decrypt (const gnutls_cipher_hd_t handle,
                           void *ciphertext, size_t ciphertextlen);
+int gnutls_cipher_decrypt2 (gnutls_cipher_hd_t handle, const void *ciphertext,
+                      size_t ciphertextlen, void* text, size_t textlen);
+int gnutls_cipher_encrypt2 (gnutls_cipher_hd_t handle, void *text, size_t textlen,
+  void* ciphertext, size_t ciphertextlen);
+
 void gnutls_cipher_deinit (gnutls_cipher_hd_t handle);
 int gnutls_cipher_get_block_size (gnutls_cipher_algorithm_t algorithm);
 
index 47eed0cbcc3b7a374d6098e685d3ecb0c9d9d108..9b25b299e0c0e8811755763ac9c1879a1341e525 100644 (file)
@@ -681,6 +681,8 @@ GNUTLS_2_11
        gnutls_pk_bits_to_sec_param;
        gnutls_rnd;
        gnutls_x509_crq_get_preferred_hash_algorithm;
+       gnutls_cipher_encrypt2;
+       gnutls_cipher_decrypt2;
 } GNUTLS_2_10;
 
 GNUTLS_PRIVATE {