spdk_dif_generate_stream() and spdk_dif_verify_stream() are very similar. Factoring out the common part into a function will improve the maintainability and do in this patch. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I16ecd0860c75037d9182298d7513749dfe8e9b56 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458376 Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>