]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: remove unused virStorageGenerateQcowPassphrase
authorPavel Hrdina <phrdina@redhat.com>
Tue, 1 Dec 2020 15:36:44 +0000 (16:36 +0100)
committerPavel Hrdina <phrdina@redhat.com>
Wed, 6 Jan 2021 12:15:16 +0000 (13:15 +0100)
The last user was removed by commit
<40f0e0348dfc84f28a500e262c4953b0d3b44fa0>.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/libvirt_private.syms
src/util/virstorageencryption.c
src/util/virstorageencryption.h

index 583fc5800edb4d60fa4e541dbc0b1e0c3d9ca53b..d7714361d328b168637ebf5689b89e0df135b88d 100644 (file)
@@ -3118,7 +3118,6 @@ virSocketAddrSetPort;
 virStorageEncryptionFormat;
 virStorageEncryptionFree;
 virStorageEncryptionParseNode;
-virStorageGenerateQcowPassphrase;
 
 
 # util/virstoragefile.h
index a330b796375a1151342ec21f048e7d1800437992..c893f0babe002416f11b69bb64c89e7fb8eb309f 100644 (file)
@@ -364,37 +364,3 @@ virStorageEncryptionFormat(virBufferPtr buf,
 
     return 0;
 }
-
-int
-virStorageGenerateQcowPassphrase(unsigned char *dest)
-{
-    int fd;
-    size_t i;
-
-    /* A qcow passphrase is up to 16 bytes, with any data following a NUL
-       ignored.  Prohibit control and non-ASCII characters to avoid possible
-       unpleasant surprises with the qemu monitor input mechanism. */
-    fd = open("/dev/urandom", O_RDONLY);
-    if (fd < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Cannot open /dev/urandom"));
-        return -1;
-    }
-    i = 0;
-    while (i < VIR_STORAGE_QCOW_PASSPHRASE_SIZE) {
-        ssize_t r;
-
-        while ((r = read(fd, dest + i, 1)) == -1 && errno == EINTR)
-            ;
-        if (r <= 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Cannot read from /dev/urandom"));
-            VIR_FORCE_CLOSE(fd);
-            return -1;
-        }
-        if (dest[i] >= 0x20 && dest[i] <= 0x7E)
-            i++; /* Got an acceptable character */
-    }
-    VIR_FORCE_CLOSE(fd);
-    return 0;
-}
index 05a7bffdfc6fe1c8771939d0d0906ad7f79c5ca6..352dd373d6ca8be231df50a7be4802117bdfd08a 100644 (file)
@@ -90,5 +90,3 @@ int virStorageEncryptionFormat(virBufferPtr buf,
 enum {
   VIR_STORAGE_QCOW_PASSPHRASE_SIZE = 16
 };
-
-int virStorageGenerateQcowPassphrase(unsigned char *dest);