Browse Source

[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

master
Robert Förster 9 years ago
parent
commit
b026612d88
  1. 0
      dev-libs/libtomcrypt/files/libtomcrypt-1.17-r7-libtool-tag-and-make-fix.patch
  2. 87
      dev-libs/libtomcrypt/files/rsa_verify_simple.c
  3. 4
      dev-libs/libtomcrypt/libtomcrypt-1.17-r7.ebuild

0
dev-libs/libtomcrypt/files/libtomcrypt-1.17-r2-libtool-tag-and-make-fix.patch → dev-libs/libtomcrypt/files/libtomcrypt-1.17-r7-libtool-tag-and-make-fix.patch

87
dev-libs/libtomcrypt/files/rsa_verify_simple.c

@ -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 */

4
dev-libs/libtomcrypt/libtomcrypt-1.17-r7.ebuild

@ -21,13 +21,11 @@ DEPEND="${RDEPEND}
src_prepare() {
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 \
-e "s:--mode=link gcc:--mode=link $(tc-getCC) ${LDFLAGS} --tag CC $(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
cp "${FILESDIR}/rsa_verify_simple.c" "${S}/src/pk/rsa"
# need libtool for cross compilation. Bug #376643
cat <<-EOF > configure.ac

Loading…
Cancel
Save