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 #include <sys/types.h> 26 #include <sys/param.h> 27 28 #ifdef _KERNEL 29 # include <sys/kmem.h> 30 #else 31 # include <arpa/inet.h> 32 # include <ctype.h> 33 # include <inttypes.h> 34 # include <stdarg.h> 35 # include <stdio.h> 36 # include <stdlib.h> 37 # include <string.h> 38 # include <time.h> 39 # include <unistd.h> 40 #endif 41 42 #include "misc.h" 43 #include "bn.h" 44 45 #include "stubs.h" 46 47 #ifndef USE_ARG 48 #define USE_ARG(x) /*LINTED*/(void)&(x) 49 #endif 50 51 void 52 OpenSSL_add_all_algorithms(void) 53 { 54 } 55 56 void 57 OPENSSL_add_all_algorithms_noconf(void) 58 { 59 } 60 61 void 62 CRYPTO_cleanup_all_ex_data(void) 63 { 64 } 65 66 BIO * 67 BIO_new_fd(int fd, int close_flag) 68 { 69 USE_ARG(fd); 70 USE_ARG(close_flag); 71 return NULL; 72 } 73 74 unsigned long 75 ERR_get_error(void) 76 { 77 return 0; 78 } 79 80 char * 81 ERR_error_string(unsigned long e, char *buf) 82 { 83 static char staticbuf[120]; 84 85 if (buf == NULL) { 86 buf = staticbuf; 87 } 88 snprintf(buf, 120, "error:%lu:netssl:[unknown function]:[unknown error]", e); 89 return buf; 90 } 91 92 void 93 ERR_remove_state(unsigned long pid) 94 { 95 USE_ARG(pid); 96 } 97 98 void 99 ERR_print_errors(BIO *bp) 100 { 101 USE_ARG(bp); 102 } 103 104 void 105 idea_set_encrypt_key(uint8_t *key, IDEA_KEY_SCHEDULE *ks) 106 { 107 printf("idea_set_encrypt_key stubbed\n"); 108 USE_ARG(key); 109 USE_ARG(ks); 110 } 111 112 void 113 idea_set_decrypt_key(IDEA_KEY_SCHEDULE *encrypt_ks, IDEA_KEY_SCHEDULE *decrypt_ks) 114 { 115 printf("idea_set_decrypt_key stubbed\n"); 116 USE_ARG(encrypt_ks); 117 USE_ARG(decrypt_ks); 118 } 119 120 void 121 idea_cfb64_encrypt(uint8_t *in, uint8_t *out, long length, des_key_schedule *ks, des_cblock *ivec, int *num, int enc) 122 { 123 printf("idea_cfb64_encrypt stubbed\n"); 124 USE_ARG(in); 125 USE_ARG(out); 126 USE_ARG(length); 127 USE_ARG(ks); 128 USE_ARG(ivec); 129 USE_ARG(num); 130 USE_ARG(enc); 131 } 132 133 void 134 idea_ecb_encrypt(uint8_t *in, uint8_t *out, IDEA_KEY_SCHEDULE *ks) 135 { 136 printf("idea_cfb64_decrypt stubbed\n"); 137 USE_ARG(in); 138 USE_ARG(out); 139 USE_ARG(ks); 140 } 141 142 int 143 Camellia_set_key(const unsigned char *userKey, const int bits, CAMELLIA_KEY *key) 144 { 145 printf("Camellia_set_key stubbed\n"); 146 USE_ARG(userKey); 147 USE_ARG(bits); 148 USE_ARG(key); 149 return 0; 150 } 151 152 void 153 Camellia_encrypt(const unsigned char *in, unsigned char *out, const CAMELLIA_KEY *key) 154 { 155 printf("Camellia_encrypt stubbed\n"); 156 USE_ARG(in); 157 USE_ARG(out); 158 USE_ARG(key); 159 } 160 161 void 162 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) 163 { 164 printf("Camellia_cfb128_encrypt stubbed\n"); 165 USE_ARG(in); 166 USE_ARG(out); 167 USE_ARG(length); 168 USE_ARG(key); 169 USE_ARG(ivec); 170 USE_ARG(num); 171 USE_ARG(enc); 172 } 173 174 void 175 Camellia_decrypt(const unsigned char *in, unsigned char *out, const CAMELLIA_KEY *key) 176 { 177 printf("Camellia_decrypt stubbed\n"); 178 USE_ARG(in); 179 USE_ARG(out); 180 USE_ARG(key); 181 } 182 183 int 184 DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule) 185 { 186 printf("DES_set_key stubbed\n"); 187 USE_ARG(key); 188 USE_ARG(schedule); 189 return 0; 190 } 191 192 void 193 DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, DES_key_schedule *ks1,DES_key_schedule *ks2, DES_key_schedule *ks3, int enc) 194 { 195 printf("DES_ecb3_encrypt stubbed\n"); 196 USE_ARG(input); 197 USE_ARG(output); 198 USE_ARG(ks1); 199 USE_ARG(ks2); 200 USE_ARG(ks3); 201 USE_ARG(enc); 202 } 203 204 void 205 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) 206 { 207 printf("DES_ede3_cfb64_encrypt stubbed\n"); 208 USE_ARG(in); 209 USE_ARG(out); 210 USE_ARG(length); 211 USE_ARG(ks1); 212 USE_ARG(ks2); 213 USE_ARG(ks3); 214 USE_ARG(ivec); 215 USE_ARG(num); 216 USE_ARG(enc); 217 } 218