Remove dead parse code.
[platform/upstream/cryptsetup.git] / lib / utils_crypt.c
1 #include <stdio.h>
2 #include <string.h>
3 #include <errno.h>
4
5 #include "utils_crypt.h"
6
7 int crypt_parse_name_and_mode(const char *s, char *cipher, char *cipher_mode)
8 {
9         if (sscanf(s, "%" MAX_CIPHER_LEN_STR "[^-]-%" MAX_CIPHER_LEN_STR "s",
10                    cipher, cipher_mode) == 2) {
11                 return 0;
12         }
13
14         if (sscanf(s, "%" MAX_CIPHER_LEN_STR "[^-]", cipher) == 1) {
15                 strncpy(cipher_mode, "cbc-plain", 9);
16                 return 0;
17         }
18
19         return -EINVAL;
20 }