The branch master has been updated
       via  d4ab70f27cb7e518e6a9d6323c996cc3feb7496b (commit)
      from  b0809bc8ffb34bf89de9e68d8caeb4d8c2aa08f9 (commit)


- Log -----------------------------------------------------------------
commit d4ab70f27cb7e518e6a9d6323c996cc3feb7496b
Author: Rich Salz <[email protected]>
Date:   Thu Sep 3 16:56:28 2015 -0400

    Test for NULL ptr == 0
    
    Add a test to ensure that "char *p = NULL" is equivalent to
    all-bytes-zero.
    
    Reviewed-by: Tim Hudson <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 test/Makefile                                    | 17 ++++++++++++++---
 engines/ccgost/e_gost_err.proto => test/nptest.c | 21 +++++++++++++--------
 2 files changed, 27 insertions(+), 11 deletions(-)
 copy engines/ccgost/e_gost_err.proto => test/nptest.c (90%)

diff --git a/test/Makefile b/test/Makefile
index 8692347..364e887 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -29,6 +29,7 @@ LIBFIPS= -L.. -lfips
 # Prefix for logline for each test
 START= @@@ START
 
+NPTEST=                nptest
 BNTEST=                bntest
 ECTEST=                ectest
 ECDSATEST=     ecdsatest
@@ -80,7 +81,9 @@ SSLSKEWITH0PTEST=     sslskewith0ptest.pl
 
 TESTS=         alltests
 
-EXE=   $(BNTEST)$(EXE_EXT) $(ECTEST)$(EXE_EXT)  $(ECDSATEST)$(EXE_EXT) 
$(ECDHTEST)$(EXE_EXT) $(GMDIFFTEST)$(EXE_EXT) $(PBELUTEST)$(EXE_EXT) 
$(IDEATEST)$(EXE_EXT) \
+EXE=   $(NPTEST)$(EXE_EXT) $(BNTEST)$(EXE_EXT) $(ECTEST)$(EXE_EXT) \
+       $(ECDSATEST)$(EXE_EXT) $(ECDHTEST)$(EXE_EXT) $(GMDIFFTEST)$(EXE_EXT) \
+       $(PBELUTEST)$(EXE_EXT) $(IDEATEST)$(EXE_EXT) \
        $(MD2TEST)$(EXE_EXT)  $(MD4TEST)$(EXE_EXT) $(MD5TEST)$(EXE_EXT) 
$(HMACTEST)$(EXE_EXT) $(WPTEST)$(EXE_EXT) \
        $(RC2TEST)$(EXE_EXT) $(RC4TEST)$(EXE_EXT) $(RC5TEST)$(EXE_EXT) \
        $(DESTEST)$(EXE_EXT) $(SHA1TEST)$(EXE_EXT) $(SHA256TEST)$(EXE_EXT) 
$(SHA512TEST)$(EXE_EXT) \
@@ -98,7 +101,8 @@ EXE= $(BNTEST)$(EXE_EXT) $(ECTEST)$(EXE_EXT)  
$(ECDSATEST)$(EXE_EXT) $(ECDHTEST)
 
 # $(METHTEST)$(EXE_EXT)
 
-OBJ=   $(BNTEST).o $(ECTEST).o  $(ECDSATEST).o $(ECDHTEST).o $(GMDIFFTEST).o 
$(PBELUTEST).o $(IDEATEST).o \
+OBJ=   $(NPTEST).o $(BNTEST).o $(ECTEST).o \
+       $(ECDSATEST).o $(ECDHTEST).o $(GMDIFFTEST).o $(PBELUTEST).o 
$(IDEATEST).o \
        $(MD2TEST).o $(MD4TEST).o $(MD5TEST).o \
        $(HMACTEST).o $(WPTEST).o \
        $(RC2TEST).o $(RC4TEST).o $(RC5TEST).o \
@@ -111,7 +115,8 @@ OBJ=        $(BNTEST).o $(ECTEST).o  $(ECDSATEST).o 
$(ECDHTEST).o $(GMDIFFTEST).o $(PBE
        $(CONSTTIMETEST).o $(VERIFYEXTRATEST).o $(CLIENTHELLOTEST).o \
        $(PACKETTEST).o testutil.o
 
-SRC=   $(BNTEST).c $(ECTEST).c  $(ECDSATEST).c $(ECDHTEST).c $(GMDIFFTEST).c 
$(PBELUTEST).c $(IDEATEST).c \
+SRC=   $(NPTEST).c $(BNTEST).c $(ECTEST).c \
+       $(ECDSATEST).c $(ECDHTEST).c $(GMDIFFTEST).c $(PBELUTEST).c 
$(IDEATEST).c \
        $(MD2TEST).c  $(MD4TEST).c $(MD5TEST).c \
        $(HMACTEST).c $(WPTEST).c \
        $(RC2TEST).c $(RC4TEST).c $(RC5TEST).c \
@@ -152,6 +157,7 @@ apps:
        @(cd ..; $(MAKE) DIRS=apps all)
 
 alltests: \
+       test_np \
        test_des test_gmdiff test_idea test_sha test_md4 test_md5 test_hmac \
        test_pbelu test_md2 test_mdc2 test_wp \
        test_rmd test_rc2 test_rc4 test_rc5 test_bf test_cast \
@@ -165,6 +171,10 @@ alltests: \
        test_constant_time test_verify_extra test_clienthello test_packet \
        test_sslvertol test_sslextension test_sslsessionticket test_sslskewith0p
 
+test_np: $(NPTEST)$(EXE_EXT)
+       @echo $(START) $@
+       ./$(NPTEST)
+
 test_evp: $(EVPTEST)$(EXE_EXT) evptests.txt
        @echo $(START) $@
        ../util/shlib_wrap.sh ./$(EVPTEST) evptests.txt
@@ -891,6 +901,7 @@ mdc2test.o: ../include/openssl/objects.h 
../include/openssl/opensslconf.h
 mdc2test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
 mdc2test.o: ../include/openssl/safestack.h ../include/openssl/stack.h
 mdc2test.o: ../include/openssl/symhacks.h mdc2test.c
+nptest.o: nptest.c
 p5_crpt2_test.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
 p5_crpt2_test.o: ../include/openssl/buffer.h ../include/openssl/conf.h
 p5_crpt2_test.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
diff --git a/engines/ccgost/e_gost_err.proto b/test/nptest.c
similarity index 90%
copy from engines/ccgost/e_gost_err.proto
copy to test/nptest.c
index c57bd1b..9528851 100644
--- a/engines/ccgost/e_gost_err.proto
+++ b/test/nptest.c
@@ -1,12 +1,12 @@
 /* ====================================================================
- * Copyright (c) 2001-2005 The OpenSSL Project.  All rights reserved.
+ * Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -52,10 +52,15 @@
  *
  */
 
-#ifndef HEADER_GOST_ERR_H
-#define HEADER_GOST_ERR_H
 
-#define GOST_LIB_NAME "GOST engine"
-#ifdef __cplusplus
- extern "C" {
-#endif
+#include <stdio.h>
+#include <string.h>
+
+int main()
+{
+    char *p = NULL;
+    char bytes[sizeof(p)];
+
+    memset(bytes, 0, sizeof bytes);
+    return memcmp(&p, bytes, sizeof(bytes)) == 0 ? 0 : 1;
+}
_____
openssl-commits mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits

Reply via email to