فهرست منبع

add crypt_des header for declarations shared with encrypt function

Rich Felker 6 سال پیش
والد
کامیت
7ab1578d05
3فایلهای تغییر یافته به همراه16 افزوده شده و 12 حذف شده
  1. 1 3
      src/crypt/crypt_des.c
  2. 14 0
      src/crypt/crypt_des.h
  3. 1 9
      src/crypt/encrypt.c

+ 1 - 3
src/crypt/crypt_des.c

@@ -56,9 +56,7 @@
 #include <stdint.h>
 #include <string.h>
 
-struct expanded_key {
-	uint32_t l[16], r[16];
-};
+#include "crypt_des.h"
 
 #define _PASSWORD_EFMT1 '_'
 

+ 14 - 0
src/crypt/crypt_des.h

@@ -0,0 +1,14 @@
+#ifndef CRYPT_DES_H
+#define CRYPT_DES_H
+
+#include <stdint.h>
+
+struct expanded_key {
+	uint32_t l[16], r[16];
+};
+
+void __des_setkey(const unsigned char *, struct expanded_key *);
+void __do_des(uint32_t, uint32_t, uint32_t *, uint32_t *,
+              uint32_t, uint32_t, const struct expanded_key *);
+
+#endif

+ 1 - 9
src/crypt/encrypt.c

@@ -2,15 +2,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-struct expanded_key {
-        uint32_t l[16], r[16];
-};
-
-void __des_setkey(const unsigned char *key, struct expanded_key *ekey);
-void __do_des(uint32_t l_in, uint32_t r_in,
-    uint32_t *l_out, uint32_t *r_out,
-    uint32_t count, uint32_t saltbits, const struct expanded_key *ekey);
-
+#include "crypt_des.h"
 
 static struct expanded_key __encrypt_key;