summaryrefslogtreecommitdiffhomepage
path: root/libtomcrypt/src/modes/ofb
diff options
context:
space:
mode:
Diffstat (limited to 'libtomcrypt/src/modes/ofb')
-rw-r--r--libtomcrypt/src/modes/ofb/ofb_decrypt.c8
-rw-r--r--libtomcrypt/src/modes/ofb/ofb_done.c8
-rw-r--r--libtomcrypt/src/modes/ofb/ofb_encrypt.c14
-rw-r--r--libtomcrypt/src/modes/ofb/ofb_getiv.c9
-rw-r--r--libtomcrypt/src/modes/ofb/ofb_setiv.c11
-rw-r--r--libtomcrypt/src/modes/ofb/ofb_start.c8
6 files changed, 30 insertions, 28 deletions
diff --git a/libtomcrypt/src/modes/ofb/ofb_decrypt.c b/libtomcrypt/src/modes/ofb/ofb_decrypt.c
index cf5f19d..1ada1ed 100644
--- a/libtomcrypt/src/modes/ofb/ofb_decrypt.c
+++ b/libtomcrypt/src/modes/ofb/ofb_decrypt.c
@@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
*/
#include "tomcrypt.h"
@@ -15,7 +15,7 @@
OFB implementation, decrypt data, Tom St Denis
*/
-#ifdef OFB
+#ifdef LTC_OFB_MODE
/**
OFB decrypt
@@ -39,5 +39,5 @@ int ofb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s
/* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_decrypt.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2005/05/05 14:35:59 $ */
+/* $Revision: 1.5 $ */
+/* $Date: 2006/06/29 01:51:34 $ */
diff --git a/libtomcrypt/src/modes/ofb/ofb_done.c b/libtomcrypt/src/modes/ofb/ofb_done.c
index 5e114f4..50a9de2 100644
--- a/libtomcrypt/src/modes/ofb/ofb_done.c
+++ b/libtomcrypt/src/modes/ofb/ofb_done.c
@@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
*/
#include "tomcrypt.h"
@@ -15,7 +15,7 @@
OFB implementation, finish chain, Tom St Denis
*/
-#ifdef OFB
+#ifdef LTC_OFB_MODE
/** Terminate the chain
@param ofb The OFB chain to terminate
@@ -38,5 +38,5 @@ int ofb_done(symmetric_OFB *ofb)
#endif
/* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_done.c,v $ */
-/* $Revision: 1.4 $ */
-/* $Date: 2005/05/05 14:35:59 $ */
+/* $Revision: 1.6 $ */
+/* $Date: 2006/06/29 01:51:34 $ */
diff --git a/libtomcrypt/src/modes/ofb/ofb_encrypt.c b/libtomcrypt/src/modes/ofb/ofb_encrypt.c
index d66979a..2c19f1d 100644
--- a/libtomcrypt/src/modes/ofb/ofb_encrypt.c
+++ b/libtomcrypt/src/modes/ofb/ofb_encrypt.c
@@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
*/
#include "tomcrypt.h"
@@ -15,7 +15,7 @@
OFB implementation, encrypt data, Tom St Denis
*/
-#ifdef OFB
+#ifdef LTC_OFB_MODE
/**
OFB encrypt
@@ -43,10 +43,12 @@ int ofb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s
while (len-- > 0) {
if (ofb->padlen == ofb->blocklen) {
- cipher_descriptor[ofb->cipher].ecb_encrypt(ofb->IV, ofb->IV, &ofb->key);
+ if ((err = cipher_descriptor[ofb->cipher].ecb_encrypt(ofb->IV, ofb->IV, &ofb->key)) != CRYPT_OK) {
+ return err;
+ }
ofb->padlen = 0;
}
- *ct++ = *pt++ ^ ofb->IV[ofb->padlen++];
+ *ct++ = *pt++ ^ ofb->IV[(ofb->padlen)++];
}
return CRYPT_OK;
}
@@ -54,5 +56,5 @@ int ofb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s
#endif
/* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_encrypt.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2005/05/05 14:35:59 $ */
+/* $Revision: 1.7 $ */
+/* $Date: 2006/11/26 01:45:14 $ */
diff --git a/libtomcrypt/src/modes/ofb/ofb_getiv.c b/libtomcrypt/src/modes/ofb/ofb_getiv.c
index f945fff..641d14b 100644
--- a/libtomcrypt/src/modes/ofb/ofb_getiv.c
+++ b/libtomcrypt/src/modes/ofb/ofb_getiv.c
@@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
*/
#include "tomcrypt.h"
@@ -15,7 +15,7 @@
OFB implementation, get IV, Tom St Denis
*/
-#ifdef OFB
+#ifdef LTC_OFB_MODE
/**
Get the current initial vector
@@ -30,6 +30,7 @@ int ofb_getiv(unsigned char *IV, unsigned long *len, symmetric_OFB *ofb)
LTC_ARGCHK(len != NULL);
LTC_ARGCHK(ofb != NULL);
if ((unsigned long)ofb->blocklen > *len) {
+ *len = ofb->blocklen;
return CRYPT_BUFFER_OVERFLOW;
}
XMEMCPY(IV, ofb->IV, ofb->blocklen);
@@ -41,5 +42,5 @@ int ofb_getiv(unsigned char *IV, unsigned long *len, symmetric_OFB *ofb)
#endif
/* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_getiv.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2005/05/05 14:35:59 $ */
+/* $Revision: 1.6 $ */
+/* $Date: 2006/06/29 01:51:34 $ */
diff --git a/libtomcrypt/src/modes/ofb/ofb_setiv.c b/libtomcrypt/src/modes/ofb/ofb_setiv.c
index f678601..35a84e9 100644
--- a/libtomcrypt/src/modes/ofb/ofb_setiv.c
+++ b/libtomcrypt/src/modes/ofb/ofb_setiv.c
@@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
*/
#include "tomcrypt.h"
@@ -15,7 +15,7 @@
OFB implementation, set IV, Tom St Denis
*/
-#ifdef OFB
+#ifdef LTC_OFB_MODE
/**
Set an initial vector
@@ -41,13 +41,12 @@ int ofb_setiv(const unsigned char *IV, unsigned long len, symmetric_OFB *ofb)
/* force next block */
ofb->padlen = 0;
- cipher_descriptor[ofb->cipher].ecb_encrypt(IV, ofb->IV, &ofb->key);
- return CRYPT_OK;
+ return cipher_descriptor[ofb->cipher].ecb_encrypt(IV, ofb->IV, &ofb->key);
}
#endif
/* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_setiv.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2005/05/05 14:35:59 $ */
+/* $Revision: 1.6 $ */
+/* $Date: 2006/06/29 01:51:34 $ */
diff --git a/libtomcrypt/src/modes/ofb/ofb_start.c b/libtomcrypt/src/modes/ofb/ofb_start.c
index 083e381..1f0f65a 100644
--- a/libtomcrypt/src/modes/ofb/ofb_start.c
+++ b/libtomcrypt/src/modes/ofb/ofb_start.c
@@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
*/
#include "tomcrypt.h"
@@ -16,7 +16,7 @@
*/
-#ifdef OFB
+#ifdef LTC_OFB_MODE
/**
Initialize a OFB context
@@ -56,5 +56,5 @@ int ofb_start(int cipher, const unsigned char *IV, const unsigned char *key,
#endif
/* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_start.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2005/05/05 14:35:59 $ */
+/* $Revision: 1.5 $ */
+/* $Date: 2006/06/29 01:51:34 $ */