[openssl-commits] [openssl] master update

Dr. Stephen Henson steve at openssl.org
Thu Mar 3 00:47:30 UTC 2016


The branch master has been updated
       via  d6c2587967f93f2f9c226bda9139ae427698f20f (commit)
       via  7f5f4102d455f7b89e8a9dd2f84fd5383303cd49 (commit)
       via  3e30fa0a6df46b39e0c69b3ab8f9d1c03cab2012 (commit)
      from  c748c1147623beaf8ea3a33d5c4b1535f74baa16 (commit)


- Log -----------------------------------------------------------------
commit d6c2587967f93f2f9c226bda9139ae427698f20f
Author: Dr. Stephen Henson <steve at openssl.org>
Date:   Wed Mar 2 21:32:40 2016 +0000

    make update
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 7f5f4102d455f7b89e8a9dd2f84fd5383303cd49
Author: Dr. Stephen Henson <steve at openssl.org>
Date:   Wed Mar 2 21:32:30 2016 +0000

    add kdf.h to mkdef.pl
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 3e30fa0a6df46b39e0c69b3ab8f9d1c03cab2012
Author: Dr. Stephen Henson <steve at openssl.org>
Date:   Wed Mar 2 04:11:02 2016 +0000

    Add KDF error codes
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 crypto/err/err.c                           |  1 +
 crypto/err/err_all.c                       |  2 ++
 crypto/err/openssl.ec                      |  1 +
 crypto/kdf/Makefile.in                     |  4 ++--
 crypto/kdf/build.info                      |  2 +-
 crypto/{buffer/buf_err.c => kdf/kdf_err.c} | 28 +++++++++++++++-------------
 crypto/kdf/tls1_prf.c                      | 12 +++++++++---
 include/openssl/err.h                      |  2 ++
 include/openssl/kdf.h                      | 18 ++++++++++++++++++
 util/libeay.num                            |  1 +
 util/mkdef.pl                              |  1 +
 11 files changed, 53 insertions(+), 19 deletions(-)
 copy crypto/{buffer/buf_err.c => kdf/kdf_err.c} (78%)

diff --git a/crypto/err/err.c b/crypto/err/err.c
index 1547181..181882d 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -157,6 +157,7 @@ static ERR_STRING_DATA ERR_str_libraries[] = {
     {ERR_PACK(ERR_LIB_HMAC, 0, 0), "HMAC routines"},
     {ERR_PACK(ERR_LIB_CT, 0, 0), "CT routines"},
     {ERR_PACK(ERR_LIB_ASYNC, 0, 0), "ASYNC routines"},
+    {ERR_PACK(ERR_LIB_KDF, 0, 0), "KDF routines"},
     {0, NULL},
 };
 
diff --git a/crypto/err/err_all.c b/crypto/err/err_all.c
index 345ce44..be6a30e 100644
--- a/crypto/err/err_all.c
+++ b/crypto/err/err_all.c
@@ -102,6 +102,7 @@
 # include <openssl/ct.h>
 #endif
 #include <openssl/async.h>
+#include <openssl/kdf.h>
 
 void err_load_crypto_strings_intern(void)
 {
@@ -158,4 +159,5 @@ void err_load_crypto_strings_intern(void)
 # endif
     ERR_load_ASYNC_strings();
 #endif
+    ERR_load_KDF_strings();
 }
diff --git a/crypto/err/openssl.ec b/crypto/err/openssl.ec
index ce9dc5c..2e15660 100644
--- a/crypto/err/openssl.ec
+++ b/crypto/err/openssl.ec
@@ -35,6 +35,7 @@ L CMS		include/openssl/cms.h		crypto/cms/cms_err.c
 L FIPS		include/openssl/fips.h		crypto/fips_err.h
 L CT		include/openssl/ct.h		crypto/ct/ct_err.c
 L ASYNC		include/openssl/async.h		crypto/async/async_err.c
+L KDF		include/openssl/kdf.h		crypto/kdf/kdf_err.c
 
 # additional header files to be scanned for function names
 L NONE		crypto/x509/x509_vfy.h		NONE
diff --git a/crypto/kdf/Makefile.in b/crypto/kdf/Makefile.in
index be4e08c..44d5762 100644
--- a/crypto/kdf/Makefile.in
+++ b/crypto/kdf/Makefile.in
@@ -15,8 +15,8 @@ CFLAGS= $(INCLUDES) $(CFLAG) $(SHARED_CFLAG)
 GENERAL=Makefile
 
 LIB=$(TOP)/libcrypto.a
-LIBSRC=tls1_prf.c
-LIBOBJ=tls1_prf.o
+LIBSRC=tls1_prf.c kdf_err.c
+LIBOBJ=tls1_prf.o kdf_err.o
 
 SRC= $(LIBSRC)
 
diff --git a/crypto/kdf/build.info b/crypto/kdf/build.info
index 8b6d9ee..320f534 100644
--- a/crypto/kdf/build.info
+++ b/crypto/kdf/build.info
@@ -1,3 +1,3 @@
 LIBS=../../libcrypto
 SOURCE[../../libcrypto]=\
-        tls1_prf.c
+        tls1_prf.c kdf_err.c
diff --git a/crypto/buffer/buf_err.c b/crypto/kdf/kdf_err.c
similarity index 78%
copy from crypto/buffer/buf_err.c
copy to crypto/kdf/kdf_err.c
index 0fb9d4f..b0321c5 100644
--- a/crypto/buffer/buf_err.c
+++ b/crypto/kdf/kdf_err.c
@@ -1,5 +1,5 @@
 /* ====================================================================
- * Copyright (c) 1999-2015 The OpenSSL Project.  All rights reserved.
+ * Copyright (c) 1999-2016 The OpenSSL Project.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -60,34 +60,36 @@
 
 #include <stdio.h>
 #include <openssl/err.h>
-#include <openssl/buffer.h>
+#include <openssl/kdf.h>
 
 /* BEGIN ERROR CODES */
 #ifndef OPENSSL_NO_ERR
 
-# define ERR_FUNC(func) ERR_PACK(ERR_LIB_BUF,func,0)
-# define ERR_REASON(reason) ERR_PACK(ERR_LIB_BUF,0,reason)
+# define ERR_FUNC(func) ERR_PACK(ERR_LIB_KDF,func,0)
+# define ERR_REASON(reason) ERR_PACK(ERR_LIB_KDF,0,reason)
 
-static ERR_STRING_DATA BUF_str_functs[] = {
-    {ERR_FUNC(BUF_F_BUF_MEM_GROW), "BUF_MEM_grow"},
-    {ERR_FUNC(BUF_F_BUF_MEM_GROW_CLEAN), "BUF_MEM_grow_clean"},
-    {ERR_FUNC(BUF_F_BUF_MEM_NEW), "BUF_MEM_new"},
+static ERR_STRING_DATA KDF_str_functs[] = {
+    {ERR_FUNC(KDF_F_PKEY_TLS1_PRF_CTRL_STR), "pkey_tls1_prf_ctrl_str"},
+    {ERR_FUNC(KDF_F_PKEY_TLS1_PRF_DERIVE), "pkey_tls1_prf_derive"},
     {0, NULL}
 };
 
-static ERR_STRING_DATA BUF_str_reasons[] = {
+static ERR_STRING_DATA KDF_str_reasons[] = {
+    {ERR_REASON(KDF_R_INVALID_DIGEST), "invalid digest"},
+    {ERR_REASON(KDF_R_MISSING_PARAMETER), "missing parameter"},
+    {ERR_REASON(KDF_R_VALUE_MISSING), "value missing"},
     {0, NULL}
 };
 
 #endif
 
-void ERR_load_BUF_strings(void)
+void ERR_load_KDF_strings(void)
 {
 #ifndef OPENSSL_NO_ERR
 
-    if (ERR_func_error_string(BUF_str_functs[0].error) == NULL) {
-        ERR_load_strings(0, BUF_str_functs);
-        ERR_load_strings(0, BUF_str_reasons);
+    if (ERR_func_error_string(KDF_str_functs[0].error) == NULL) {
+        ERR_load_strings(0, KDF_str_functs);
+        ERR_load_strings(0, KDF_str_reasons);
     }
 #endif
 }
diff --git a/crypto/kdf/tls1_prf.c b/crypto/kdf/tls1_prf.c
index 1302eb0..4b40c88 100644
--- a/crypto/kdf/tls1_prf.c
+++ b/crypto/kdf/tls1_prf.c
@@ -141,14 +141,18 @@ static int pkey_tls1_prf_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
 static int pkey_tls1_prf_ctrl_str(EVP_PKEY_CTX *ctx,
                                   const char *type, const char *value)
 {
-    if (value == NULL)
+    if (value == NULL) {
+        KDFerr(KDF_F_PKEY_TLS1_PRF_CTRL_STR, KDF_R_VALUE_MISSING);
         return 0;
+    }
     if (strcmp(type, "md") == 0) {
         TLS1_PRF_PKEY_CTX *kctx = ctx->data;
 
         const EVP_MD *md = EVP_get_digestbyname(value);
-        if (md == NULL)
+        if (md == NULL) {
+            KDFerr(KDF_F_PKEY_TLS1_PRF_CTRL_STR, KDF_R_INVALID_DIGEST);
             return 0;
+        }
         kctx->md = md;
         return 1;
     }
@@ -167,8 +171,10 @@ static int pkey_tls1_prf_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
                                 size_t *keylen)
 {
     TLS1_PRF_PKEY_CTX *kctx = ctx->data;
-    if (kctx->md == NULL || kctx->sec == NULL || kctx->seedlen == 0)
+    if (kctx->md == NULL || kctx->sec == NULL || kctx->seedlen == 0) {
+        KDFerr(KDF_F_PKEY_TLS1_PRF_DERIVE, KDF_R_MISSING_PARAMETER);
         return 0;
+    }
     return tls1_prf_alg(kctx->md, kctx->sec, kctx->seclen,
                         kctx->seed, kctx->seedlen,
                         key, *keylen);
diff --git a/include/openssl/err.h b/include/openssl/err.h
index 8c3b1aa..0b12d92 100644
--- a/include/openssl/err.h
+++ b/include/openssl/err.h
@@ -194,6 +194,7 @@ typedef struct err_state_st {
 # define ERR_LIB_JPAKE           49
 # define ERR_LIB_CT              50
 # define ERR_LIB_ASYNC           51
+# define ERR_LIB_KDF             52
 
 # define ERR_LIB_USER            128
 
@@ -232,6 +233,7 @@ typedef struct err_state_st {
 # define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
 # define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
 # define ASYNCerr(f,r) ERR_PUT_error(ERR_LIB_ASYNC,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
+# define KDFerr(f,r) ERR_PUT_error(ERR_LIB_KDF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
 
 /*
  * Borland C seems too stupid to be able to shift and do longs in the
diff --git a/include/openssl/kdf.h b/include/openssl/kdf.h
index b28a3f2..a1aed8d 100644
--- a/include/openssl/kdf.h
+++ b/include/openssl/kdf.h
@@ -74,6 +74,24 @@ extern "C" {
             EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
                               EVP_PKEY_CTRL_TLS_SEED, seedlen, (void *)seed)
 
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_KDF_strings(void);
+
+/* Error codes for the KDF functions. */
+
+/* Function codes. */
+# define KDF_F_PKEY_TLS1_PRF_CTRL_STR                     100
+# define KDF_F_PKEY_TLS1_PRF_DERIVE                       101
+
+/* Reason codes. */
+# define KDF_R_INVALID_DIGEST                             100
+# define KDF_R_MISSING_PARAMETER                          101
+# define KDF_R_VALUE_MISSING                              102
+
 #ifdef  __cplusplus
 }
 #endif
diff --git a/util/libeay.num b/util/libeay.num
index 3033574..bca9066 100755
--- a/util/libeay.num
+++ b/util/libeay.num
@@ -4803,3 +4803,4 @@ CT_POLICY_EVAL_CTX_free                 5306	1_1_0	EXIST::FUNCTION:
 CT_verify_no_bad_scts                   5307	1_1_0	EXIST::FUNCTION:
 EVP_PKEY_CTX_hex2ctrl                   5308	1_1_0	EXIST::FUNCTION:
 EVP_PKEY_CTX_str2ctrl                   5309	1_1_0	EXIST::FUNCTION:
+ERR_load_KDF_strings                    5310	1_1_0	EXIST::FUNCTION:
diff --git a/util/mkdef.pl b/util/mkdef.pl
index c716003..409a390 100755
--- a/util/mkdef.pl
+++ b/util/mkdef.pl
@@ -295,6 +295,7 @@ $crypto.=" include/openssl/srp.h";
 $crypto.=" include/openssl/modes.h";
 $crypto.=" include/openssl/async.h";
 $crypto.=" include/openssl/ct.h";
+$crypto.=" include/openssl/kdf.h";
 
 my $symhacks="include/openssl/symhacks.h";
 


More information about the openssl-commits mailing list