Remove some more crypto ifdef, fix a few small bugs
This commit is contained in:
parent
27da6d4a0e
commit
6b5c4c3359
8 changed files with 55 additions and 37 deletions
|
@ -24,8 +24,8 @@
|
||||||
#include "tls/bignum.h"
|
#include "tls/bignum.h"
|
||||||
#include "tls/asn1.h"
|
#include "tls/asn1.h"
|
||||||
|
|
||||||
|
#include "sha1_i.h"
|
||||||
#ifdef CONFIG_CRYPTO_INTERNAL
|
#include "md5_i.h"
|
||||||
|
|
||||||
#ifdef CONFIG_TLS_INTERNAL
|
#ifdef CONFIG_TLS_INTERNAL
|
||||||
|
|
||||||
|
@ -831,6 +831,3 @@ error:
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* EAP_FAST || EAP_SERVER_FAST || CONFIG_WPS */
|
#endif /* EAP_FAST || EAP_SERVER_FAST || CONFIG_WPS */
|
||||||
|
|
||||||
|
|
||||||
#endif /* CONFIG_CRYPTO_INTERNAL */
|
|
||||||
|
|
|
@ -16,10 +16,9 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "sha1.h"
|
#include "sha1.h"
|
||||||
|
#include "sha1_i.h"
|
||||||
#include "crypto.h"
|
#include "crypto.h"
|
||||||
|
|
||||||
void SHA1Transform(u32 state[5], const unsigned char buffer[64]);
|
|
||||||
|
|
||||||
|
|
||||||
int fips186_2_prf(const u8 *seed, size_t seed_len, u8 *x, size_t xlen)
|
int fips186_2_prf(const u8 *seed, size_t seed_len, u8 *x, size_t xlen)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
|
#include "md5_i.h"
|
||||||
#include "crypto.h"
|
#include "crypto.h"
|
||||||
|
|
||||||
struct MD5Context {
|
struct MD5Context {
|
||||||
|
@ -24,12 +25,6 @@ struct MD5Context {
|
||||||
u8 in[64];
|
u8 in[64];
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef CONFIG_CRYPTO_INTERNAL
|
|
||||||
static void MD5Init(struct MD5Context *context);
|
|
||||||
static void MD5Update(struct MD5Context *context, unsigned char const *buf,
|
|
||||||
unsigned len);
|
|
||||||
static void MD5Final(unsigned char digest[16], struct MD5Context *context);
|
|
||||||
#endif /* CONFIG_CRYPTO_INTERNAL */
|
|
||||||
static void MD5Transform(u32 buf[4], u32 const in[16]);
|
static void MD5Transform(u32 buf[4], u32 const in[16]);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,14 +21,4 @@ void hmac_md5_vector(const u8 *key, size_t key_len, size_t num_elem,
|
||||||
const u8 *addr[], const size_t *len, u8 *mac);
|
const u8 *addr[], const size_t *len, u8 *mac);
|
||||||
void hmac_md5(const u8 *key, size_t key_len, const u8 *data, size_t data_len,
|
void hmac_md5(const u8 *key, size_t key_len, const u8 *data, size_t data_len,
|
||||||
u8 *mac);
|
u8 *mac);
|
||||||
|
|
||||||
#ifdef CONFIG_CRYPTO_INTERNAL
|
|
||||||
struct MD5Context;
|
|
||||||
|
|
||||||
void MD5Init(struct MD5Context *context);
|
|
||||||
void MD5Update(struct MD5Context *context, unsigned char const *buf,
|
|
||||||
unsigned len);
|
|
||||||
void MD5Final(unsigned char digest[16], struct MD5Context *context);
|
|
||||||
#endif /* CONFIG_CRYPTO_INTERNAL */
|
|
||||||
|
|
||||||
#endif /* MD5_H */
|
#endif /* MD5_H */
|
||||||
|
|
25
src/crypto/md5_i.h
Normal file
25
src/crypto/md5_i.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* MD5 internal definitions
|
||||||
|
* Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* Alternatively, this software may be distributed under the terms of BSD
|
||||||
|
* license.
|
||||||
|
*
|
||||||
|
* See README and COPYING for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MD5_I_H
|
||||||
|
#define MD5_I_H
|
||||||
|
|
||||||
|
struct MD5Context;
|
||||||
|
|
||||||
|
void MD5Init(struct MD5Context *context);
|
||||||
|
void MD5Update(struct MD5Context *context, unsigned char const *buf,
|
||||||
|
unsigned len);
|
||||||
|
void MD5Final(unsigned char digest[16], struct MD5Context *context);
|
||||||
|
|
||||||
|
#endif /* MD5_I_H */
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "sha1.h"
|
#include "sha1.h"
|
||||||
|
#include "sha1_i.h"
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
#include "crypto.h"
|
#include "crypto.h"
|
||||||
|
|
||||||
|
@ -27,11 +28,6 @@ struct SHA1Context {
|
||||||
|
|
||||||
typedef struct SHA1Context SHA1_CTX;
|
typedef struct SHA1Context SHA1_CTX;
|
||||||
|
|
||||||
#ifndef CONFIG_CRYPTO_INTERNAL
|
|
||||||
static void SHA1Init(struct SHA1Context *context);
|
|
||||||
static void SHA1Update(struct SHA1Context *context, const void *data, u32 len);
|
|
||||||
static void SHA1Final(unsigned char digest[20], struct SHA1Context *context);
|
|
||||||
#endif /* CONFIG_CRYPTO_INTERNAL */
|
|
||||||
void SHA1Transform(u32 state[5], const unsigned char buffer[64]);
|
void SHA1Transform(u32 state[5], const unsigned char buffer[64]);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,13 +30,4 @@ int __must_check tls_prf(const u8 *secret, size_t secret_len,
|
||||||
u8 *out, size_t outlen);
|
u8 *out, size_t outlen);
|
||||||
void pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len,
|
void pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len,
|
||||||
int iterations, u8 *buf, size_t buflen);
|
int iterations, u8 *buf, size_t buflen);
|
||||||
|
|
||||||
#ifdef CONFIG_CRYPTO_INTERNAL
|
|
||||||
struct SHA1Context;
|
|
||||||
|
|
||||||
void SHA1Init(struct SHA1Context *context);
|
|
||||||
void SHA1Update(struct SHA1Context *context, const void *data, u32 len);
|
|
||||||
void SHA1Final(unsigned char digest[20], struct SHA1Context *context);
|
|
||||||
#endif /* CONFIG_CRYPTO_INTERNAL */
|
|
||||||
|
|
||||||
#endif /* SHA1_H */
|
#endif /* SHA1_H */
|
||||||
|
|
25
src/crypto/sha1_i.h
Normal file
25
src/crypto/sha1_i.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* SHA1 internal definitions
|
||||||
|
* Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* Alternatively, this software may be distributed under the terms of BSD
|
||||||
|
* license.
|
||||||
|
*
|
||||||
|
* See README and COPYING for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SHA1_I_H
|
||||||
|
#define SHA1_I_H
|
||||||
|
|
||||||
|
struct SHA1Context;
|
||||||
|
|
||||||
|
void SHA1Init(struct SHA1Context *context);
|
||||||
|
void SHA1Update(struct SHA1Context *context, const void *data, u32 len);
|
||||||
|
void SHA1Final(unsigned char digest[20], struct SHA1Context *context);
|
||||||
|
void SHA1Transform(u32 state[5], const unsigned char buffer[64]);
|
||||||
|
|
||||||
|
#endif /* SHA1_I_H */
|
Loading…
Reference in a new issue