Просмотр исходного кода

Remove const warnings in crypto.c.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1826 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 17 лет назад
Родитель
Сommit
bb87034524
2 измененных файлов с 6 добавлено и 6 удалено
  1. 4 4
      exec/crypto.c
  2. 2 2
      exec/crypto.h

+ 4 - 4
exec/crypto.c

@@ -682,7 +682,7 @@ const struct _prng_descriptor *prng_descriptor[] = {
 
 #define B(x,i) ((unsigned char)(((x) >> (8*i)) & 0xFF))
 
-static ulong32 BYTE2WORD(unsigned char *b)
+static ulong32 BYTE2WORD(const unsigned char *b)
 {
    ulong32 t;
    LOAD32L(t, b);
@@ -845,7 +845,7 @@ int sober128_add_entropy(const unsigned char *buf, unsigned long len, prng_state
        assert ((len & 3) == 0);
     
        for (i = 0; i < len; i += 4) {
-           k = BYTE2WORD((unsigned char*)&buf[i]);
+           k = BYTE2WORD(&buf[i]);
           ADDKEY(k);
           cycle(c->R);
           XORNL(nltap(c));
@@ -870,7 +870,7 @@ int sober128_add_entropy(const unsigned char *buf, unsigned long len, prng_state
        assert ((len & 3) == 0);
     
        for (i = 0; i < len; i += 4) {
-           k = BYTE2WORD((unsigned char *)&buf[i]);
+           k = BYTE2WORD(&buf[i]);
           ADDKEY(k);
           cycle(c->R);
           XORNL(nltap(c));
@@ -987,7 +987,7 @@ const struct _hash_descriptor sha1_desc =
 #define F2(x,y,z)  ((x & y) | (z & (x | y)))
 #define F3(x,y,z)  (x ^ y ^ z)
 
-static void sha1_compress(hash_state *md, unsigned char *buf)
+static void sha1_compress(hash_state *md, const unsigned char *buf)
 {
     ulong32 a,b,c,d,e,W[80],i;
 

+ 2 - 2
exec/crypto.h

@@ -52,7 +52,7 @@ typedef union Hash_state {
 } hash_state;
 
 struct _hash_descriptor {
-    char *name;
+    const char *name;
     unsigned char ID;
     unsigned long hashsize;       /* digest output size in bytes  */
     unsigned long blocksize;      /* the block size the hash uses */
@@ -106,7 +106,7 @@ typedef union Prng_state {
 } prng_state;
 
 struct _prng_descriptor {
-    char *name;
+    const char *name;
     int  export_size;    /* size in bytes of exported state */
     int (*start)(prng_state *);
     int (*add_entropy)(const unsigned char *, unsigned long, prng_state *);