|
@@ -70,7 +70,6 @@ struct cipher_algorithm {
|
70
|
70
|
* @v src Data to encrypt
|
71
|
71
|
* @v dst Buffer for encrypted data
|
72
|
72
|
* @v len Length of data
|
73
|
|
- * @ret rc Return status code
|
74
|
73
|
*
|
75
|
74
|
* @v len is guaranteed to be a multiple of @c blocksize.
|
76
|
75
|
*/
|
|
@@ -82,7 +81,6 @@ struct cipher_algorithm {
|
82
|
81
|
* @v src Data to decrypt
|
83
|
82
|
* @v dst Buffer for decrypted data
|
84
|
83
|
* @v len Length of data
|
85
|
|
- * @ret rc Return status code
|
86
|
84
|
*
|
87
|
85
|
* @v len is guaranteed to be a multiple of @c blocksize.
|
88
|
86
|
*/
|
|
@@ -123,17 +121,30 @@ static inline void cipher_setiv ( struct cipher_algorithm *cipher,
|
123
|
121
|
cipher->setiv ( ctx, iv );
|
124
|
122
|
}
|
125
|
123
|
|
|
124
|
+static inline void cipher_encrypt ( struct cipher_algorithm *cipher,
|
|
125
|
+ void *ctx, const void *src, void *dst,
|
|
126
|
+ size_t len ) {
|
|
127
|
+ cipher->encrypt ( ctx, src, dst, len );
|
|
128
|
+}
|
|
129
|
+#define cipher_encrypt( cipher, ctx, src, dst, len ) do { \
|
|
130
|
+ assert ( ( len & ( (cipher)->blocksize - 1 ) ) == 0 ); \
|
|
131
|
+ cipher_encrypt ( (cipher), (ctx), (src), (dst), (len) ); \
|
|
132
|
+ } while ( 0 )
|
|
133
|
+
|
|
134
|
+static inline void cipher_decrypt ( struct cipher_algorithm *cipher,
|
|
135
|
+ void *ctx, const void *src, void *dst,
|
|
136
|
+ size_t len ) {
|
|
137
|
+ cipher->decrypt ( ctx, src, dst, len );
|
|
138
|
+}
|
|
139
|
+#define cipher_decrypt( cipher, ctx, src, dst, len ) do { \
|
|
140
|
+ assert ( ( len & ( (cipher)->blocksize - 1 ) ) == 0 ); \
|
|
141
|
+ cipher_decrypt ( (cipher), (ctx), (src), (dst), (len) ); \
|
|
142
|
+ } while ( 0 )
|
|
143
|
+
|
126
|
144
|
static inline int is_stream_cipher ( struct cipher_algorithm *cipher ) {
|
127
|
145
|
return ( cipher->blocksize == 1 );
|
128
|
146
|
}
|
129
|
147
|
|
130
|
|
-extern int cipher_encrypt ( struct cipher_algorithm *cipher,
|
131
|
|
- void *ctx, const void *src, void *dst,
|
132
|
|
- size_t len );
|
133
|
|
-extern int cipher_decrypt ( struct cipher_algorithm *cipher,
|
134
|
|
- void *ctx, const void *src, void *dst,
|
135
|
|
- size_t len );
|
136
|
|
-
|
137
|
148
|
extern struct digest_algorithm digest_null;
|
138
|
149
|
extern struct cipher_algorithm cipher_null;
|
139
|
150
|
extern struct pubkey_algorithm pubkey_null;
|