X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fptlrpc%2Fsec_plain.c;h=10f88fab20521789e4cb5ed8358d338f215e5de1;hb=353e3c2f8d9f195c0f87a16259f22b2f84de11d4;hp=d123e30aa175f781b71ab0c58c2baf10c7d7a9a8;hpb=6d57017bcb81a8cff88fa049ab662b4c0677f625;p=fs%2Flustre-release.git diff --git a/lustre/ptlrpc/sec_plain.c b/lustre/ptlrpc/sec_plain.c index d123e30..10f88fa 100644 --- a/lustre/ptlrpc/sec_plain.c +++ b/lustre/ptlrpc/sec_plain.c @@ -270,15 +270,18 @@ int plain_ctx_verify(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req) } if (unlikely(req->rq_early)) { - cksum = crc32_le(!(__u32) 0, - lustre_msg_buf(msg, PLAIN_PACK_MSG_OFF, 0), - lustre_msg_buflen(msg, PLAIN_PACK_MSG_OFF)); - if (cksum != msg->lm_cksum) { - CDEBUG(D_SEC, - "early reply checksum mismatch: %08x != %08x\n", - cpu_to_le32(cksum), msg->lm_cksum); - RETURN(-EINVAL); - } + unsigned int hsize = 4; + + cfs_crypto_hash_digest(CFS_HASH_ALG_CRC32, + lustre_msg_buf(msg, PLAIN_PACK_MSG_OFF, 0), + lustre_msg_buflen(msg, PLAIN_PACK_MSG_OFF), + NULL, 0, (unsigned char *)&cksum, &hsize); + if (cksum != msg->lm_cksum) { + CDEBUG(D_SEC, + "early reply checksum mismatch: %08x != %08x\n", + cpu_to_le32(cksum), msg->lm_cksum); + RETURN(-EINVAL); + } } else { /* whether we sent with bulk or not, we expect the same * in reply, except for early reply */ @@ -892,10 +895,13 @@ int plain_authorize(struct ptlrpc_request *req) else req->rq_reply_off = 0; } else { - msg->lm_cksum = crc32_le(!(__u32) 0, - lustre_msg_buf(msg, PLAIN_PACK_MSG_OFF, 0), - lustre_msg_buflen(msg, PLAIN_PACK_MSG_OFF)); - req->rq_reply_off = 0; + unsigned int hsize = 4; + + cfs_crypto_hash_digest(CFS_HASH_ALG_CRC32, + lustre_msg_buf(msg, PLAIN_PACK_MSG_OFF, 0), + lustre_msg_buflen(msg, PLAIN_PACK_MSG_OFF), + NULL, 0, (unsigned char *)&msg->lm_cksum, &hsize); + req->rq_reply_off = 0; } RETURN(0);