1/*- 2 * Copyright (c) 2012 Alistair Crooks <agc@NetBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25#ifndef STUBS_H_ 26#define STUBS_H_ 20120327 27 28#ifndef __BEGIN_DECLS 29# if defined(__cplusplus) 30# define __BEGIN_DECLS extern "C" { 31# define __END_DECLS } 32# else 33# define __BEGIN_DECLS 34# define __END_DECLS 35# endif 36#endif 37 38__BEGIN_DECLS 39 40/*********************************/ 41/* stubs */ 42/*********************************/ 43 44void OpenSSL_add_all_algorithms(void); 45void OPENSSL_add_all_algorithms_noconf(void); 46void CRYPTO_cleanup_all_ex_data(void); 47 48#include <stdio.h> 49 50#define BIO FILE 51 52BIO *BIO_new_fd(int /*fd*/, int /*close_flag*/); 53 54unsigned long ERR_get_error(void); 55char *ERR_error_string(unsigned long /*e*/, char */*buf*/); 56void ERR_remove_state(unsigned long /*pid*/); 57void ERR_print_errors(BIO */*bp*/); 58 59#define IDEA_KEY_SCHEDULE void 60#define des_key_schedule void 61#define des_cblock void 62#define IDEA_DECRYPT 0 63#define IDEA_ENCRYPT 1 64#define IDEA_BLOCK 8 65#define IDEA_KEY_LENGTH 16 66 67void idea_set_encrypt_key(uint8_t *key, IDEA_KEY_SCHEDULE *ks); 68void idea_set_decrypt_key(IDEA_KEY_SCHEDULE *encrypt_ks, IDEA_KEY_SCHEDULE *decrypt_ks); 69void idea_cfb64_encrypt(uint8_t *in, uint8_t *out, long length, des_key_schedule *ks, des_cblock *ivec, int *num, int enc); 70void idea_ecb_encrypt(uint8_t *in, uint8_t *out, IDEA_KEY_SCHEDULE *ks); 71 72#define CAMELLIA_KEY void 73#define CAMELLIA_DECRYPT 0 74#define CAMELLIA_ENCRYPT 1 75#define CAMELLIA_BLOCK_SIZE 16 76 77int Camellia_set_key(const unsigned char *userKey, const int bits, CAMELLIA_KEY *key); 78void Camellia_encrypt(const unsigned char *in, unsigned char *out, const CAMELLIA_KEY *key); 79void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, int *num, const int enc); 80void Camellia_decrypt(const unsigned char *in, unsigned char *out, const CAMELLIA_KEY *key); 81 82#define const_DES_cblock void 83#define DES_cblock void 84#define DES_key_schedule void 85#define DES_DECRYPT 0 86#define DES_ENCRYPT 1 87 88int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule); 89void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, DES_key_schedule *ks1,DES_key_schedule *ks2, DES_key_schedule *ks3, int enc); 90void DES_ede3_cfb64_encrypt(const unsigned char *in,unsigned char *out, long length,DES_key_schedule *ks1, DES_key_schedule *ks2,DES_key_schedule *ks3, DES_cblock *ivec,int *num,int enc); 91 92__END_DECLS 93 94#endif 95