[dev-libs/libtomcrypt] kill rsa_verify_simple.c since it is part of stormlib now (as it should have been...) so this is what the intree ebuild was + multilib now
This commit is contained in:
parent
d68351f517
commit
b026612d88
@ -1,87 +0,0 @@
|
|||||||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
|
||||||
*
|
|
||||||
* LibTomCrypt is a library that provides various cryptographic
|
|
||||||
* algorithms in a highly modular and flexible manner.
|
|
||||||
*
|
|
||||||
* The library is free for all purposes without any express
|
|
||||||
* guarantee it works.
|
|
||||||
*
|
|
||||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
|
||||||
*/
|
|
||||||
#include "../../headers/tomcrypt.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
@file rsa_verify_simple.c
|
|
||||||
Created by Ladislav Zezula (zezula@volny.cz) as modification
|
|
||||||
for Blizzard strong signature verification
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef LTC_MRSA
|
|
||||||
|
|
||||||
/**
|
|
||||||
Simple RSA decryption
|
|
||||||
@param sig The signature data
|
|
||||||
@param siglen The length of the signature data (octets)
|
|
||||||
@param hash The hash of the message that was signed
|
|
||||||
@param hashlen The length of the hash of the message that was signed (octets)
|
|
||||||
@param stat [out] The result of the signature comparison, 1==valid, 0==invalid
|
|
||||||
@param key The public RSA key corresponding
|
|
||||||
@return Error code
|
|
||||||
*/
|
|
||||||
int rsa_verify_simple(const unsigned char *sig, unsigned long siglen,
|
|
||||||
const unsigned char *hash, unsigned long hashlen,
|
|
||||||
int *stat,
|
|
||||||
rsa_key *key)
|
|
||||||
{
|
|
||||||
unsigned long modulus_bitlen, modulus_bytelen, x;
|
|
||||||
unsigned char *tmpbuf;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
LTC_ARGCHK(sig != NULL);
|
|
||||||
LTC_ARGCHK(hash != NULL);
|
|
||||||
LTC_ARGCHK(stat != NULL);
|
|
||||||
LTC_ARGCHK(key != NULL);
|
|
||||||
|
|
||||||
/* default to invalid */
|
|
||||||
*stat = 0;
|
|
||||||
|
|
||||||
/* get modulus len in bits */
|
|
||||||
modulus_bitlen = mp_count_bits( (key->N));
|
|
||||||
|
|
||||||
/* outlen must be at least the size of the modulus */
|
|
||||||
modulus_bytelen = mp_unsigned_bin_size( (key->N));
|
|
||||||
if (modulus_bytelen != siglen) {
|
|
||||||
return CRYPT_INVALID_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* allocate temp buffer for decoded sig */
|
|
||||||
tmpbuf = XMALLOC(siglen);
|
|
||||||
if (tmpbuf == NULL) {
|
|
||||||
return CRYPT_MEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* RSA decode it */
|
|
||||||
x = siglen;
|
|
||||||
if ((err = ltc_mp.rsa_me(sig, siglen, tmpbuf, &x, PK_PUBLIC, key)) != CRYPT_OK) {
|
|
||||||
XFREE(tmpbuf);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* make sure the output is the right size */
|
|
||||||
if (x != siglen) {
|
|
||||||
XFREE(tmpbuf);
|
|
||||||
return CRYPT_INVALID_PACKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* compare the decrypted signature with the given hash */
|
|
||||||
if(x == hashlen && XMEMCMP(tmpbuf, hash, hashlen) == 0)
|
|
||||||
*stat = 1;
|
|
||||||
|
|
||||||
#ifdef LTC_CLEAN_STACK
|
|
||||||
zeromem(tmpbuf, siglen);
|
|
||||||
#endif
|
|
||||||
XFREE(tmpbuf);
|
|
||||||
return CRYPT_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* LTC_MRSA */
|
|
@ -21,13 +21,11 @@ DEPEND="${RDEPEND}
|
|||||||
|
|
||||||
src_prepare() {
|
src_prepare() {
|
||||||
use doc || sed -i '/^install:/s:docs::' makefile
|
use doc || sed -i '/^install:/s:docs::' makefile
|
||||||
epatch "${FILESDIR}"/libtomcrypt-1.17-r2-libtool-tag-and-make-fix.patch
|
epatch "${FILESDIR}"/libtomcrypt-1.17-r7-libtool-tag-and-make-fix.patch
|
||||||
sed -i \
|
sed -i \
|
||||||
-e "s:--mode=link gcc:--mode=link $(tc-getCC) ${LDFLAGS} --tag CC $(tc-getCC):g" \
|
-e "s:--mode=link gcc:--mode=link $(tc-getCC) ${LDFLAGS} --tag CC $(tc-getCC):g" \
|
||||||
-e "s: gcc: $(tc-getCC):g" \
|
-e "s: gcc: $(tc-getCC):g" \
|
||||||
-e "s:src/pk/rsa/rsa_verify_hash.o :src/pk/rsa/rsa_verify_hash.o src/pk/rsa/rsa_verify_simple.o :g" \
|
|
||||||
{,testprof/}makefile.shared || die
|
{,testprof/}makefile.shared || die
|
||||||
cp "${FILESDIR}/rsa_verify_simple.c" "${S}/src/pk/rsa"
|
|
||||||
|
|
||||||
# need libtool for cross compilation. Bug #376643
|
# need libtool for cross compilation. Bug #376643
|
||||||
cat <<-EOF > configure.ac
|
cat <<-EOF > configure.ac
|
||||||
|
Loading…
Reference in New Issue
Block a user