/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include "libsoftcrypto.h"
typedef struct {
int num;
const char *str;
} mechstr_t;
/*
* If a new enum value is added to ucrypto_mech_t AND support for that new
* mechanism is implemented by this library, it must also be inserted here
* in mechstrlist in the same order it appears in the ucrypto_mech_t enum.
* ucrypto_id2mech() uses bsearch() to traverse the list, thus order matters.
*
* JDK hardwired to the ucrypto_mech_t enum values. Do not change existing
* enum values. Do not add an entry here if only the enum value is defined,
* but there is no actual support implemented for the mechanism. See also
* the comment for ucrypto_mech_t.
*/
{CRYPTO_AES_ECB, "CRYPTO_AES_ECB"},
{CRYPTO_AES_CBC, "CRYPTO_AES_CBC"},
{CRYPTO_AES_CBC_PAD, "CRYPTO_AES_CBC_PAD"},
{CRYPTO_AES_CTR, "CRYPTO_AES_CTR"},
{CRYPTO_AES_CCM, "CRYPTO_AES_CCM"},
{CRYPTO_AES_GCM, "CRYPTO_AES_GCM"},
{CRYPTO_AES_CFB128, "CRYPTO_AES_CFB128"},
{CRYPTO_AES_XTS, "CRYPTO_AES_XTS"},
{CRYPTO_AES_XCBC_MAC, "CRYPTO_AES_XCBC_MAC"},
{CRYPTO_RSA_PKCS, "CRYPTO_RSA_PKCS"},
{CRYPTO_RSA_X_509, "CRYPTO_RSA_X_509"},
{CRYPTO_MD5_RSA_PKCS, "CRYPTO_MD5_RSA_PKCS"},
{CRYPTO_SHA1_RSA_PKCS, "CRYPTO_SHA1_RSA_PKCS"},
{CRYPTO_SHA256_RSA_PKCS, "CRYPTO_SHA256_RSA_PKCS"},
{CRYPTO_SHA384_RSA_PKCS, "CRYPTO_SHA384_RSA_PKCS"},
{CRYPTO_SHA512_RSA_PKCS, "CRYPTO_SHA512_RSA_PKCS"},
{CRYPTO_SHA224_RSA_PKCS, "CRYPTO_SHA224_RSA_PKCS"}
};
/* bsearch compare function */
static int
}
/* Returns the string value of the mechanism for a given mechanism number */
const char *
{
return (NULL);
}
/*
* Return a delimited string of supported mechanisms with their
* value number specified in ucrypto_mech_t. See libsoftcrypto.h for
* details on format
*
*/
int
ucrypto_get_mechlist(char *s)
{
int i = 0, pos;
if (s == NULL)
s = &(str[0]);
for (i = 0; i < max; i++)
pos++; /* Need to count the NULL */
return (pos);
}
/*
* With a given mechanism string value, match it with the supported
* mechanism and return the mechanism number, if found; otherwise, it
* returns an undefined mech number.
*/
{
int i;
return (0);
for (i = 0; i < max; i++) {
return (mechstrlist[i].num);
}
return (0);
}