OpenSSL 1.1.1-pre2
This commit is contained in:
+36
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include "internal/refcount.h"
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/objects.h>
|
||||
@@ -55,7 +56,7 @@ int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode)
|
||||
|
||||
if (mode >= 0)
|
||||
pkey->save_parameters = mode;
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC
|
||||
@@ -64,10 +65,10 @@ int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode)
|
||||
|
||||
if (mode >= 0)
|
||||
pkey->save_parameters = mode;
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
|
||||
@@ -160,7 +161,7 @@ int EVP_PKEY_up_ref(EVP_PKEY *pkey)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (CRYPTO_atomic_add(&pkey->references, 1, &i, pkey->lock) <= 0)
|
||||
if (CRYPTO_UP_REF(&pkey->references, &i, pkey->lock) <= 0)
|
||||
return 0;
|
||||
|
||||
REF_PRINT_COUNT("EVP_PKEY", pkey);
|
||||
@@ -269,6 +270,35 @@ const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len)
|
||||
return os->data;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_POLY1305
|
||||
const unsigned char *EVP_PKEY_get0_poly1305(const EVP_PKEY *pkey, size_t *len)
|
||||
{
|
||||
ASN1_OCTET_STRING *os = NULL;
|
||||
if (pkey->type != EVP_PKEY_POLY1305) {
|
||||
EVPerr(EVP_F_EVP_PKEY_GET0_POLY1305, EVP_R_EXPECTING_A_POLY1305_KEY);
|
||||
return NULL;
|
||||
}
|
||||
os = EVP_PKEY_get0(pkey);
|
||||
*len = os->length;
|
||||
return os->data;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_SIPHASH
|
||||
const unsigned char *EVP_PKEY_get0_siphash(const EVP_PKEY *pkey, size_t *len)
|
||||
{
|
||||
ASN1_OCTET_STRING *os = NULL;
|
||||
|
||||
if (pkey->type != EVP_PKEY_SIPHASH) {
|
||||
EVPerr(EVP_F_EVP_PKEY_GET0_SIPHASH, EVP_R_EXPECTING_A_SIPHASH_KEY);
|
||||
return NULL;
|
||||
}
|
||||
os = EVP_PKEY_get0(pkey);
|
||||
*len = os->length;
|
||||
return os->data;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key)
|
||||
{
|
||||
@@ -412,7 +442,7 @@ void EVP_PKEY_free(EVP_PKEY *x)
|
||||
if (x == NULL)
|
||||
return;
|
||||
|
||||
CRYPTO_atomic_add(&x->references, -1, &i, x->lock);
|
||||
CRYPTO_DOWN_REF(&x->references, &i, x->lock);
|
||||
REF_PRINT_COUNT("EVP_PKEY", x);
|
||||
if (i > 0)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user