VirtualBox

Ignore:
Timestamp:
Mar 3, 2022 7:17:34 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
150325
Message:

libs/openssl-3.0.1: started applying and adjusting our OpenSSL changes to 3.0.1. bugref:10128

Location:
trunk/src/libs/openssl-3.0.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/openssl-3.0.1

    • Property svn:mergeinfo
      •  

        old new  
        1212/vendor/openssl/1.1.1c:131722-131725
        1313/vendor/openssl/1.1.1k:145841-145843
         14/vendor/openssl/3.0.1:150323-150324
         15/vendor/openssl/current:147554-150322
  • trunk/src/libs/openssl-3.0.1/crypto/ppccap.c

    r91772 r94082  
    22 * Copyright 2009-2021 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    4  * Licensed under the OpenSSL license (the "License").  You may not use
     4 * Licensed under the Apache License 2.0 (the "License").  You may not use
    55 * this file except in compliance with the License.  You can obtain a copy
    66 * in the file LICENSE in the source distribution or at
     
    2828#endif
    2929#include <openssl/crypto.h>
    30 #include <openssl/bn.h>
    31 #include <internal/cryptlib.h>
    32 #include <crypto/chacha.h>
    33 #include "bn/bn_local.h"
    34 
    35 #include "ppc_arch.h"
     30#include "internal/cryptlib.h"
     31#include "crypto/ppc_arch.h"
    3632
    3733unsigned int OPENSSL_ppccap_P = 0;
    3834
    3935static sigset_t all_masked;
    40 
    41 #ifdef OPENSSL_BN_ASM_MONT
    42 int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
    43                 const BN_ULONG *np, const BN_ULONG *n0, int num)
    44 {
    45     int bn_mul_mont_int(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
    46                         const BN_ULONG *np, const BN_ULONG *n0, int num);
    47     int bn_mul4x_mont_int(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
    48                           const BN_ULONG *np, const BN_ULONG *n0, int num);
    49 
    50     if (num < 4)
    51         return 0;
    52 
    53     if ((num & 3) == 0)
    54         return bn_mul4x_mont_int(rp, ap, bp, np, n0, num);
    55 
    56     /*
    57      * There used to be [optional] call to bn_mul_mont_fpu64 here,
    58      * but above subroutine is faster on contemporary processors.
    59      * Formulation means that there might be old processors where
    60      * FPU code path would be faster, POWER6 perhaps, but there was
    61      * no opportunity to figure it out...
    62      */
    63 
    64     return bn_mul_mont_int(rp, ap, bp, np, n0, num);
    65 }
    66 #endif
    67 
    68 void sha256_block_p8(void *ctx, const void *inp, size_t len);
    69 void sha256_block_ppc(void *ctx, const void *inp, size_t len);
    70 void sha256_block_data_order(void *ctx, const void *inp, size_t len);
    71 void sha256_block_data_order(void *ctx, const void *inp, size_t len)
    72 {
    73     OPENSSL_ppccap_P & PPC_CRYPTO207 ? sha256_block_p8(ctx, inp, len) :
    74         sha256_block_ppc(ctx, inp, len);
    75 }
    76 
    77 void sha512_block_p8(void *ctx, const void *inp, size_t len);
    78 void sha512_block_ppc(void *ctx, const void *inp, size_t len);
    79 void sha512_block_data_order(void *ctx, const void *inp, size_t len);
    80 void sha512_block_data_order(void *ctx, const void *inp, size_t len)
    81 {
    82     OPENSSL_ppccap_P & PPC_CRYPTO207 ? sha512_block_p8(ctx, inp, len) :
    83         sha512_block_ppc(ctx, inp, len);
    84 }
    85 
    86 #ifndef OPENSSL_NO_CHACHA
    87 void ChaCha20_ctr32_int(unsigned char *out, const unsigned char *inp,
    88                         size_t len, const unsigned int key[8],
    89                         const unsigned int counter[4]);
    90 void ChaCha20_ctr32_vmx(unsigned char *out, const unsigned char *inp,
    91                         size_t len, const unsigned int key[8],
    92                         const unsigned int counter[4]);
    93 void ChaCha20_ctr32_vsx(unsigned char *out, const unsigned char *inp,
    94                         size_t len, const unsigned int key[8],
    95                         const unsigned int counter[4]);
    96 void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp,
    97                     size_t len, const unsigned int key[8],
    98                     const unsigned int counter[4])
    99 {
    100     OPENSSL_ppccap_P & PPC_CRYPTO207
    101         ? ChaCha20_ctr32_vsx(out, inp, len, key, counter)
    102         : OPENSSL_ppccap_P & PPC_ALTIVEC
    103             ? ChaCha20_ctr32_vmx(out, inp, len, key, counter)
    104             : ChaCha20_ctr32_int(out, inp, len, key, counter);
    105 }
    106 #endif
    107 
    108 #ifndef OPENSSL_NO_POLY1305
    109 void poly1305_init_int(void *ctx, const unsigned char key[16]);
    110 void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len,
    111                          unsigned int padbit);
    112 void poly1305_emit(void *ctx, unsigned char mac[16],
    113                        const unsigned int nonce[4]);
    114 void poly1305_init_fpu(void *ctx, const unsigned char key[16]);
    115 void poly1305_blocks_fpu(void *ctx, const unsigned char *inp, size_t len,
    116                          unsigned int padbit);
    117 void poly1305_emit_fpu(void *ctx, unsigned char mac[16],
    118                        const unsigned int nonce[4]);
    119 int poly1305_init(void *ctx, const unsigned char key[16], void *func[2]);
    120 int poly1305_init(void *ctx, const unsigned char key[16], void *func[2])
    121 {
    122     if (sizeof(size_t) == 4 && (OPENSSL_ppccap_P & PPC_FPU)) {
    123         poly1305_init_fpu(ctx, key);
    124         func[0] = (void*)(uintptr_t)poly1305_blocks_fpu;
    125         func[1] = (void*)(uintptr_t)poly1305_emit_fpu;
    126     } else {
    127         poly1305_init_int(ctx, key);
    128         func[0] = (void*)(uintptr_t)poly1305_blocks;
    129         func[1] = (void*)(uintptr_t)poly1305_emit;
    130     }
    131     return 1;
    132 }
    133 #endif
    134 
    135 #ifdef ECP_NISTZ256_ASM
    136 void ecp_nistz256_mul_mont(unsigned long res[4], const unsigned long a[4],
    137                            const unsigned long b[4]);
    138 
    139 void ecp_nistz256_to_mont(unsigned long res[4], const unsigned long in[4]);
    140 void ecp_nistz256_to_mont(unsigned long res[4], const unsigned long in[4])
    141 {
    142     static const unsigned long RR[] = { 0x0000000000000003U,
    143                                         0xfffffffbffffffffU,
    144                                         0xfffffffffffffffeU,
    145                                         0x00000004fffffffdU };
    146 
    147     ecp_nistz256_mul_mont(res, in, RR);
    148 }
    149 
    150 void ecp_nistz256_from_mont(unsigned long res[4], const unsigned long in[4]);
    151 void ecp_nistz256_from_mont(unsigned long res[4], const unsigned long in[4])
    152 {
    153     static const unsigned long one[] = { 1, 0, 0, 0 };
    154 
    155     ecp_nistz256_mul_mont(res, in, one);
    156 }
    157 #endif
    15836
    15937static sigjmp_buf ill_jmp;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette