OLD | NEW |
1 /* crypto/evp/e_seed.c -*- mode:C; c-file-style: "eay" -*- */ | 1 /* crypto/evp/e_seed.c -*- mode:C; c-file-style: "eay" -*- */ |
2 /* ==================================================================== | 2 /* ==================================================================== |
3 * Copyright (c) 2007 The OpenSSL Project. All rights reserved. | 3 * Copyright (c) 2007 The OpenSSL Project. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 * OF THE POSSIBILITY OF SUCH DAMAGE. | 47 * OF THE POSSIBILITY OF SUCH DAMAGE. |
48 * ==================================================================== | 48 * ==================================================================== |
49 * | 49 * |
50 * This product includes cryptographic software written by Eric Young | 50 * This product includes cryptographic software written by Eric Young |
51 * (eay@cryptsoft.com). This product includes software written by Tim | 51 * (eay@cryptsoft.com). This product includes software written by Tim |
52 * Hudson (tjh@cryptsoft.com). | 52 * Hudson (tjh@cryptsoft.com). |
53 * | 53 * |
54 */ | 54 */ |
55 | 55 |
56 #include <openssl/opensslconf.h> | 56 #include <openssl/opensslconf.h> |
| 57 #ifndef OPENSSL_NO_SEED |
57 #include <openssl/evp.h> | 58 #include <openssl/evp.h> |
58 #include <openssl/err.h> | 59 #include <openssl/err.h> |
59 #include <string.h> | 60 #include <string.h> |
60 #include <assert.h> | 61 #include <assert.h> |
61 #ifndef OPENSSL_NO_SEED | |
62 #include <openssl/seed.h> | 62 #include <openssl/seed.h> |
63 #include "evp_locl.h" | 63 #include "evp_locl.h" |
64 | 64 |
65 static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const un
signed char *iv, int enc); | 65 static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const un
signed char *iv, int enc); |
66 | 66 |
67 typedef struct | 67 typedef struct |
68 { | 68 { |
69 SEED_KEY_SCHEDULE ks; | 69 SEED_KEY_SCHEDULE ks; |
70 } EVP_SEED_KEY; | 70 } EVP_SEED_KEY; |
71 | 71 |
72 IMPLEMENT_BLOCK_CIPHER(seed, ks, SEED, EVP_SEED_KEY, NID_seed, | 72 IMPLEMENT_BLOCK_CIPHER(seed, ks, SEED, EVP_SEED_KEY, NID_seed, |
73 16, 16, 16, 128, | 73 16, 16, 16, 128, |
74 0, seed_init_key, 0, 0, 0, 0) | 74 0, seed_init_key, 0, 0, 0, 0) |
75 | 75 |
76 static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 76 static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
77 const unsigned char *iv, int enc) | 77 const unsigned char *iv, int enc) |
78 { | 78 { |
79 SEED_set_key(key, ctx->cipher_data); | 79 SEED_set_key(key, ctx->cipher_data); |
80 return 1; | 80 return 1; |
81 } | 81 } |
82 | 82 |
83 #endif | 83 #endif |
OLD | NEW |