diff options
author | Pauli <paul.dale@oracle.com> | 2019-08-21 18:54:35 +1000 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2019-09-06 19:27:57 +1000 |
commit | fb9e6dd6f8b1de99c880ff3b458d6bc0dec907bb (patch) | |
tree | 60daa87494f3243dc9cce72284843ba8981b21cf /crypto/kdf | |
parent | 55accfd2f11d02cf4cfdc6077216ae59f1748f6a (diff) | |
download | openssl-fb9e6dd6f8b1de99c880ff3b458d6bc0dec907bb.tar.gz |
KDF/PRF updates to libcrypto
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9662)
Diffstat (limited to 'crypto/kdf')
-rw-r--r-- | crypto/kdf/build.info | 3 | ||||
-rw-r--r-- | crypto/kdf/kdf_local.h | 22 | ||||
-rw-r--r-- | crypto/kdf/kdf_util.c | 73 |
3 files changed, 1 insertions, 97 deletions
diff --git a/crypto/kdf/build.info b/crypto/kdf/build.info index 4fdaccddec..bc4b31ce91 100644 --- a/crypto/kdf/build.info +++ b/crypto/kdf/build.info @@ -1,4 +1,3 @@ LIBS=../../libcrypto SOURCE[../../libcrypto]=\ - tls1_prf.c kdf_err.c kdf_util.c hkdf.c scrypt.c pbkdf2.c sshkdf.c \ - sskdf.c x942kdf.c + kdf_err.c kdf_util.c diff --git a/crypto/kdf/kdf_local.h b/crypto/kdf/kdf_local.h deleted file mode 100644 index 4956dad920..0000000000 --- a/crypto/kdf/kdf_local.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. - * - * Licensed under the Apache License 2.0 (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -int call_ctrl(int (*ctrl)(EVP_KDF_IMPL *impl, int cmd, va_list args), - EVP_KDF_IMPL *impl, int cmd, ...); -int kdf_str2ctrl(EVP_KDF_IMPL *impl, - int (*ctrl)(EVP_KDF_IMPL *impl, int cmd, va_list args), - int cmd, const char *str); -int kdf_hex2ctrl(EVP_KDF_IMPL *impl, - int (*ctrl)(EVP_KDF_IMPL *impl, int cmd, va_list args), - int cmd, const char *hex); -int kdf_md2ctrl(EVP_KDF_IMPL *impl, - int (*ctrl)(EVP_KDF_IMPL *impl, int cmd, va_list args), - int cmd, const char *md_name); - diff --git a/crypto/kdf/kdf_util.c b/crypto/kdf/kdf_util.c deleted file mode 100644 index 8eb6d26b34..0000000000 --- a/crypto/kdf/kdf_util.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. - * - * Licensed under the Apache License 2.0 (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#include <string.h> -#include <stdarg.h> -#include <openssl/kdf.h> -#include <openssl/evp.h> -#include "internal/cryptlib.h" -#include "internal/evp_int.h" -#include "internal/numbers.h" -#include "kdf_local.h" - -int call_ctrl(int (*ctrl)(EVP_KDF_IMPL *impl, int cmd, va_list args), - EVP_KDF_IMPL *impl, int cmd, ...) -{ - int ret; - va_list args; - - va_start(args, cmd); - ret = ctrl(impl, cmd, args); - va_end(args); - - return ret; -} - -/* Utility functions to send a string or hex string to a ctrl */ - -int kdf_str2ctrl(EVP_KDF_IMPL *impl, - int (*ctrl)(EVP_KDF_IMPL *impl, int cmd, va_list args), - int cmd, const char *str) -{ - return call_ctrl(ctrl, impl, cmd, (const unsigned char *)str, strlen(str)); -} - -int kdf_hex2ctrl(EVP_KDF_IMPL *impl, - int (*ctrl)(EVP_KDF_IMPL *impl, int cmd, va_list args), - int cmd, const char *hex) -{ - unsigned char *bin; - long binlen; - int ret = -1; - - bin = OPENSSL_hexstr2buf(hex, &binlen); - if (bin == NULL) - return 0; - - if (binlen <= INT_MAX) - ret = call_ctrl(ctrl, impl, cmd, bin, (size_t)binlen); - OPENSSL_free(bin); - return ret; -} - -/* Pass a message digest to a ctrl */ -int kdf_md2ctrl(EVP_KDF_IMPL *impl, - int (*ctrl)(EVP_KDF_IMPL *impl, int cmd, va_list args), - int cmd, const char *md_name) -{ - const EVP_MD *md; - - if (md_name == NULL || (md = EVP_get_digestbyname(md_name)) == NULL) { - KDFerr(KDF_F_KDF_MD2CTRL, KDF_R_INVALID_DIGEST); - return 0; - } - return call_ctrl(ctrl, impl, cmd, md); -} - |