Skip to content

crypt_composite_sign.c语法错误以及PQCP_SCLOUDPLUS_Cmp逻辑错误 #8

Description

@Mmandysa
  • PQCP\src\composite_sign\src\crypt_composite_sign.c第642行缺少分号
  • scloudplus.c中的PQCP_SCLOUDPLUS_Cmp存在问题
int32_t PQCP_SCLOUDPLUS_Cmp(SCLOUDPLUS_Ctx *ctx1, SCLOUDPLUS_Ctx *ctx2)
{
    if (ctx1 == NULL || ctx2 == NULL || ctx1->para == NULL || ctx2->para == NULL) {
        return PQCP_NULL_INPUT;
    };
   //  这里的比较长度不应为sizeof(SCLOUDPLUS_Ctx)
    if (memcmp(ctx1->para, ctx2->para, sizeof(SCLOUDPLUS_Ctx)) != 0) {
        return PQCP_SCLOUDPLUS_CMP_FALSE;
    }
  // 以下逻辑会导致一边有公私钥、另一边没有时也会返回相等,PkeyCmp 结果会出现假阳性
    if (ctx1->publicKey != NULL && ctx2->publicKey != NULL) {
        if (memcmp(ctx1->publicKey, ctx2->publicKey, ctx1->para->pkSize) != 0) {
            return PQCP_SCLOUDPLUS_CMP_FALSE;
        }
    }
    if (ctx1->privateKey != NULL && ctx2->privateKey != NULL) {
        if (memcmp(ctx1->privateKey, ctx2->privateKey, ctx1->para->kemSkSize) != 0) {
            return PQCP_SCLOUDPLUS_CMP_FALSE;
        }
    }
    return PQCP_SUCCESS;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions