# "Dereferencing Pointer To Incomplete Type" on ARM

**URL:** <https://www.ruby-forum.com/t/dereferencing-pointer-to-incomplete-type-on-arm/243068>\
**Category:** NGINX\
**Created:** [August 19, 2015, 3:15pm UTC](https://www.ruby-forum.com/t/dereferencing-pointer-to-incomplete-type-on-arm/243068 "2015-08-19T15:15:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [August 19, 2015, 3:15pm UTC](https://www.ruby-forum.com/t/dereferencing-pointer-to-incomplete-type-on-arm/243068/1 "2015-08-19T15:15:56Z")

</div>

I swear I had built the hg default version on my AMD64 just fine, but  
now  
I’m doing it on my ARM device running Ubuntu 15.04 with kernel 4.2.  
I used the default system openssl, but also tried with the master git  
version all with the same result.

Attempts with:

1. ./auto/configure --with-http\_ssl\_module --with-ipv6
2. ./auto/configure --with-http\_ssl\_module --with-ipv6 --with-cc-opt=“-I  
/usr/local/ssl/include -I /usr/local/include” --with-ld-opt=“-L  
/usr/local/ssl/lib -L /usr/local/lib”
3. ./auto/configure --with-ipv6 --with-http\_ssl\_module  
–with-openssl=/src/openssl/  
and of course “make”.

* * *

src/event/ngx\_event\_openssl.c: In function ‘ngx\_ssl\_handshake’:  
src/event/ngx\_event\_openssl.c:1164:31: error: dereferencing pointer to  
incomplete type  
if (c-\>ssl-\>connection-\>s3) {  
^  
src/event/ngx\_event\_openssl.c:1165:31: error: dereferencing pointer to  
incomplete type  
c-\>ssl-\>connection-\>s3-\>flags |=  
SSL3\_FLAGS\_NO\_RENEGOTIATE\_CIPHERS;  
^

* * *

“./auto/configure --with-ipv6” built with no problems.

Posted at Nginx Forum:

> **["Dereferencing Pointer To Incomplete Type" on ARM](https://forum.nginx.org/read.php?2,261124,261124#msg-261124)**
>
> I swear I had built the hg default version on my AMD64 just fine, but now I'm doing it on my ARM device running Ubuntu 15.04 with kernel 4.2. I used the default system openssl, but also tried with the master git version all with the same result....

---

<div class="post-metadata">

**Author:** ![vindicator](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e79b87/32.png) [@vindicator](https://www.ruby-forum.com/u/vindicator)\
**Post date:** [August 20, 2015, 11:45am UTC](https://www.ruby-forum.com/t/dereferencing-pointer-to-incomplete-type-on-arm/243068/2 "2015-08-20T11:45:40Z")

</div>

Looks like it isn’t just nginx (or even more likely IS an openssl issue)  
because I just encountered it again with pjproject:

* * *

…/src/pj/ssl\_sock\_ossl.c:1001:5: warning: implicit declaration of  
function  
‘M\_ASN1\_STRING\_length’ [-Wimplicit-function-declaration]  
len = M\_ASN1\_STRING\_length(X509\_get\_serialNumber(x));  
^  
…/src/pj/ssl\_sock\_ossl.c: In function ‘pj\_ssl\_sock\_get\_info’:  
…/src/pj/ssl\_sock\_ossl.c:2285:24: error: dereferencing pointer to  
incomplete type  
info-\>cipher = (cipher-\>id & 0x00FFFFFF);  
^

* * *

Posted at Nginx Forum:

> **[Re: "Dereferencing Pointer To Incomplete Type" on ARM](https://forum.nginx.org/read.php?2,261124,261142#msg-261142)**
>
> I swear I had built the hg default version on my AMD64 just fine, but now I'm doing it on my ARM device running Ubuntu 15.04 with kernel 4.2. I used the default system openssl, but also tried with the master git version all with the same result....

---

<div class="post-metadata">

**Author:** ![vindicator](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e79b87/32.png) [@vindicator](https://www.ruby-forum.com/u/vindicator)\
**Post date:** [August 24, 2015, 6:24pm UTC](https://www.ruby-forum.com/t/dereferencing-pointer-to-incomplete-type-on-arm/243068/3 "2015-08-24T18:24:49Z")

</div>

Hello!

On Wed, Aug 19, 2015 at 09:15:07AM -0400, vindicator wrote:

> 1. ./auto/configure --with-ipv6 --with-http\_ssl\_module  
> c-\>ssl-\>connection-\>s3-\>flags |=  
> SSL3\_FLAGS\_NO\_RENEGOTIATE\_CIPHERS;  
> ^
> 
> * * *
> 
> “./auto/configure --with-ipv6” built with no problems.

Looks like you have OPENSSL\_NO\_SSL\_INTERN defined by default in your  
system.  
Try this patch:

— a/src/event/ngx\_event\_openssl.c  
+++ b/src/event/ngx\_event\_openssl.c  
@@ -1159,6 +1159,7 @@ ngx\_ssl\_handshake(ngx\_connection\_t \*c)  
c-\>send\_chain = ngx\_ssl\_send\_chain;

#ifdef SSL3\_FLAGS\_NO\_RENEGOTIATE\_CIPHERS  
+#ifndef OPENSSL\_NO\_SSL\_INTERN

```
     /* initial handshake done, disable renegotiation 

```

(CVE-2009-3555) \*/  
if (c-\>ssl-\>connection-\>s3) {  
@@ -1166,6 +1167,7 @@ ngx\_ssl\_handshake(ngx\_connection\_t \*c)  
}

#endif  
+#endif

```
     return NGX_OK;
 }

```

–  
Maxim D.

> **[nginx](http://nginx.org/)**

---

<div class="post-metadata">

**Author:** ![vindicator](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e79b87/32.png) [@vindicator](https://www.ruby-forum.com/u/vindicator)\
**Post date:** [August 25, 2015, 3:53pm UTC](https://www.ruby-forum.com/t/dereferencing-pointer-to-incomplete-type-on-arm/243068/4 "2015-08-25T15:53:03Z")

</div>

Hello!

On Mon, Aug 24, 2015 at 10:40:05PM -0400, vindicator wrote:

> ```
> ^
> ^
> 
> ```
> 
> cc1: all warnings being treated as errors
> 
> * * *

[…]

Oh, it looks like you are trying to build nginx against OpenSSL  
master branch. As OpenSSL guys are changing things rapidly  
nowadays, it’s not really going to work. Try any released version  
instead.

Quick and dirty fix below, but I wouldn’t bet it will be enough to  
build with OpenSSL master even in a week from now.

— a/src/event/ngx\_event\_openssl.c  
+++ b/src/event/ngx\_event\_openssl.c  
@@ -1159,6 +1159,7 @@ ngx\_ssl\_handshake(ngx\_connection\_t \*c)  
c-\>send\_chain = ngx\_ssl\_send\_chain;

#ifdef SSL3\_FLAGS\_NO\_RENEGOTIATE\_CIPHERS  
+#if 0

```
     /* initial handshake done, disable renegotiation 

```

(CVE-2009-3555) \*/  
if (c-\>ssl-\>connection-\>s3) {  
@@ -1166,6 +1167,7 @@ ngx\_ssl\_handshake(ngx\_connection\_t \*c)  
}

#endif  
+#endif

```
     return NGX_OK;
 }

```

@@ -2861,7 +2863,7 @@ ngx\_ssl\_session\_ticket\_key\_callback(ngx\_  
ngx\_hex\_dump(buf, key[0].name, 16) - buf, buf,  
SSL\_session\_reused(ssl\_conn) ? “reused” :  
“new”);

- 

```
   RAND_pseudo_bytes(iv, 16);

```

- 

```
   RAND_bytes(iv, 16);
   EVP_EncryptInit_ex(ectx, EVP_aes_128_cbc(), NULL, 

```

key[0].aes\_key, iv);  
HMAC\_Init\_ex(hctx, key[0].hmac\_key, 16,  
ngx\_ssl\_session\_ticket\_md(), NULL);

–  
Maxim D.

> **[nginx](http://nginx.org/)**

---

<div class="post-metadata">

**Author:** ![vindicator](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e79b87/32.png) [@vindicator](https://www.ruby-forum.com/u/vindicator)\
**Post date:** [August 25, 2015, 4:40am UTC](https://www.ruby-forum.com/t/dereferencing-pointer-to-incomplete-type-on-arm/243068/5 "2015-08-25T04:40:37Z")

</div>

Thanks, but no. I’m still getting that error:

* * *

cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror  
-g  
-I src/core -I src/event -I src/event/modules -I src/os/unix -I objs   
-o objs/src/event/ngx\_event\_openssl.o   
src/event/ngx\_event\_openssl.c  
src/event/ngx\_event\_openssl.c: In function ‘ngx\_ssl\_handshake’:  
src/event/ngx\_event\_openssl.c:1165:31: error: dereferencing pointer to  
incomplete type  
if (c-\>ssl-\>connection-\>s3) {  
^  
src/event/ngx\_event\_openssl.c:1166:31: error: dereferencing pointer to  
incomplete type  
c-\>ssl-\>connection-\>s3-\>flags |=  
SSL3\_FLAGS\_NO\_RENEGOTIATE\_CIPHERS;  
^  
src/event/ngx\_event\_openssl.c: In function  
‘ngx\_ssl\_session\_ticket\_key\_callback’:  
src/event/ngx\_event\_openssl.c:2866:9: error: implicit declaration of  
function ‘RAND\_pseudo\_bytes’ [-Werror=implicit-function-declaration]  
RAND\_pseudo\_bytes(iv, 16);  
^  
cc1: all warnings being treated as errors

* * *

Changed code section:

* * *

```
    c->recv_chain = ngx_ssl_recv_chain;
    c->send_chain = ngx_ssl_send_chain;

```

#ifdef SSL3\_FLAGS\_NO\_RENEGOTIATE\_CIPHERS  
#ifndef OPENSSL\_NO\_SSL\_INTERN

```
    /* initial handshake done, disable renegotiation (CVE-2009-3555) 

```

\*/  
if (c-\>ssl-\>connection-\>s3) {  
c-\>ssl-\>connection-\>s3-\>flags |=  
SSL3\_FLAGS\_NO\_RENEGOTIATE\_CIPHERS;  
}

#endif  
#endif

```
    return NGX_OK;
}

sslerr = SSL_get_error(c->ssl->connection, n);

```

* * *

Just adding that I clean the source before each build attempt via:

* * *

hg --config “extensions.purge=” purge --all  
hg revert --all

* * *

I also don’t know where I’d find if “OPENSSL\_NO\_SSL\_INTERN” was already  
defined. printenv doesn’t show it, nor does a recursive grep in /etc or  
~.  
Let me know if there are any other tests you’d like me to try or any  
other  
information you need from me that may help.

Posted at Nginx Forum:

> **[Re: "Dereferencing Pointer To Incomplete Type" on ARM](https://forum.nginx.org/read.php?2,261124,261218#msg-261218)**
>
> I swear I had built the hg default version on my AMD64 just fine, but now I'm doing it on my ARM device running Ubuntu 15.04 with kernel 4.2. I used the default system openssl, but also tried with the master git version all with the same result....
