Dead code: crypto/dh,modes,pkcs12,ripemd,rsa,srp
And an uncompiled C++ test file. Also remove srp_lcl.h, with help from Richard. Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
parent
156a872233
commit
dfb56425b6
@ -116,15 +116,7 @@ int DH_check(const DH *dh, int *ret)
|
|||||||
l = BN_mod_word(dh->p, 24);
|
l = BN_mod_word(dh->p, 24);
|
||||||
if (l != 11)
|
if (l != 11)
|
||||||
*ret |= DH_NOT_SUITABLE_GENERATOR;
|
*ret |= DH_NOT_SUITABLE_GENERATOR;
|
||||||
}
|
} else if (BN_is_word(dh->g, DH_GENERATOR_5)) {
|
||||||
#if 0
|
|
||||||
else if (BN_is_word(dh->g, DH_GENERATOR_3)) {
|
|
||||||
l = BN_mod_word(dh->p, 12);
|
|
||||||
if (l != 5)
|
|
||||||
*ret |= DH_NOT_SUITABLE_GENERATOR;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else if (BN_is_word(dh->g, DH_GENERATOR_5)) {
|
|
||||||
l = BN_mod_word(dh->p, 10);
|
l = BN_mod_word(dh->p, 10);
|
||||||
if ((l != 3) && (l != 7))
|
if ((l != 3) && (l != 7))
|
||||||
*ret |= DH_NOT_SUITABLE_GENERATOR;
|
*ret |= DH_NOT_SUITABLE_GENERATOR;
|
||||||
|
@ -136,17 +136,7 @@ static int dh_builtin_genparams(DH *ret, int prime_len, int generator,
|
|||||||
if (!BN_set_word(t2, 11))
|
if (!BN_set_word(t2, 11))
|
||||||
goto err;
|
goto err;
|
||||||
g = 2;
|
g = 2;
|
||||||
}
|
} else if (generator == DH_GENERATOR_5) {
|
||||||
#if 0 /* does not work for safe primes */
|
|
||||||
else if (generator == DH_GENERATOR_3) {
|
|
||||||
if (!BN_set_word(t1, 12))
|
|
||||||
goto err;
|
|
||||||
if (!BN_set_word(t2, 5))
|
|
||||||
goto err;
|
|
||||||
g = 3;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else if (generator == DH_GENERATOR_5) {
|
|
||||||
if (!BN_set_word(t1, 10))
|
if (!BN_set_word(t1, 10))
|
||||||
goto err;
|
goto err;
|
||||||
if (!BN_set_word(t2, 3))
|
if (!BN_set_word(t2, 3))
|
||||||
|
@ -1036,9 +1036,6 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx,
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
|
||||||
n = (unsigned int)mlen % 16; /* alternative to ctx->mres */
|
|
||||||
#endif
|
|
||||||
mlen += len;
|
mlen += len;
|
||||||
if (mlen > ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len))
|
if (mlen > ((U64(1) << 36) - 32) || (sizeof(len) == 8 && mlen < len))
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -118,13 +118,6 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
|
|||||||
int tmpn = n;
|
int tmpn = n;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (!pass) {
|
|
||||||
PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI, ERR_R_PASSED_NULL_PARAMETER);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
EVP_MD_CTX_init(&ctx);
|
EVP_MD_CTX_init(&ctx);
|
||||||
#ifdef DEBUG_KEYGEN
|
#ifdef DEBUG_KEYGEN
|
||||||
fprintf(stderr, "KEYGEN DEBUG\n");
|
fprintf(stderr, "KEYGEN DEBUG\n");
|
||||||
|
@ -1,82 +0,0 @@
|
|||||||
//
|
|
||||||
// gettsc.inl
|
|
||||||
//
|
|
||||||
// gives access to the Pentium's (secret) cycle counter
|
|
||||||
//
|
|
||||||
// This software was written by Leonard Janke (janke@unixg.ubc.ca)
|
|
||||||
// in 1996-7 and is entered, by him, into the public domain.
|
|
||||||
|
|
||||||
#if defined(__WATCOMC__)
|
|
||||||
void GetTSC(unsigned long&);
|
|
||||||
#pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax];
|
|
||||||
#elif defined(__GNUC__)
|
|
||||||
inline
|
|
||||||
void GetTSC(unsigned long& tsc)
|
|
||||||
{
|
|
||||||
asm volatile(".byte 15, 49\n\t"
|
|
||||||
: "=eax" (tsc)
|
|
||||||
:
|
|
||||||
: "%edx", "%eax");
|
|
||||||
}
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
inline
|
|
||||||
void GetTSC(unsigned long& tsc)
|
|
||||||
{
|
|
||||||
unsigned long a;
|
|
||||||
__asm _emit 0fh
|
|
||||||
__asm _emit 31h
|
|
||||||
__asm mov a, eax;
|
|
||||||
tsc=a;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <openssl/ripemd.h>
|
|
||||||
|
|
||||||
#define ripemd160_block_x86 ripemd160_block_asm_host_order
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
void ripemd160_block_x86(RIPEMD160_CTX *ctx, unsigned char *buffer,int num);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main(int argc,char *argv[])
|
|
||||||
{
|
|
||||||
unsigned char buffer[64*256];
|
|
||||||
RIPEMD160_CTX ctx;
|
|
||||||
unsigned long s1,s2,e1,e2;
|
|
||||||
unsigned char k[16];
|
|
||||||
unsigned long data[2];
|
|
||||||
unsigned char iv[8];
|
|
||||||
int i,num=0,numm;
|
|
||||||
int j=0;
|
|
||||||
|
|
||||||
if (argc >= 2)
|
|
||||||
num=atoi(argv[1]);
|
|
||||||
|
|
||||||
if (num == 0) num=16;
|
|
||||||
if (num > 250) num=16;
|
|
||||||
numm=num+2;
|
|
||||||
#if 0
|
|
||||||
num*=64;
|
|
||||||
numm*=64;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (j=0; j<6; j++)
|
|
||||||
{
|
|
||||||
for (i=0; i<10; i++) /**/
|
|
||||||
{
|
|
||||||
ripemd160_block_x86(&ctx,buffer,numm);
|
|
||||||
GetTSC(s1);
|
|
||||||
ripemd160_block_x86(&ctx,buffer,numm);
|
|
||||||
GetTSC(e1);
|
|
||||||
GetTSC(s2);
|
|
||||||
ripemd160_block_x86(&ctx,buffer,num);
|
|
||||||
GetTSC(e2);
|
|
||||||
ripemd160_block_x86(&ctx,buffer,num);
|
|
||||||
}
|
|
||||||
printf("ripemd160 (%d bytes) %d %d (%.2f)\n",num*64,
|
|
||||||
e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -94,13 +94,6 @@ void ripemd160_block_data_order(RIPEMD160_CTX *c, const void *p, size_t num);
|
|||||||
|
|
||||||
#include "md32_common.h"
|
#include "md32_common.h"
|
||||||
|
|
||||||
#if 0
|
|
||||||
# define F1(x,y,z) ((x)^(y)^(z))
|
|
||||||
# define F2(x,y,z) (((x)&(y))|((~x)&z))
|
|
||||||
# define F3(x,y,z) (((x)|(~y))^(z))
|
|
||||||
# define F4(x,y,z) (((x)&(z))|((y)&(~(z))))
|
|
||||||
# define F5(x,y,z) ((x)^((y)|(~(z))))
|
|
||||||
#else
|
|
||||||
/*
|
/*
|
||||||
* Transformed F2 and F4 are courtesy of Wei Dai <weidai@eskimo.com>
|
* Transformed F2 and F4 are courtesy of Wei Dai <weidai@eskimo.com>
|
||||||
*/
|
*/
|
||||||
@ -109,7 +102,6 @@ void ripemd160_block_data_order(RIPEMD160_CTX *c, const void *p, size_t num);
|
|||||||
#define F3(x,y,z) (((~(y)) | (x)) ^ (z))
|
#define F3(x,y,z) (((~(y)) | (x)) ^ (z))
|
||||||
#define F4(x,y,z) ((((x) ^ (y)) & (z)) ^ (y))
|
#define F4(x,y,z) ((((x) ^ (y)) & (z)) ^ (y))
|
||||||
#define F5(x,y,z) (((~(z)) | (y)) ^ (x))
|
#define F5(x,y,z) (((~(z)) | (y)) ^ (x))
|
||||||
#endif
|
|
||||||
|
|
||||||
#define RIPEMD160_A 0x67452301L
|
#define RIPEMD160_A 0x67452301L
|
||||||
#define RIPEMD160_B 0xEFCDAB89L
|
#define RIPEMD160_B 0xEFCDAB89L
|
||||||
|
@ -79,9 +79,6 @@ static int RSA_null_public_decrypt(int flen, const unsigned char *from,
|
|||||||
unsigned char *to, RSA *rsa, int padding);
|
unsigned char *to, RSA *rsa, int padding);
|
||||||
static int RSA_null_private_decrypt(int flen, const unsigned char *from,
|
static int RSA_null_private_decrypt(int flen, const unsigned char *from,
|
||||||
unsigned char *to, RSA *rsa, int padding);
|
unsigned char *to, RSA *rsa, int padding);
|
||||||
#if 0 /* not currently used */
|
|
||||||
static int RSA_null_mod_exp(const BIGNUM *r0, const BIGNUM *i, RSA *rsa);
|
|
||||||
#endif
|
|
||||||
static int RSA_null_init(RSA *rsa);
|
static int RSA_null_init(RSA *rsa);
|
||||||
static int RSA_null_finish(RSA *rsa);
|
static int RSA_null_finish(RSA *rsa);
|
||||||
static RSA_METHOD rsa_null_meth = {
|
static RSA_METHOD rsa_null_meth = {
|
||||||
@ -136,14 +133,6 @@ static int RSA_null_public_decrypt(int flen, const unsigned char *from,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 /* not currently used */
|
|
||||||
static int RSA_null_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa)
|
|
||||||
{
|
|
||||||
... err(RSA_F_RSA_NULL_MOD_EXP, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int RSA_null_init(RSA *rsa)
|
static int RSA_null_init(RSA *rsa)
|
||||||
{
|
{
|
||||||
return (1);
|
return (1);
|
||||||
|
@ -82,7 +82,7 @@ srp_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
|||||||
srp_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
|
srp_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
|
||||||
srp_lib.o: ../../include/openssl/sha.h ../../include/openssl/srp.h
|
srp_lib.o: ../../include/openssl/sha.h ../../include/openssl/srp.h
|
||||||
srp_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
|
srp_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
|
||||||
srp_lib.o: ../cryptlib.h ../include/internal/bn_srp.h srp_lcl.h srp_lib.c
|
srp_lib.o: ../cryptlib.h ../include/internal/bn_srp.h srp_lib.c
|
||||||
srp_vfy.o: ../../e_os.h ../../include/openssl/asn1.h
|
srp_vfy.o: ../../e_os.h ../../include/openssl/asn1.h
|
||||||
srp_vfy.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
srp_vfy.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||||
srp_vfy.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
srp_vfy.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||||
@ -94,4 +94,4 @@ srp_vfy.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
|
|||||||
srp_vfy.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
|
srp_vfy.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
|
||||||
srp_vfy.o: ../../include/openssl/srp.h ../../include/openssl/stack.h
|
srp_vfy.o: ../../include/openssl/srp.h ../../include/openssl/stack.h
|
||||||
srp_vfy.o: ../../include/openssl/symhacks.h ../../include/openssl/txt_db.h
|
srp_vfy.o: ../../include/openssl/symhacks.h ../../include/openssl/txt_db.h
|
||||||
srp_vfy.o: ../cryptlib.h srp_lcl.h srp_vfy.c
|
srp_vfy.o: ../cryptlib.h srp_vfy.c
|
||||||
|
@ -1,84 +0,0 @@
|
|||||||
/* crypto/srp/srp_lcl.h */
|
|
||||||
/*
|
|
||||||
* Written by Peter Sylvester (peter.sylvester@edelweb.fr) for the EdelKey
|
|
||||||
* project and contributed to the OpenSSL project 2004.
|
|
||||||
*/
|
|
||||||
/* ====================================================================
|
|
||||||
* Copyright (c) 2004 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.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
*
|
|
||||||
* 3. All advertising materials mentioning features or use of this
|
|
||||||
* software must display the following acknowledgment:
|
|
||||||
* "This product includes software developed by the OpenSSL Project
|
|
||||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
|
||||||
*
|
|
||||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* prior written permission. For written permission, please contact
|
|
||||||
* licensing@OpenSSL.org.
|
|
||||||
*
|
|
||||||
* 5. Products derived from this software may not be called "OpenSSL"
|
|
||||||
* nor may "OpenSSL" appear in their names without prior written
|
|
||||||
* permission of the OpenSSL Project.
|
|
||||||
*
|
|
||||||
* 6. Redistributions of any form whatsoever must retain the following
|
|
||||||
* acknowledgment:
|
|
||||||
* "This product includes software developed by the OpenSSL Project
|
|
||||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
|
||||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
|
||||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
||||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
||||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
* ====================================================================
|
|
||||||
*
|
|
||||||
* This product includes cryptographic software written by Eric Young
|
|
||||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
|
||||||
* Hudson (tjh@cryptsoft.com).
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef HEADER_SRP_LCL_H
|
|
||||||
# define HEADER_SRP_LCL_H
|
|
||||||
|
|
||||||
# include <openssl/srp.h>
|
|
||||||
# include <openssl/sha.h>
|
|
||||||
|
|
||||||
# if 0
|
|
||||||
# define srp_bn_print(a) {fprintf(stderr, #a "="); BN_print_fp(stderr,a); \
|
|
||||||
fprintf(stderr,"\n");}
|
|
||||||
# else
|
|
||||||
# define srp_bn_print(a)
|
|
||||||
# endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -59,7 +59,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef OPENSSL_NO_SRP
|
#ifndef OPENSSL_NO_SRP
|
||||||
# include "cryptlib.h"
|
# include "cryptlib.h"
|
||||||
# include "srp_lcl.h"
|
# include <openssl/sha.h>
|
||||||
# include <openssl/srp.h>
|
# include <openssl/srp.h>
|
||||||
# include <openssl/evp.h>
|
# include <openssl/evp.h>
|
||||||
# include "internal/bn_srp.h"
|
# include "internal/bn_srp.h"
|
||||||
@ -317,9 +317,6 @@ char *SRP_check_known_gN_param(BIGNUM *g, BIGNUM *N)
|
|||||||
if ((g == NULL) || (N == NULL))
|
if ((g == NULL) || (N == NULL))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
srp_bn_print(g);
|
|
||||||
srp_bn_print(N);
|
|
||||||
|
|
||||||
for (i = 0; i < KNOWN_GN_NUMBER; i++) {
|
for (i = 0; i < KNOWN_GN_NUMBER; i++) {
|
||||||
if (BN_cmp(knowngN[i].g, g) == 0 && BN_cmp(knowngN[i].N, N) == 0)
|
if (BN_cmp(knowngN[i].g, g) == 0 && BN_cmp(knowngN[i].N, N) == 0)
|
||||||
return knowngN[i].id;
|
return knowngN[i].id;
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef OPENSSL_NO_SRP
|
#ifndef OPENSSL_NO_SRP
|
||||||
# include "cryptlib.h"
|
# include "cryptlib.h"
|
||||||
# include "srp_lcl.h"
|
# include <openssl/sha.h>
|
||||||
# include <openssl/srp.h>
|
# include <openssl/srp.h>
|
||||||
# include <openssl/evp.h>
|
# include <openssl/evp.h>
|
||||||
# include <openssl/buffer.h>
|
# include <openssl/buffer.h>
|
||||||
@ -607,9 +607,6 @@ int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
|
|||||||
(verifier == NULL) || (N == NULL) || (g == NULL) || (bn_ctx == NULL))
|
(verifier == NULL) || (N == NULL) || (g == NULL) || (bn_ctx == NULL))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
srp_bn_print(N);
|
|
||||||
srp_bn_print(g);
|
|
||||||
|
|
||||||
if (*salt == NULL) {
|
if (*salt == NULL) {
|
||||||
RAND_pseudo_bytes(tmp2, SRP_RANDOM_SALT_LEN);
|
RAND_pseudo_bytes(tmp2, SRP_RANDOM_SALT_LEN);
|
||||||
|
|
||||||
@ -627,8 +624,6 @@ int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
srp_bn_print(*verifier);
|
|
||||||
|
|
||||||
result = 1;
|
result = 1;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user