[CRYPTO] scatterwalk: Restore custom sg chaining for now
[safe/jmp/linux-2.6] / crypto / gcm.c
index ed8a626..502da92 100644 (file)
 
 #include <crypto/algapi.h>
 #include <crypto/gf128mul.h>
+#include <crypto/scatterwalk.h>
 #include <linux/err.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/slab.h>
 
-#include "scatterwalk.h"
+#include "internal.h"
 
 struct gcm_instance_ctx {
        struct crypto_spawn ctr;
@@ -99,7 +100,7 @@ static void crypto_gcm_ghash_update_sg(struct crypto_gcm_ghash_ctx *ctx,
                n = scatterwalk_clamp(&walk, len);
 
                if (!n) {
-                       scatterwalk_start(&walk, sg_next(walk.sg));
+                       scatterwalk_start(&walk, scatterwalk_sg_next(walk.sg));
                        n = scatterwalk_clamp(&walk, len);
                }
 
@@ -327,7 +328,7 @@ static int crypto_gcm_decrypt(struct aead_request *req)
 
        scatterwalk_map_and_copy(iauth_tag, req->src, cryptlen, authsize, 0);
        if (memcmp(iauth_tag, auth_tag, authsize))
-               return -EINVAL;
+               return -EBADMSG;
 
        return crypto_ablkcipher_decrypt(&abreq);
 }