Commit 0145dd32 authored by Richard Levitte's avatar Richard Levitte
Browse files

Add automatic initializations support for EVP_MAC objects

parent 567db2c1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ SOURCE[../../libcrypto]=\
        e_old.c pmeth_lib.c pmeth_fn.c pmeth_gn.c m_sigver.c \
        e_aes_cbc_hmac_sha1.c e_aes_cbc_hmac_sha256.c e_rc4_hmac_md5.c \
        e_chacha20_poly1305.c cmeth_lib.c \
        mac_lib.c
        mac_lib.c c_allm.c

INCLUDE[e_aes.o]=.. ../modes
INCLUDE[e_aes_cbc_hmac_sha1.o]=../modes

crypto/evp/c_allm.c

0 → 100644
+15 −0
Original line number Diff line number Diff line
/*
 * Copyright 2018 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
 * in the file LICENSE in the source distribution or at
 * https://www.openssl.org/source/license.html
 */

#include <openssl/evp.h>
#include "internal/evp_int.h"

void openssl_add_all_macs_int(void)
{
}
+1 −0
Original line number Diff line number Diff line
@@ -448,6 +448,7 @@ struct evp_pkey_st {

void openssl_add_all_ciphers_int(void);
void openssl_add_all_digests_int(void);
void openssl_add_all_macs_int(void);
void evp_cleanup_int(void);
void evp_app_cleanup_int(void);

+25 −0
Original line number Diff line number Diff line
@@ -235,6 +235,23 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_add_all_digests)
    return 1;
}

static CRYPTO_ONCE add_all_macs = CRYPTO_ONCE_STATIC_INIT;
DEFINE_RUN_ONCE_STATIC(ossl_init_add_all_macs)
{
    /*
     * OPENSSL_NO_AUTOALGINIT is provided here to prevent at compile time
     * pulling in all the macs during static linking
     */
#ifndef OPENSSL_NO_AUTOALGINIT
# ifdef OPENSSL_INIT_DEBUG
    fprintf(stderr, "OPENSSL_INIT: ossl_init_add_all_macs: "
                    "openssl_add_all_macs_int()\n");
# endif
    openssl_add_all_macs_int();
#endif
    return 1;
}

DEFINE_RUN_ONCE_STATIC(ossl_init_no_add_algs)
{
    /* Do nothing */
@@ -619,6 +636,14 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings)
            && !RUN_ONCE(&add_all_digests, ossl_init_add_all_digests))
        return 0;

    if ((opts & OPENSSL_INIT_NO_ADD_ALL_MACS)
            && !RUN_ONCE(&add_all_macs, ossl_init_no_add_algs))
        return 0;

    if ((opts & OPENSSL_INIT_ADD_ALL_MACS)
            && !RUN_ONCE(&add_all_macs, ossl_init_add_all_macs))
        return 0;

    if ((opts & OPENSSL_INIT_ATFORK)
            && !openssl_init_fork_handlers())
        return 0;
+8 −1
Original line number Diff line number Diff line
@@ -377,7 +377,14 @@ int CRYPTO_memcmp(const void * in_a, const void * in_b, size_t len);
/* OPENSSL_INIT_ZLIB                         0x00010000L */
# define OPENSSL_INIT_ATFORK                 0x00020000L
/* OPENSSL_INIT_BASE_ONLY                    0x00040000L */
/* OPENSSL_INIT flag range 0xfff00000 reserved for OPENSSL_init_ssl() */
/* FREE: 0x00080000L */
/* OPENSSL_INIT flag range 0x03f00000 reserved for OPENSSL_init_ssl() */
# define OPENSSL_INIT_NO_ADD_ALL_MACS        0x04000000L
# define OPENSSL_INIT_ADD_ALL_MACS           0x08000000L
/* FREE: 0x10000000L */
/* FREE: 0x20000000L */
/* FREE: 0x40000000L */
/* FREE: 0x80000000L */
/* Max OPENSSL_INIT flag value is 0x80000000 */

/* openssl and dasync not counted as builtin */
Loading