crypto: add sanity checking of plaintext/ciphertext length

When encrypting/decrypting data, the plaintext/ciphertext
buffers are required to be a multiple of the cipher block
size. If this is not done, nettle will abort and gcrypt
will report an error. To get consistent behaviour add
explicit checks upfront for the buffer sizes.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 files changed
tree: 4a0b45548a6eb797c9c254797f065b2b5cd9b33e
  1. audio/
  2. backends/
  3. block/
  4. bsd-user/
  5. crypto/
  6. default-configs/
  7. disas/
  8. docs/
  9. fpu/
  10. fsdev/
  11. gdb-xml/
  12. hw/
  13. include/
  14. libdecnumber/
  15. linux-headers/
  16. linux-user/
  17. migration/
  18. net/
  19. pc-bios/
  20. po/
  21. qapi/
  22. qga/
  23. qobject/
  24. qom/
  25. roms/
  26. scripts/
  27. slirp/
  28. stubs/
  29. target-alpha/
  30. target-arm/
  31. target-cris/
  32. target-i386/
  33. target-lm32/
  34. target-m68k/
  35. target-microblaze/
  36. target-mips/
  37. target-moxie/
  38. target-openrisc/
  39. target-ppc/
  40. target-s390x/
  41. target-sh4/
  42. target-sparc/
  43. target-tilegx/
  44. target-tricore/
  45. target-unicore32/
  46. target-xtensa/
  47. tcg/
  48. tests/
  49. trace/
  50. ui/
  51. util/
  52. .dir-locals.el
  53. .exrc
  54. .gitignore
  55. .gitmodules
  56. .mailmap
  57. .travis.yml
  58. accel.c
  59. aio-posix.c
  60. aio-win32.c
  61. arch_init.c
  62. async.c
  63. balloon.c
  64. block.c
  65. blockdev-nbd.c
  66. blockdev.c
  67. blockjob.c
  68. bootdevice.c
  69. bt-host.c
  70. bt-vhci.c
  71. Changelog
  72. CODING_STYLE
  73. configure
  74. COPYING
  75. COPYING.LIB
  76. cpu-exec-common.c
  77. cpu-exec.c
  78. cpus.c
  79. cputlb.c
  80. device-hotplug.c
  81. device_tree.c
  82. disas.c
  83. dma-helpers.c
  84. dump.c
  85. exec.c
  86. gdbstub.c
  87. HACKING
  88. hmp-commands-info.hx
  89. hmp-commands.hx
  90. hmp.c
  91. hmp.h
  92. iohandler.c
  93. ioport.c
  94. iothread.c
  95. kvm-all.c
  96. kvm-stub.c
  97. LICENSE
  98. main-loop.c
  99. MAINTAINERS
  100. Makefile
  101. Makefile.objs
  102. Makefile.target
  103. memory.c
  104. memory_mapping.c
  105. module-common.c
  106. monitor.c
  107. nbd.c
  108. numa.c
  109. os-posix.c
  110. os-win32.c
  111. page_cache.c
  112. qapi-schema.json
  113. qdev-monitor.c
  114. qdict-test-data.txt
  115. qemu-bridge-helper.c
  116. qemu-char.c
  117. qemu-doc.texi
  118. qemu-ga.texi
  119. qemu-img-cmds.hx
  120. qemu-img.c
  121. qemu-img.texi
  122. qemu-io-cmds.c
  123. qemu-io.c
  124. qemu-log.c
  125. qemu-nbd.c
  126. qemu-nbd.texi
  127. qemu-options-wrapper.h
  128. qemu-options.h
  129. qemu-options.hx
  130. qemu-seccomp.c
  131. qemu-tech.texi
  132. qemu-timer.c
  133. qemu.nsi
  134. qemu.sasl
  135. qjson.c
  136. qmp-commands.hx
  137. qmp.c
  138. qtest.c
  139. README
  140. rules.mak
  141. softmmu_template.h
  142. spice-qemu-char.c
  143. tcg-runtime.c
  144. tci.c
  145. thread-pool.c
  146. thunk.c
  147. tpm.c
  148. trace-events
  149. translate-all.c
  150. translate-all.h
  151. translate-common.c
  152. user-exec.c
  153. VERSION
  154. version.rc
  155. vl.c
  156. xen-common-stub.c
  157. xen-common.c
  158. xen-hvm-stub.c
  159. xen-hvm.c
  160. xen-mapcache.c