diff -r 641f389e9157 -r a71299154b21 crypto/weakcrypto/test/tasymmetric/script_gen/utils.c --- a/crypto/weakcrypto/test/tasymmetric/script_gen/utils.c Tue Aug 31 17:00:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,208 +0,0 @@ -/* -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - - - -/** - @file -*/ - -#include "utils.h" -#include -#include -#include - -void printBN(BIGNUM* bn) - { - char* text = BN_bn2hex(bn); - printf("%s", text); - OPENSSL_free(text); - } - -void printBin(char* data, int len) - { - BIGNUM* bn = BN_new(); - bn = BN_bin2bn(data, len, bn); - printBN(bn); - BN_free(bn); - } - -static int vectorNumber = 1; - -/** - * Print the first few lines of the action block. - */ - -void printActionHeader(char* name, char* type) - { - printf("\n"); - printf("\t%s %i (%s)\n", name, vectorNumber++, type); - printf("\t%s\n", type); - printf("\t\n"); - } - -/** - * Print the last few lines of the action block. - */ - -void printActionFooter(BOOL passes) - { - printf("\t\n"); - printf("\t\n"); - printf("\t\t%s\n", passes ? "ETrue" : "EFalse"); - printf("\t\n"); - printf("\n"); - } - -/** - * Print an element containg hex data. - */ - -void printHexElement(char* name, unsigned char* data, int len) - { - printf("\t\t<%s>", name); - printBin(data, len); - printf("\n", name); - } - -/** - * Print an element containg hex data. - */ - -void printBNElement(char* name, BIGNUM* num) - { - printf("\t\t<%s>", name); - printBN(num); - printf("\n", name); - } - -/** - * Scramble some data - used for generating tests that we expect to fail. - */ - -void scramble(unsigned char* data, int len) - { - int i; - for (i = 0 ; i < len ; ++ i) - data[i] ^= i; - } - -/** - * Print an openssl error and exit. - */ - -void processError() - { - unsigned long err = ERR_get_error(); - ERR_load_crypto_strings(); - printf("Openssl error: %s\n", ERR_error_string(err, NULL)); - exit(1); - } - -//////////////////////////////////////////////////////////////////////////////// -// Random stuff -//////////////////////////////////////////////////////////////////////////////// - -int random_value = 1; - -void random_seed(const void* buf, int num) - { - } - -int random_bytes(unsigned char *buf, int num) - { - int i; - for (i=0; i