Print this page
8982 Support building with OpenSSL 1.1

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/krb5/plugins/preauth/pkinit/pkinit_crypto_openssl.h
          +++ new/usr/src/lib/krb5/plugins/preauth/pkinit/pkinit_crypto_openssl.h
↓ open down ↓ 22 lines elided ↑ open up ↑
  23   23   * REGENTS OF THE UNIVERSITY OF MICHIGAN SHALL NOT BE LIABLE
  24   24   * FOR ANY DAMAGES, INCLUDING SPECIAL, INDIRECT, INCIDENTAL, OR
  25   25   * CONSEQUENTIAL DAMAGES, WITH RESPECT TO ANY CLAIM ARISING
  26   26   * OUT OF OR IN CONNECTION WITH THE USE OF THE SOFTWARE, EVEN
  27   27   * IF IT HAS BEEN OR IS HEREAFTER ADVISED OF THE POSSIBILITY OF
  28   28   * SUCH DAMAGES.
  29   29   */
  30   30  
  31   31  /*
  32   32   * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
       33 + * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
  33   34   */
  34   35  
  35   36  #ifndef _PKINIT_CRYPTO_OPENSSL_H
  36   37  #define _PKINIT_CRYPTO_OPENSSL_H
  37   38  
  38   39  #include <openssl/bn.h>
  39   40  #include <openssl/dh.h>
  40   41  #include <openssl/x509.h>
  41   42  #include <openssl/pkcs7.h>
  42   43  #include <openssl/pkcs12.h>
  43   44  #include <openssl/obj_mac.h>
  44   45  #include <openssl/x509v3.h>
  45   46  #include <openssl/err.h>
  46   47  #include <openssl/evp.h>
  47      -#include <openssl/asn1_mac.h>
  48   48  #include <openssl/sha.h>
  49   49  #include <openssl/asn1.h>
  50   50  #include <openssl/pem.h>
       51 +#include <openssl/rsa.h>
  51   52  
       53 +#if OPENSSL_VERSION_NUMBER < 0x10100000L
       54 +#include <openssl/asn1_mac.h>
       55 +#else
       56 +#include <openssl/asn1t.h>
       57 +#endif
       58 +
  52   59  #include "pkinit.h"
  53   60  
  54   61  #define DN_BUF_LEN  256
  55   62  #define MAX_CREDS_ALLOWED 20
  56   63  
  57   64  struct _pkinit_cred_info {
  58   65      X509 *cert;
  59   66      EVP_PKEY *key;
  60   67  #ifndef WITHOUT_PKCS11
  61   68      CK_BYTE_PTR cert_id;
↓ open down ↓ 93 lines elided ↑ open up ↑
 155  162  static krb5_error_code pkinit_init_dh_params(pkinit_plg_crypto_context );
 156  163  static void pkinit_fini_dh_params(pkinit_plg_crypto_context );
 157  164  
 158  165  static krb5_error_code pkinit_init_certs(pkinit_identity_crypto_context ctx);
 159  166  static void pkinit_fini_certs(pkinit_identity_crypto_context ctx);
 160  167  
 161  168  static krb5_error_code pkinit_init_pkcs11(pkinit_identity_crypto_context ctx);
 162  169  static void pkinit_fini_pkcs11(pkinit_identity_crypto_context ctx);
 163  170  
 164  171  static krb5_error_code pkinit_encode_dh_params
 165      -        (BIGNUM *, BIGNUM *, BIGNUM *, unsigned char **, unsigned int *);
      172 +        (const BIGNUM *, const BIGNUM *, const BIGNUM *,
      173 +                unsigned char **, unsigned int *);
 166  174  static DH *pkinit_decode_dh_params
 167  175          (DH **, unsigned char **, unsigned int );
 168  176  static int pkinit_check_dh_params
 169      -        (BIGNUM * p1, BIGNUM * p2, BIGNUM * g1, BIGNUM * q1);
      177 +        (const BIGNUM *p1, const BIGNUM *p2, const BIGNUM *g1,
      178 +                const BIGNUM *q1);
 170  179  
 171  180  static krb5_error_code pkinit_sign_data
 172  181          (krb5_context context, pkinit_identity_crypto_context cryptoctx,
 173  182                  unsigned char *data, unsigned int data_len,
 174  183                  unsigned char **sig, unsigned int *sig_len);
 175  184  
 176  185  static krb5_error_code create_signature
 177  186          (unsigned char **, unsigned int *, unsigned char *, unsigned int,
 178  187                  EVP_PKEY *pkey);
 179  188  
↓ open down ↓ 88 lines elided ↑ open up ↑
 268  277  wrap_signeddata(unsigned char *data, unsigned int data_len,
 269  278                  unsigned char **out, unsigned int *out_len,
 270  279                  int is_longhorn_server);
 271  280  #else
 272  281  static int
 273  282  wrap_signeddata(unsigned char *data, unsigned int data_len,
 274  283                  unsigned char **out, unsigned int *out_len);
 275  284  #endif
 276  285  
 277  286  /* This handy macro borrowed from crypto/x509v3/v3_purp.c */
      287 +
      288 +#if OPENSSL_VERSION_NUMBER < 0x10100000L
 278  289  #define ku_reject(x, usage) \
 279  290          (((x)->ex_flags & EXFLAG_KUSAGE) && !((x)->ex_kusage & (usage)))
      291 +#else
      292 +#define ku_reject(x, usage) \
      293 +        ((X509_get_extension_flags(x) & EXFLAG_KUSAGE) && \
      294 +        !(X509_get_key_usage(x) & (usage)))
      295 +#endif
 280  296  
 281  297  static char *
 282  298  pkinit_pkcs11_code_to_text(int err);
 283  299  
 284  300  #endif  /* _PKINIT_CRYPTO_OPENSSL_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX