projects
/
silc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added SILC Thread Queue API
[silc.git]
/
lib
/
silccrypt
/
cast.c
diff --git
a/lib/silccrypt/cast.c
b/lib/silccrypt/cast.c
index 522078871f7b06adb4aa23aa8895a636d33f52c3..65b9f1d29ce5caa9ce9c259d4db71c9a8944427a 100644
(file)
--- a/
lib/silccrypt/cast.c
+++ b/
lib/silccrypt/cast.c
@@
-70,7
+70,7
@@
Mean: 674 cycles = 38.0 mbits/sec
/* Sets the key for the cipher. */
/* Sets the key for the cipher. */
-SILC_CIPHER_API_SET_KEY(cast)
+SILC_CIPHER_API_SET_KEY(cast
_cbc
)
{
SilcUInt32 k[8];
{
SilcUInt32 k[8];
@@
-80,9
+80,16
@@
SILC_CIPHER_API_SET_KEY(cast)
return TRUE;
}
return TRUE;
}
+/* Sets IV for the cipher. */
+
+SILC_CIPHER_API_SET_IV(cast_cbc)
+{
+
+}
+
/* Returns the size of the cipher context. */
/* Returns the size of the cipher context. */
-SILC_CIPHER_API_CONTEXT_LEN(cast)
+SILC_CIPHER_API_CONTEXT_LEN(cast
_cbc
)
{
return sizeof(CastContext);
}
{
return sizeof(CastContext);
}
@@
-90,11
+97,15
@@
SILC_CIPHER_API_CONTEXT_LEN(cast)
/* Encrypts with the cipher in CBC mode. Source and destination buffers
maybe one and same. */
/* Encrypts with the cipher in CBC mode. Source and destination buffers
maybe one and same. */
-SILC_CIPHER_API_ENCRYPT
_CBC(cast
)
+SILC_CIPHER_API_ENCRYPT
(cast_cbc
)
{
SilcUInt32 tiv[4];
int i;
{
SilcUInt32 tiv[4];
int i;
+ SILC_ASSERT((len & (16 - 1)) == 0);
+ if (len & (16 - 1))
+ return FALSE;
+
SILC_CBC_GET_IV(tiv, iv);
SILC_CBC_ENC_PRE(tiv, src);
SILC_CBC_GET_IV(tiv, iv);
SILC_CBC_ENC_PRE(tiv, src);
@@
-115,11
+126,14
@@
SILC_CIPHER_API_ENCRYPT_CBC(cast)
/* Decrypts with the cipher in CBC mode. Source and destination buffers
maybe one and same. */
/* Decrypts with the cipher in CBC mode. Source and destination buffers
maybe one and same. */
-SILC_CIPHER_API_DECRYPT
_CBC(cast
)
+SILC_CIPHER_API_DECRYPT
(cast_cbc
)
{
SilcUInt32 tmp[4], tmp2[4], tiv[4];
int i;
{
SilcUInt32 tmp[4], tmp2[4], tiv[4];
int i;
+ if (len & (16 - 1))
+ return FALSE;
+
SILC_CBC_GET_IV(tiv, iv);
SILC_CBC_DEC_PRE(tmp, src);
SILC_CBC_GET_IV(tiv, iv);
SILC_CBC_DEC_PRE(tmp, src);