]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Avoid increased alignment restriction warnings
authorRobbie Harwood <rharwood@redhat.com>
Thu, 6 Apr 2017 16:55:36 +0000 (12:55 -0400)
committerGreg Hudson <ghudson@mit.edu>
Fri, 14 Apr 2017 16:02:50 +0000 (12:02 -0400)
In kdb_log.h, cast through void * after computing the address in the
INDEX macro.

In ipropd_svc.c, use a void * instead of a char * as the generic
handler return value.

In rc4.c, cast through void * when using the cipher state data pointer
as a structure pointer.

In sha256.c and sha512.c, cast through void * when using the save
buffer as a structure pointer.  (This code may not be conformant, but
it should work in practice given the offsets of the save field in the
sha256state and sha512state structures.)

[ghudson@mit.edu: rewrote commit message]

src/include/kdb_log.h
src/kadmin/server/ipropd_svc.c
src/lib/crypto/builtin/enc_provider/rc4.c
src/lib/crypto/builtin/sha2/sha256.c
src/lib/crypto/builtin/sha2/sha512.c

index 25b823674a9fd26bb1760da120beb4ae289a07d4..4239575659a31162e6e6581700f1970159ba2849 100644 (file)
@@ -21,9 +21,8 @@ extern "C" {
 /*
  * DB macros
  */
-#define INDEX(ulog, i) (kdb_ent_header_t *)((char *)(ulog) +            \
-                                            sizeof(kdb_hlog_t) +        \
-                                            (i) * ulog->kdb_block)
+#define INDEX(ulog, i) (kdb_ent_header_t *)(void *)                     \
+    ((char *)(ulog) + sizeof(kdb_hlog_t) + (i) * ulog->kdb_block)
 
 /*
  * Current DB version #
index bce668f4221ac55194d5b891ffad0a685cdb536e..a5415b246dc683cb71796995ceba2f33539056cf 100644 (file)
@@ -532,9 +532,9 @@ krb5_iprop_prog_1(struct svc_req *rqstp,
     union {
        kdb_last_t iprop_get_updates_1_arg;
     } argument;
-    char *result;
+    void *result;
     bool_t (*_xdr_argument)(), (*_xdr_result)();
-    char *(*local)(/* union XXX *, struct svc_req * */);
+    void *(*local)(/* union XXX *, struct svc_req * */);
     char *whoami = "krb5_iprop_prog_1";
 
     if (!check_iprop_rpcsec_auth(rqstp)) {
@@ -555,19 +555,19 @@ krb5_iprop_prog_1(struct svc_req *rqstp,
     case IPROP_GET_UPDATES:
        _xdr_argument = xdr_kdb_last_t;
        _xdr_result = xdr_kdb_incr_result_t;
-       local = (char *(*)()) iprop_get_updates_1_svc;
+       local = (void *(*)()) iprop_get_updates_1_svc;
        break;
 
     case IPROP_FULL_RESYNC:
        _xdr_argument = xdr_void;
        _xdr_result = xdr_kdb_fullresync_result_t;
-       local = (char *(*)()) iprop_full_resync_1_svc;
+       local = (void *(*)()) iprop_full_resync_1_svc;
        break;
 
     case IPROP_FULL_RESYNC_EXT:
        _xdr_argument = xdr_u_int32;
        _xdr_result = xdr_kdb_fullresync_result_t;
-       local = (char *(*)()) iprop_full_resync_ext_1_svc;
+       local = (void *(*)()) iprop_full_resync_ext_1_svc;
        break;
 
     default:
index 3776f80715abb5d4f8e2f92154437ed08f736cc7..df710489eaf0aa36479bca2cf0f6ec41b0ac50f3 100644 (file)
@@ -113,7 +113,7 @@ k5_arcfour_docrypt(krb5_key key, const krb5_data *state, krb5_crypto_iov *data,
         return KRB5_BAD_MSIZE;
 
     if (state != NULL) {
-        cipher_state = (ArcFourCipherState *)state->data;
+        cipher_state = (ArcFourCipherState *)(void *)state->data;
         arcfour_ctx = &cipher_state->ctx;
         if (cipher_state->initialized == 0) {
             ret = k5_arcfour_init(arcfour_ctx, key->keyblock.contents,
index e34bed575c5fc138d8d15f3369d4af7c08a797a8..2b5cbe480503913fcf39cda043955800ed363f90 100644 (file)
@@ -211,14 +211,14 @@ k5_sha256_update(SHA256_CTX *m, const void *v, size_t len)
 #if !defined(WORDS_BIGENDIAN) || defined(_CRAY)
            int i;
            uint32_t current[16];
-           struct x32 *u = (struct x32*)m->save;
+           struct x32 *u = (struct x32*)(void*)m->save;
            for(i = 0; i < 8; i++){
                current[2*i+0] = swap_uint32_t(u[i].a);
                current[2*i+1] = swap_uint32_t(u[i].b);
            }
            calc(m, current);
 #else
-           calc(m, (uint32_t*)m->save);
+           calc(m, (uint32_t*)(void*)m->save);
 #endif
            offset = 0;
        }
index 8f0ce894033f6c439cc1d3089444d286bce058ce..6130655576c9267e0507e1494100db60b238bcd6 100644 (file)
@@ -217,14 +217,14 @@ k5_sha512_update (SHA512_CTX *m, const void *v, size_t len)
 #if !defined(WORDS_BIGENDIAN) || defined(_CRAY)
            int i;
            uint64_t current[16];
-           struct x64 *us = (struct x64*)m->save;
+           struct x64 *us = (struct x64*)(void*)m->save;
            for(i = 0; i < 8; i++){
                current[2*i+0] = swap_uint64_t(us[i].a);
                current[2*i+1] = swap_uint64_t(us[i].b);
            }
            calc(m, current);
 #else
-           calc(m, (uint64_t*)m->save);
+           calc(m, (uint64_t*)(void*)m->save);
 #endif
            offset = 0;
        }