#include "inner.h"
-#define CTX ((br_pem_decoder_context *)((unsigned char *)t0ctx - offsetof(br_pem_decoder_context, cpu)))
+#define CTX ((br_pem_decoder_context *)(void *)((unsigned char *)t0ctx - offsetof(br_pem_decoder_context, cpu)))
/* see bearssl_pem.h */
void
#include "inner.h"
-#define CTX ((br_pem_decoder_context *)((unsigned char *)t0ctx - offsetof(br_pem_decoder_context, cpu)))
+#define CTX ((br_pem_decoder_context *)(void *)((unsigned char *)t0ctx - offsetof(br_pem_decoder_context, cpu)))
/* see bearssl_pem.h */
void
/*
* This macro evaluates to a pointer to the current engine context.
*/
-#define ENG ((br_ssl_engine_context *)((unsigned char *)t0ctx - offsetof(br_ssl_engine_context, cpu)))
+#define ENG ((br_ssl_engine_context *)(void *)((unsigned char *)t0ctx - offsetof(br_ssl_engine_context, cpu)))
/* get16 */
size_t addr = (size_t)T0_POP();
- T0_PUSH(*(uint16_t *)((unsigned char *)ENG + addr));
+ T0_PUSH(*(uint16_t *)(void *)((unsigned char *)ENG + addr));
}
break;
/* get32 */
size_t addr = (size_t)T0_POP();
- T0_PUSH(*(uint32_t *)((unsigned char *)ENG + addr));
+ T0_PUSH(*(uint32_t *)(void *)((unsigned char *)ENG + addr));
}
break;
/* set16 */
size_t addr = (size_t)T0_POP();
- *(uint16_t *)((unsigned char *)ENG + addr) = (uint16_t)T0_POP();
+ *(uint16_t *)(void *)((unsigned char *)ENG + addr) = (uint16_t)T0_POP();
}
break;
/* set32 */
size_t addr = (size_t)T0_POP();
- *(uint32_t *)((unsigned char *)ENG + addr) = (uint32_t)T0_POP();
+ *(uint32_t *)(void *)((unsigned char *)ENG + addr) = (uint32_t)T0_POP();
}
break;
/*
* This macro evaluates to a pointer to the current engine context.
*/
-#define ENG ((br_ssl_engine_context *)((unsigned char *)t0ctx - offsetof(br_ssl_engine_context, cpu)))
+#define ENG ((br_ssl_engine_context *)(void *)((unsigned char *)t0ctx - offsetof(br_ssl_engine_context, cpu)))
}
\ Read a 16-bit word from the context (address is offset in context).
cc: get16 ( addr -- val ) {
size_t addr = (size_t)T0_POP();
- T0_PUSH(*(uint16_t *)((unsigned char *)ENG + addr));
+ T0_PUSH(*(uint16_t *)(void *)((unsigned char *)ENG + addr));
}
\ Read a 32-bit word from the context (address is offset in context).
cc: get32 ( addr -- val ) {
size_t addr = (size_t)T0_POP();
- T0_PUSH(*(uint32_t *)((unsigned char *)ENG + addr));
+ T0_PUSH(*(uint32_t *)(void *)((unsigned char *)ENG + addr));
}
\ Set a byte in the context (address is offset in context).
\ Set a 16-bit word in the context (address is offset in context).
cc: set16 ( val addr -- ) {
size_t addr = (size_t)T0_POP();
- *(uint16_t *)((unsigned char *)ENG + addr) = (uint16_t)T0_POP();
+ *(uint16_t *)(void *)((unsigned char *)ENG + addr) = (uint16_t)T0_POP();
}
\ Set a 32-bit word in the context (address is offset in context).
cc: set32 ( val addr -- ) {
size_t addr = (size_t)T0_POP();
- *(uint32_t *)((unsigned char *)ENG + addr) = (uint32_t)T0_POP();
+ *(uint32_t *)(void *)((unsigned char *)ENG + addr) = (uint32_t)T0_POP();
}
\ Define a word that evaluates as an address of a field within the
/*
* This macro evaluates to a pointer to the current engine context.
*/
-#define ENG ((br_ssl_engine_context *)((unsigned char *)t0ctx - offsetof(br_ssl_engine_context, cpu)))
+#define ENG ((br_ssl_engine_context *)(void *)((unsigned char *)t0ctx - offsetof(br_ssl_engine_context, cpu)))
/* get16 */
size_t addr = (size_t)T0_POP();
- T0_PUSH(*(uint16_t *)((unsigned char *)ENG + addr));
+ T0_PUSH(*(uint16_t *)(void *)((unsigned char *)ENG + addr));
}
break;
/* get32 */
size_t addr = (size_t)T0_POP();
- T0_PUSH(*(uint32_t *)((unsigned char *)ENG + addr));
+ T0_PUSH(*(uint32_t *)(void *)((unsigned char *)ENG + addr));
}
break;
/* set16 */
size_t addr = (size_t)T0_POP();
- *(uint16_t *)((unsigned char *)ENG + addr) = (uint16_t)T0_POP();
+ *(uint16_t *)(void *)((unsigned char *)ENG + addr) = (uint16_t)T0_POP();
}
break;
/* set32 */
size_t addr = (size_t)T0_POP();
- *(uint32_t *)((unsigned char *)ENG + addr) = (uint32_t)T0_POP();
+ *(uint32_t *)(void *)((unsigned char *)ENG + addr) = (uint32_t)T0_POP();
}
break;
cc: set16 ( val addr -- ) {
uint32_t addr = T0_POP();
- *(uint16_t *)((unsigned char *)CTX + addr) = T0_POP();
+ *(uint16_t *)(void *)((unsigned char *)CTX + addr) = T0_POP();
}
cc: set32 ( val addr -- ) {
uint32_t addr = T0_POP();
- *(uint32_t *)((unsigned char *)CTX + addr) = T0_POP();
+ *(uint32_t *)(void *)((unsigned char *)CTX + addr) = T0_POP();
}
cc: get8 ( addr -- val ) {
cc: get16 ( addr -- val ) {
uint32_t addr = T0_POP();
- T0_PUSH(*(uint16_t *)((unsigned char *)CTX + addr));
+ T0_PUSH(*(uint16_t *)(void *)((unsigned char *)CTX + addr));
}
cc: get32 ( addr -- val ) {
uint32_t addr = T0_POP();
- T0_PUSH(*(uint32_t *)((unsigned char *)CTX + addr));
+ T0_PUSH(*(uint32_t *)(void *)((unsigned char *)CTX + addr));
}
\ Read an ASN.1 tag. This function returns the "constructed" status
#include "inner.h"
-#define CTX ((br_skey_decoder_context *)((unsigned char *)t0ctx - offsetof(br_skey_decoder_context, cpu)))
+#define CTX ((br_skey_decoder_context *)(void *)((unsigned char *)t0ctx - offsetof(br_skey_decoder_context, cpu)))
#define CONTEXT_NAME br_skey_decoder_context
/* see bearssl_x509.h */
#include "inner.h"
-#define CTX ((br_skey_decoder_context *)((unsigned char *)t0ctx - offsetof(br_skey_decoder_context, cpu)))
+#define CTX ((br_skey_decoder_context *)(void *)((unsigned char *)t0ctx - offsetof(br_skey_decoder_context, cpu)))
#define CONTEXT_NAME br_skey_decoder_context
/* see bearssl_x509.h */
#include "inner.h"
-#define CTX ((br_x509_decoder_context *)((unsigned char *)t0ctx - offsetof(br_x509_decoder_context, cpu)))
+#define CTX ((br_x509_decoder_context *)(void *)((unsigned char *)t0ctx - offsetof(br_x509_decoder_context, cpu)))
#define CONTEXT_NAME br_x509_decoder_context
/* see bearssl_x509.h */
/* set32 */
uint32_t addr = T0_POP();
- *(uint32_t *)((unsigned char *)CTX + addr) = T0_POP();
+ *(uint32_t *)(void *)((unsigned char *)CTX + addr) = T0_POP();
}
break;
#include "inner.h"
-#define CTX ((br_x509_decoder_context *)((unsigned char *)t0ctx - offsetof(br_x509_decoder_context, cpu)))
+#define CTX ((br_x509_decoder_context *)(void *)((unsigned char *)t0ctx - offsetof(br_x509_decoder_context, cpu)))
#define CONTEXT_NAME br_x509_decoder_context
/* see bearssl_x509.h */
xm_get_pkey
};
-#define CTX ((br_x509_minimal_context *)((unsigned char *)t0ctx - offsetof(br_x509_minimal_context, cpu)))
+#define CTX ((br_x509_minimal_context *)(void *)((unsigned char *)t0ctx - offsetof(br_x509_minimal_context, cpu)))
#define CONTEXT_NAME br_x509_minimal_context
#define DNHASH_LEN ((CTX->dn_hash_impl->desc >> BR_HASHDESC_OUT_OFF) & BR_HASHDESC_OUT_MASK)
/* get16 */
uint32_t addr = T0_POP();
- T0_PUSH(*(uint16_t *)((unsigned char *)CTX + addr));
+ T0_PUSH(*(uint16_t *)(void *)((unsigned char *)CTX + addr));
}
break;
/* get32 */
uint32_t addr = T0_POP();
- T0_PUSH(*(uint32_t *)((unsigned char *)CTX + addr));
+ T0_PUSH(*(uint32_t *)(void *)((unsigned char *)CTX + addr));
}
break;
/* set16 */
uint32_t addr = T0_POP();
- *(uint16_t *)((unsigned char *)CTX + addr) = T0_POP();
+ *(uint16_t *)(void *)((unsigned char *)CTX + addr) = T0_POP();
}
break;
/* set32 */
uint32_t addr = T0_POP();
- *(uint32_t *)((unsigned char *)CTX + addr) = T0_POP();
+ *(uint32_t *)(void *)((unsigned char *)CTX + addr) = T0_POP();
}
break;
xm_get_pkey
};
-#define CTX ((br_x509_minimal_context *)((unsigned char *)t0ctx - offsetof(br_x509_minimal_context, cpu)))
+#define CTX ((br_x509_minimal_context *)(void *)((unsigned char *)t0ctx - offsetof(br_x509_minimal_context, cpu)))
#define CONTEXT_NAME br_x509_minimal_context
#define DNHASH_LEN ((CTX->dn_hash_impl->desc >> BR_HASHDESC_OUT_OFF) & BR_HASHDESC_OUT_MASK)
sa = (struct sockaddr *)p->ai_addr;
if (sa->sa_family == AF_INET) {
- addr = &((struct sockaddr_in *)sa)->sin_addr;
+ addr = &((struct sockaddr_in *)
+ (void *)sa)->sin_addr;
} else if (sa->sa_family == AF_INET6) {
- addr = &((struct sockaddr_in6 *)sa)->sin6_addr;
+ addr = &((struct sockaddr_in6 *)
+ (void *)sa)->sin6_addr;
} else {
addr = NULL;
}
sa = (struct sockaddr *)p->ai_addr;
if (sa->sa_family == AF_INET) {
- sa4 = *(struct sockaddr_in *)sa;
+ memcpy(&sa4, sa, sizeof sa4);
sa = (struct sockaddr *)&sa4;
sa_len = sizeof sa4;
addr = &sa4.sin_addr;
sa4.sin_addr.s_addr = INADDR_ANY;
}
} else if (sa->sa_family == AF_INET6) {
- sa6 = *(struct sockaddr_in6 *)sa;
+ memcpy(&sa6, sa, sizeof sa6);
sa = (struct sockaddr *)&sa6;
sa_len = sizeof sa6;
addr = &sa6.sin6_addr;