Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8274656: Remove default_checksum and safe_checksum_type from krb5.conf
Reviewed-by: valeriep
  • Loading branch information
wangweij committed Oct 5, 2021
1 parent 03d3c03 commit 1e75203
Show file tree
Hide file tree
Showing 13 changed files with 5 additions and 1,350 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -73,56 +73,7 @@ public class Checksum {
// draft-brezak-win2k-krb-rc4-hmac-04.txt
public static final int CKSUMTYPE_HMAC_MD5_ARCFOUR = -138;

// default checksum type, -1 if not set
static int CKSUMTYPE_DEFAULT;
static int SAFECKSUMTYPE_DEFAULT;

private static boolean DEBUG = Krb5.DEBUG;
static {
initStatic();
}

public static void initStatic() {
String temp = null;
Config cfg = null;
try {
cfg = Config.getInstance();
temp = cfg.get("libdefaults", "default_checksum");
if (temp != null) {
CKSUMTYPE_DEFAULT = Config.getType(temp);
} else {
CKSUMTYPE_DEFAULT = -1;
}
} catch (Exception exc) {
if (DEBUG) {
System.out.println("Exception in getting default checksum "+
"value from the configuration. " +
"No default checksum set.");
exc.printStackTrace();
}
CKSUMTYPE_DEFAULT = -1;
}


try {
temp = cfg.get("libdefaults", "safe_checksum_type");
if (temp != null)
{
SAFECKSUMTYPE_DEFAULT = Config.getType(temp);
} else {
SAFECKSUMTYPE_DEFAULT = -1;
}
} catch (Exception exc) {
if (DEBUG) {
System.out.println("Exception in getting safe default " +
"checksum value " +
"from the configuration. " +
"No safe default checksum set.");
exc.printStackTrace();
}
SAFECKSUMTYPE_DEFAULT = -1;
}
}

/**
* Constructs a new Checksum using the raw data and type.
Expand Down Expand Up @@ -169,21 +120,6 @@ public Checksum(int new_cksumType, byte[] data,
data, data.length, key.getBytes(), usage);
}

/**
* Verifies the keyed checksum over the data passed in.
*/
public boolean verifyKeyedChecksum(byte[] data, EncryptionKey key, int usage)
throws KdcErrException, KrbApErrException, KrbCryptoException {
CksumType cksumEngine = CksumType.getInstance(cksumType);
if (!cksumEngine.isKeyed()) {
throw new KrbApErrException(Krb5.KRB_AP_ERR_INAPP_CKSUM);
} else {
return cksumEngine.verifyChecksum(
data, data.length, key.getBytes(), checksum, usage);
}
}


/**
* Verifies the checksum over the data passed in. The checksum might
* be a keyed or not.
Expand Down
Expand Up @@ -153,7 +153,6 @@ public static void refresh() throws KrbException {
}
KdcComm.initStatic();
EType.initStatic();
Checksum.initStatic();
KrbAsReqBuilder.ReferralsState.initStatic();
}

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -126,7 +126,7 @@ public EncryptedData(
}
*/

// used in KrbApRep, KrbApReq, KrbAsReq, KrbCred, KrbPriv
// used in KrbApRep, KrbApReq, KrbAsReq
public EncryptedData(
EncryptionKey key,
byte[] plaintext,
Expand Down

This file was deleted.

1 comment on commit 1e75203

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.