Commit 9132582a authored by Kai Vehmanen's avatar Kai Vehmanen

Removed sha1.h API and related code due to licensing issues with regards to...

Removed sha1.h API and related code due to licensing issues with regards to RFC3174. Closes sf.net bug #1525308. See RELEASE comments concerning the effects to 1.12.0 API/ABI.

darcs-hash:20060725200513-7659e-f73a174f9d14c7535a3542939438ff91eed06782.gz
parent cb5b40e5
......@@ -18,11 +18,18 @@ API/ABI changes and versioning
other important information to developers;
- and should be updated _continuously_! />
- Added su_yield().
- Added su_yield() function.
- Removed sofia-sip/sha1.h from the library. This removal is
not considered as an API change, but instead a bugfix to
the 1.12.0 API/ABI. We know of no applications that are using
the sha1.h functionality, so applying this change as a bugfix
was seen as an acceptable action. If however some application
relying on sha1.h is found, please contact the sofia-sip team
and we will reconsider the issue. See sf.net bug #1525308 for
the history of this issue.
- This release is ABI/API compatible with applications
linked against 1.12.0.
Contributors to this release
----------------------------
......
......@@ -15,20 +15,20 @@ INCLUDES = -I$(srcdir)/../su -I../su
noinst_LTLIBRARIES = libipt.la
check_PROGRAMS = sha1test torture_base64
check_PROGRAMS = torture_base64
TESTS = sha1test torture_base64
TESTS = torture_base64
# ----------------------------------------------------------------------
# Rules for building the targets
nobase_include_sofia_HEADERS = \
sofia-sip/rc4.h \
sofia-sip/sha1.h sofia-sip/base64.h \
sofia-sip/base64.h \
sofia-sip/string0.h sofia-sip/token64.h \
sofia-sip/uniqueid.h
libipt_la_SOURCES = sha1.c base64.c string0.c token64.c
libipt_la_SOURCES = base64.c string0.c token64.c
EXTRA_DIST = sofia-sip/utf8.h \
utf8internal.h \
......@@ -41,7 +41,6 @@ LDADD = libipt.la \
../sresolv/libsresolv.la \
../su/libsu.la
sha1test_LDFLAGS = -static
torture_base64_LDFLAGS = -static
# ----------------------------------------------------------------------
......
This diff is collapsed.
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
/*
* sha1test.c
*
* Description:
* This file will exercise the SHA-1 code performing the three
* tests documented in FIPS PUB 180-1 plus one which calls
* SHA1Input with an exact multiple of 512 bits, plus a few
* error test checks.
*
* Portability Issues:
* None.
*
*/
#include "config.h"
#include <stdio.h>
#include <string.h>
#include "sofia-sip/sha1.h"
/*
* Define patterns for testing
*/
#define TEST1 "abc"
#define TEST2a "abcdbcdecdefdefgefghfghighijhi"
#define TEST2b "jkijkljklmklmnlmnomnopnopq"
#define TEST2 TEST2a TEST2b
#define TEST3 "a"
#define TEST4a "01234567012345670123456701234567"
#define TEST4b "01234567012345670123456701234567"
/* an exact multiple of 512 bits */
#define TEST4 TEST4a TEST4b
char *testarray[4] =
{
TEST1,
TEST2,
TEST3,
TEST4
};
long int repeatcount[4] = { 1, 1, 1000000, 10 };
char *resultarray[4] =
{
"A9 99 3E 36 47 06 81 6A BA 3E 25 71 78 50 C2 6C 9C D0 D8 9D",
"84 98 3E 44 1C 3B D2 6E BA AE 4A A1 F9 51 29 E5 E5 46 70 F1",
"34 AA 97 3C D4 C4 DA A4 F6 1E EB 2B DB AD 27 31 65 34 01 6F",
"DE A3 56 A2 CD DD 90 C7 A7 EC ED C5 EB B5 63 93 4F 46 04 52"
};
int main()
{
SHA1Context sha;
int i, j, err;
uint8_t Message_Digest[20];
/*
* Perform SHA-1 tests
*/
for(j = 0; j < 4; ++j)
{
printf( "\nTest %d: %ld, '%s'\n",
j+1,
repeatcount[j],
testarray[j]);
err = SHA1Reset(&sha);
if (err)
{
fprintf(stderr, "SHA1Reset Error %d.\n", err );
break; /* out of for j loop */
}
for(i = 0; i < repeatcount[j]; ++i)
{
err = SHA1Input(&sha,
(const unsigned char *) testarray[j],
strlen(testarray[j]));
if (err)
{
fprintf(stderr, "SHA1Input Error %d.\n", err );
break; /* out of for i loop */
}
}
err = SHA1Result(&sha, Message_Digest);
if (err)
{
fprintf(stderr,
"SHA1Result Error %d, could not compute message digest.\n",
err );
}
else
{
printf("\t");
for(i = 0; i < 20 ; ++i)
{
printf("%02X ", Message_Digest[i]);
}
printf("\n");
}
printf("Should match:\n");
printf("\t%s\n", resultarray[j]);
}
/* Test some error returns */
err = SHA1Input(&sha,(const unsigned char *) testarray[1], 1);
printf ("\nError %d. Should be %d.\n", err, shaStateError );
err = SHA1Reset(0);
printf ("\nError %d. Should be %d.\n", err, shaNull );
return 0;
}
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
/**@file sofia-sip/sha1.h
*
* This is the header file for code which implements the Secure
* Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
* April 17, 1995.
*
* @par
* The SHA-1 produces a 160-bit message digest for a given
* data stream. It should take about 2**n steps to find a
* message with the same digest as a given message and
* 2**(n/2) to find any two messages with the same digest,
* when n is the digest size in bits. Therefore, this
* algorithm can serve as a means of providing a
* "fingerprint" for a message.
*
* @par Portability Issues
* SHA-1 is defined in terms of 32-bit "words". This code
* uses <stdint.h> (included via "sha1.h" to define 32 and 8
* bit unsigned integer types. If your C compiler does not
* support 32 bit unsigned integers, this code is not
* appropriate.
*
* @par Caveats
* SHA-1 is designed to work with messages less than 2^64 bits
* long. Although SHA-1 allows a message digest to be generated
* for messages of any number of bits less than 2^64, this
* implementation only works with messages with a length that is
* a multiple of the size of an 8-bit character.
*
* @par
* Many of the variable names in this code, especially the
* single character names, were used because those were the names
* used in the publication.
*/
#ifndef _SHA1_H_
#define _SHA1_H_
#ifndef SU_TYPES_H
#include <sofia-sip/su_types.h>
/*
* If you do not have the ISO standard stdint.h header file, then you
* must typdef the following:
* name meaning
* uint32_t unsigned 32 bit integer
* uint8_t unsigned 8 bit integer (i.e., unsigned char)
* int_least16_t integer of >= 16 bits
*
*/
#endif
SOFIA_BEGIN_DECLS
#ifndef _SHA_enum_
#define _SHA_enum_
/** SHA1 Error Codes */
enum
{
shaSuccess = 0, /**< Successful call */
shaNull, /**< Null pointer parameter */
shaInputTooLong, /**< Input data too long */
shaStateError /**< Called Input after Result */
};
#endif
#define SHA1HashSize 20
/**
* This structure will hold context information for the SHA-1
* hashing operation
*/
typedef struct SHA1Context
{
uint32_t Intermediate_Hash[SHA1HashSize/4]; /**< Message Digest */
uint32_t Length_Low; /**< Message length in bits */
uint32_t Length_High; /**< Message length in bits */
unsigned Computed : 1; /**< Is the digest computed? */
unsigned Corrupted : 1; /**< Is the message digest corrupted? */
unsigned : 0;
/** Index into message block array */
int_least16_t Message_Block_Index;
uint8_t Message_Block[64]; /**< 512-bit message blocks */
} SHA1Context;
/*
* Function Prototypes
*/
SOFIAPUBFUN int SHA1Reset( SHA1Context *);
SOFIAPUBFUN int SHA1Input( SHA1Context *,
const uint8_t *,
unsigned int);
SOFIAPUBFUN int SHA1Result( SHA1Context *,
uint8_t Message_Digest[SHA1HashSize]);
SOFIA_END_DECLS
#endif
......@@ -34,7 +34,6 @@
#include <sofia-sip/string0.h>
#include <sofia-sip/su_strlst.h>
#include <sofia-sip/sha1.h>
#include <sofia-sip/token64.h>
#include <sofia-sip/su_tagarg.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment