nss/nosha224.patch

102 lines
3.4 KiB
Diff

diff -up ./mozilla/security/nss/cmd/bltest/blapitest.c.nosha224 ./mozilla/security/nss/cmd/bltest/blapitest.c
--- ./mozilla/security/nss/cmd/bltest/blapitest.c.nosha224 2011-09-16 12:16:50.000000000 -0700
+++ ./mozilla/security/nss/cmd/bltest/blapitest.c 2011-12-10 11:45:11.346011408 -0800
@@ -686,7 +686,9 @@ typedef enum {
bltestMD2, /* Hash algorithms */
bltestMD5, /* . */
bltestSHA1, /* . */
+#ifndef NO_SHA224_AVAILABLE
bltestSHA224, /* . */
+#endif
bltestSHA256, /* . */
bltestSHA384, /* . */
bltestSHA512, /* . */
@@ -721,7 +723,9 @@ static char *mode_strings[] =
"md2",
"md5",
"sha1",
+#ifndef NO_SHA224_AVAILABLE
"sha224",
+#endif
"sha256",
"sha384",
"sha512",
@@ -1761,6 +1765,7 @@ finish:
return rv;
}
+#ifndef NO_SHA224_AVAILABLE
SECStatus
SHA224_restart(unsigned char *dest, const unsigned char *src, uint32 src_length)
{
@@ -1800,6 +1805,7 @@ finish:
SHA224_DestroyContext(cx, PR_TRUE);
return rv;
}
+#endif
SECStatus
SHA256_restart(unsigned char *dest, const unsigned char *src, uint32 src_length)
@@ -2093,6 +2099,7 @@ cipherInit(bltestCipherInfo *cipherInfo,
cipherInfo->cipher.hashCipher = (restart) ? sha1_restart : SHA1_HashBuf;
return SECSuccess;
break;
+#ifndef NO_SHA224_AVAILABLE
case bltestSHA224:
restart = cipherInfo->params.hash.restart;
SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
@@ -2100,6 +2107,7 @@ cipherInit(bltestCipherInfo *cipherInfo,
cipherInfo->cipher.hashCipher = (restart) ? SHA224_restart
: SHA224_HashBuf;
return SECSuccess;
+#endif
break;
case bltestSHA256:
restart = cipherInfo->params.hash.restart;
@@ -2542,7 +2550,9 @@ cipherFinish(bltestCipherInfo *cipherInf
case bltestMD2: /* hash contexts are ephemeral */
case bltestMD5:
case bltestSHA1:
+#ifndef NO_SHA224_AVAILABLE
case bltestSHA224:
+#endif
case bltestSHA256:
case bltestSHA384:
case bltestSHA512:
@@ -2896,7 +2906,9 @@ get_params(PRArenaPool *arena, bltestPar
case bltestMD2:
case bltestMD5:
case bltestSHA1:
+#ifndef NO_SHA224_AVAILABLE
case bltestSHA224:
+#endif
case bltestSHA256:
case bltestSHA384:
case bltestSHA512:
diff -up ./mozilla/security/nss/cmd/bltest/Makefile.nosha224 ./mozilla/security/nss/cmd/bltest/Makefile
--- ./mozilla/security/nss/cmd/bltest/Makefile.nosha224 2011-12-10 11:52:27.321001376 -0800
+++ ./mozilla/security/nss/cmd/bltest/Makefile 2011-12-10 11:56:07.580996325 -0800
@@ -62,6 +62,11 @@ include $(CORE_DEPTH)/coreconf/config.mk
include ../platlibs.mk
+# Don't compile code that requires SHA224 if it isn't avilable
+# Such is the case when system freebl/softokn is the 3.12 one
+#
+CFLAGS+=-DNO_SHA224_AVAILABLE
+
#EXTRA_SHARED_LIBS += \
# -L/usr/lib \
# -lposix4 \
diff -up ./mozilla/security/nss/tests/cipher/cipher.txt.nosha224 ./mozilla/security/nss/tests/cipher/cipher.txt
--- ./mozilla/security/nss/tests/cipher/cipher.txt.nosha224 2010-08-17 22:57:05.000000000 -0700
+++ ./mozilla/security/nss/tests/cipher/cipher.txt 2011-12-04 22:03:47.317609956 -0800
@@ -73,7 +73,6 @@
0 md2_-H MD2_Hash
0 md5_-H MD5_Hash
0 sha1_-H SHA1_Hash
- 0 sha224_-H SHA224_Hash
0 sha256_-H SHA256_Hash
0 sha384_-H SHA384_Hash
0 sha512_-H SHA512_Hash