aft: Avoid invalid read.
[paraslash.git] / crypt_backend.h
index 3ea32c2045432d55ed34ad6ba1b29362b32c4d0c..b0998d8513f35303243ccd632abc3c0aa46f6377 100644 (file)
@@ -1,16 +1,19 @@
-/*
- * Copyright (C) 2011 Andre Noll <maan@systemlinux.org>
- *
- * Licensed under the GPL v2. For licencing details see COPYING.
- */
+/* Copyright (C) 2011 Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */
 
 /** \file crypt_backend.h Non-public crypto interface. */
 
-/* This should only be incuded from files which provide crypto functions. */
+/* This should only be included from files which provide crypto functions. */
 
-size_t is_ssh_rsa_key(char *data, size_t size);
-uint32_t read_ssh_u32(const void *vp);
-int uudecode(const char *src, unsigned char *target, size_t targsize);
-int check_ssh_key_header(const unsigned char *blob, int blen);
-int check_key_file(const char *file, bool private_key);
-int base64_decode(char const *src, unsigned char *target, size_t targsize);
+/** AES block size in bytes. */
+#define AES_CRT128_BLOCK_SIZE 16
+
+int decode_public_key(const char *filename, unsigned char **blob,
+               size_t *decoded_size);
+int decode_private_key(const char *key_file, unsigned char **result,
+               size_t *blob_size);
+/** Legacy PEM keys (openssh-7.7 and earlier, paraslash.0.6.2 and earlier) */
+#define PKT_PEM (0)
+/** OPENSSH keys (since openssh-7.8, paraslash.0.6.3) */
+#define PKT_OPENSSH (1)
+int check_private_key_file(const char *file);
+int find_openssh_bignum_offset(const unsigned char *data, int len);