{
*tfmfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
if (*tfmfd == -1)
- return -ENOENT;
+ return -ENOTSUP;
if (bind(*tfmfd, (struct sockaddr *)sa, sizeof(*sa)) == -1) {
close(*tfmfd);
return 0;
}
-static int crypt_kernel_cipher_available(void)
-{
- struct stat st;
-
- if(stat("/sys/module/algif_skcipher", &st) < 0)
- return -ENOENT;
-
- return -ENOTSUP;
-}
-
/*
*ciphers
*
- * ENOENT - no API available
- * ENOTSUP - algorithm not available
+ * ENOENT - algorithm not available
+ * ENOTSUP - AF_ALG family not available
+ * (but cannot check specificaly for skcipher API)
*/
int crypt_cipher_init(struct crypt_cipher **ctx, const char *name,
const char *mode, const void *buffer, size_t length)
r = crypt_kernel_socket_init(&sa, &h->tfmfd, &h->opfd);
if (r < 0) {
free(h);
- if (r == -ENOENT)
- return crypt_kernel_cipher_available();
return r;
}