Browse Source

Added setiv method

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
0d07657296
1 changed files with 16 additions and 0 deletions
  1. 16
    0
      src/include/gpxe/crypto.h

+ 16
- 0
src/include/gpxe/crypto.h View File

@@ -34,6 +34,12 @@ struct crypto_algorithm {
34 34
 	 * @ret rc		Return status code
35 35
 	 */
36 36
 	int ( * setkey ) ( void *ctx, void *key, size_t keylen );
37
+	/** Set initialisation vector
38
+	 *
39
+	 * @v ctx		Context
40
+	 * @v iv		Initialisation vector
41
+	 */
42
+	void ( *setiv ) ( void *ctx, void *iv );
37 43
 	/** Encode data
38 44
 	 *
39 45
 	 * @v ctx		Context
@@ -85,6 +91,16 @@ static inline void digest_final ( struct crypto_algorithm *crypto,
85 91
 	crypto->final ( ctx, out );
86 92
 }
87 93
 
94
+static inline void cipher_setiv ( struct crypto_algorithm *crypto,
95
+				 void *ctx, void *iv ) {
96
+	crypto->setiv ( ctx, iv );
97
+}
98
+
99
+static inline int cipher_setkey ( struct crypto_algorithm *crypto,
100
+				  void *ctx, void *key, size_t keylen ) {
101
+	return crypto->setkey ( ctx, key, keylen );
102
+}
103
+
88 104
 static inline int cipher_encrypt ( struct crypto_algorithm *crypto,
89 105
 				   void *ctx, const void *src, void *dst,
90 106
 				   size_t len ) {

Loading…
Cancel
Save